.. | .. |
---|
142 | 142 | return sb->s_fs_info; |
---|
143 | 143 | } |
---|
144 | 144 | |
---|
| 145 | +/* |
---|
| 146 | + * Functions that determine the variant of the FAT file system (i.e., |
---|
| 147 | + * whether this is FAT12, FAT16 or FAT32. |
---|
| 148 | + */ |
---|
| 149 | +static inline bool is_fat12(const struct msdos_sb_info *sbi) |
---|
| 150 | +{ |
---|
| 151 | + return sbi->fat_bits == 12; |
---|
| 152 | +} |
---|
| 153 | + |
---|
| 154 | +static inline bool is_fat16(const struct msdos_sb_info *sbi) |
---|
| 155 | +{ |
---|
| 156 | + return sbi->fat_bits == 16; |
---|
| 157 | +} |
---|
| 158 | + |
---|
| 159 | +static inline bool is_fat32(const struct msdos_sb_info *sbi) |
---|
| 160 | +{ |
---|
| 161 | + return sbi->fat_bits == 32; |
---|
| 162 | +} |
---|
| 163 | + |
---|
| 164 | +/* Maximum number of clusters */ |
---|
| 165 | +static inline u32 max_fat(struct super_block *sb) |
---|
| 166 | +{ |
---|
| 167 | + struct msdos_sb_info *sbi = MSDOS_SB(sb); |
---|
| 168 | + |
---|
| 169 | + return is_fat32(sbi) ? MAX_FAT32 : |
---|
| 170 | + is_fat16(sbi) ? MAX_FAT16 : MAX_FAT12; |
---|
| 171 | +} |
---|
| 172 | + |
---|
145 | 173 | static inline struct msdos_inode_info *MSDOS_I(struct inode *inode) |
---|
146 | 174 | { |
---|
147 | 175 | return container_of(inode, struct msdos_inode_info, vfs_inode); |
---|
.. | .. |
---|
257 | 285 | const struct msdos_dir_entry *de) |
---|
258 | 286 | { |
---|
259 | 287 | int cluster = le16_to_cpu(de->start); |
---|
260 | | - if (sbi->fat_bits == 32) |
---|
| 288 | + if (is_fat32(sbi)) |
---|
261 | 289 | cluster |= (le16_to_cpu(de->starthi) << 16); |
---|
262 | 290 | return cluster; |
---|
263 | 291 | } |
---|
.. | .. |
---|
416 | 444 | __le16 __time, __le16 __date, u8 time_cs); |
---|
417 | 445 | extern void fat_time_unix2fat(struct msdos_sb_info *sbi, struct timespec64 *ts, |
---|
418 | 446 | __le16 *time, __le16 *date, u8 *time_cs); |
---|
| 447 | +extern int fat_truncate_time(struct inode *inode, struct timespec64 *now, |
---|
| 448 | + int flags); |
---|
| 449 | +extern int fat_update_time(struct inode *inode, struct timespec64 *now, |
---|
| 450 | + int flags); |
---|
419 | 451 | extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); |
---|
420 | 452 | |
---|
421 | 453 | int fat_cache_init(void); |
---|