2 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include "exfat_config.h"
23 #include "exfat_global.h"
24 #include "exfat_data.h"
25 #include "exfat_oal.h"
27 #include "exfat_blkdev.h"
28 #include "exfat_cache.h"
29 #include "exfat_nls.h"
30 #include "exfat_api.h"
31 #include "exfat_cache.h"
37 #if EXFAT_CONFIG_KERNEL_DEBUG
38 #define EXFAT_IOC_GET_DEBUGFLAGS _IOR('f', 100, long)
39 #define EXFAT_IOC_SET_DEBUGFLAGS _IOW('f', 101, long)
41 #define EXFAT_DEBUGFLAGS_INVALID_UMOUNT 0x01
42 #define EXFAT_DEBUGFLAGS_ERROR_RW 0x02
47 #define DENTRY_SIZE 32
48 #define DENTRY_SIZE_BITS 5
50 #define PBR_SIGNATURE 0xAA55
51 #define EXT_SIGNATURE 0xAA550000
52 #define VOL_LABEL "NO NAME "
53 #define OEM_NAME "MSWIN4.1"
54 #define STR_FAT12 "FAT12 "
55 #define STR_FAT16 "FAT16 "
56 #define STR_FAT32 "FAT32 "
57 #define STR_EXFAT "EXFAT "
58 #define VOL_CLEAN 0x0000
59 #define VOL_DIRTY 0x0002
61 #define FAT12_THRESHOLD 4087
62 #define FAT16_THRESHOLD 65527
63 #define FAT32_THRESHOLD 268435457
64 #define EXFAT_THRESHOLD 268435457
66 #define TYPE_UNUSED 0x0000
67 #define TYPE_DELETED 0x0001
68 #define TYPE_INVALID 0x0002
69 #define TYPE_CRITICAL_PRI 0x0100
70 #define TYPE_BITMAP 0x0101
71 #define TYPE_UPCASE 0x0102
72 #define TYPE_VOLUME 0x0103
73 #define TYPE_DIR 0x0104
74 #define TYPE_FILE 0x011F
75 #define TYPE_SYMLINK 0x015F
76 #define TYPE_CRITICAL_SEC 0x0200
77 #define TYPE_STREAM 0x0201
78 #define TYPE_EXTEND 0x0202
79 #define TYPE_ACL 0x0203
80 #define TYPE_BENIGN_PRI 0x0400
81 #define TYPE_GUID 0x0401
82 #define TYPE_PADDING 0x0402
83 #define TYPE_ACLTAB 0x0403
84 #define TYPE_BENIGN_SEC 0x0800
85 #define TYPE_ALL 0x0FFF
91 #define CS_DIR_ENTRY 0
92 #define CS_PBR_SECTOR 1
95 #define DIR_DELETED 0xFFFF0321
97 #define CLUSTER_16(x) ((UINT16)(x))
98 #define CLUSTER_32(x) ((UINT32)(x))
100 #define START_SECTOR(x) \
101 ( (((x)-2) << p_fs->sectors_per_clu_bits) + p_fs->data_start_sector )
103 #define IS_LAST_SECTOR_IN_CLUSTER(sec) \
104 ( (((sec) - p_fs->data_start_sector + 1) & ((1 << p_fs->sectors_per_clu_bits) -1)) == 0)
106 #define GET_CLUSTER_FROM_SECTOR(sec) \
107 ((((sec) - p_fs->data_start_sector) >> p_fs->sectors_per_clu_bits) +2)
109 #define GET16(p_src) \
110 ( ((UINT16)(p_src)[0]) | (((UINT16)(p_src)[1]) << 8) )
111 #define GET32(p_src) \
112 ( ((UINT32)(p_src)[0]) | (((UINT32)(p_src)[1]) << 8) | \
113 (((UINT32)(p_src)[2]) << 16) | (((UINT32)(p_src)[3]) << 24) )
114 #define GET64(p_src) \
115 ( ((UINT64)(p_src)[0]) | (((UINT64)(p_src)[1]) << 8) | \
116 (((UINT64)(p_src)[2]) << 16) | (((UINT64)(p_src)[3]) << 24) | \
117 (((UINT64)(p_src)[4]) << 32) | (((UINT64)(p_src)[5]) << 40) | \
118 (((UINT64)(p_src)[6]) << 48) | (((UINT64)(p_src)[7]) << 56) )
121 #define SET16(p_dst,src) \
123 (p_dst)[0]=(UINT8)(src); \
124 (p_dst)[1]=(UINT8)(((UINT16)(src)) >> 8); \
126 #define SET32(p_dst,src) \
128 (p_dst)[0]=(UINT8)(src); \
129 (p_dst)[1]=(UINT8)(((UINT32)(src)) >> 8); \
130 (p_dst)[2]=(UINT8)(((UINT32)(src)) >> 16); \
131 (p_dst)[3]=(UINT8)(((UINT32)(src)) >> 24); \
133 #define SET64(p_dst,src) \
135 (p_dst)[0]=(UINT8)(src); \
136 (p_dst)[1]=(UINT8)(((UINT64)(src)) >> 8); \
137 (p_dst)[2]=(UINT8)(((UINT64)(src)) >> 16); \
138 (p_dst)[3]=(UINT8)(((UINT64)(src)) >> 24); \
139 (p_dst)[4]=(UINT8)(((UINT64)(src)) >> 32); \
140 (p_dst)[5]=(UINT8)(((UINT64)(src)) >> 40); \
141 (p_dst)[6]=(UINT8)(((UINT64)(src)) >> 48); \
142 (p_dst)[7]=(UINT8)(((UINT64)(src)) >> 56); \
145 #if (FFS_CONFIG_LITTLE_ENDIAN == 1)
146 #define GET16_A(p_src) (*((UINT16 *)(p_src)))
147 #define GET32_A(p_src) (*((UINT32 *)(p_src)))
148 #define GET64_A(p_src) (*((UINT64 *)(p_src)))
149 #define SET16_A(p_dst,src) *((UINT16 *)(p_dst)) = (UINT16)(src)
150 #define SET32_A(p_dst,src) *((UINT32 *)(p_dst)) = (UINT32)(src)
151 #define SET64_A(p_dst,src) *((UINT64 *)(p_dst)) = (UINT64)(src)
153 #define GET16_A(p_src) GET16(p_src)
154 #define GET32_A(p_src) GET32(p_src)
155 #define GET64_A(p_src) GET64(p_src)
156 #define SET16_A(p_dst,src) SET16(p_dst, src)
157 #define SET32_A(p_dst,src) SET32(p_dst, src)
158 #define SET64_A(p_dst,src) SET64(p_dst, src)
161 #define HIGH_INDEX_BIT (8)
162 #define HIGH_INDEX_MASK (0xFF00)
163 #define LOW_INDEX_BIT (16-HIGH_INDEX_BIT)
164 #define UTBL_ROW_COUNT (1<<LOW_INDEX_BIT)
165 #define UTBL_COL_COUNT (1<<HIGH_INDEX_BIT)
167 static inline UINT16 get_col_index(UINT16 i)
169 return i >> LOW_INDEX_BIT;
171 static inline UINT16 get_row_index(UINT16 i)
173 return i & ~HIGH_INDEX_MASK;
180 UINT8 boot_code[390];
185 UINT8 sector_size[2];
186 UINT8 sectors_per_clu;
187 UINT8 num_reserved[2];
189 UINT8 num_root_entries[2];
190 UINT8 num_sectors[2];
192 UINT8 num_fat_sectors[2];
193 UINT8 sectors_in_track[2];
195 UINT8 num_hid_sectors[4];
196 UINT8 num_huge_sectors[4];
207 UINT8 sector_size[2];
208 UINT8 sectors_per_clu;
209 UINT8 num_reserved[2];
211 UINT8 num_root_entries[2];
212 UINT8 num_sectors[2];
214 UINT8 num_fat_sectors[2];
215 UINT8 sectors_in_track[2];
217 UINT8 num_hid_sectors[4];
218 UINT8 num_huge_sectors[4];
219 UINT8 num_fat32_sectors[4];
222 UINT8 root_cluster[4];
223 UINT8 fsinfo_sector[2];
224 UINT8 backup_sector[2];
243 UINT8 root_cluster[4];
247 UINT8 sector_size_bits;
248 UINT8 sectors_per_clu_bits;
257 UINT8 reserved1[480];
259 UINT8 free_cluster[4];
260 UINT8 next_cluster[4];
270 UINT8 name[DOS_NAME_LENGTH];
273 UINT8 create_time_ms;
274 UINT8 create_time[2];
275 UINT8 create_date[2];
276 UINT8 access_date[2];
277 UINT8 start_clu_hi[2];
278 UINT8 modify_time[2];
279 UINT8 modify_date[2];
280 UINT8 start_clu_lo[2];
286 UINT8 unicode_0_4[10];
290 UINT8 unicode_5_10[12];
292 UINT8 unicode_11_12[4];
301 UINT8 create_time[2];
302 UINT8 create_date[2];
303 UINT8 modify_time[2];
304 UINT8 modify_date[2];
305 UINT8 access_time[2];
306 UINT8 access_date[2];
307 UINT8 create_time_ms;
308 UINT8 modify_time_ms;
309 UINT8 access_time_ms;
329 UINT8 unicode_0_14[30];
352 UINT8 unicode_0_10[22];
362 typedef struct __FS_STRUCT_T {
364 struct super_block *sb;
365 struct semaphore v_sem;
369 INT32 (*alloc_cluster)(struct super_block *sb, INT32 num_alloc, CHAIN_T *p_chain);
370 void (*free_cluster)(struct super_block *sb, CHAIN_T *p_chain, INT32 do_relse);
371 INT32 (*count_used_clusters)(struct super_block *sb);
373 INT32 (*init_dir_entry)(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, UINT32 type,
374 UINT32 start_clu, UINT64 size);
375 INT32 (*init_ext_entry)(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, INT32 num_entries,
376 UNI_NAME_T *p_uniname, DOS_NAME_T *p_dosname);
377 INT32 (*find_dir_entry)(struct super_block *sb, CHAIN_T *p_dir, UNI_NAME_T *p_uniname, INT32 num_entries, DOS_NAME_T *p_dosname, UINT32 type);
378 void (*delete_dir_entry)(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, INT32 offset, INT32 num_entries);
379 void (*get_uni_name_from_ext_entry)(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, UINT16 *uniname);
380 INT32 (*count_ext_entries)(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, DENTRY_T *p_entry);
381 INT32 (*calc_num_entries)(UNI_NAME_T *p_uniname);
383 UINT32 (*get_entry_type)(DENTRY_T *p_entry);
384 void (*set_entry_type)(DENTRY_T *p_entry, UINT32 type);
385 UINT32 (*get_entry_attr)(DENTRY_T *p_entry);
386 void (*set_entry_attr)(DENTRY_T *p_entry, UINT32 attr);
387 UINT8 (*get_entry_flag)(DENTRY_T *p_entry);
388 void (*set_entry_flag)(DENTRY_T *p_entry, UINT8 flag);
389 UINT32 (*get_entry_clu0)(DENTRY_T *p_entry);
390 void (*set_entry_clu0)(DENTRY_T *p_entry, UINT32 clu0);
391 UINT64 (*get_entry_size)(DENTRY_T *p_entry);
392 void (*set_entry_size)(DENTRY_T *p_entry, UINT64 size);
393 void (*get_entry_time)(DENTRY_T *p_entry, TIMESTAMP_T *tp, UINT8 mode);
394 void (*set_entry_time)(DENTRY_T *p_entry, TIMESTAMP_T *tp, UINT8 mode);
397 typedef struct __FS_INFO_T {
405 UINT32 cluster_size_bits;
406 UINT32 sectors_per_clu;
407 UINT32 sectors_per_clu_bits;
410 UINT32 FAT1_start_sector;
411 UINT32 FAT2_start_sector;
412 UINT32 root_start_sector;
413 UINT32 data_start_sector;
414 UINT32 num_FAT_sectors;
417 UINT32 dentries_in_root;
418 UINT32 dentries_per_clu;
421 struct buffer_head *pbr_bh;
425 struct buffer_head **vol_amap;
430 UINT32 used_clusters;
431 UENTRY_T hint_uentry;
437 BUF_CACHE_T FAT_cache_array[FAT_CACHE_SIZE];
438 BUF_CACHE_T FAT_cache_lru_list;
439 BUF_CACHE_T FAT_cache_hash_list[FAT_CACHE_HASH_SIZE];
441 BUF_CACHE_T buf_cache_array[BUF_CACHE_SIZE];
442 BUF_CACHE_T buf_cache_lru_list;
443 BUF_CACHE_T buf_cache_hash_list[BUF_CACHE_HASH_SIZE];
446 #define ES_2_ENTRIES 2
447 #define ES_3_ENTRIES 3
448 #define ES_ALL_ENTRIES 0
460 INT32 ffsShutdown(void);
462 INT32 ffsMountVol(struct super_block *sb, INT32 drv);
463 INT32 ffsUmountVol(struct super_block *sb);
464 INT32 ffsCheckVol(struct super_block *sb);
465 INT32 ffsGetVolInfo(struct super_block *sb, VOL_INFO_T *info);
466 INT32 ffsSyncVol(struct super_block *sb, INT32 do_sync);
468 INT32 ffsLookupFile(struct inode *inode, UINT8 *path, FILE_ID_T *fid);
469 INT32 ffsCreateFile(struct inode *inode, UINT8 *path, UINT8 mode, FILE_ID_T *fid);
470 INT32 ffsReadFile(struct inode *inode, FILE_ID_T *fid, void *buffer, UINT64 count, UINT64 *rcount);
471 INT32 ffsWriteFile(struct inode *inode, FILE_ID_T *fid, void *buffer, UINT64 count, UINT64 *wcount);
472 INT32 ffsTruncateFile(struct inode *inode, UINT64 old_size, UINT64 new_size);
473 INT32 ffsMoveFile(struct inode *old_parent_inode, FILE_ID_T *fid, struct inode *new_parent_inode, struct dentry *new_dentry);
474 INT32 ffsRemoveFile(struct inode *inode, FILE_ID_T *fid);
475 INT32 ffsSetAttr(struct inode *inode, UINT32 attr);
476 INT32 ffsGetStat(struct inode *inode, DIR_ENTRY_T *info);
477 INT32 ffsSetStat(struct inode *inode, DIR_ENTRY_T *info);
478 INT32 ffsMapCluster(struct inode *inode, INT32 clu_offset, UINT32 *clu);
480 INT32 ffsCreateDir(struct inode *inode, UINT8 *path, FILE_ID_T *fid);
481 INT32 ffsReadDir(struct inode *inode, DIR_ENTRY_T *dir_ent);
482 INT32 ffsRemoveDir(struct inode *inode, FILE_ID_T *fid);
483 INT32 ffsRemoveEntry(struct inode *inode, FILE_ID_T *fid);
486 INT32 fs_shutdown(void);
487 void fs_set_vol_flags(struct super_block *sb, UINT32 new_flag);
488 void fs_sync(struct super_block *sb, INT32 do_sync);
489 void fs_error(struct super_block *sb);
491 INT32 clear_cluster(struct super_block *sb, UINT32 clu);
492 INT32 fat_alloc_cluster(struct super_block *sb, INT32 num_alloc, CHAIN_T *p_chain);
493 INT32 exfat_alloc_cluster(struct super_block *sb, INT32 num_alloc, CHAIN_T *p_chain);
494 void fat_free_cluster(struct super_block *sb, CHAIN_T *p_chain, INT32 do_relse);
495 void exfat_free_cluster(struct super_block *sb, CHAIN_T *p_chain, INT32 do_relse);
496 UINT32 find_last_cluster(struct super_block *sb, CHAIN_T *p_chain);
497 INT32 count_num_clusters(struct super_block *sb, CHAIN_T *dir);
498 INT32 fat_count_used_clusters(struct super_block *sb);
499 INT32 exfat_count_used_clusters(struct super_block *sb);
500 void exfat_chain_cont_cluster(struct super_block *sb, UINT32 chain, INT32 len);
502 INT32 load_alloc_bitmap(struct super_block *sb);
503 void free_alloc_bitmap(struct super_block *sb);
504 INT32 set_alloc_bitmap(struct super_block *sb, UINT32 clu);
505 INT32 clr_alloc_bitmap(struct super_block *sb, UINT32 clu);
506 UINT32 test_alloc_bitmap(struct super_block *sb, UINT32 clu);
507 void sync_alloc_bitmap(struct super_block *sb);
509 INT32 load_upcase_table(struct super_block *sb);
510 void free_upcase_table(struct super_block *sb);
512 UINT32 fat_get_entry_type(DENTRY_T *p_entry);
513 UINT32 exfat_get_entry_type(DENTRY_T *p_entry);
514 void fat_set_entry_type(DENTRY_T *p_entry, UINT32 type);
515 void exfat_set_entry_type(DENTRY_T *p_entry, UINT32 type);
516 UINT32 fat_get_entry_attr(DENTRY_T *p_entry);
517 UINT32 exfat_get_entry_attr(DENTRY_T *p_entry);
518 void fat_set_entry_attr(DENTRY_T *p_entry, UINT32 attr);
519 void exfat_set_entry_attr(DENTRY_T *p_entry, UINT32 attr);
520 UINT8 fat_get_entry_flag(DENTRY_T *p_entry);
521 UINT8 exfat_get_entry_flag(DENTRY_T *p_entry);
522 void fat_set_entry_flag(DENTRY_T *p_entry, UINT8 flag);
523 void exfat_set_entry_flag(DENTRY_T *p_entry, UINT8 flag);
524 UINT32 fat_get_entry_clu0(DENTRY_T *p_entry);
525 UINT32 exfat_get_entry_clu0(DENTRY_T *p_entry);
526 void fat_set_entry_clu0(DENTRY_T *p_entry, UINT32 start_clu);
527 void exfat_set_entry_clu0(DENTRY_T *p_entry, UINT32 start_clu);
528 UINT64 fat_get_entry_size(DENTRY_T *p_entry);
529 UINT64 exfat_get_entry_size(DENTRY_T *p_entry);
530 void fat_set_entry_size(DENTRY_T *p_entry, UINT64 size);
531 void exfat_set_entry_size(DENTRY_T *p_entry, UINT64 size);
532 void fat_get_entry_time(DENTRY_T *p_entry, TIMESTAMP_T *tp, UINT8 mode);
533 void exfat_get_entry_time(DENTRY_T *p_entry, TIMESTAMP_T *tp, UINT8 mode);
534 void fat_set_entry_time(DENTRY_T *p_entry, TIMESTAMP_T *tp, UINT8 mode);
535 void exfat_set_entry_time(DENTRY_T *p_entry, TIMESTAMP_T *tp, UINT8 mode);
536 INT32 fat_init_dir_entry(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, UINT32 type, UINT32 start_clu, UINT64 size);
537 INT32 exfat_init_dir_entry(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, UINT32 type, UINT32 start_clu, UINT64 size);
538 INT32 fat_init_ext_dir_entry(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, INT32 num_entries, UNI_NAME_T *p_uniname, DOS_NAME_T *p_dosname);
539 INT32 exfat_init_ext_dir_entry(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, INT32 num_entries, UNI_NAME_T *p_uniname, DOS_NAME_T *p_dosname);
540 void init_dos_entry(DOS_DENTRY_T *ep, UINT32 type, UINT32 start_clu, UINT8 tz_utc);
541 void init_ext_entry(EXT_DENTRY_T *ep, INT32 order, UINT8 chksum, UINT16 *uniname);
542 void init_file_entry(FILE_DENTRY_T *ep, UINT32 type, UINT8 tz_utc);
543 void init_strm_entry(STRM_DENTRY_T *ep, UINT8 flags, UINT32 start_clu, UINT64 size);
544 void init_name_entry(NAME_DENTRY_T *ep, UINT16 *uniname);
545 void fat_delete_dir_entry(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, INT32 order, INT32 num_entries);
546 void exfat_delete_dir_entry(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, INT32 order, INT32 num_entries);
548 INT32 find_location(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, UINT32 *sector, INT32 *offset);
549 DENTRY_T *get_entry_with_sector(struct super_block *sb, UINT32 sector, INT32 offset);
550 DENTRY_T *get_entry_in_dir(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, UINT32 *sector);
551 ENTRY_SET_CACHE_T *get_entry_set_in_dir (struct super_block *sb, CHAIN_T *p_dir, INT32 entry, UINT32 type, DENTRY_T **file_ep);
552 void release_entry_set (ENTRY_SET_CACHE_T *es);
553 INT32 write_whole_entry_set (struct super_block *sb, ENTRY_SET_CACHE_T *es);
554 INT32 write_partial_entries_in_entry_set (struct super_block *sb, ENTRY_SET_CACHE_T *es, DENTRY_T *ep, UINT32 count);
555 INT32 search_deleted_or_unused_entry(struct super_block *sb, CHAIN_T *p_dir, INT32 num_entries);
556 INT32 find_empty_entry(struct inode *inode, CHAIN_T *p_dir, INT32 num_entries);
557 INT32 fat_find_dir_entry(struct super_block *sb, CHAIN_T *p_dir, UNI_NAME_T *p_uniname, INT32 num_entries, DOS_NAME_T *p_dosname, UINT32 type);
558 INT32 exfat_find_dir_entry(struct super_block *sb, CHAIN_T *p_dir, UNI_NAME_T *p_uniname, INT32 num_entries, DOS_NAME_T *p_dosname, UINT32 type);
559 INT32 fat_count_ext_entries(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, DENTRY_T *p_entry);
560 INT32 exfat_count_ext_entries(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, DENTRY_T *p_entry);
561 INT32 count_dos_name_entries(struct super_block *sb, CHAIN_T *p_dir, UINT32 type);
562 void update_dir_checksum(struct super_block *sb, CHAIN_T *p_dir, INT32 entry);
563 void update_dir_checksum_with_entry_set (struct super_block *sb, ENTRY_SET_CACHE_T *es);
564 BOOL is_dir_empty(struct super_block *sb, CHAIN_T *p_dir);
566 INT32 get_num_entries_and_dos_name(struct super_block *sb, CHAIN_T *p_dir, UNI_NAME_T *p_uniname, INT32 *entries, DOS_NAME_T *p_dosname);
567 void get_uni_name_from_dos_entry(struct super_block *sb, DOS_DENTRY_T *ep, UNI_NAME_T *p_uniname, UINT8 mode);
568 void fat_get_uni_name_from_ext_entry(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, UINT16 *uniname);
569 void exfat_get_uni_name_from_ext_entry(struct super_block *sb, CHAIN_T *p_dir, INT32 entry, UINT16 *uniname);
570 INT32 extract_uni_name_from_ext_entry(EXT_DENTRY_T *ep, UINT16 *uniname, INT32 order);
571 INT32 extract_uni_name_from_name_entry(NAME_DENTRY_T *ep, UINT16 *uniname, INT32 order);
572 INT32 fat_generate_dos_name(struct super_block *sb, CHAIN_T *p_dir, DOS_NAME_T *p_dosname);
573 void fat_attach_count_to_dos_name(UINT8 *dosname, INT32 count);
574 INT32 fat_calc_num_entries(UNI_NAME_T *p_uniname);
575 INT32 exfat_calc_num_entries(UNI_NAME_T *p_uniname);
576 UINT8 calc_checksum_1byte(void *data, INT32 len, UINT8 chksum);
577 UINT16 calc_checksum_2byte(void *data, INT32 len, UINT16 chksum, INT32 type);
578 UINT32 calc_checksum_4byte(void *data, INT32 len, UINT32 chksum, INT32 type);
580 INT32 resolve_path(struct inode *inode, UINT8 *path, CHAIN_T *p_dir, UNI_NAME_T *p_uniname);
581 INT32 resolve_name(UINT8 *name, UINT8 **arg);
583 INT32 fat16_mount(struct super_block *sb, PBR_SECTOR_T *p_pbr);
584 INT32 fat32_mount(struct super_block *sb, PBR_SECTOR_T *p_pbr);
585 INT32 exfat_mount(struct super_block *sb, PBR_SECTOR_T *p_pbr);
586 INT32 create_dir(struct inode *inode, CHAIN_T *p_dir, UNI_NAME_T *p_uniname, FILE_ID_T *fid);
587 INT32 create_file(struct inode *inode, CHAIN_T *p_dir, UNI_NAME_T *p_uniname, UINT8 mode, FILE_ID_T *fid);
588 void remove_file(struct inode *inode, CHAIN_T *p_dir, INT32 entry);
589 INT32 rename_file(struct inode *inode, CHAIN_T *p_dir, INT32 old_entry, UNI_NAME_T *p_uniname, FILE_ID_T *fid);
590 INT32 move_file(struct inode *inode, CHAIN_T *p_olddir, INT32 oldentry, CHAIN_T *p_newdir, UNI_NAME_T *p_uniname, FILE_ID_T *fid);
592 INT32 sector_read(struct super_block *sb, UINT32 sec, struct buffer_head **bh, INT32 read);
593 INT32 sector_write(struct super_block *sb, UINT32 sec, struct buffer_head *bh, INT32 sync);
594 INT32 multi_sector_read(struct super_block *sb, UINT32 sec, struct buffer_head **bh, INT32 num_secs, INT32 read);
595 INT32 multi_sector_write(struct super_block *sb, UINT32 sec, struct buffer_head *bh, INT32 num_secs, INT32 sync);