exfat_fs.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
  4. */
  5. #ifndef _EXFAT_FS_H
  6. #define _EXFAT_FS_H
  7. #include <linux/fs.h>
  8. #include <linux/ratelimit.h>
  9. #include <linux/nls.h>
  10. #define EXFAT_SUPER_MAGIC 0x2011BAB0UL
  11. #define EXFAT_ROOT_INO 1
  12. #define EXFAT_CLUSTERS_UNTRACKED (~0u)
  13. /*
  14. * exfat error flags
  15. */
  16. enum exfat_error_mode {
  17. EXFAT_ERRORS_CONT, /* ignore error and continue */
  18. EXFAT_ERRORS_PANIC, /* panic on error */
  19. EXFAT_ERRORS_RO, /* remount r/o on error */
  20. };
  21. /*
  22. * exfat nls lossy flag
  23. */
  24. enum {
  25. NLS_NAME_NO_LOSSY, /* no lossy */
  26. NLS_NAME_LOSSY, /* just detected incorrect filename(s) */
  27. NLS_NAME_OVERLEN, /* the length is over than its limit */
  28. };
  29. #define EXFAT_HASH_BITS 8
  30. #define EXFAT_HASH_SIZE (1UL << EXFAT_HASH_BITS)
  31. /*
  32. * Type Definitions
  33. */
  34. #define ES_2_ENTRIES 2
  35. #define ES_ALL_ENTRIES 0
  36. #define DIR_DELETED 0xFFFF0321
  37. /* type values */
  38. #define TYPE_UNUSED 0x0000
  39. #define TYPE_DELETED 0x0001
  40. #define TYPE_INVALID 0x0002
  41. #define TYPE_CRITICAL_PRI 0x0100
  42. #define TYPE_BITMAP 0x0101
  43. #define TYPE_UPCASE 0x0102
  44. #define TYPE_VOLUME 0x0103
  45. #define TYPE_DIR 0x0104
  46. #define TYPE_FILE 0x011F
  47. #define TYPE_CRITICAL_SEC 0x0200
  48. #define TYPE_STREAM 0x0201
  49. #define TYPE_EXTEND 0x0202
  50. #define TYPE_ACL 0x0203
  51. #define TYPE_BENIGN_PRI 0x0400
  52. #define TYPE_GUID 0x0401
  53. #define TYPE_PADDING 0x0402
  54. #define TYPE_ACLTAB 0x0403
  55. #define TYPE_BENIGN_SEC 0x0800
  56. #define TYPE_ALL 0x0FFF
  57. #define MAX_CHARSET_SIZE 6 /* max size of multi-byte character */
  58. #define MAX_NAME_LENGTH 255 /* max len of file name excluding NULL */
  59. #define MAX_VFSNAME_BUF_SIZE ((MAX_NAME_LENGTH + 1) * MAX_CHARSET_SIZE)
  60. /* Enough size to hold 256 dentry (even 512 Byte sector) */
  61. #define DIR_CACHE_SIZE (256*sizeof(struct exfat_dentry)/512+1)
  62. #define EXFAT_HINT_NONE -1
  63. #define EXFAT_MIN_SUBDIR 2
  64. /*
  65. * helpers for cluster size to byte conversion.
  66. */
  67. #define EXFAT_CLU_TO_B(b, sbi) ((b) << (sbi)->cluster_size_bits)
  68. #define EXFAT_B_TO_CLU(b, sbi) ((b) >> (sbi)->cluster_size_bits)
  69. #define EXFAT_B_TO_CLU_ROUND_UP(b, sbi) \
  70. (((b - 1) >> (sbi)->cluster_size_bits) + 1)
  71. #define EXFAT_CLU_OFFSET(off, sbi) ((off) & ((sbi)->cluster_size - 1))
  72. /*
  73. * helpers for block size to byte conversion.
  74. */
  75. #define EXFAT_BLK_TO_B(b, sb) ((b) << (sb)->s_blocksize_bits)
  76. #define EXFAT_B_TO_BLK(b, sb) ((b) >> (sb)->s_blocksize_bits)
  77. #define EXFAT_B_TO_BLK_ROUND_UP(b, sb) \
  78. (((b - 1) >> (sb)->s_blocksize_bits) + 1)
  79. #define EXFAT_BLK_OFFSET(off, sb) ((off) & ((sb)->s_blocksize - 1))
  80. /*
  81. * helpers for block size to dentry size conversion.
  82. */
  83. #define EXFAT_B_TO_DEN_IDX(b, sbi) \
  84. ((b) << ((sbi)->cluster_size_bits - DENTRY_SIZE_BITS))
  85. #define EXFAT_B_TO_DEN(b) ((b) >> DENTRY_SIZE_BITS)
  86. #define EXFAT_DEN_TO_B(b) ((b) << DENTRY_SIZE_BITS)
  87. /*
  88. * helpers for fat entry.
  89. */
  90. #define FAT_ENT_SIZE (4)
  91. #define FAT_ENT_SIZE_BITS (2)
  92. #define FAT_ENT_OFFSET_SECTOR(sb, loc) (EXFAT_SB(sb)->FAT1_start_sector + \
  93. (((u64)loc << FAT_ENT_SIZE_BITS) >> sb->s_blocksize_bits))
  94. #define FAT_ENT_OFFSET_BYTE_IN_SECTOR(sb, loc) \
  95. ((loc << FAT_ENT_SIZE_BITS) & (sb->s_blocksize - 1))
  96. /*
  97. * helpers for bitmap.
  98. */
  99. #define CLUSTER_TO_BITMAP_ENT(clu) ((clu) - EXFAT_RESERVED_CLUSTERS)
  100. #define BITMAP_ENT_TO_CLUSTER(ent) ((ent) + EXFAT_RESERVED_CLUSTERS)
  101. #define BITS_PER_SECTOR(sb) ((sb)->s_blocksize * BITS_PER_BYTE)
  102. #define BITS_PER_SECTOR_MASK(sb) (BITS_PER_SECTOR(sb) - 1)
  103. #define BITMAP_OFFSET_SECTOR_INDEX(sb, ent) \
  104. ((ent / BITS_PER_BYTE) >> (sb)->s_blocksize_bits)
  105. #define BITMAP_OFFSET_BIT_IN_SECTOR(sb, ent) (ent & BITS_PER_SECTOR_MASK(sb))
  106. #define BITMAP_OFFSET_BYTE_IN_SECTOR(sb, ent) \
  107. ((ent / BITS_PER_BYTE) & ((sb)->s_blocksize - 1))
  108. #define BITS_PER_BYTE_MASK 0x7
  109. #define IGNORED_BITS_REMAINED(clu, clu_base) ((1 << ((clu) - (clu_base))) - 1)
  110. struct exfat_dentry_namebuf {
  111. char *lfn;
  112. int lfnbuf_len; /* usually MAX_UNINAME_BUF_SIZE */
  113. };
  114. /* unicode name structure */
  115. struct exfat_uni_name {
  116. /* +3 for null and for converting */
  117. unsigned short name[MAX_NAME_LENGTH + 3];
  118. u16 name_hash;
  119. unsigned char name_len;
  120. };
  121. /* directory structure */
  122. struct exfat_chain {
  123. unsigned int dir;
  124. unsigned int size;
  125. unsigned char flags;
  126. };
  127. /* first empty entry hint information */
  128. struct exfat_hint_femp {
  129. /* entry index of a directory */
  130. int eidx;
  131. /* count of continuous empty entry */
  132. int count;
  133. /* the cluster that first empty slot exists in */
  134. struct exfat_chain cur;
  135. };
  136. /* hint structure */
  137. struct exfat_hint {
  138. unsigned int clu;
  139. union {
  140. unsigned int off; /* cluster offset */
  141. int eidx; /* entry index */
  142. };
  143. };
  144. struct exfat_entry_set_cache {
  145. struct super_block *sb;
  146. bool modified;
  147. unsigned int start_off;
  148. int num_bh;
  149. struct buffer_head *bh[DIR_CACHE_SIZE];
  150. unsigned int num_entries;
  151. };
  152. struct exfat_dir_entry {
  153. struct exfat_chain dir;
  154. int entry;
  155. unsigned int type;
  156. unsigned int start_clu;
  157. unsigned char flags;
  158. unsigned short attr;
  159. loff_t size;
  160. unsigned int num_subdirs;
  161. struct timespec64 atime;
  162. struct timespec64 mtime;
  163. struct timespec64 crtime;
  164. struct exfat_dentry_namebuf namebuf;
  165. };
  166. /*
  167. * exfat mount in-memory data
  168. */
  169. struct exfat_mount_options {
  170. kuid_t fs_uid;
  171. kgid_t fs_gid;
  172. unsigned short fs_fmask;
  173. unsigned short fs_dmask;
  174. /* permission for setting the [am]time */
  175. unsigned short allow_utime;
  176. /* charset for filename input/display */
  177. char *iocharset;
  178. /* on error: continue, panic, remount-ro */
  179. enum exfat_error_mode errors;
  180. unsigned utf8:1, /* Use of UTF-8 character set */
  181. discard:1; /* Issue discard requests on deletions */
  182. int time_offset; /* Offset of timestamps from UTC (in minutes) */
  183. };
  184. /*
  185. * EXFAT file system superblock in-memory data
  186. */
  187. struct exfat_sb_info {
  188. unsigned long long num_sectors; /* num of sectors in volume */
  189. unsigned int num_clusters; /* num of clusters in volume */
  190. unsigned int cluster_size; /* cluster size in bytes */
  191. unsigned int cluster_size_bits;
  192. unsigned int sect_per_clus; /* cluster size in sectors */
  193. unsigned int sect_per_clus_bits;
  194. unsigned long long FAT1_start_sector; /* FAT1 start sector */
  195. unsigned long long FAT2_start_sector; /* FAT2 start sector */
  196. unsigned long long data_start_sector; /* data area start sector */
  197. unsigned int num_FAT_sectors; /* num of FAT sectors */
  198. unsigned int root_dir; /* root dir cluster */
  199. unsigned int dentries_per_clu; /* num of dentries per cluster */
  200. unsigned int vol_flags; /* volume flags */
  201. unsigned int vol_flags_persistent; /* volume flags to retain */
  202. struct buffer_head *boot_bh; /* buffer_head of BOOT sector */
  203. unsigned int map_clu; /* allocation bitmap start cluster */
  204. unsigned int map_sectors; /* num of allocation bitmap sectors */
  205. struct buffer_head **vol_amap; /* allocation bitmap */
  206. unsigned short *vol_utbl; /* upcase table */
  207. unsigned int clu_srch_ptr; /* cluster search pointer */
  208. unsigned int used_clusters; /* number of used clusters */
  209. struct mutex s_lock; /* superblock lock */
  210. struct exfat_mount_options options;
  211. struct nls_table *nls_io; /* Charset used for input and display */
  212. struct ratelimit_state ratelimit;
  213. spinlock_t inode_hash_lock;
  214. struct hlist_head inode_hashtable[EXFAT_HASH_SIZE];
  215. struct rcu_head rcu;
  216. };
  217. #define EXFAT_CACHE_VALID 0
  218. /*
  219. * EXFAT file system inode in-memory data
  220. */
  221. struct exfat_inode_info {
  222. struct exfat_chain dir;
  223. int entry;
  224. unsigned int type;
  225. unsigned short attr;
  226. unsigned int start_clu;
  227. unsigned char flags;
  228. /*
  229. * the copy of low 32bit of i_version to check
  230. * the validation of hint_stat.
  231. */
  232. unsigned int version;
  233. /* hint for cluster last accessed */
  234. struct exfat_hint hint_bmap;
  235. /* hint for entry index we try to lookup next time */
  236. struct exfat_hint hint_stat;
  237. /* hint for first empty entry */
  238. struct exfat_hint_femp hint_femp;
  239. spinlock_t cache_lru_lock;
  240. struct list_head cache_lru;
  241. int nr_caches;
  242. /* for avoiding the race between alloc and free */
  243. unsigned int cache_valid_id;
  244. /*
  245. * NOTE: i_size_ondisk is 64bits, so must hold ->inode_lock to access.
  246. * physically allocated size.
  247. */
  248. loff_t i_size_ondisk;
  249. /* block-aligned i_size (used in cont_write_begin) */
  250. loff_t i_size_aligned;
  251. /* on-disk position of directory entry or 0 */
  252. loff_t i_pos;
  253. /* hash by i_location */
  254. struct hlist_node i_hash_fat;
  255. /* protect bmap against truncate */
  256. struct rw_semaphore truncate_lock;
  257. struct inode vfs_inode;
  258. /* File creation time */
  259. struct timespec64 i_crtime;
  260. };
  261. static inline struct exfat_sb_info *EXFAT_SB(struct super_block *sb)
  262. {
  263. return sb->s_fs_info;
  264. }
  265. static inline struct exfat_inode_info *EXFAT_I(struct inode *inode)
  266. {
  267. return container_of(inode, struct exfat_inode_info, vfs_inode);
  268. }
  269. /*
  270. * If ->i_mode can't hold 0222 (i.e. ATTR_RO), we use ->i_attrs to
  271. * save ATTR_RO instead of ->i_mode.
  272. *
  273. * If it's directory and !sbi->options.rodir, ATTR_RO isn't read-only
  274. * bit, it's just used as flag for app.
  275. */
  276. static inline int exfat_mode_can_hold_ro(struct inode *inode)
  277. {
  278. struct exfat_sb_info *sbi = EXFAT_SB(inode->i_sb);
  279. if (S_ISDIR(inode->i_mode))
  280. return 0;
  281. if ((~sbi->options.fs_fmask) & 0222)
  282. return 1;
  283. return 0;
  284. }
  285. /* Convert attribute bits and a mask to the UNIX mode. */
  286. static inline mode_t exfat_make_mode(struct exfat_sb_info *sbi,
  287. unsigned short attr, mode_t mode)
  288. {
  289. if ((attr & ATTR_READONLY) && !(attr & ATTR_SUBDIR))
  290. mode &= ~0222;
  291. if (attr & ATTR_SUBDIR)
  292. return (mode & ~sbi->options.fs_dmask) | S_IFDIR;
  293. return (mode & ~sbi->options.fs_fmask) | S_IFREG;
  294. }
  295. /* Return the FAT attribute byte for this inode */
  296. static inline unsigned short exfat_make_attr(struct inode *inode)
  297. {
  298. unsigned short attr = EXFAT_I(inode)->attr;
  299. if (S_ISDIR(inode->i_mode))
  300. attr |= ATTR_SUBDIR;
  301. if (exfat_mode_can_hold_ro(inode) && !(inode->i_mode & 0222))
  302. attr |= ATTR_READONLY;
  303. return attr;
  304. }
  305. static inline void exfat_save_attr(struct inode *inode, unsigned short attr)
  306. {
  307. if (exfat_mode_can_hold_ro(inode))
  308. EXFAT_I(inode)->attr = attr & (ATTR_RWMASK | ATTR_READONLY);
  309. else
  310. EXFAT_I(inode)->attr = attr & ATTR_RWMASK;
  311. }
  312. static inline bool exfat_is_last_sector_in_cluster(struct exfat_sb_info *sbi,
  313. sector_t sec)
  314. {
  315. return ((sec - sbi->data_start_sector + 1) &
  316. ((1 << sbi->sect_per_clus_bits) - 1)) == 0;
  317. }
  318. static inline sector_t exfat_cluster_to_sector(struct exfat_sb_info *sbi,
  319. unsigned int clus)
  320. {
  321. return ((sector_t)(clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) +
  322. sbi->data_start_sector;
  323. }
  324. static inline int exfat_sector_to_cluster(struct exfat_sb_info *sbi,
  325. sector_t sec)
  326. {
  327. return ((sec - sbi->data_start_sector) >> sbi->sect_per_clus_bits) +
  328. EXFAT_RESERVED_CLUSTERS;
  329. }
  330. /* super.c */
  331. int exfat_set_volume_dirty(struct super_block *sb);
  332. int exfat_clear_volume_dirty(struct super_block *sb);
  333. /* fatent.c */
  334. #define exfat_get_next_cluster(sb, pclu) exfat_ent_get(sb, *(pclu), pclu)
  335. int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc,
  336. struct exfat_chain *p_chain);
  337. int exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain);
  338. int exfat_ent_get(struct super_block *sb, unsigned int loc,
  339. unsigned int *content);
  340. int exfat_ent_set(struct super_block *sb, unsigned int loc,
  341. unsigned int content);
  342. int exfat_count_ext_entries(struct super_block *sb, struct exfat_chain *p_dir,
  343. int entry, struct exfat_dentry *p_entry);
  344. int exfat_chain_cont_cluster(struct super_block *sb, unsigned int chain,
  345. unsigned int len);
  346. int exfat_zeroed_cluster(struct inode *dir, unsigned int clu);
  347. int exfat_find_last_cluster(struct super_block *sb, struct exfat_chain *p_chain,
  348. unsigned int *ret_clu);
  349. int exfat_count_num_clusters(struct super_block *sb,
  350. struct exfat_chain *p_chain, unsigned int *ret_count);
  351. /* balloc.c */
  352. int exfat_load_bitmap(struct super_block *sb);
  353. void exfat_free_bitmap(struct exfat_sb_info *sbi);
  354. int exfat_set_bitmap(struct inode *inode, unsigned int clu);
  355. void exfat_clear_bitmap(struct inode *inode, unsigned int clu);
  356. unsigned int exfat_find_free_bitmap(struct super_block *sb, unsigned int clu);
  357. int exfat_count_used_clusters(struct super_block *sb, unsigned int *ret_count);
  358. /* file.c */
  359. extern const struct file_operations exfat_file_operations;
  360. int __exfat_truncate(struct inode *inode, loff_t new_size);
  361. void exfat_truncate(struct inode *inode, loff_t size);
  362. int exfat_setattr(struct dentry *dentry, struct iattr *attr);
  363. int exfat_getattr(const struct path *path, struct kstat *stat,
  364. unsigned int request_mask, unsigned int query_flags);
  365. int exfat_file_fsync(struct file *file, loff_t start, loff_t end, int datasync);
  366. /* namei.c */
  367. extern const struct dentry_operations exfat_dentry_ops;
  368. extern const struct dentry_operations exfat_utf8_dentry_ops;
  369. /* cache.c */
  370. int exfat_cache_init(void);
  371. void exfat_cache_shutdown(void);
  372. void exfat_cache_inval_inode(struct inode *inode);
  373. int exfat_get_cluster(struct inode *inode, unsigned int cluster,
  374. unsigned int *fclus, unsigned int *dclus,
  375. unsigned int *last_dclus, int allow_eof);
  376. /* dir.c */
  377. extern const struct inode_operations exfat_dir_inode_operations;
  378. extern const struct file_operations exfat_dir_operations;
  379. unsigned int exfat_get_entry_type(struct exfat_dentry *p_entry);
  380. int exfat_init_dir_entry(struct inode *inode, struct exfat_chain *p_dir,
  381. int entry, unsigned int type, unsigned int start_clu,
  382. unsigned long long size);
  383. int exfat_init_ext_entry(struct inode *inode, struct exfat_chain *p_dir,
  384. int entry, int num_entries, struct exfat_uni_name *p_uniname);
  385. int exfat_remove_entries(struct inode *inode, struct exfat_chain *p_dir,
  386. int entry, int order, int num_entries);
  387. int exfat_update_dir_chksum(struct inode *inode, struct exfat_chain *p_dir,
  388. int entry);
  389. void exfat_update_dir_chksum_with_entry_set(struct exfat_entry_set_cache *es);
  390. int exfat_calc_num_entries(struct exfat_uni_name *p_uniname);
  391. int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei,
  392. struct exfat_chain *p_dir, struct exfat_uni_name *p_uniname,
  393. int num_entries, unsigned int type);
  394. int exfat_alloc_new_dir(struct inode *inode, struct exfat_chain *clu);
  395. int exfat_find_location(struct super_block *sb, struct exfat_chain *p_dir,
  396. int entry, sector_t *sector, int *offset);
  397. struct exfat_dentry *exfat_get_dentry(struct super_block *sb,
  398. struct exfat_chain *p_dir, int entry, struct buffer_head **bh,
  399. sector_t *sector);
  400. struct exfat_dentry *exfat_get_dentry_cached(struct exfat_entry_set_cache *es,
  401. int num);
  402. struct exfat_entry_set_cache *exfat_get_dentry_set(struct super_block *sb,
  403. struct exfat_chain *p_dir, int entry, unsigned int type);
  404. int exfat_free_dentry_set(struct exfat_entry_set_cache *es, int sync);
  405. int exfat_count_dir_entries(struct super_block *sb, struct exfat_chain *p_dir);
  406. /* inode.c */
  407. extern const struct inode_operations exfat_file_inode_operations;
  408. void exfat_sync_inode(struct inode *inode);
  409. struct inode *exfat_build_inode(struct super_block *sb,
  410. struct exfat_dir_entry *info, loff_t i_pos);
  411. void exfat_hash_inode(struct inode *inode, loff_t i_pos);
  412. void exfat_unhash_inode(struct inode *inode);
  413. struct inode *exfat_iget(struct super_block *sb, loff_t i_pos);
  414. int exfat_write_inode(struct inode *inode, struct writeback_control *wbc);
  415. void exfat_evict_inode(struct inode *inode);
  416. int exfat_block_truncate_page(struct inode *inode, loff_t from);
  417. /* exfat/nls.c */
  418. unsigned short exfat_toupper(struct super_block *sb, unsigned short a);
  419. int exfat_uniname_ncmp(struct super_block *sb, unsigned short *a,
  420. unsigned short *b, unsigned int len);
  421. int exfat_utf16_to_nls(struct super_block *sb,
  422. struct exfat_uni_name *uniname, unsigned char *p_cstring,
  423. int len);
  424. int exfat_nls_to_utf16(struct super_block *sb,
  425. const unsigned char *p_cstring, const int len,
  426. struct exfat_uni_name *uniname, int *p_lossy);
  427. int exfat_create_upcase_table(struct super_block *sb);
  428. void exfat_free_upcase_table(struct exfat_sb_info *sbi);
  429. /* exfat/misc.c */
  430. void __exfat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
  431. __printf(3, 4) __cold;
  432. #define exfat_fs_error(sb, fmt, args...) \
  433. __exfat_fs_error(sb, 1, fmt, ## args)
  434. #define exfat_fs_error_ratelimit(sb, fmt, args...) \
  435. __exfat_fs_error(sb, __ratelimit(&EXFAT_SB(sb)->ratelimit), \
  436. fmt, ## args)
  437. void exfat_msg(struct super_block *sb, const char *lv, const char *fmt, ...)
  438. __printf(3, 4) __cold;
  439. #define exfat_err(sb, fmt, ...) \
  440. exfat_msg(sb, KERN_ERR, fmt, ##__VA_ARGS__)
  441. #define exfat_warn(sb, fmt, ...) \
  442. exfat_msg(sb, KERN_WARNING, fmt, ##__VA_ARGS__)
  443. #define exfat_info(sb, fmt, ...) \
  444. exfat_msg(sb, KERN_INFO, fmt, ##__VA_ARGS__)
  445. void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
  446. u8 tz, __le16 time, __le16 date, u8 time_cs);
  447. void exfat_truncate_atime(struct timespec64 *ts);
  448. void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
  449. u8 *tz, __le16 *time, __le16 *date, u8 *time_cs);
  450. u16 exfat_calc_chksum16(void *data, int len, u16 chksum, int type);
  451. u32 exfat_calc_chksum32(void *data, int len, u32 chksum, int type);
  452. void exfat_update_bh(struct buffer_head *bh, int sync);
  453. int exfat_update_bhs(struct buffer_head **bhs, int nr_bhs, int sync);
  454. void exfat_chain_set(struct exfat_chain *ec, unsigned int dir,
  455. unsigned int size, unsigned char flags);
  456. void exfat_chain_dup(struct exfat_chain *dup, struct exfat_chain *ec);
  457. #endif /* !_EXFAT_FS_H */