fsck.fat.h (dosfstools-4.1) | : | fsck.fat.h (dosfstools-4.2) | ||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
#include <fcntl.h> | #include <fcntl.h> | |||
#include <stddef.h> | #include <stddef.h> | |||
#include <stdint.h> | #include <stdint.h> | |||
#include "endian_compat.h" | #include "endian_compat.h" | |||
#include "msdos_fs.h" | #include "msdos_fs.h" | |||
#define VFAT_LN_ATTR (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) | #define VFAT_LN_ATTR (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) | |||
#define FAT_STATE_DIRTY 0x01 | #define FAT_STATE_DIRTY 0x01 | |||
#define FAT_NEED_SURFACE_TEST 0x02 | ||||
#define FAT16_FLAG_HARDDISK_ERROR 0x4000 | ||||
#define FAT16_FLAG_CLEAN_SHUTDOWN 0x8000 | ||||
#define FAT32_FLAG_HARDDISK_ERROR 0x4000000 | ||||
#define FAT32_FLAG_CLEAN_SHUTDOWN 0x8000000 | ||||
/* ++roman: Use own definition of boot sector structure -- the kernel headers' | /* ++roman: Use own definition of boot sector structure -- the kernel headers' | |||
* name for it is msdos_boot_sector in 2.0 and fat_boot_sector in 2.1 ... */ | * name for it is msdos_boot_sector in 2.0 and fat_boot_sector in 2.1 ... */ | |||
struct boot_sector { | struct boot_sector { | |||
uint8_t ignored[3]; /* Boot strap short or near jump */ | uint8_t ignored[3]; /* Boot strap short or near jump */ | |||
uint8_t system_id[8]; /* Name - can be used to special case | uint8_t system_id[8]; /* Name - can be used to special case | |||
partition manager volumes */ | partition manager volumes */ | |||
uint8_t sector_size[2]; /* bytes per logical sector */ | uint8_t sector_size[2]; /* bytes per logical sector */ | |||
uint8_t cluster_size; /* sectors/cluster */ | uint8_t cluster_size; /* sectors/cluster */ | |||
uint16_t reserved; /* reserved sectors */ | uint16_t reserved; /* reserved sectors */ | |||
skipping to change at line 72 | skipping to change at line 79 | |||
/* The following fields are only used by FAT32 */ | /* The following fields are only used by FAT32 */ | |||
uint32_t fat32_length; /* sectors/FAT */ | uint32_t fat32_length; /* sectors/FAT */ | |||
uint16_t flags; /* bit 8: fat mirroring, low 4: active fat */ | uint16_t flags; /* bit 8: fat mirroring, low 4: active fat */ | |||
uint8_t version[2]; /* major, minor filesystem version */ | uint8_t version[2]; /* major, minor filesystem version */ | |||
uint32_t root_cluster; /* first cluster in root directory */ | uint32_t root_cluster; /* first cluster in root directory */ | |||
uint16_t info_sector; /* filesystem info sector */ | uint16_t info_sector; /* filesystem info sector */ | |||
uint16_t backup_boot; /* backup boot sector */ | uint16_t backup_boot; /* backup boot sector */ | |||
uint8_t reserved2[12]; /* Unused */ | uint8_t reserved2[12]; /* Unused */ | |||
uint8_t drive_number; /* Logical Drive Number */ | uint8_t drive_number; /* Logical Drive Number */ | |||
uint8_t reserved3; /* Unused */ | uint8_t boot_flags; /* bit 0: dirty, bit 1: need surface test */ | |||
uint8_t extended_sig; /* Extended Signature (0x29) */ | uint8_t extended_sig; /* Extended Signature (0x29) */ | |||
uint32_t serial; /* Serial number */ | uint32_t serial; /* Serial number */ | |||
uint8_t label[11]; /* FS label */ | uint8_t label[11]; /* FS label */ | |||
uint8_t fs_type[8]; /* FS Type */ | uint8_t fs_type[8]; /* FS Type */ | |||
/* fill up to 512 bytes */ | /* fill up to 512 bytes */ | |||
uint8_t junk[422]; | uint8_t junk[422]; | |||
} __attribute__ ((packed)); | } __attribute__ ((packed)); | |||
skipping to change at line 101 | skipping to change at line 108 | |||
uint8_t dir_entries[2]; /* root directory entries */ | uint8_t dir_entries[2]; /* root directory entries */ | |||
uint8_t sectors[2]; /* number of sectors */ | uint8_t sectors[2]; /* number of sectors */ | |||
uint8_t media; /* media code (unused) */ | uint8_t media; /* media code (unused) */ | |||
uint16_t fat_length; /* sectors/FAT */ | uint16_t fat_length; /* sectors/FAT */ | |||
uint16_t secs_track; /* sectors per track */ | uint16_t secs_track; /* sectors per track */ | |||
uint16_t heads; /* number of heads */ | uint16_t heads; /* number of heads */ | |||
uint32_t hidden; /* hidden sectors (unused) */ | uint32_t hidden; /* hidden sectors (unused) */ | |||
uint32_t total_sect; /* number of sectors (if sectors == 0) */ | uint32_t total_sect; /* number of sectors (if sectors == 0) */ | |||
uint8_t drive_number; /* Logical Drive Number */ | uint8_t drive_number; /* Logical Drive Number */ | |||
uint8_t reserved2; /* Unused */ | uint8_t boot_flags; /* bit 0: dirty, bit 1: need surface test */ | |||
uint8_t extended_sig; /* Extended Signature (0x29) */ | uint8_t extended_sig; /* Extended Signature (0x29) */ | |||
uint32_t serial; /* Serial number */ | uint32_t serial; /* Serial number */ | |||
uint8_t label[11]; /* FS label */ | uint8_t label[11]; /* FS label */ | |||
uint8_t fs_type[8]; /* FS Type */ | uint8_t fs_type[8]; /* FS Type */ | |||
/* fill up to 512 bytes */ | /* fill up to 512 bytes */ | |||
uint8_t junk[450]; | uint8_t junk[450]; | |||
} __attribute__ ((packed)); | } __attribute__ ((packed)); | |||
skipping to change at line 153 | skipping to change at line 160 | |||
} DOS_FILE; | } DOS_FILE; | |||
typedef struct { | typedef struct { | |||
uint32_t value; | uint32_t value; | |||
uint32_t reserved; | uint32_t reserved; | |||
} FAT_ENTRY; | } FAT_ENTRY; | |||
typedef struct { | typedef struct { | |||
int nfats; | int nfats; | |||
off_t fat_start; | off_t fat_start; | |||
off_t fat_size; /* unit is bytes */ | unsigned int fat_size; /* unit is bytes */ | |||
unsigned int fat_bits; /* size of a FAT entry */ | unsigned int fat_bits; /* size of a FAT entry */ | |||
unsigned int eff_fat_bits; /* # of used bits in a FAT entry */ | unsigned int eff_fat_bits; /* # of used bits in a FAT entry */ | |||
uint32_t root_cluster; /* 0 for old-style root dir */ | uint32_t root_cluster; /* 0 for old-style root dir */ | |||
off_t root_start; | off_t root_start; | |||
unsigned int root_entries; | unsigned int root_entries; | |||
off_t data_start; | off_t data_start; | |||
unsigned int cluster_size; | unsigned int cluster_size; | |||
uint32_t data_clusters; /* not including two reserved cluster numbers */ | uint32_t data_clusters; /* not including two reserved cluster numbers */ | |||
off_t fsinfo_start; /* 0 if not present */ | off_t fsinfo_start; /* 0 if not present */ | |||
long free_clusters; | long free_clusters; | |||
off_t backupboot_start; /* 0 if not present */ | off_t backupboot_start; /* 0 if not present */ | |||
unsigned char *fat; | unsigned char *fat; | |||
DOS_FILE **cluster_owner; | DOS_FILE **cluster_owner; | |||
char *label; | uint32_t serial; | |||
char label[11]; | ||||
} DOS_FS; | } DOS_FS; | |||
extern int interactive, rw, list, verbose, test, write_immed; | extern int rw, list, verbose, test, no_spaces_in_sfns; | |||
extern int atari_format; | extern long fat_table; | |||
extern int only_uppercase_label; | ||||
extern unsigned n_files; | extern unsigned n_files; | |||
extern void *mem_queue; | extern void *mem_queue; | |||
/* value to use as end-of-file marker */ | /* value to use as end-of-file marker */ | |||
#define FAT_EOF(fs) ((atari_format ? 0xfff : 0xff8) | FAT_EXTD(fs)) | #define FAT_EOF(fs) ((atari_format ? 0xfff : 0xff8) | FAT_EXTD(fs)) | |||
#define FAT_IS_EOF(fs,v) ((uint32_t)(v) >= (0xff8|FAT_EXTD(fs))) | #define FAT_IS_EOF(fs,v) ((uint32_t)(v) >= (0xff8|FAT_EXTD(fs))) | |||
/* value to mark bad clusters */ | /* value to mark bad clusters */ | |||
#define FAT_BAD(fs) (0xff7 | FAT_EXTD(fs)) | #define FAT_BAD(fs) (0xff7 | FAT_EXTD(fs)) | |||
/* range of values used for bad clusters */ | /* range of values used for bad clusters */ | |||
#define FAT_MIN_BAD(fs) ((atari_format ? 0xff0 : 0xff7) | FAT_EXTD(fs)) | #define FAT_MIN_BAD(fs) ((atari_format ? 0xff0 : 0xff7) | FAT_EXTD(fs)) | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 15 lines changed or added |