From: OGAWA Hirofumi include/linux/msdos_fs.h cleanup include/linux/msdos_fs.h | 33 ++++++++++++++------------------- 1 files changed, 14 insertions(+), 19 deletions(-) diff -puN include/linux/msdos_fs.h~fat-05-msdos_fs-h-cleanup include/linux/msdos_fs.h --- 25/include/linux/msdos_fs.h~fat-05-msdos_fs-h-cleanup 2003-12-21 22:18:03.000000000 -0800 +++ 25-akpm/include/linux/msdos_fs.h 2003-12-21 22:18:03.000000000 -0800 @@ -4,13 +4,8 @@ /* * The MS-DOS filesystem constants/structures */ -#include -#include #include -struct statfs; - - #define SECTOR_SIZE 512 /* sector size (bytes) */ #define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */ #define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */ @@ -18,6 +13,9 @@ struct statfs; #define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry)) #define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */ + +#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ + #define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */ #define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */ @@ -25,8 +23,6 @@ struct statfs; #define FAT_MAX_DIR_ENTRIES (65536) #define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS) -#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ - #define ATTR_NONE 0 /* no attribute bits */ #define ATTR_RO 1 /* read-only */ #define ATTR_HIDDEN 2 /* hidden */ @@ -35,10 +31,10 @@ struct statfs; #define ATTR_DIR 16 /* directory */ #define ATTR_ARCH 32 /* archived */ +/* attribute bits that are copied "as is" */ #define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN) - /* attribute bits that are copied "as is" */ +/* bits that are used by the Windows 95/Windows NT extended FAT */ #define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) - /* bits that are used by the Windows 95/Windows NT extended FAT */ #define CASE_LOWER_BASE 8 /* base is lower case */ #define CASE_LOWER_EXT 16 /* extension is lower case */ @@ -46,8 +42,12 @@ struct statfs; #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) +/* valid file mode bits */ #define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO) - /* valid file mode bits */ +/* Convert attribute bits and a mask to the UNIX mode. */ +#define MSDOS_MKMODE(a, m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO)) +/* Convert the UNIX mode to MS-DOS attribute bits. */ +#define MSDOS_MKATTR(m) ((m & S_IWUGO) ? ATTR_NONE : ATTR_RO) #define MSDOS_NAME 11 /* maximum name length */ #define MSDOS_LONGNAME 256 /* maximum name length */ @@ -80,8 +80,8 @@ struct statfs; #define FAT_ENT_BAD (BAD_FAT32) #define FAT_ENT_EOF (EOF_FAT32) -#define FAT_FSINFO_SIG1 0x41615252 -#define FAT_FSINFO_SIG2 0x61417272 +#define FAT_FSINFO_SIG1 0x41615252 +#define FAT_FSINFO_SIG2 0x61417272 #define IS_FSINFO(x) (CF_LE_L((x)->signature1) == FAT_FSINFO_SIG1 \ && CF_LE_L((x)->signature2) == FAT_FSINFO_SIG2) @@ -179,15 +179,10 @@ struct vfat_slot_info { loff_t i_pos; /* on-disk position of directory entry */ }; -/* Convert attribute bits and a mask to the UNIX mode. */ -#define MSDOS_MKMODE(a,m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO)) - -/* Convert the UNIX mode to MS-DOS attribute bits. */ -#define MSDOS_MKATTR(m) ((m & S_IWUGO) ? ATTR_NONE : ATTR_RO) - - #ifdef __KERNEL__ +#include +#include #include #include #include _