Lines Matching +full:multi +full:- +full:cluster

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
52 (ES_IDX_FIRST_FILENAME + EXFAT_FILENAME_ENTRY_NUM(name_len) - 1)
78 #define MAX_CHARSET_SIZE 6 /* max size of multi-byte character */
82 #define EXFAT_HINT_NONE -1
86 * helpers for cluster size to byte conversion.
88 #define EXFAT_CLU_TO_B(b, sbi) ((b) << (sbi)->cluster_size_bits)
89 #define EXFAT_B_TO_CLU(b, sbi) ((b) >> (sbi)->cluster_size_bits)
91 (((b - 1) >> (sbi)->cluster_size_bits) + 1)
92 #define EXFAT_CLU_OFFSET(off, sbi) ((off) & ((sbi)->cluster_size - 1))
97 #define EXFAT_BLK_TO_B(b, sb) ((b) << (sb)->s_blocksize_bits)
98 #define EXFAT_B_TO_BLK(b, sb) ((b) >> (sb)->s_blocksize_bits)
100 (((b - 1) >> (sb)->s_blocksize_bits) + 1)
101 #define EXFAT_BLK_OFFSET(off, sb) ((off) & ((sb)->s_blocksize - 1))
110 * helpers for cluster size to dentry size conversion.
113 ((clu) << ((sbi)->cluster_size_bits - DENTRY_SIZE_BITS))
115 ((dentry) >> ((sbi)->cluster_size_bits - DENTRY_SIZE_BITS))
122 #define FAT_ENT_OFFSET_SECTOR(sb, loc) (EXFAT_SB(sb)->FAT1_start_sector + \
123 (((u64)loc << FAT_ENT_SIZE_BITS) >> sb->s_blocksize_bits))
125 ((loc << FAT_ENT_SIZE_BITS) & (sb->s_blocksize - 1))
130 #define CLUSTER_TO_BITMAP_ENT(clu) ((clu) - EXFAT_RESERVED_CLUSTERS)
132 #define BITS_PER_SECTOR(sb) ((sb)->s_blocksize * BITS_PER_BYTE)
133 #define BITS_PER_SECTOR_MASK(sb) (BITS_PER_SECTOR(sb) - 1)
135 ((ent / BITS_PER_BYTE) >> (sb)->s_blocksize_bits)
138 ((ent / BITS_PER_BYTE) & ((sb)->s_blocksize - 1))
139 #define IGNORED_BITS_REMAINED(clu, clu_base) ((1UL << ((clu) - (clu_base))) - 1)
181 /* the cluster that first empty slot exists in */
189 unsigned int off; /* cluster offset */
204 #define IS_DYNAMIC_ES(es) ((es)->__bh != (es)->bh)
207 /* the cluster where file dentry is located */
209 /* the index of file dentry in ->dir */
225 * exfat mount in-memory data
236 /* on error: continue, panic, remount-ro */
238 unsigned utf8:1, /* Use of UTF-8 character set */
243 /* Support creating zero-size directory, default: false */
248 * EXFAT file system superblock in-memory data
253 unsigned int cluster_size; /* cluster size in bytes */
255 unsigned int sect_per_clus; /* cluster size in sectors */
261 unsigned int root_dir; /* root dir cluster */
262 unsigned int dentries_per_clu; /* num of dentries per cluster */
267 unsigned int map_clu; /* allocation bitmap start cluster */
273 unsigned int clu_srch_ptr; /* cluster search pointer */
292 * EXFAT file system inode in-memory data
295 /* the cluster where file dentry is located */
297 /* the index of file dentry in ->dir */
309 /* hint for cluster last accessed */
322 /* on-disk position of directory entry or 0 */
336 return sb->s_fs_info; in EXFAT_SB()
346 return test_bit(EXFAT_FLAGS_SHUTDOWN, &EXFAT_SB(sb)->s_exfat_flags); in exfat_forced_shutdown()
350 * If ->i_mode can't hold 0222 (i.e. ATTR_RO), we use ->i_attrs to
351 * save ATTR_RO instead of ->i_mode.
353 * If it's directory and !sbi->options.rodir, ATTR_RO isn't read-only
358 struct exfat_sb_info *sbi = EXFAT_SB(inode->i_sb); in exfat_mode_can_hold_ro()
360 if (S_ISDIR(inode->i_mode)) in exfat_mode_can_hold_ro()
363 if ((~sbi->options.fs_fmask) & 0222) in exfat_mode_can_hold_ro()
376 return (mode & ~sbi->options.fs_dmask) | S_IFDIR; in exfat_make_mode()
378 return (mode & ~sbi->options.fs_fmask) | S_IFREG; in exfat_make_mode()
384 unsigned short attr = EXFAT_I(inode)->attr; in exfat_make_attr()
386 if (S_ISDIR(inode->i_mode)) in exfat_make_attr()
388 if (exfat_mode_can_hold_ro(inode) && !(inode->i_mode & 0222)) in exfat_make_attr()
396 EXFAT_I(inode)->attr = attr & (EXFAT_ATTR_RWMASK | EXFAT_ATTR_READONLY); in exfat_save_attr()
398 EXFAT_I(inode)->attr = attr & EXFAT_ATTR_RWMASK; in exfat_save_attr()
404 return ((sec - sbi->data_start_sector + 1) & in exfat_is_last_sector_in_cluster()
405 ((1 << sbi->sect_per_clus_bits) - 1)) == 0; in exfat_is_last_sector_in_cluster()
411 return ((sector_t)(clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) + in exfat_cluster_to_sector()
412 sbi->data_start_sector; in exfat_cluster_to_sector()
418 return ((sec - sbi->data_start_sector) >> sbi->sect_per_clus_bits) + in exfat_sector_to_cluster()
425 return clus >= EXFAT_FIRST_CLUSTER && clus < sbi->num_clusters; in is_valid_cluster()
430 return ((loff_t)inode->i_blocks) << 9; in exfat_ondisk_size()
487 int exfat_get_cluster(struct inode *inode, unsigned int cluster,
516 exfat_get_dentry_set(es, sb, &(ei)->dir, (ei)->entry, ES_ALL_ENTRIES)
555 __exfat_fs_error(sb, __ratelimit(&EXFAT_SB(sb)->ratelimit), \
560 pr_err("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
562 pr_warn("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
564 pr_info("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
566 pr_debug("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)