This source file includes following definitions.
- msdos_sread
1 #ifndef _MSDOS_FS_H
2 #define _MSDOS_FS_H
3
4
5
6
7
8 #include <linux/fs.h>
9
10 #define MSDOS_ROOT_INO 1
11 #define SECTOR_SIZE 512
12 #define SECTOR_BITS 9
13 #define MSDOS_DPB (MSDOS_DPS*2)
14 #define MSDOS_DPB_BITS 5
15 #define MSDOS_DPS (SECTOR_SIZE/sizeof(struct msdos_dir_entry))
16 #define MSDOS_DPS_BITS 4
17 #define MSDOS_DIR_BITS 5
18
19 #define MSDOS_SUPER_MAGIC 0x4d44
20
21 #define FAT_CACHE 8
22
23 #define ATTR_RO 1
24 #define ATTR_HIDDEN 2
25 #define ATTR_SYS 4
26 #define ATTR_VOLUME 8
27 #define ATTR_DIR 16
28 #define ATTR_ARCH 32
29
30 #define ATTR_NONE 0
31 #define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
32
33
34 #define DELETED_FLAG 0xe5
35
36 #define D_START 0
37 #define D_ATTRS 1
38 #define D_BUSY 2
39
40 #define D_DEPEND 3
41
42 #define D_OLD 4
43
44 #define D_BINARY 5
45
46 #define MSDOS_SB(s) (&((s)->u.msdos_sb))
47
48 #define MSDOS_NAME 11
49 #define MSDOS_DOT ". "
50 #define MSDOS_DOTDOT ".. "
51
52 #define MSDOS_FAT12 4086
53
54 struct msdos_boot_sector {
55 char ignored[13];
56 unsigned char cluster_size;
57 unsigned short reserved;
58 unsigned char fats;
59 unsigned char dir_entries[2];
60 unsigned char sectors[2];
61 unsigned char media;
62 unsigned short fat_length;
63 unsigned short secs_track;
64 unsigned short heads;
65 unsigned long hidden;
66 unsigned long total_sect;
67 };
68
69 struct msdos_dir_entry {
70 char name[8],ext[3];
71 unsigned char attr;
72 char unused[10];
73 unsigned short time,date,start;
74 unsigned long size;
75 };
76
77 struct fat_cache {
78 int device;
79 int ino;
80 int file_cluster;
81 int disk_cluster;
82 struct fat_cache *next;
83 };
84
85
86
87 #define MSDOS_CAN_BMAP(mib) (!(((mib)->cluster_size & 1) || \
88 ((mib)->data_start & 1)))
89
90
91
92 #define MSDOS_MKMODE(a,m) (m & (a & ATTR_RO ? 0444 : 0777))
93
94
95
96 #define MSDOS_MKATTR(m) (!(m & 0200) ? ATTR_RO : ATTR_NONE)
97
98
99 static inline struct buffer_head *msdos_sread(int dev,int sector,void **start)
100 {
101 struct buffer_head *bh;
102
103 if (!(bh = bread(dev,sector >> 1, 1024)))
104 return NULL;
105 *start = bh->b_data+((sector & 1) << SECTOR_BITS);
106 return bh;
107 }
108
109
110
111
112 extern int is_binary(char conversion,char *extension);
113 extern void lock_creation(void);
114 extern void unlock_creation(void);
115 extern int msdos_add_cluster(struct inode *inode);
116 extern int date_dos2unix(unsigned short time,unsigned short date);
117 extern void date_unix2dos(int unix_date,unsigned short *time,
118 unsigned short *date);
119 extern int msdos_get_entry(struct inode *dir,int *pos,struct buffer_head **bh,
120 struct msdos_dir_entry **de);
121 extern int msdos_scan(struct inode *dir,char *name,struct buffer_head **res_bh,
122 struct msdos_dir_entry **res_de,int *ino);
123 extern int msdos_parent_ino(struct inode *dir,int locked);
124
125
126
127 extern int fat_access(struct super_block *sb,int this,int new_value);
128 extern int msdos_smap(struct inode *inode,int sector);
129 extern int fat_free(struct inode *inode,int skip);
130 extern void cache_init(void);
131 void cache_lookup(struct inode *inode,int cluster,int *f_clu,int *d_clu);
132 void cache_add(struct inode *inode,int f_clu,int d_clu);
133 void cache_inval_inode(struct inode *inode);
134 void cache_inval_dev(int device);
135 int get_cluster(struct inode *inode,int cluster);
136
137
138
139 extern int msdos_lookup(struct inode *dir,const char *name,int len,
140 struct inode **result);
141 extern int msdos_create(struct inode *dir,const char *name,int len,int mode,
142 struct inode **result);
143 extern int msdos_mkdir(struct inode *dir,const char *name,int len,int mode);
144 extern int msdos_rmdir(struct inode *dir,const char *name,int len);
145 extern int msdos_unlink(struct inode *dir,const char *name,int len);
146 extern int msdos_rename(struct inode *old_dir,const char *old_name,int old_len,
147 struct inode *new_dir,const char *new_name,int new_len);
148
149
150
151 extern void msdos_put_inode(struct inode *inode);
152 extern void msdos_put_super(struct super_block *sb);
153 extern struct super_block *msdos_read_super(struct super_block *s,void *data);
154 extern void msdos_statfs(struct super_block *sb,struct statfs *buf);
155 extern int msdos_bmap(struct inode *inode,int block);
156 extern void msdos_read_inode(struct inode *inode);
157 extern void msdos_write_inode(struct inode *inode);
158
159
160
161 extern struct file_operations msdos_dir_operations;
162 extern struct inode_operations msdos_dir_inode_operations;
163
164
165
166 extern struct file_operations msdos_file_operations;
167 extern struct inode_operations msdos_file_inode_operations;
168 extern struct inode_operations msdos_file_inode_operations_no_bmap;
169
170 extern void msdos_truncate(struct inode *inode);
171
172 #endif