blob: a15bd82c38a851441e40ebe050315723187da60a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
#ifndef _FAT_FS_H
#define _FAT_FS_H
#include "types.h"
#define FAT_DIR_ENTRY_SIZE 32
#define FAT_ATTR_READ_ONLY 0x01
#define FAT_ATTR_HIDDEN 0x02
#define FAT_ATTR_SYSTEM 0x04
#define FAT_ATTR_VOLUME_ID 0x08
#define FAT_ATTR_DIRECTORY 0x10
#define FAT_ATTR_ARCHIVE 0x20
#define FAT_MAXFILE 256
#define FAT_ATTR_LONG_NAME (FAT_ATTR_READ_ONLY \
| FAT_ATTR_HIDDEN \
| FAT_ATTR_SYSTEM \
| FAT_ATTR_VOLUME_ID)
#define FAT_ATTR_VALID (FAT_ATTR_READ_ONLY \
| FAT_ATTR_HIDDEN \
| FAT_ATTR_SYSTEM \
| FAT_ATTR_DIRECTORY \
| FAT_ATTR_ARCHIVE)
/*
* The fat file system structures
*/
struct fat_bpb {
__u8 jmp_boot[3];
__u8 oem_name[8];
__u16 sector_size;
__u8 bxSecPerClust;
__u16 bxResSectors;
__u8 bxFATs;
__u16 bxRootDirEnts;
__u16 bxSectors;
__u8 media;
__u16 bxFATsecs;
__u16 sectors_per_track;
__u16 num_heads;
__u32 num_hidden_sectors;
__u32 bsHugeSectors;
union {
struct {
__u8 num_ph_drive;
__u8 reserved;
__u8 boot_sig;
__u32 num_serial;
__u8 label[11];
__u8 fstype[8];
} __attribute__ ((packed)) fat12_16;
struct {
__u32 bxFATsecs_32;
__u16 extended_flags;
__u16 fs_version;
__u32 root_cluster;
__u16 fs_info;
__u16 backup_boot_sector;
__u8 reserved[12];
__u8 num_ph_drive;
__u8 reserved1;
__u8 boot_sig;
__u32 num_serial;
__u8 label[11];
__u8 fstype[8];
} __attribute__ ((packed)) fat32;
} __attribute__ ((packed)) u;
} __attribute__ ((packed));
struct fat_dir_entry {
__u8 name[11];
__u8 attr;
__u8 nt_reserved;
__u8 c_time_tenth;
__u16 c_time;
__u16 c_date;
__u16 a_date;
__u16 first_cluster_high;
__u16 w_time;
__u16 w_date;
__u16 first_cluster_low;
__u32 file_size;
} __attribute__ ((packed));
struct fat_long_name_entry {
__u8 id;
__u16 name1[5];
__u8 attr;
__u8 reserved;
__u8 checksum;
__u16 name2[6];
__u16 first_cluster;
__u16 name3[2];
} __attribute__ ((packed));
#endif /* fat_fs.h */
|