1 /****************************************************************************
2 ****************************************************************************
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
10 ****************************************************************************
11 ****************************************************************************/
12 #ifndef _LINUX_MSDOS_FS_H
13 #define _LINUX_MSDOS_FS_H
15 #include <linux/magic.h>
17 #include <asm/byteorder.h>
19 #define SECTOR_SIZE 512
21 #define MSDOS_DPB (MSDOS_DPS)
22 #define MSDOS_DPB_BITS 4
23 #define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry))
24 #define MSDOS_DPS_BITS 4
25 #define CF_LE_W(v) le16_to_cpu(v)
26 #define CF_LE_L(v) le32_to_cpu(v)
27 #define CT_LE_W(v) cpu_to_le16(v)
28 #define CT_LE_L(v) cpu_to_le32(v)
30 #define MSDOS_ROOT_INO 1
31 #define MSDOS_DIR_BITS 5
33 #define FAT_MAX_DIR_ENTRIES (65536)
34 #define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS)
44 #define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
46 #define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME)
48 #define CASE_LOWER_BASE 8
49 #define CASE_LOWER_EXT 16
51 #define DELETED_FLAG 0xe5
52 #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
54 #define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)
56 #define MSDOS_MKMODE(a, m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO))
59 #define MSDOS_LONGNAME 256
60 #define MSDOS_SLOTS 21
61 #define MSDOS_DOT ". "
62 #define MSDOS_DOTDOT ".. "
64 #define FAT_VALID_MEDIA(x) ((0xF8 <= (x) && (x) <= 0xFF) || (x) == 0xF0)
65 #define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
67 #define FAT_START_ENT 2
69 #define MAX_FAT12 0xFF4
70 #define MAX_FAT16 0xFFF4
71 #define MAX_FAT32 0x0FFFFFF6
72 #define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12)
74 #define BAD_FAT12 0xFF7
75 #define BAD_FAT16 0xFFF7
76 #define BAD_FAT32 0x0FFFFFF7
78 #define EOF_FAT12 0xFFF
79 #define EOF_FAT16 0xFFFF
80 #define EOF_FAT32 0x0FFFFFFF
82 #define FAT_ENT_FREE (0)
83 #define FAT_ENT_BAD (BAD_FAT32)
84 #define FAT_ENT_EOF (EOF_FAT32)
86 #define FAT_FSINFO_SIG1 0x41615252
87 #define FAT_FSINFO_SIG2 0x61417272
88 #define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2)
90 #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2])
91 #define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct dirent [2])
93 #define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
94 #define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32)
95 #define VFAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x12, __u32)
97 #define VFAT_SFN_DISPLAY_LOWER 0x0001
98 #define VFAT_SFN_DISPLAY_WIN95 0x0002
99 #define VFAT_SFN_DISPLAY_WINNT 0x0004
100 #define VFAT_SFN_CREATE_WIN95 0x0100
101 #define VFAT_SFN_CREATE_WINNT 0x0200
103 struct fat_boot_sector {
128 struct fat_boot_fsinfo {
130 __le32 reserved1[120];
132 __le32 free_clusters;
137 struct fat_boot_bsx {
145 #define FAT16_BSX_OFFSET 36
146 #define FAT32_BSX_OFFSET 64
148 struct msdos_dir_entry {
149 __u8 name[MSDOS_NAME];
157 __le16 time,date,start;
161 struct msdos_dir_slot {
172 struct fat_slot_info {
176 struct msdos_dir_entry *de;
177 struct buffer_head *bh;