Lines Matching +full:cluster +full:- +full:mode

1 /* SPDX-License-Identifier: GPL-2.0 */
37 unsigned char errors; /* On error: continue, panic, remount-ro */
45 utf8:1, /* Use of UTF-8 character set (Default) */
61 * MS-DOS file system in-core superblock data
64 unsigned short sec_per_clus; /* sectors/cluster */
66 unsigned int cluster_size; /* cluster size */
73 unsigned long max_cluster; /* maximum cluster number */
74 unsigned long root_cluster; /* first cluster of the root directory */
79 unsigned int prev_free; /* previously allocated cluster number */
80 unsigned int free_clusters; /* -1 if undefined */
110 * MS-DOS file system inode data in memory
119 /* NOTE: mmu_private is 64bits, so must hold ->i_mutex to access */
122 int i_start; /* first cluster or 0 */
123 int i_logstart; /* logical first cluster */
125 loff_t i_pos; /* on-disk position of directory entry or 0 */
134 loff_t i_pos; /* on-disk position of directory entry */
143 return sb->s_fs_info; in MSDOS_SB()
152 return sbi->fat_bits == 12; in is_fat12()
157 return sbi->fat_bits == 16; in is_fat16()
162 return sbi->fat_bits == 32; in is_fat32()
180 * If ->i_mode can't hold S_IWUGO (i.e. ATTR_RO), we use ->i_attrs to
181 * save ATTR_RO instead of ->i_mode.
183 * If it's directory and !sbi->options.rodir, ATTR_RO isn't read-only
188 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_mode_can_hold_ro()
191 if (S_ISDIR(inode->i_mode)) { in fat_mode_can_hold_ro()
192 if (!sbi->options.rodir) in fat_mode_can_hold_ro()
194 mask = ~sbi->options.fs_dmask; in fat_mode_can_hold_ro()
196 mask = ~sbi->options.fs_fmask; in fat_mode_can_hold_ro()
203 /* Convert attribute bits and a mask to the UNIX mode. */
205 u8 attrs, umode_t mode) in fat_make_mode() argument
207 if (attrs & ATTR_RO && !((attrs & ATTR_DIR) && !sbi->options.rodir)) in fat_make_mode()
208 mode &= ~S_IWUGO; in fat_make_mode()
211 return (mode & ~sbi->options.fs_dmask) | S_IFDIR; in fat_make_mode()
213 return (mode & ~sbi->options.fs_fmask) | S_IFREG; in fat_make_mode()
219 u8 attrs = MSDOS_I(inode)->i_attrs; in fat_make_attrs()
220 if (S_ISDIR(inode->i_mode)) in fat_make_attrs()
222 if (fat_mode_can_hold_ro(inode) && !(inode->i_mode & S_IWUGO)) in fat_make_attrs()
230 MSDOS_I(inode)->i_attrs = attrs & ATTR_UNUSED; in fat_save_attrs()
232 MSDOS_I(inode)->i_attrs = attrs & (ATTR_UNUSED | ATTR_RO); in fat_save_attrs()
248 return ((sector_t)clus - FAT_START_ENT) * sbi->sec_per_clus in fat_clus_to_blknr()
249 + sbi->data_start; in fat_clus_to_blknr()
255 *blknr = i_pos >> sbi->dir_per_block_bits; in fat_get_blknr_offset()
256 *offset = i_pos & (sbi->dir_per_block - 1); in fat_get_blknr_offset()
264 spin_lock(&sbi->inode_hash_lock); in fat_i_pos_read()
266 i_pos = MSDOS_I(inode)->i_pos; in fat_i_pos_read()
268 spin_unlock(&sbi->inode_hash_lock); in fat_i_pos_read()
276 while (len--) { in fat16_towchar()
288 int cluster = le16_to_cpu(de->start); in fat_get_start() local
290 cluster |= (le16_to_cpu(de->starthi) << 16); in fat_get_start()
291 return cluster; in fat_get_start()
294 static inline void fat_set_start(struct msdos_dir_entry *de, int cluster) in fat_set_start() argument
296 de->start = cpu_to_le16(cluster); in fat_set_start()
297 de->starthi = cpu_to_le16(cluster >> 16); in fat_set_start()
303 while (len--) { in fatwchar_to16()
316 extern int fat_get_cluster(struct inode *inode, int cluster,
356 fatent->nr_bhs = 0; in fatent_init()
357 fatent->entry = 0; in fatent_init()
358 fatent->u.ent32_p = NULL; in fatent_init()
359 fatent->bhs[0] = fatent->bhs[1] = NULL; in fatent_init()
360 fatent->fat_inode = NULL; in fatent_init()
365 fatent->entry = entry; in fatent_set_entry()
366 fatent->u.ent32_p = NULL; in fatent_set_entry()
372 fatent->u.ent32_p = NULL; in fatent_brelse()
373 for (i = 0; i < fatent->nr_bhs; i++) in fatent_brelse()
374 brelse(fatent->bhs[i]); in fatent_brelse()
375 fatent->nr_bhs = 0; in fatent_brelse()
376 fatent->bhs[0] = fatent->bhs[1] = NULL; in fatent_brelse()
377 fatent->fat_inode = NULL; in fatent_brelse()
382 return FAT_START_ENT <= entry && entry < sbi->max_cluster; in fat_valid_entry()
390 extern int fat_alloc_clusters(struct inode *inode, int *cluster,
392 extern int fat_free_clusters(struct inode *inode, int cluster);
436 __fat_fs_error(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), fmt , ## args)
438 #define FAT_PRINTK_PREFIX "%sFAT-fs (%s): "
448 if (__ratelimit(&MSDOS_SB(sb)->ratelimit)) \