1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
9 #include <linux/types.h>
10 #include <linux/buffer_head.h>
12 #ifdef CONFIG_EXFAT_KERNEL_DEBUG
13 /* For Debugging Purpose */
14 /* IOCTL code 'f' used by
15 * - file systems typically #0~0x1F
16 * - embedded terminal devices #128~
17 * - exts for debugging purpose #99
18 * number 100 and 101 is available now but has possible conflicts
20 #define EXFAT_IOC_GET_DEBUGFLAGS _IOR('f', 100, long)
21 #define EXFAT_IOC_SET_DEBUGFLAGS _IOW('f', 101, long)
23 #define EXFAT_DEBUGFLAGS_INVALID_UMOUNT 0x01
24 #define EXFAT_DEBUGFLAGS_ERROR_RW 0x02
25 #endif /* CONFIG_EXFAT_KERNEL_DEBUG */
27 #ifdef CONFIG_EXFAT_DEBUG_MSG
33 #define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
35 #define DENTRY_SIZE 32 /* dir entry size */
36 #define DENTRY_SIZE_BITS 5
39 #define PBR_SIGNATURE 0xAA55
40 #define EXT_SIGNATURE 0xAA550000
41 #define VOL_LABEL "NO NAME " /* size should be 11 */
42 #define OEM_NAME "MSWIN4.1" /* size should be 8 */
43 #define STR_FAT12 "FAT12 " /* size should be 8 */
44 #define STR_FAT16 "FAT16 " /* size should be 8 */
45 #define STR_FAT32 "FAT32 " /* size should be 8 */
46 #define STR_EXFAT "EXFAT " /* size should be 8 */
47 #define VOL_CLEAN 0x0000
48 #define VOL_DIRTY 0x0002
50 /* max number of clusters */
51 #define FAT12_THRESHOLD 4087 /* 2^12 - 1 + 2 (clu 0 & 1) */
52 #define FAT16_THRESHOLD 65527 /* 2^16 - 1 + 2 */
53 #define FAT32_THRESHOLD 268435457 /* 2^28 - 1 + 2 */
54 #define EXFAT_THRESHOLD 268435457 /* 2^28 - 1 + 2 */
57 #define TYPE_UNUSED 0x0000
58 #define TYPE_DELETED 0x0001
59 #define TYPE_INVALID 0x0002
60 #define TYPE_CRITICAL_PRI 0x0100
61 #define TYPE_BITMAP 0x0101
62 #define TYPE_UPCASE 0x0102
63 #define TYPE_VOLUME 0x0103
64 #define TYPE_DIR 0x0104
65 #define TYPE_FILE 0x011F
66 #define TYPE_SYMLINK 0x015F
67 #define TYPE_CRITICAL_SEC 0x0200
68 #define TYPE_STREAM 0x0201
69 #define TYPE_EXTEND 0x0202
70 #define TYPE_ACL 0x0203
71 #define TYPE_BENIGN_PRI 0x0400
72 #define TYPE_GUID 0x0401
73 #define TYPE_PADDING 0x0402
74 #define TYPE_ACLTAB 0x0403
75 #define TYPE_BENIGN_SEC 0x0800
76 #define TYPE_ALL 0x0FFF
84 #define CS_DIR_ENTRY 0
85 #define CS_PBR_SECTOR 1
88 #define CLUSTER_16(x) ((u16)(x))
89 #define CLUSTER_32(x) ((u32)(x))
91 #define START_SECTOR(x) \
92 ((((sector_t)((x) - 2)) << p_fs->sectors_per_clu_bits) + \
93 p_fs->data_start_sector)
95 #define IS_LAST_SECTOR_IN_CLUSTER(sec) \
96 ((((sec) - p_fs->data_start_sector + 1) & \
97 ((1 << p_fs->sectors_per_clu_bits) - 1)) == 0)
99 #define GET_CLUSTER_FROM_SECTOR(sec) \
100 ((u32)((((sec) - p_fs->data_start_sector) >> \
101 p_fs->sectors_per_clu_bits) + 2))
103 #define GET16(p_src) \
104 (((u16)(p_src)[0]) | (((u16)(p_src)[1]) << 8))
105 #define GET32(p_src) \
106 (((u32)(p_src)[0]) | (((u32)(p_src)[1]) << 8) | \
107 (((u32)(p_src)[2]) << 16) | (((u32)(p_src)[3]) << 24))
108 #define GET64(p_src) \
109 (((u64)(p_src)[0]) | (((u64)(p_src)[1]) << 8) | \
110 (((u64)(p_src)[2]) << 16) | (((u64)(p_src)[3]) << 24) | \
111 (((u64)(p_src)[4]) << 32) | (((u64)(p_src)[5]) << 40) | \
112 (((u64)(p_src)[6]) << 48) | (((u64)(p_src)[7]) << 56))
114 #define SET16(p_dst, src) \
116 (p_dst)[0] = (u8)(src); \
117 (p_dst)[1] = (u8)(((u16)(src)) >> 8); \
119 #define SET32(p_dst, src) \
121 (p_dst)[0] = (u8)(src); \
122 (p_dst)[1] = (u8)(((u32)(src)) >> 8); \
123 (p_dst)[2] = (u8)(((u32)(src)) >> 16); \
124 (p_dst)[3] = (u8)(((u32)(src)) >> 24); \
126 #define SET64(p_dst, src) \
128 (p_dst)[0] = (u8)(src); \
129 (p_dst)[1] = (u8)(((u64)(src)) >> 8); \
130 (p_dst)[2] = (u8)(((u64)(src)) >> 16); \
131 (p_dst)[3] = (u8)(((u64)(src)) >> 24); \
132 (p_dst)[4] = (u8)(((u64)(src)) >> 32); \
133 (p_dst)[5] = (u8)(((u64)(src)) >> 40); \
134 (p_dst)[6] = (u8)(((u64)(src)) >> 48); \
135 (p_dst)[7] = (u8)(((u64)(src)) >> 56); \
138 #ifdef __LITTLE_ENDIAN
139 #define GET16_A(p_src) (*((u16 *)(p_src)))
140 #define GET32_A(p_src) (*((u32 *)(p_src)))
141 #define GET64_A(p_src) (*((u64 *)(p_src)))
142 #define SET16_A(p_dst, src) (*((u16 *)(p_dst)) = (u16)(src))
143 #define SET32_A(p_dst, src) (*((u32 *)(p_dst)) = (u32)(src))
144 #define SET64_A(p_dst, src) (*((u64 *)(p_dst)) = (u64)(src))
145 #else /* BIG_ENDIAN */
146 #define GET16_A(p_src) GET16(p_src)
147 #define GET32_A(p_src) GET32(p_src)
148 #define GET64_A(p_src) GET64(p_src)
149 #define SET16_A(p_dst, src) SET16(p_dst, src)
150 #define SET32_A(p_dst, src) SET32(p_dst, src)
151 #define SET64_A(p_dst, src) SET64(p_dst, src)
154 /* cache size (in number of sectors) */
155 /* (should be an exponential value of 2) */
156 #define FAT_CACHE_SIZE 128
157 #define FAT_CACHE_HASH_SIZE 64
158 #define BUF_CACHE_SIZE 256
159 #define BUF_CACHE_HASH_SIZE 64
161 /* Upcase table macro */
162 #define HIGH_INDEX_BIT (8)
163 #define HIGH_INDEX_MASK (0xFF00)
164 #define LOW_INDEX_BIT (16 - HIGH_INDEX_BIT)
165 #define UTBL_ROW_COUNT BIT(LOW_INDEX_BIT)
166 #define UTBL_COL_COUNT BIT(HIGH_INDEX_BIT)
168 static inline u16 get_col_index(u16 i)
170 return i >> LOW_INDEX_BIT;
173 static inline u16 get_row_index(u16 i)
175 return i & ~HIGH_INDEX_MASK;
178 #define EXFAT_SUPER_MAGIC (0x2011BAB0L)
179 #define EXFAT_ROOT_INO 1
182 #define FAT12 0x01 /* FAT12 */
183 #define FAT16 0x0E /* Win95 FAT16 (LBA) */
184 #define FAT32 0x0C /* Win95 FAT32 (LBA) */
185 #define EXFAT 0x07 /* exFAT */
187 /* file name lengths */
188 #define MAX_CHARSET_SIZE 3 /* max size of multi-byte character */
189 #define MAX_PATH_DEPTH 15 /* max depth of path name */
190 #define MAX_NAME_LENGTH 256 /* max len of filename including NULL */
191 #define MAX_PATH_LENGTH 260 /* max len of pathname including NULL */
192 #define DOS_NAME_LENGTH 11 /* DOS filename length excluding NULL */
193 #define DOS_PATH_LENGTH 80 /* DOS pathname length excluding NULL */
195 /* file attributes */
196 #define ATTR_NORMAL 0x0000
197 #define ATTR_READONLY 0x0001
198 #define ATTR_HIDDEN 0x0002
199 #define ATTR_SYSTEM 0x0004
200 #define ATTR_VOLUME 0x0008
201 #define ATTR_SUBDIR 0x0010
202 #define ATTR_ARCHIVE 0x0020
203 #define ATTR_SYMLINK 0x0040
204 #define ATTR_EXTEND 0x000F
205 #define ATTR_RWMASK 0x007E
207 /* file creation modes */
208 #define FM_REGULAR 0x00
209 #define FM_SYMLINK 0x40
211 #define NUM_UPCASE 2918
213 #define DOS_CUR_DIR_NAME ". "
214 #define DOS_PAR_DIR_NAME ".. "
216 #ifdef __LITTLE_ENDIAN
217 #define UNI_CUR_DIR_NAME ".\0"
218 #define UNI_PAR_DIR_NAME ".\0.\0"
220 #define UNI_CUR_DIR_NAME "\0."
221 #define UNI_PAR_DIR_NAME "\0.\0."
235 u32 Offset; /* start sector number of the partition */
236 u32 Size; /* in sectors */
240 u32 SecSize; /* sector size in bytes */
241 u32 DevSize; /* block device size in sectors */
252 /* directory structure */
273 char Name[MAX_NAME_LENGTH * MAX_CHARSET_SIZE];
275 /* used only for FAT12/16/32, not used for exFAT */
276 char ShortName[DOS_NAME_LENGTH + 2];
281 struct date_time_t CreateTimestamp;
282 struct date_time_t ModifyTimestamp;
283 struct date_time_t AccessTimestamp;
287 u16 sec; /* 0 ~ 59 */
288 u16 min; /* 0 ~ 59 */
289 u16 hour; /* 0 ~ 23 */
290 u16 day; /* 1 ~ 31 */
291 u16 mon; /* 1 ~ 12 */
292 u16 year; /* 0 ~ 127 (since 1980) */
295 /* MS_DOS FAT partition boot record (512 bytes) */
296 struct pbr_sector_t {
304 /* MS-DOS FAT12/16 BIOS parameter block (51 bytes) */
310 u8 num_root_entries[2];
313 u8 num_fat_sectors[2];
314 u8 sectors_in_track[2];
316 u8 num_hid_sectors[4];
317 u8 num_huge_sectors[4];
327 /* MS-DOS FAT32 BIOS parameter block (79 bytes) */
333 u8 num_root_entries[2];
336 u8 num_fat_sectors[2];
337 u8 sectors_in_track[2];
339 u8 num_hid_sectors[4];
340 u8 num_huge_sectors[4];
341 u8 num_fat32_sectors[4];
357 /* MS-DOS EXFAT BIOS parameter block (109 bytes) */
371 u8 sectors_per_clu_bits;
378 /* MS-DOS FAT file system information sector (512 bytes) */
379 struct fsi_sector_t {
389 /* MS-DOS FAT directory entry (32 bytes) */
394 struct dos_dentry_t {
395 u8 name[DOS_NAME_LENGTH];
409 /* MS-DOS FAT extended directory entry (32 bytes) */
410 struct ext_dentry_t {
421 /* MS-DOS EXFAT file directory entry (32 bytes) */
422 struct file_dentry_t {
440 /* MS-DOS EXFAT stream extension directory entry (32 bytes) */
441 struct strm_dentry_t {
454 /* MS-DOS EXFAT file name directory entry (32 bytes) */
455 struct name_dentry_t {
461 /* MS-DOS EXFAT allocation bitmap directory entry (32 bytes) */
462 struct bmap_dentry_t {
470 /* MS-DOS EXFAT up-case table directory entry (32 bytes) */
471 struct case_dentry_t {
480 /* MS-DOS EXFAT volume label directory entry (32 bytes) */
481 struct volm_dentry_t {
488 /* unused entry hint information */
495 /* DOS name structure */
497 u8 name[DOS_NAME_LENGTH];
501 /* unicode name structure */
503 u16 name[MAX_NAME_LENGTH];
509 struct buf_cache_t *next;
510 struct buf_cache_t *prev;
511 struct buf_cache_t *hash_next;
512 struct buf_cache_t *hash_prev;
516 struct buffer_head *buf_bh;
520 s32 (*alloc_cluster)(struct super_block *sb, s32 num_alloc,
521 struct chain_t *p_chain);
522 void (*free_cluster)(struct super_block *sb, struct chain_t *p_chain,
524 s32 (*count_used_clusters)(struct super_block *sb);
526 s32 (*init_dir_entry)(struct super_block *sb, struct chain_t *p_dir,
527 s32 entry, u32 type, u32 start_clu, u64 size);
528 s32 (*init_ext_entry)(struct super_block *sb, struct chain_t *p_dir,
529 s32 entry, s32 num_entries,
530 struct uni_name_t *p_uniname,
531 struct dos_name_t *p_dosname);
532 s32 (*find_dir_entry)(struct super_block *sb, struct chain_t *p_dir,
533 struct uni_name_t *p_uniname, s32 num_entries,
534 struct dos_name_t *p_dosname, u32 type);
535 void (*delete_dir_entry)(struct super_block *sb,
536 struct chain_t *p_dir, s32 entry,
537 s32 offset, s32 num_entries);
538 void (*get_uni_name_from_ext_entry)(struct super_block *sb,
539 struct chain_t *p_dir, s32 entry,
541 s32 (*count_ext_entries)(struct super_block *sb,
542 struct chain_t *p_dir, s32 entry,
543 struct dentry_t *p_entry);
544 s32 (*calc_num_entries)(struct uni_name_t *p_uniname);
546 u32 (*get_entry_type)(struct dentry_t *p_entry);
547 void (*set_entry_type)(struct dentry_t *p_entry, u32 type);
548 u32 (*get_entry_attr)(struct dentry_t *p_entry);
549 void (*set_entry_attr)(struct dentry_t *p_entry, u32 attr);
550 u8 (*get_entry_flag)(struct dentry_t *p_entry);
551 void (*set_entry_flag)(struct dentry_t *p_entry, u8 flag);
552 u32 (*get_entry_clu0)(struct dentry_t *p_entry);
553 void (*set_entry_clu0)(struct dentry_t *p_entry, u32 clu0);
554 u64 (*get_entry_size)(struct dentry_t *p_entry);
555 void (*set_entry_size)(struct dentry_t *p_entry, u64 size);
556 void (*get_entry_time)(struct dentry_t *p_entry,
557 struct timestamp_t *tp, u8 mode);
558 void (*set_entry_time)(struct dentry_t *p_entry,
559 struct timestamp_t *tp, u8 mode);
563 u32 drv; /* drive ID */
564 u32 vol_type; /* volume FAT type */
565 u32 vol_id; /* volume serial number */
567 u64 num_sectors; /* num of sectors in volume */
568 u32 num_clusters; /* num of clusters in volume */
569 u32 cluster_size; /* cluster size in bytes */
570 u32 cluster_size_bits;
571 u32 sectors_per_clu; /* cluster size in sectors */
572 u32 sectors_per_clu_bits;
574 u32 PBR_sector; /* PBR sector */
575 u32 FAT1_start_sector; /* FAT1 start sector */
576 u32 FAT2_start_sector; /* FAT2 start sector */
577 u32 root_start_sector; /* root dir start sector */
578 u32 data_start_sector; /* data area start sector */
579 u32 num_FAT_sectors; /* num of FAT sectors */
581 u32 root_dir; /* root dir cluster */
582 u32 dentries_in_root; /* num of dentries in root dir */
583 u32 dentries_per_clu; /* num of dentries per cluster */
585 u32 vol_flag; /* volume dirty flag */
586 struct buffer_head *pbr_bh; /* PBR sector */
588 u32 map_clu; /* allocation bitmap start cluster */
589 u32 map_sectors; /* num of allocation bitmap sectors */
590 struct buffer_head **vol_amap; /* allocation bitmap */
592 u16 **vol_utbl; /* upcase table */
594 u32 clu_srch_ptr; /* cluster search pointer */
595 u32 used_clusters; /* number of used clusters */
596 struct uentry_t hint_uentry; /* unused entry hint information */
598 u32 dev_ejected; /* block device operation error flag */
600 struct fs_func *fs_func;
601 struct mutex v_mutex;
604 struct buf_cache_t FAT_cache_array[FAT_CACHE_SIZE];
605 struct buf_cache_t FAT_cache_lru_list;
606 struct buf_cache_t FAT_cache_hash_list[FAT_CACHE_HASH_SIZE];
609 struct buf_cache_t buf_cache_array[BUF_CACHE_SIZE];
610 struct buf_cache_t buf_cache_lru_list;
611 struct buf_cache_t buf_cache_hash_list[BUF_CACHE_HASH_SIZE];
614 #define ES_2_ENTRIES 2
615 #define ES_3_ENTRIES 3
616 #define ES_ALL_ENTRIES 0
618 struct entry_set_cache_t {
619 /* sector number that contains file_entry */
622 /* byte offset in the sector */
626 * flag in stream entry.
627 * 01 for cluster chain,
628 * 03 for contig. clusteres.
634 /* __buf should be the last member */
638 #define EXFAT_ERRORS_CONT 1 /* ignore error and continue */
639 #define EXFAT_ERRORS_PANIC 2 /* panic on error */
640 #define EXFAT_ERRORS_RO 3 /* remount r/o on error */
643 #define EXFAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x12, __u32)
645 struct exfat_mount_options {
648 unsigned short fs_fmask;
649 unsigned short fs_dmask;
651 /* permission for setting the [am]time */
652 unsigned short allow_utime;
654 /* codepage for shortname conversions */
655 unsigned short codepage;
657 /* charset for filename input/display */
660 unsigned char casesensitive;
662 /* on error: continue, panic, remount-ro */
663 unsigned char errors;
664 #ifdef CONFIG_EXFAT_DISCARD
665 /* flag on if -o dicard specified and device support discard() */
666 unsigned char discard;
667 #endif /* CONFIG_EXFAT_DISCARD */
670 #define EXFAT_HASH_BITS 8
671 #define EXFAT_HASH_SIZE BIT(EXFAT_HASH_BITS)
674 * EXFAT file system in-core superblock data
677 s32 sector_size; /* in bytes */
678 s32 sector_size_bits;
679 s32 sector_size_mask;
681 /* total number of sectors in this block device */
688 struct exfat_sb_info {
689 struct fs_info_t fs_info;
690 struct bd_info_t bd_info;
692 struct exfat_mount_options options;
696 struct nls_table *nls_disk; /* Codepage used on disk */
697 struct nls_table *nls_io; /* Charset used for input and display */
699 struct inode *fat_inode;
701 spinlock_t inode_hash_lock;
702 struct hlist_head inode_hashtable[EXFAT_HASH_SIZE];
703 #ifdef CONFIG_EXFAT_KERNEL_DEBUG
705 #endif /* CONFIG_EXFAT_KERNEL_DEBUG */
709 * EXFAT file system inode data in memory
711 struct exfat_inode_info {
712 struct file_id_t fid;
714 /* NOTE: mmu_private is 64bits, so must hold ->i_mutex to access */
715 loff_t mmu_private; /* physically allocated size */
716 loff_t i_pos; /* on-disk position of directory entry or 0 */
717 struct hlist_node i_hash_fat; /* hash by i_location */
718 struct rw_semaphore truncate_lock;
719 struct inode vfs_inode;
720 struct rw_semaphore i_alloc_sem; /* protect bmap against truncate */
723 #define EXFAT_SB(sb) ((struct exfat_sb_info *)((sb)->s_fs_info))
725 static inline struct exfat_inode_info *EXFAT_I(struct inode *inode)
727 return container_of(inode, struct exfat_inode_info, vfs_inode);
730 /* NLS management function */
731 u16 nls_upper(struct super_block *sb, u16 a);
732 int nls_uniname_cmp(struct super_block *sb, u16 *a, u16 *b);
733 void nls_uniname_to_cstring(struct super_block *sb, u8 *p_cstring,
734 struct uni_name_t *p_uniname);
735 void nls_cstring_to_uniname(struct super_block *sb,
736 struct uni_name_t *p_uniname, u8 *p_cstring,
739 /* buffer cache management */
740 void exfat_buf_init(struct super_block *sb);
741 void exfat_buf_shutdown(struct super_block *sb);
742 int exfat_fat_read(struct super_block *sb, u32 loc, u32 *content);
743 s32 exfat_fat_write(struct super_block *sb, u32 loc, u32 content);
744 u8 *exfat_fat_getblk(struct super_block *sb, sector_t sec);
745 void exfat_fat_modify(struct super_block *sb, sector_t sec);
746 void exfat_fat_release_all(struct super_block *sb);
747 void exfat_fat_sync(struct super_block *sb);
748 u8 *exfat_buf_getblk(struct super_block *sb, sector_t sec);
749 void exfat_buf_modify(struct super_block *sb, sector_t sec);
750 void exfat_buf_lock(struct super_block *sb, sector_t sec);
751 void exfat_buf_unlock(struct super_block *sb, sector_t sec);
752 void exfat_buf_release(struct super_block *sb, sector_t sec);
753 void exfat_buf_release_all(struct super_block *sb);
754 void exfat_buf_sync(struct super_block *sb);
756 /* fs management functions */
757 void fs_set_vol_flags(struct super_block *sb, u32 new_flag);
758 void fs_error(struct super_block *sb);
760 /* cluster management functions */
761 s32 count_num_clusters(struct super_block *sb, struct chain_t *dir);
762 void exfat_chain_cont_cluster(struct super_block *sb, u32 chain, s32 len);
764 /* allocation bitmap management functions */
765 s32 load_alloc_bitmap(struct super_block *sb);
766 void free_alloc_bitmap(struct super_block *sb);
767 void sync_alloc_bitmap(struct super_block *sb);
769 /* upcase table management functions */
770 s32 load_upcase_table(struct super_block *sb);
771 void free_upcase_table(struct super_block *sb);
773 /* dir entry management functions */
774 struct timestamp_t *tm_current(struct timestamp_t *tm);
776 struct dentry_t *get_entry_in_dir(struct super_block *sb, struct chain_t *p_dir,
777 s32 entry, sector_t *sector);
778 struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb,
779 struct chain_t *p_dir, s32 entry,
781 struct dentry_t **file_ep);
782 void release_entry_set(struct entry_set_cache_t *es);
783 s32 count_dos_name_entries(struct super_block *sb, struct chain_t *p_dir,
785 void update_dir_checksum(struct super_block *sb, struct chain_t *p_dir,
787 void update_dir_checksum_with_entry_set(struct super_block *sb,
788 struct entry_set_cache_t *es);
789 bool is_dir_empty(struct super_block *sb, struct chain_t *p_dir);
791 /* name conversion functions */
792 s32 get_num_entries_and_dos_name(struct super_block *sb, struct chain_t *p_dir,
793 struct uni_name_t *p_uniname, s32 *entries,
794 struct dos_name_t *p_dosname);
795 u16 calc_checksum_2byte(void *data, s32 len, u16 chksum, s32 type);
797 /* name resolution functions */
798 s32 resolve_path(struct inode *inode, char *path, struct chain_t *p_dir,
799 struct uni_name_t *p_uniname);
801 /* file operation functions */
802 s32 exfat_mount(struct super_block *sb, struct pbr_sector_t *p_pbr);
803 s32 create_dir(struct inode *inode, struct chain_t *p_dir,
804 struct uni_name_t *p_uniname, struct file_id_t *fid);
805 s32 create_file(struct inode *inode, struct chain_t *p_dir,
806 struct uni_name_t *p_uniname, u8 mode, struct file_id_t *fid);
807 void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry);
808 s32 rename_file(struct inode *inode, struct chain_t *p_dir, s32 old_entry,
809 struct uni_name_t *p_uniname, struct file_id_t *fid);
810 s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry,
811 struct chain_t *p_newdir, struct uni_name_t *p_uniname,
812 struct file_id_t *fid);
814 /* sector read/write functions */
815 int sector_read(struct super_block *sb, sector_t sec,
816 struct buffer_head **bh, bool read);
817 int sector_write(struct super_block *sb, sector_t sec,
818 struct buffer_head *bh, bool sync);
819 int multi_sector_read(struct super_block *sb, sector_t sec,
820 struct buffer_head **bh, s32 num_secs, bool read);
821 int multi_sector_write(struct super_block *sb, sector_t sec,
822 struct buffer_head *bh, s32 num_secs, bool sync);
824 void exfat_bdev_open(struct super_block *sb);
825 void exfat_bdev_close(struct super_block *sb);
826 int exfat_bdev_read(struct super_block *sb, sector_t secno,
827 struct buffer_head **bh, u32 num_secs, bool read);
828 int exfat_bdev_write(struct super_block *sb, sector_t secno,
829 struct buffer_head *bh, u32 num_secs, bool sync);
830 int exfat_bdev_sync(struct super_block *sb);
832 extern const u8 uni_upcase[];
833 #endif /* _EXFAT_H */