xv6-simplified
0.1
简化版xv6
Loading...
Searching...
No Matches
src
include
fat32.h
Go to the documentation of this file.
1
11
#define ATTR_READ_ONLY 0x01
12
#define ATTR_HIDDEN 0x02
13
#define ATTR_SYSTEM 0x04
14
#define ATTR_VOLUME_ID 0x08
15
#define ATTR_DIRECTORY 0x10
16
#define ATTR_ARCHIVE 0x20
17
#define ATTR_LONG_NAME 0x0F
18
19
#define LAST_LONG_ENTRY 0x40
20
#define FAT32_EOC 0x0ffffff8
21
#define EMPTY_ENTRY 0xe5
22
#define END_OF_ENTRY 0x00
23
#define CHAR_LONG_NAME 13
24
#define CHAR_SHORT_NAME 11
25
26
#define FAT32_MAX_FILENAME 255
27
#define FAT32_MAX_PATH 260
28
#define ENTRY_CACHE_NUM 50
29
30
// 目录项描述符
31
struct
dirent
{
32
char
filename
[
FAT32_MAX_FILENAME
+ 1];
// 所属文件的文件名
33
uint8
attribute
;
// 该目录项属性
34
uint32
first_clus
;
// 首簇号
35
uint32
file_size
;
// 文件大小
36
37
uint32
cur_clus
;
// 当前所处簇号
38
uint
clus_cnt
;
// 当前所处簇号相对于首簇号的“偏移量”
39
40
/* for OS */
41
uint8
dev
;
// 所属设备号
42
uint8
dirty
;
// 脏位
43
short
valid
;
// 有效位
44
int
ref
;
// 链接数
45
uint32
off
;
// 偏移
46
struct
dirent
*
parent
;
// 上级目录的目录项
47
struct
dirent
*
next
;
// 前一个目录项
48
struct
dirent
*
prev
;
// 后一个目录项
49
// struct sleeplock lock;
50
};
51
52
// 短文件名目录项
53
typedef
struct
short_name_entry
{
54
char
name
[
CHAR_SHORT_NAME
];
// 文件名
55
uint8
attr
;
// 属性
56
uint8
_reserve
;
// 保留位
57
uint8
_ctime_tenth
;
// 创建时间(1/10秒)
58
uint16
_ctime
;
// 创建时间
59
uint16
_cdate
;
// 创建日期
60
uint16
_lst_adate
;
// 最近一次访问日期
61
uint16
fst_clus_hi
;
// 首簇号的高位
62
uint16
_lst_mtime
;
// 最近一次修改时间
63
uint16
_lst_mdate
;
// 最近一次修改日期
64
uint16
fst_clus_lo
;
// 首簇号的低位
65
uint32
file_size
;
// 文件大小(字节)
66
}
__attribute__
((packed, aligned(4))) SHORT_NAME_ENTRY;
67
68
// 长文件名目录项
69
typedef struct
long_name_entry
{
70
uint8
order
;
// 序号
71
uint16
name1
[5];
// 第1~5个Unicode
72
uint8
attr
;
// 属性(恒为0xF)
73
uint8
_reserve
;
// 保留位
74
uint8
checksum
;
// 校验和
75
uint16
name2
[6];
// 第6~11个Unicode
76
uint16
_fst_clus_lo
;
// 首簇号的低位(通常为0)
77
uint16
name3
[2];
// 第12~13个Unicode
78
}
__attribute__
((packed, aligned(4))) LONG_NAME_ENTRY;
79
80
union
dentry
81
{
82
SHORT_NAME_ENTRY
sne
;
83
LONG_NAME_ENTRY
lne
;
84
};
85
name1
uint16 name1[5]
Definition
fat32.h:1
name2
uint16 name2[6]
Definition
fat32.h:5
CHAR_SHORT_NAME
#define CHAR_SHORT_NAME
Definition
fat32.h:24
FAT32_MAX_FILENAME
#define FAT32_MAX_FILENAME
Definition
fat32.h:26
__attribute__
union dentry __attribute__
name3
uint16 name3[2]
Definition
fat32.h:7
dirent
Definition
fat32.h:31
dirent::dev
uint8 dev
Definition
fat32.h:41
dirent::dirty
uint8 dirty
Definition
fat32.h:42
dirent::attribute
uint8 attribute
Definition
fat32.h:33
dirent::off
uint32 off
Definition
fat32.h:45
dirent::cur_clus
uint32 cur_clus
Definition
fat32.h:37
dirent::filename
char filename[FAT32_MAX_FILENAME+1]
Definition
fat32.h:32
dirent::clus_cnt
uint clus_cnt
Definition
fat32.h:38
dirent::valid
short valid
Definition
fat32.h:43
dirent::file_size
uint32 file_size
Definition
fat32.h:35
dirent::first_clus
uint32 first_clus
Definition
fat32.h:34
dirent::ref
int ref
Definition
fat32.h:44
dirent::parent
struct dirent * parent
Definition
fat32.h:46
dirent::next
struct dirent * next
Definition
fat32.h:47
dirent::prev
struct dirent * prev
Definition
fat32.h:48
long_name_entry
Definition
fat32.h:69
long_name_entry::attr
uint8 attr
Definition
fat32.h:72
long_name_entry::_fst_clus_lo
uint16 _fst_clus_lo
Definition
fat32.h:76
long_name_entry::checksum
uint8 checksum
Definition
fat32.h:74
long_name_entry::order
uint8 order
Definition
fat32.h:70
long_name_entry::_reserve
uint8 _reserve
Definition
fat32.h:73
short_name_entry
Definition
fat32.h:53
short_name_entry::_lst_adate
uint16 _lst_adate
Definition
fat32.h:60
short_name_entry::fst_clus_lo
uint16 fst_clus_lo
Definition
fat32.h:64
short_name_entry::attr
uint8 attr
Definition
fat32.h:55
short_name_entry::_cdate
uint16 _cdate
Definition
fat32.h:59
short_name_entry::name
char name[CHAR_SHORT_NAME]
Definition
fat32.h:54
short_name_entry::_reserve
uint8 _reserve
Definition
fat32.h:56
short_name_entry::_ctime_tenth
uint8 _ctime_tenth
Definition
fat32.h:57
short_name_entry::_ctime
uint16 _ctime
Definition
fat32.h:58
short_name_entry::file_size
uint32 file_size
Definition
fat32.h:65
short_name_entry::fst_clus_hi
uint16 fst_clus_hi
Definition
fat32.h:61
short_name_entry::_lst_mdate
uint16 _lst_mdate
Definition
fat32.h:63
short_name_entry::_lst_mtime
uint16 _lst_mtime
Definition
fat32.h:62
uint16
unsigned short uint16
Definition
types.h:20
uint32
unsigned int uint32
Definition
types.h:22
uint
unsigned int uint
Definition
types.h:11
uint8
unsigned char uint8
Definition
types.h:18
dentry
Definition
fat32.h:81
dentry::sne
SHORT_NAME_ENTRY sne
Definition
fat32.h:82
dentry::lne
LONG_NAME_ENTRY lne
Definition
fat32.h:83
Generated by
1.9.7