Lines Matching +full:cluster +full:- +full:mode
1 /* SPDX-License-Identifier: GPL-2.0 */
39 unsigned char errors; /* On error: continue, panic, remount-ro */
47 utf8:1, /* Use of UTF-8 character set (Default) */
64 * MS-DOS file system in-core superblock data
67 unsigned short sec_per_clus; /* sectors/cluster */
69 unsigned int cluster_size; /* cluster size */
76 unsigned long max_cluster; /* maximum cluster number */
77 unsigned long root_cluster; /* first cluster of the root directory */
82 unsigned int prev_free; /* previously allocated cluster number */
83 unsigned int free_clusters; /* -1 if undefined */
113 * MS-DOS file system inode data in memory
122 /* NOTE: mmu_private is 64bits, so must hold ->i_mutex to access */
125 int i_start; /* first cluster or 0 */
126 int i_logstart; /* logical first cluster */
128 loff_t i_pos; /* on-disk position of directory entry or 0 */
137 loff_t i_pos; /* on-disk position of directory entry */
146 return sb->s_fs_info; in MSDOS_SB()
155 return sbi->fat_bits == 12; in is_fat12()
160 return sbi->fat_bits == 16; in is_fat16()
165 return sbi->fat_bits == 32; in is_fat32()
183 * If ->i_mode can't hold S_IWUGO (i.e. ATTR_RO), we use ->i_attrs to
184 * save ATTR_RO instead of ->i_mode.
186 * If it's directory and !sbi->options.rodir, ATTR_RO isn't read-only
191 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_mode_can_hold_ro()
194 if (S_ISDIR(inode->i_mode)) { in fat_mode_can_hold_ro()
195 if (!sbi->options.rodir) in fat_mode_can_hold_ro()
197 mask = ~sbi->options.fs_dmask; in fat_mode_can_hold_ro()
199 mask = ~sbi->options.fs_fmask; in fat_mode_can_hold_ro()
206 /* Convert attribute bits and a mask to the UNIX mode. */
208 u8 attrs, umode_t mode) in fat_make_mode() argument
210 if (attrs & ATTR_RO && !((attrs & ATTR_DIR) && !sbi->options.rodir)) in fat_make_mode()
211 mode &= ~S_IWUGO; in fat_make_mode()
214 return (mode & ~sbi->options.fs_dmask) | S_IFDIR; in fat_make_mode()
216 return (mode & ~sbi->options.fs_fmask) | S_IFREG; in fat_make_mode()
222 u8 attrs = MSDOS_I(inode)->i_attrs; in fat_make_attrs()
223 if (S_ISDIR(inode->i_mode)) in fat_make_attrs()
225 if (fat_mode_can_hold_ro(inode) && !(inode->i_mode & S_IWUGO)) in fat_make_attrs()
233 MSDOS_I(inode)->i_attrs = attrs & ATTR_UNUSED; in fat_save_attrs()
235 MSDOS_I(inode)->i_attrs = attrs & (ATTR_UNUSED | ATTR_RO); in fat_save_attrs()
251 return ((sector_t)clus - FAT_START_ENT) * sbi->sec_per_clus in fat_clus_to_blknr()
252 + sbi->data_start; in fat_clus_to_blknr()
258 *blknr = i_pos >> sbi->dir_per_block_bits; in fat_get_blknr_offset()
259 *offset = i_pos & (sbi->dir_per_block - 1); in fat_get_blknr_offset()
267 spin_lock(&sbi->inode_hash_lock); in fat_i_pos_read()
269 i_pos = MSDOS_I(inode)->i_pos; in fat_i_pos_read()
271 spin_unlock(&sbi->inode_hash_lock); in fat_i_pos_read()
279 while (len--) { in fat16_towchar()
291 int cluster = le16_to_cpu(de->start); in fat_get_start() local
293 cluster |= (le16_to_cpu(de->starthi) << 16); in fat_get_start()
294 return cluster; in fat_get_start()
297 static inline void fat_set_start(struct msdos_dir_entry *de, int cluster) in fat_set_start() argument
299 de->start = cpu_to_le16(cluster); in fat_set_start()
300 de->starthi = cpu_to_le16(cluster >> 16); in fat_set_start()
306 while (len--) { in fatwchar_to16()
319 extern int fat_get_cluster(struct inode *inode, int cluster,
359 fatent->nr_bhs = 0; in fatent_init()
360 fatent->entry = 0; in fatent_init()
361 fatent->u.ent32_p = NULL; in fatent_init()
362 fatent->bhs[0] = fatent->bhs[1] = NULL; in fatent_init()
363 fatent->fat_inode = NULL; in fatent_init()
368 fatent->entry = entry; in fatent_set_entry()
369 fatent->u.ent32_p = NULL; in fatent_set_entry()
375 fatent->u.ent32_p = NULL; in fatent_brelse()
376 for (i = 0; i < fatent->nr_bhs; i++) in fatent_brelse()
377 brelse(fatent->bhs[i]); in fatent_brelse()
378 fatent->nr_bhs = 0; in fatent_brelse()
379 fatent->bhs[0] = fatent->bhs[1] = NULL; in fatent_brelse()
380 fatent->fat_inode = NULL; in fatent_brelse()
385 return FAT_START_ENT <= entry && entry < sbi->max_cluster; in fat_valid_entry()
393 extern int fat_alloc_clusters(struct inode *inode, int *cluster,
395 extern int fat_free_clusters(struct inode *inode, int cluster);
448 __fat_fs_error(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), fmt , ## args)
450 #define FAT_PRINTK_PREFIX "%sFAT-fs (%s): "
460 if (__ratelimit(&MSDOS_SB(sb)->ratelimit)) \