RTEMS CPU Kit with SuperCore  4.11.3
fat.h
Go to the documentation of this file.
1 
12 /*
13  *
14  * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
15  * Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
16  *
17  * The license and distribution terms for this file may be
18  * found in the file LICENSE in this distribution or at
19  * http://www.rtems.org/license/LICENSE.
20  */
21 
22 #ifndef __DOSFS_FAT_H__
23 #define __DOSFS_FAT_H__
24 
25 #include <sys/param.h>
26 #include <string.h>
27 
28 #include <rtems/seterr.h>
29 
30 #include <rtems/score/cpu.h>
31 #include <errno.h>
32 #include <rtems/bdbuf.h>
33 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #ifndef RC_OK
45 #define RC_OK 0
46 #endif
47 
48 /*
49  * Remember that all FAT file system on disk data structure is
50  * "little endian"!
51  * (derived from linux)
52  */
53 /*
54  * Conversion from and to little-endian byte order. (no-op on i386/i486)
55  *
56  * Naming: Ca_b_c, where a: F = from, T = to, b: LE = little-endian,
57  * BE = big-endian, c: W = word (16 bits), L = longword (32 bits)
58  */
59 
60 #if (CPU_BIG_ENDIAN == TRUE)
61 # define CF_LE_W(v) CPU_swap_u16((uint16_t)(v))
62 # define CF_LE_L(v) CPU_swap_u32((uint32_t)(v))
63 # define CT_LE_W(v) CPU_swap_u16((uint16_t)(v))
64 # define CT_LE_L(v) CPU_swap_u32((uint32_t)(v))
65 #else
66 # define CF_LE_W(v) (v)
67 # define CF_LE_L(v) (v)
68 # define CT_LE_W(v) (v)
69 # define CT_LE_L(v) (v)
70 #endif
71 
72 #define FAT_HASH_SIZE 2
73 #define FAT_HASH_MODULE FAT_HASH_SIZE
74 
75 
76 #define FAT_SECTOR512_SIZE 512 /* sector size (bytes) */
77 #define FAT_SECTOR512_BITS 9 /* log2(SECTOR_SIZE) */
78 
79 /* maximum + 1 number of clusters for FAT12 */
80 #define FAT_FAT12_MAX_CLN 4085
81 
82 /* maximum + 1 number of clusters for FAT16 */
83 #define FAT_FAT16_MAX_CLN 65525
84 
85 #define FAT_FAT12 0x01
86 #define FAT_FAT16 0x02
87 #define FAT_FAT32 0x04
88 
89 #define FAT_UNDEFINED_VALUE (uint32_t)0xFFFFFFFF
90 
91 #define FAT_FAT12_EOC 0x0FF8
92 #define FAT_FAT16_EOC 0xFFF8
93 #define FAT_FAT32_EOC (uint32_t)0x0FFFFFF8
94 
95 #define FAT_FAT12_FREE 0x0000
96 #define FAT_FAT16_FREE 0x0000
97 #define FAT_FAT32_FREE 0x00000000
98 
99 #define FAT_GENFAT_EOC (uint32_t)0xFFFFFFFF
100 #define FAT_GENFAT_FREE (uint32_t)0x00000000
101 
102 #define FAT_FAT12_SHIFT 0x04
103 
104 #define FAT_FAT12_MASK 0x00000FFF
105 #define FAT_FAT16_MASK 0x0000FFFF
106 #define FAT_FAT32_MASK (uint32_t)0x0FFFFFFF
107 
108 #define FAT_MAX_BPB_SIZE 90
109 #define FAT_TOTAL_MBR_SIZE 512
110 
111 /* size of useful information in FSInfo sector */
112 #define FAT_USEFUL_INFO_SIZE 12
113 
114 #define FAT_GET_ADDR(x, ofs) ((uint8_t *)(x) + (ofs))
115 
116 #define FAT_GET_VAL8(x, ofs) (uint8_t)(*((uint8_t *)(x) + (ofs)))
117 
118 #define FAT_GET_VAL16(x, ofs) \
119  (uint16_t)( (*((uint8_t *)(x) + (ofs))) | \
120  ((*((uint8_t *)(x) + (ofs) + 1)) << 8) )
121 
122 #define FAT_GET_VAL32(x, ofs) \
123  (uint32_t)( (uint32_t)(*((uint8_t *)(x) + (ofs))) | \
124  ((uint32_t)(*((uint8_t *)(x) + (ofs) + 1)) << 8) | \
125  ((uint32_t)(*((uint8_t *)(x) + (ofs) + 2)) << 16) | \
126  ((uint32_t)(*((uint8_t *)(x) + (ofs) + 3)) << 24) )
127 
128 #define FAT_SET_VAL8(x, ofs,val) \
129  (*((uint8_t *)(x)+(ofs))=(uint8_t)(val))
130 
131 #define FAT_SET_VAL16(x, ofs,val) do { \
132  FAT_SET_VAL8((x),(ofs),(val)); \
133  FAT_SET_VAL8((x),(ofs)+1,(val)>>8);\
134  } while (0)
135 
136 #define FAT_SET_VAL32(x, ofs,val) do { \
137  uint32_t val1 = val; \
138  FAT_SET_VAL16((x),(ofs),(val1)&0xffff);\
139  FAT_SET_VAL16((x),(ofs)+2,(val1)>>16);\
140  } while (0)
141 
142 /* macros to access boot sector fields */
143 #define FAT_GET_BR_JMPBOOT(x) FAT_GET_VAL8( x, 0)
144 #define FAT_SET_BR_JMPBOOT(x,val) FAT_SET_VAL8( x, 0,val)
145 
146 #define FAT_GET_ADDR_BR_OEMNAME(x) FAT_GET_ADDR( x, 3)
147 #define FAT_BR_OEMNAME_SIZE (8)
148 
149 #define FAT_GET_BR_BYTES_PER_SECTOR(x) FAT_GET_VAL16(x, 11)
150 #define FAT_SET_BR_BYTES_PER_SECTOR(x,val) FAT_SET_VAL16(x, 11,val)
151 
152 #define FAT_GET_BR_SECTORS_PER_CLUSTER(x) FAT_GET_VAL8( x, 13)
153 #define FAT_SET_BR_SECTORS_PER_CLUSTER(x,val)FAT_SET_VAL8( x, 13,val)
154 
155 #define FAT_GET_BR_RESERVED_SECTORS_NUM(x) FAT_GET_VAL16(x, 14)
156 #define FAT_SET_BR_RESERVED_SECTORS_NUM(x,val) FAT_SET_VAL16(x, 14,val)
157 
158 #define FAT_GET_BR_FAT_NUM(x) FAT_GET_VAL8( x, 16)
159 #define FAT_SET_BR_FAT_NUM(x,val) FAT_SET_VAL8( x, 16,val)
160 
161 #define FAT_GET_BR_FILES_PER_ROOT_DIR(x) FAT_GET_VAL16(x, 17)
162 #define FAT_SET_BR_FILES_PER_ROOT_DIR(x,val) FAT_SET_VAL16(x, 17,val)
163 
164 #define FAT_GET_BR_TOTAL_SECTORS_NUM16(x) FAT_GET_VAL16(x, 19)
165 #define FAT_SET_BR_TOTAL_SECTORS_NUM16(x,val)FAT_SET_VAL16(x, 19,val)
166 
167 #define FAT_GET_BR_MEDIA(x) FAT_GET_VAL8( x, 21)
168 #define FAT_SET_BR_MEDIA(x,val) FAT_SET_VAL8( x, 21,val)
169 
170 #define FAT_GET_BR_SECTORS_PER_FAT(x) FAT_GET_VAL16(x, 22)
171 #define FAT_SET_BR_SECTORS_PER_FAT(x,val) FAT_SET_VAL16(x, 22,val)
172 
173 #define FAT_GET_BR_SECTORS_PER_TRACK(x) FAT_GET_VAL16(x, 24)
174 #define FAT_SET_BR_SECTORS_PER_TRACK(x,val) FAT_SET_VAL16(x, 24,val)
175 
176 #define FAT_GET_BR_NUMBER_OF_HEADS(x) FAT_GET_VAL16(x, 26)
177 #define FAT_SET_BR_NUMBER_OF_HEADS(x,val) FAT_SET_VAL16(x, 26,val)
178 
179 #define FAT_GET_BR_HIDDEN_SECTORS(x) FAT_GET_VAL32(x, 28)
180 #define FAT_SET_BR_HIDDEN_SECTORS(x,val) FAT_SET_VAL32(x, 28,val)
181 
182 #define FAT_GET_BR_TOTAL_SECTORS_NUM32(x) FAT_GET_VAL32(x, 32)
183 #define FAT_SET_BR_TOTAL_SECTORS_NUM32(x,val) FAT_SET_VAL32(x, 32,val)
184  /* --- start of FAT12/16 specific fields */
185 #define FAT_GET_BR_DRVNUM(x) FAT_GET_VAL8( x, 36)
186 #define FAT_SET_BR_DRVNUM(x,val) FAT_SET_VAL8( x, 36,val)
187 
188 #define FAT_GET_BR_RSVD1(x) FAT_GET_VAL8( x, 37)
189 #define FAT_SET_BR_RSVD1(x,val) FAT_SET_VAL8( x, 37,val)
190 
191 #define FAT_GET_BR_BOOTSIG(x) FAT_GET_VAL8( x, 38)
192 #define FAT_SET_BR_BOOTSIG(x,val) FAT_SET_VAL8( x, 38,val)
193 #define FAT_BR_BOOTSIG_VAL (0x29)
194 
195 #define FAT_GET_BR_VOLID(x) FAT_GET_VAL32(x, 39)
196 #define FAT_SET_BR_VOLID(x,val) FAT_SET_VAL32(x, 39,val)
197 
198 #define FAT_GET_ADDR_BR_VOLLAB(x) FAT_GET_ADDR (x, 43)
199 #define FAT_BR_VOLLAB_SIZE (11)
200 
201 #define FAT_GET_ADDR_BR_FILSYSTYPE(x) FAT_GET_ADDR (x, 54)
202 #define FAT_BR_FILSYSTYPE_SIZE (8)
203  /* --- end of FAT12/16 specific fields */
204  /* --- start of FAT32 specific fields */
205 #define FAT_GET_BR_SECTORS_PER_FAT32(x) FAT_GET_VAL32(x, 36)
206 #define FAT_SET_BR_SECTORS_PER_FAT32(x,val) FAT_SET_VAL32(x, 36,val)
207 
208 #define FAT_GET_BR_EXT_FLAGS(x) FAT_GET_VAL16(x, 40)
209 #define FAT_SET_BR_EXT_FLAGS(x,val) FAT_SET_VAL16(x, 40,val)
210 
211 #define FAT_GET_BR_FSVER(x) FAT_GET_VAL16(x, 42)
212 #define FAT_SET_BR_FSVER(x,val) FAT_SET_VAL16(x, 42,val)
213 
214 #define FAT_GET_BR_FAT32_ROOT_CLUSTER(x) FAT_GET_VAL32(x, 44)
215 #define FAT_SET_BR_FAT32_ROOT_CLUSTER(x,val) FAT_SET_VAL32(x, 44,val)
216 
217 #define FAT_GET_BR_FAT32_FS_INFO_SECTOR(x) FAT_GET_VAL16(x, 48)
218 #define FAT_SET_BR_FAT32_FS_INFO_SECTOR(x,val) FAT_SET_VAL16(x, 48,val)
219 
220 #define FAT_GET_BR_FAT32_BK_BOOT_SECTOR(x) FAT_GET_VAL16(x, 50)
221 #define FAT_SET_BR_FAT32_BK_BOOT_SECTOR(x,val) FAT_SET_VAL16(x, 50,val)
222 
223 #define FAT_GET_ADDR_BR_FAT32_RESERVED(x) FAT_GET_ADDR (x, 52)
224 #define FAT_BR_FAT32_RESERVED_SIZE (12)
225 
226 #define FAT_GET_BR_FAT32_DRVNUM(x) FAT_GET_VAL8( x, 64)
227 #define FAT_SET_BR_FAT32_DRVNUM(x,val) FAT_SET_VAL8( x, 64,val)
228 
229 #define FAT_GET_BR_FAT32_RSVD1(x) FAT_GET_VAL8( x, 65)
230 #define FAT_SET_BR_FAT32_RSVD1(x,val) FAT_SET_VAL8( x, 65,val)
231 
232 #define FAT_GET_BR_FAT32_BOOTSIG(x) FAT_GET_VAL8( x, 66)
233 #define FAT_SET_BR_FAT32_BOOTSIG(x,val) FAT_SET_VAL8( x, 66,val)
234 #define FAT_BR_FAT32_BOOTSIG_VAL (0x29)
235 
236 #define FAT_GET_BR_FAT32_VOLID(x) FAT_GET_VAL32(x, 67)
237 #define FAT_SET_BR_FAT32_VOLID(x,val) FAT_SET_VAL32(x, 67,val)
238 
239 #define FAT_GET_ADDR_BR_FAT32_VOLLAB(x) FAT_GET_ADDR (x, 71)
240 #define FAT_BR_FAT32_VOLLAB_SIZE (11)
241 
242 #define FAT_GET_ADDR_BR_FAT32_FILSYSTYPE(x) FAT_GET_ADDR (x, 82)
243 #define FAT_BR_FAT32_FILSYSTYPE_SIZE (8)
244  /* --- end of FAT32 specific fields */
245 
246 #define FAT_GET_BR_SIGNATURE(x) FAT_GET_VAL16(x,510)
247 #define FAT_SET_BR_SIGNATURE(x,val) FAT_SET_VAL16(x,510,val)
248 #define FAT_BR_SIGNATURE_VAL (0xAA55)
249 
250  /*
251  * FAT32 FSINFO description
252  */
253 #define FAT_GET_FSINFO_LEAD_SIGNATURE(x) FAT_GET_VAL32(x, 0)
254 #define FAT_SET_FSINFO_LEAD_SIGNATURE(x,val) FAT_SET_VAL32(x, 0,val)
255 #define FAT_FSINFO_LEAD_SIGNATURE_VALUE (0x41615252)
256 
257 #define FAT_GET_FSINFO_STRUC_SIGNATURE(x) FAT_GET_VAL32(x,484)
258 #define FAT_SET_FSINFO_STRUC_SIGNATURE(x,val) FAT_SET_VAL32(x,484,val)
259 #define FAT_FSINFO_STRUC_SIGNATURE_VALUE (0x61417272)
260 
261 #define FAT_GET_FSINFO_TRAIL_SIGNATURE(x) FAT_GET_VAL32(x,508)
262 #define FAT_SET_FSINFO_TRAIL_SIGNATURE(x,val) FAT_SET_VAL32(x,508,val)
263 #define FAT_FSINFO_TRAIL_SIGNATURE_VALUE (0xAA550000)
264 /*
265  * I read FSInfo sector from offset 484 to access the information, so offsets
266  * of these fields a relative
267  */
268 #define FAT_GET_FSINFO_FREE_CLUSTER_COUNT(x) FAT_GET_VAL32(x, 4)
269 #define FAT_SET_FSINFO_FREE_CLUSTER_COUNT(x,val) FAT_SET_VAL32(x, 4,val)
270 #define FAT_GET_FSINFO_NEXT_FREE_CLUSTER(x) FAT_GET_VAL32(x, 8)
271 #define FAT_SET_FSINFO_NEXT_FREE_CLUSTER(x,val) FAT_SET_VAL32(x, 8,val)
272 
273 #define FAT_FSI_INFO 484
274 #define FAT_FSINFO_STRUCT_OFFSET 488
275 #define FAT_FSINFO_FREE_CLUSTER_COUNT_OFFSET (FAT_FSINFO_STRUCT_OFFSET+0)
276 
277 #define FAT_FSINFO_NEXT_FREE_CLUSTER_OFFSET (FAT_FSINFO_STRUCT_OFFSET+4)
278 
279 #define FAT_RSRVD_CLN 0x02
280 
281 #define FAT_FSI_LEADSIG_SIZE 0x04
282 
283 #define FAT_TOTAL_FSINFO_SIZE 512
284 
285 #define MS_BYTES_PER_CLUSTER_LIMIT 0x8000 /* 32K */
286 #define MS_BYTES_PER_CLUSTER_LIMIT_FAT12 0x1000 /* 4K */
287 
288 #define FAT_BR_EXT_FLAGS_MIRROR 0x0080
289 
290 #define FAT_BR_EXT_FLAGS_FAT_NUM 0x000F
291 
292 #define FAT_BR_MEDIA_FIXED 0xf8
293 
294 #define FAT_DIRENTRY_SIZE 32
295 
296 #define FAT_DIRENTRIES_PER_SEC512 16
297 
298 /*
299  * Volume descriptor
300  * Description of the volume the FAT filesystem is located on - generally
301  * the fields of the structure correspond to Boot Sector and BPB Structure
302  * fields
303  */
304 typedef struct fat_vol_s
305 {
306  uint16_t bps; /* bytes per sector */
307  uint8_t sec_log2; /* log2 of bps */
308  uint8_t sec_mul; /* log2 of 512bts sectors number per sector */
309  uint8_t spc; /* sectors per cluster */
310  uint8_t spc_log2; /* log2 of spc */
311  uint16_t bpc; /* bytes per cluster */
312  uint8_t bpc_log2; /* log2 of bytes per cluster */
313  uint8_t sectors_per_block; /* sectors per bdbuf block */
314  uint16_t bytes_per_block; /* number of bytes for the bduf block device handling */
315  uint8_t bytes_per_block_log2; /* log2 of bytes_per_block */
316  uint8_t fats; /* number of FATs */
317  uint8_t type; /* FAT type */
318  uint32_t mask;
319  uint32_t eoc_val;
320  uint16_t fat_loc; /* FAT start */
321  uint32_t fat_length; /* sectors per FAT */
322  uint32_t rdir_loc; /* root directory start */
323  uint16_t rdir_entrs; /* files per root directory */
324  uint32_t rdir_secs; /* sectors per root directory */
325  uint32_t rdir_size; /* root directory size in bytes */
326  uint32_t tot_secs; /* total count of sectors */
327  uint32_t data_fsec; /* first data sector */
328  uint32_t data_cls; /* count of data clusters */
329  uint32_t rdir_cl; /* first cluster of the root directory */
330  uint16_t info_sec; /* FSInfo Sector Structure location */
331  uint32_t free_cls; /* last known free clusters count */
332  uint32_t free_cls_in_fs_info; /* last known free clusters count
333  in FS info sector */
334  uint32_t next_cl; /* next free cluster number */
335  uint32_t next_cl_in_fs_info; /* next free cluster number in FS
336  info sector */
337  uint8_t mirror; /* mirroring enabla/disable */
338  uint32_t afat_loc; /* active FAT location */
339  uint8_t afat; /* the number of active FAT */
340  int fd; /* the disk device file descriptor */
341  rtems_disk_device *dd; /* disk device (see libblock) */
342  void *private_data; /* reserved */
343 } fat_vol_t;
344 
345 
346 typedef struct fat_cache_s
347 {
348  uint32_t blk_num;
349  bool modified;
350  uint8_t state;
351  rtems_bdbuf_buffer *buf;
352 } fat_cache_t;
353 
354 /*
355  * This structure identifies the instance of the filesystem on the FAT
356  * ("fat-file") level.
357  */
358 typedef struct fat_fs_info_s
359 {
360  fat_vol_t vol; /* volume descriptor */
361  rtems_chain_control *vhash; /* "vhash" of fat-file descriptors */
362  rtems_chain_control *rhash; /* "rhash" of fat-file descriptors */
363  char *uino; /* array of unique ino numbers */
364  uint32_t index;
365  uint32_t uino_pool_size; /* size */
366  uint32_t uino_base;
367  fat_cache_t c; /* cache */
368  uint8_t *sec_buf; /* just placeholder for anything */
369 } fat_fs_info_t;
370 
371 /*
372  * FAT position is a the cluster and the offset into the
373  * cluster.
374  */
375 typedef struct fat_pos_s
376 {
377  uint32_t cln;
378  uint32_t ofs;
379 } fat_pos_t;
380 
381 /*
382  * If the name we looking for is file we store not only first data cluster
383  * number, but and cluster number and offset for directory entry for this
384  * name. We also add the LFN start offset so we can delete it the whole
385  * file name. We can then use this to delete the file.
386  */
387 typedef struct fat_dir_pos_s
388 {
389  fat_pos_t sname;
390  fat_pos_t lname;
391 } fat_dir_pos_t;
392 
393 /*
394  * Set the long name entries to this value for a short file name.
395  */
396 #define FAT_FILE_SHORT_NAME (0xffffffff)
397 
398 #define FAT_FAT_OFFSET(fat_type, cln) \
399  ((fat_type) & FAT_FAT12 ? ((cln) + ((cln) >> 1)) : \
400  (fat_type) & FAT_FAT16 ? ((cln) << 1) : \
401  ((cln) << 2))
402 
403 #define FAT_CLUSTER_IS_ODD(n) ((n) & 0x0001)
404 
405 #define FAT12_SHIFT 0x4 /* half of a byte */
406 
407 /* initial size of array of unique ino */
408 #define FAT_UINO_POOL_INIT_SIZE 0x100
409 
410 /* cache support */
411 #define FAT_CACHE_EMPTY 0x0
412 #define FAT_CACHE_ACTUAL 0x1
413 
414 #define FAT_OP_TYPE_READ 0x1
415 #define FAT_OP_TYPE_GET 0x2
416 
417 static inline void
418 fat_dir_pos_init(
419  fat_dir_pos_t *dir_pos
420  )
421 {
422  dir_pos->sname.cln = 0;
423  dir_pos->sname.ofs = 0;
424  dir_pos->lname.cln = FAT_FILE_SHORT_NAME;
425  dir_pos->lname.ofs = FAT_FILE_SHORT_NAME;
426 }
427 
428 static inline uint32_t
429 fat_cluster_num_to_sector_num(
430  const fat_fs_info_t *fs_info,
431  uint32_t cln
432  )
433 {
434  if ( (cln == 0) && (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)) )
435  return fs_info->vol.rdir_loc;
436 
437  return (((cln - FAT_RSRVD_CLN) << fs_info->vol.spc_log2) +
438  fs_info->vol.data_fsec);
439 }
440 
441 static inline uint32_t
442 fat_cluster_num_to_sector512_num(
443  const fat_fs_info_t *fs_info,
444  uint32_t cln
445  )
446 {
447  if (cln == 1)
448  return 1;
449 
450  return (fat_cluster_num_to_sector_num(fs_info, cln) <<
451  fs_info->vol.sec_mul);
452 }
453 
454 static inline uint32_t
455  fat_block_num_to_cluster_num (const fat_fs_info_t *fs_info,
456  const uint32_t block_number)
457 {
458  return block_number >> (fs_info->vol.bpc_log2 - fs_info->vol.bytes_per_block_log2);
459 }
460 
461 static inline uint32_t
462  fat_block_num_to_sector_num (const fat_fs_info_t *fs_info,
463  const uint32_t block_number)
464 {
465  return block_number << (fs_info->vol.bytes_per_block_log2 - fs_info->vol.sec_log2);
466 }
467 
468 static inline uint32_t
469  fat_sector_num_to_block_num (const fat_fs_info_t *fs_info,
470  const uint32_t sector_number)
471 {
472  return sector_number >> (fs_info->vol.bytes_per_block_log2 - fs_info->vol.sec_log2);
473 }
474 
475 static inline uint32_t
476  fat_sector_offset_to_block_offset (const fat_fs_info_t *fs_info,
477  const uint32_t sector,
478  const uint32_t sector_offset)
479 {
480  return sector_offset +
481  ((sector -
482  fat_block_num_to_sector_num (fs_info,
483  fat_sector_num_to_block_num (fs_info, sector)))
484  << fs_info->vol.sec_log2);
485 }
486 
487 static inline void
488 fat_buf_mark_modified(fat_fs_info_t *fs_info)
489 {
490  fs_info->c.modified = true;
491 }
492 
493 int
494 fat_buf_access(fat_fs_info_t *fs_info,
495  uint32_t sec_num,
496  int op_type,
497  uint8_t **sec_buf);
498 
499 int
500 fat_buf_release(fat_fs_info_t *fs_info);
501 
502 ssize_t
503 _fat_block_read(fat_fs_info_t *fs_info,
504  uint32_t start,
505  uint32_t offset,
506  uint32_t count,
507  void *buff);
508 
509 ssize_t
510 fat_cluster_write(fat_fs_info_t *fs_info,
511  uint32_t start_cln,
512  uint32_t offset,
513  uint32_t count,
514  const void *buff);
515 
516 ssize_t
517 fat_sector_write(fat_fs_info_t *fs_info,
518  uint32_t start,
519  uint32_t offset,
520  uint32_t count,
521  const void *buff);
522 
523 ssize_t
524 fat_cluster_set(fat_fs_info_t *fs_info,
525  uint32_t start,
526  uint32_t offset,
527  uint32_t count,
528  uint8_t pattern);
529 
530 
531 int
532 fat_init_volume_info(fat_fs_info_t *fs_info, const char *device);
533 
534 int
535 fat_init_clusters_chain(fat_fs_info_t *fs_info,
536  uint32_t start_cln);
537 
538 int
539 fat_shutdown_drive(fat_fs_info_t *fs_info);
540 
541 
542 uint32_t
543 fat_get_unique_ino(fat_fs_info_t *fs_info);
544 
545 bool
546 fat_ino_is_unique(fat_fs_info_t *fs_info,
547  uint32_t ino);
548 
549 void
550 fat_free_unique_ino(fat_fs_info_t *fs_info,
551  uint32_t ino);
552 
553 int
554 fat_sync(fat_fs_info_t *fs_info);
555 
556 #ifdef __cplusplus
557 }
558 #endif
559 
560 #endif /* __DOSFS_FAT_H__ */
Data which Ease the Burden of Consistently Setting Errno.
Definition: fat.h:387
This is used to manage a chain.
Definition: chain.h:83
Description of a disk device (logical and physical disks).
Definition: diskdevs.h:158
Definition: fat.h:358
Definition: fat.h:375
Definition: fat.h:346
To manage buffers we using buffer descriptors (BD).
Definition: bdbuf.h:314
Definition: fat.h:304
Block Device Buffer Management.