19e975daeSOGAWA Hirofumi #ifndef _FAT_H 29e975daeSOGAWA Hirofumi #define _FAT_H 39e975daeSOGAWA Hirofumi 49e975daeSOGAWA Hirofumi #include <linux/buffer_head.h> 59e975daeSOGAWA Hirofumi #include <linux/string.h> 69e975daeSOGAWA Hirofumi #include <linux/nls.h> 79e975daeSOGAWA Hirofumi #include <linux/fs.h> 89e975daeSOGAWA Hirofumi #include <linux/mutex.h> 9aaa04b48SOGAWA Hirofumi #include <linux/ratelimit.h> 109e975daeSOGAWA Hirofumi #include <linux/msdos_fs.h> 119e975daeSOGAWA Hirofumi 129e975daeSOGAWA Hirofumi /* 139e975daeSOGAWA Hirofumi * vfat shortname flags 149e975daeSOGAWA Hirofumi */ 159e975daeSOGAWA Hirofumi #define VFAT_SFN_DISPLAY_LOWER 0x0001 /* convert to lowercase for display */ 169e975daeSOGAWA Hirofumi #define VFAT_SFN_DISPLAY_WIN95 0x0002 /* emulate win95 rule for display */ 179e975daeSOGAWA Hirofumi #define VFAT_SFN_DISPLAY_WINNT 0x0004 /* emulate winnt rule for display */ 189e975daeSOGAWA Hirofumi #define VFAT_SFN_CREATE_WIN95 0x0100 /* emulate win95 rule for create */ 199e975daeSOGAWA Hirofumi #define VFAT_SFN_CREATE_WINNT 0x0200 /* emulate winnt rule for create */ 209e975daeSOGAWA Hirofumi 2185c78591SDenis Karpov #define FAT_ERRORS_CONT 1 /* ignore error and continue */ 2285c78591SDenis Karpov #define FAT_ERRORS_PANIC 2 /* panic on error */ 2385c78591SDenis Karpov #define FAT_ERRORS_RO 3 /* remount r/o on error */ 2485c78591SDenis Karpov 259e975daeSOGAWA Hirofumi struct fat_mount_options { 269e975daeSOGAWA Hirofumi uid_t fs_uid; 279e975daeSOGAWA Hirofumi gid_t fs_gid; 289e975daeSOGAWA Hirofumi unsigned short fs_fmask; 299e975daeSOGAWA Hirofumi unsigned short fs_dmask; 309e975daeSOGAWA Hirofumi unsigned short codepage; /* Codepage for shortname conversions */ 319e975daeSOGAWA Hirofumi char *iocharset; /* Charset used for filename input/display */ 329e975daeSOGAWA Hirofumi unsigned short shortname; /* flags for shortname display/create rule */ 339e975daeSOGAWA Hirofumi unsigned char name_check; /* r = relaxed, n = normal, s = strict */ 3485c78591SDenis Karpov unsigned char errors; /* On error: continue, panic, remount-ro */ 359e975daeSOGAWA Hirofumi unsigned short allow_utime;/* permission for setting the [am]time */ 369e975daeSOGAWA Hirofumi unsigned quiet:1, /* set = fake successful chmods and chowns */ 379e975daeSOGAWA Hirofumi showexec:1, /* set = only set x bit for com/exe/bat */ 389e975daeSOGAWA Hirofumi sys_immutable:1, /* set = system files are immutable */ 399e975daeSOGAWA Hirofumi dotsOK:1, /* set = hidden and system files are named '.filename' */ 409e975daeSOGAWA Hirofumi isvfat:1, /* 0=no vfat long filename support, 1=vfat support */ 419e975daeSOGAWA Hirofumi utf8:1, /* Use of UTF-8 character set (Default) */ 429e975daeSOGAWA Hirofumi unicode_xlate:1, /* create escape sequences for unhandled Unicode */ 439e975daeSOGAWA Hirofumi numtail:1, /* Does first alias have a numeric '~1' type tail? */ 449e975daeSOGAWA Hirofumi flush:1, /* write things quickly */ 459e975daeSOGAWA Hirofumi nocase:1, /* Does this need case conversion? 0=need case conversion*/ 469e975daeSOGAWA Hirofumi usefree:1, /* Use free_clusters for FAT32 */ 47dfc209c0SOGAWA Hirofumi tz_utc:1, /* Filesystem timestamps are in UTC */ 48681142f9SChristoph Hellwig rodir:1, /* allow ATTR_RO for directory */ 49681142f9SChristoph Hellwig discard:1; /* Issue discard requests on deletions */ 509e975daeSOGAWA Hirofumi }; 519e975daeSOGAWA Hirofumi 529e975daeSOGAWA Hirofumi #define FAT_HASH_BITS 8 539e975daeSOGAWA Hirofumi #define FAT_HASH_SIZE (1UL << FAT_HASH_BITS) 549e975daeSOGAWA Hirofumi 559e975daeSOGAWA Hirofumi /* 569e975daeSOGAWA Hirofumi * MS-DOS file system in-core superblock data 579e975daeSOGAWA Hirofumi */ 589e975daeSOGAWA Hirofumi struct msdos_sb_info { 599e975daeSOGAWA Hirofumi unsigned short sec_per_clus; /* sectors/cluster */ 609e975daeSOGAWA Hirofumi unsigned short cluster_bits; /* log2(cluster_size) */ 619e975daeSOGAWA Hirofumi unsigned int cluster_size; /* cluster size */ 629e975daeSOGAWA Hirofumi unsigned char fats,fat_bits; /* number of FATs, FAT bits (12 or 16) */ 639e975daeSOGAWA Hirofumi unsigned short fat_start; 649e975daeSOGAWA Hirofumi unsigned long fat_length; /* FAT start & length (sec.) */ 659e975daeSOGAWA Hirofumi unsigned long dir_start; 669e975daeSOGAWA Hirofumi unsigned short dir_entries; /* root dir start & entries */ 679e975daeSOGAWA Hirofumi unsigned long data_start; /* first data sector */ 689e975daeSOGAWA Hirofumi unsigned long max_cluster; /* maximum cluster number */ 699e975daeSOGAWA Hirofumi unsigned long root_cluster; /* first cluster of the root directory */ 709e975daeSOGAWA Hirofumi unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */ 719e975daeSOGAWA Hirofumi struct mutex fat_lock; 729e975daeSOGAWA Hirofumi unsigned int prev_free; /* previously allocated cluster number */ 739e975daeSOGAWA Hirofumi unsigned int free_clusters; /* -1 if undefined */ 749e975daeSOGAWA Hirofumi unsigned int free_clus_valid; /* is free_clusters valid? */ 759e975daeSOGAWA Hirofumi struct fat_mount_options options; 769e975daeSOGAWA Hirofumi struct nls_table *nls_disk; /* Codepage used on disk */ 779e975daeSOGAWA Hirofumi struct nls_table *nls_io; /* Charset used for input and display */ 789e975daeSOGAWA Hirofumi const void *dir_ops; /* Opaque; default directory operations */ 799e975daeSOGAWA Hirofumi int dir_per_block; /* dir entries per block */ 809e975daeSOGAWA Hirofumi int dir_per_block_bits; /* log2(dir_per_block) */ 819e975daeSOGAWA Hirofumi 829e975daeSOGAWA Hirofumi int fatent_shift; 839e975daeSOGAWA Hirofumi struct fatent_operations *fatent_ops; 84b522412aSAl Viro struct inode *fat_inode; 859e975daeSOGAWA Hirofumi 86aaa04b48SOGAWA Hirofumi struct ratelimit_state ratelimit; 87aaa04b48SOGAWA Hirofumi 889e975daeSOGAWA Hirofumi spinlock_t inode_hash_lock; 899e975daeSOGAWA Hirofumi struct hlist_head inode_hashtable[FAT_HASH_SIZE]; 909e975daeSOGAWA Hirofumi }; 919e975daeSOGAWA Hirofumi 929e975daeSOGAWA Hirofumi #define FAT_CACHE_VALID 0 /* special case for valid cache */ 939e975daeSOGAWA Hirofumi 949e975daeSOGAWA Hirofumi /* 959e975daeSOGAWA Hirofumi * MS-DOS file system inode data in memory 969e975daeSOGAWA Hirofumi */ 979e975daeSOGAWA Hirofumi struct msdos_inode_info { 989e975daeSOGAWA Hirofumi spinlock_t cache_lru_lock; 999e975daeSOGAWA Hirofumi struct list_head cache_lru; 1009e975daeSOGAWA Hirofumi int nr_caches; 1019e975daeSOGAWA Hirofumi /* for avoiding the race between fat_free() and fat_get_cluster() */ 1029e975daeSOGAWA Hirofumi unsigned int cache_valid_id; 1039e975daeSOGAWA Hirofumi 1042bdf67ebSOGAWA Hirofumi /* NOTE: mmu_private is 64bits, so must hold ->i_mutex to access */ 1052bdf67ebSOGAWA Hirofumi loff_t mmu_private; /* physically allocated size */ 1062bdf67ebSOGAWA Hirofumi 1079e975daeSOGAWA Hirofumi int i_start; /* first cluster or 0 */ 1089e975daeSOGAWA Hirofumi int i_logstart; /* logical first cluster */ 1099e975daeSOGAWA Hirofumi int i_attrs; /* unused attribute bits */ 1109e975daeSOGAWA Hirofumi loff_t i_pos; /* on-disk position of directory entry or 0 */ 1119e975daeSOGAWA Hirofumi struct hlist_node i_fat_hash; /* hash by i_location */ 1129e975daeSOGAWA Hirofumi struct inode vfs_inode; 1139e975daeSOGAWA Hirofumi }; 1149e975daeSOGAWA Hirofumi 1159e975daeSOGAWA Hirofumi struct fat_slot_info { 1169e975daeSOGAWA Hirofumi loff_t i_pos; /* on-disk position of directory entry */ 1179e975daeSOGAWA Hirofumi loff_t slot_off; /* offset for slot or de start */ 1189e975daeSOGAWA Hirofumi int nr_slots; /* number of slots + 1(de) in filename */ 1199e975daeSOGAWA Hirofumi struct msdos_dir_entry *de; 1209e975daeSOGAWA Hirofumi struct buffer_head *bh; 1219e975daeSOGAWA Hirofumi }; 1229e975daeSOGAWA Hirofumi 1239e975daeSOGAWA Hirofumi static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb) 1249e975daeSOGAWA Hirofumi { 1259e975daeSOGAWA Hirofumi return sb->s_fs_info; 1269e975daeSOGAWA Hirofumi } 1279e975daeSOGAWA Hirofumi 1289e975daeSOGAWA Hirofumi static inline struct msdos_inode_info *MSDOS_I(struct inode *inode) 1299e975daeSOGAWA Hirofumi { 1309e975daeSOGAWA Hirofumi return container_of(inode, struct msdos_inode_info, vfs_inode); 1319e975daeSOGAWA Hirofumi } 1329e975daeSOGAWA Hirofumi 1339183482fSOGAWA Hirofumi /* 1349183482fSOGAWA Hirofumi * If ->i_mode can't hold S_IWUGO (i.e. ATTR_RO), we use ->i_attrs to 1359183482fSOGAWA Hirofumi * save ATTR_RO instead of ->i_mode. 136dfc209c0SOGAWA Hirofumi * 137dfc209c0SOGAWA Hirofumi * If it's directory and !sbi->options.rodir, ATTR_RO isn't read-only 138dfc209c0SOGAWA Hirofumi * bit, it's just used as flag for app. 1399183482fSOGAWA Hirofumi */ 1409183482fSOGAWA Hirofumi static inline int fat_mode_can_hold_ro(struct inode *inode) 1419183482fSOGAWA Hirofumi { 1429183482fSOGAWA Hirofumi struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); 1439183482fSOGAWA Hirofumi mode_t mask; 1449183482fSOGAWA Hirofumi 145dfc209c0SOGAWA Hirofumi if (S_ISDIR(inode->i_mode)) { 146dfc209c0SOGAWA Hirofumi if (!sbi->options.rodir) 147dfc209c0SOGAWA Hirofumi return 0; 1489183482fSOGAWA Hirofumi mask = ~sbi->options.fs_dmask; 149dfc209c0SOGAWA Hirofumi } else 1509183482fSOGAWA Hirofumi mask = ~sbi->options.fs_fmask; 1519183482fSOGAWA Hirofumi 1529183482fSOGAWA Hirofumi if (!(mask & S_IWUGO)) 1539183482fSOGAWA Hirofumi return 0; 1549183482fSOGAWA Hirofumi return 1; 1559183482fSOGAWA Hirofumi } 1569183482fSOGAWA Hirofumi 1579c0aa1b8SOGAWA Hirofumi /* Convert attribute bits and a mask to the UNIX mode. */ 1589c0aa1b8SOGAWA Hirofumi static inline mode_t fat_make_mode(struct msdos_sb_info *sbi, 1599c0aa1b8SOGAWA Hirofumi u8 attrs, mode_t mode) 1609c0aa1b8SOGAWA Hirofumi { 161dfc209c0SOGAWA Hirofumi if (attrs & ATTR_RO && !((attrs & ATTR_DIR) && !sbi->options.rodir)) 1629c0aa1b8SOGAWA Hirofumi mode &= ~S_IWUGO; 1639c0aa1b8SOGAWA Hirofumi 1649c0aa1b8SOGAWA Hirofumi if (attrs & ATTR_DIR) 1659c0aa1b8SOGAWA Hirofumi return (mode & ~sbi->options.fs_dmask) | S_IFDIR; 1669c0aa1b8SOGAWA Hirofumi else 1679c0aa1b8SOGAWA Hirofumi return (mode & ~sbi->options.fs_fmask) | S_IFREG; 1689c0aa1b8SOGAWA Hirofumi } 1699c0aa1b8SOGAWA Hirofumi 1709e975daeSOGAWA Hirofumi /* Return the FAT attribute byte for this inode */ 1719c0aa1b8SOGAWA Hirofumi static inline u8 fat_make_attrs(struct inode *inode) 1729e975daeSOGAWA Hirofumi { 1739183482fSOGAWA Hirofumi u8 attrs = MSDOS_I(inode)->i_attrs; 1749183482fSOGAWA Hirofumi if (S_ISDIR(inode->i_mode)) 1759183482fSOGAWA Hirofumi attrs |= ATTR_DIR; 1769183482fSOGAWA Hirofumi if (fat_mode_can_hold_ro(inode) && !(inode->i_mode & S_IWUGO)) 1779183482fSOGAWA Hirofumi attrs |= ATTR_RO; 1789183482fSOGAWA Hirofumi return attrs; 1799e975daeSOGAWA Hirofumi } 1809e975daeSOGAWA Hirofumi 1819c0aa1b8SOGAWA Hirofumi static inline void fat_save_attrs(struct inode *inode, u8 attrs) 1829c0aa1b8SOGAWA Hirofumi { 1839183482fSOGAWA Hirofumi if (fat_mode_can_hold_ro(inode)) 1849c0aa1b8SOGAWA Hirofumi MSDOS_I(inode)->i_attrs = attrs & ATTR_UNUSED; 1859183482fSOGAWA Hirofumi else 1869183482fSOGAWA Hirofumi MSDOS_I(inode)->i_attrs = attrs & (ATTR_UNUSED | ATTR_RO); 1879c0aa1b8SOGAWA Hirofumi } 1889c0aa1b8SOGAWA Hirofumi 1899e975daeSOGAWA Hirofumi static inline unsigned char fat_checksum(const __u8 *name) 1909e975daeSOGAWA Hirofumi { 1919e975daeSOGAWA Hirofumi unsigned char s = name[0]; 1929e975daeSOGAWA Hirofumi s = (s<<7) + (s>>1) + name[1]; s = (s<<7) + (s>>1) + name[2]; 1939e975daeSOGAWA Hirofumi s = (s<<7) + (s>>1) + name[3]; s = (s<<7) + (s>>1) + name[4]; 1949e975daeSOGAWA Hirofumi s = (s<<7) + (s>>1) + name[5]; s = (s<<7) + (s>>1) + name[6]; 1959e975daeSOGAWA Hirofumi s = (s<<7) + (s>>1) + name[7]; s = (s<<7) + (s>>1) + name[8]; 1969e975daeSOGAWA Hirofumi s = (s<<7) + (s>>1) + name[9]; s = (s<<7) + (s>>1) + name[10]; 1979e975daeSOGAWA Hirofumi return s; 1989e975daeSOGAWA Hirofumi } 1999e975daeSOGAWA Hirofumi 2009e975daeSOGAWA Hirofumi static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus) 2019e975daeSOGAWA Hirofumi { 2029e975daeSOGAWA Hirofumi return ((sector_t)clus - FAT_START_ENT) * sbi->sec_per_clus 2039e975daeSOGAWA Hirofumi + sbi->data_start; 2049e975daeSOGAWA Hirofumi } 2059e975daeSOGAWA Hirofumi 2069e975daeSOGAWA Hirofumi static inline void fat16_towchar(wchar_t *dst, const __u8 *src, size_t len) 2079e975daeSOGAWA Hirofumi { 2089e975daeSOGAWA Hirofumi #ifdef __BIG_ENDIAN 2099e975daeSOGAWA Hirofumi while (len--) { 2109e975daeSOGAWA Hirofumi *dst++ = src[0] | (src[1] << 8); 2119e975daeSOGAWA Hirofumi src += 2; 2129e975daeSOGAWA Hirofumi } 2139e975daeSOGAWA Hirofumi #else 2149e975daeSOGAWA Hirofumi memcpy(dst, src, len * 2); 2159e975daeSOGAWA Hirofumi #endif 2169e975daeSOGAWA Hirofumi } 2179e975daeSOGAWA Hirofumi 2189e975daeSOGAWA Hirofumi static inline void fatwchar_to16(__u8 *dst, const wchar_t *src, size_t len) 2199e975daeSOGAWA Hirofumi { 2209e975daeSOGAWA Hirofumi #ifdef __BIG_ENDIAN 2219e975daeSOGAWA Hirofumi while (len--) { 2229e975daeSOGAWA Hirofumi dst[0] = *src & 0x00FF; 2239e975daeSOGAWA Hirofumi dst[1] = (*src & 0xFF00) >> 8; 2249e975daeSOGAWA Hirofumi dst += 2; 2259e975daeSOGAWA Hirofumi src++; 2269e975daeSOGAWA Hirofumi } 2279e975daeSOGAWA Hirofumi #else 2289e975daeSOGAWA Hirofumi memcpy(dst, src, len * 2); 2299e975daeSOGAWA Hirofumi #endif 2309e975daeSOGAWA Hirofumi } 2319e975daeSOGAWA Hirofumi 2329e975daeSOGAWA Hirofumi /* fat/cache.c */ 2339e975daeSOGAWA Hirofumi extern void fat_cache_inval_inode(struct inode *inode); 2349e975daeSOGAWA Hirofumi extern int fat_get_cluster(struct inode *inode, int cluster, 2359e975daeSOGAWA Hirofumi int *fclus, int *dclus); 2369e975daeSOGAWA Hirofumi extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys, 2372bdf67ebSOGAWA Hirofumi unsigned long *mapped_blocks, int create); 2389e975daeSOGAWA Hirofumi 2399e975daeSOGAWA Hirofumi /* fat/dir.c */ 2409e975daeSOGAWA Hirofumi extern const struct file_operations fat_dir_operations; 2419e975daeSOGAWA Hirofumi extern int fat_search_long(struct inode *inode, const unsigned char *name, 2429e975daeSOGAWA Hirofumi int name_len, struct fat_slot_info *sinfo); 2439e975daeSOGAWA Hirofumi extern int fat_dir_empty(struct inode *dir); 2449e975daeSOGAWA Hirofumi extern int fat_subdirs(struct inode *dir); 2459e975daeSOGAWA Hirofumi extern int fat_scan(struct inode *dir, const unsigned char *name, 2469e975daeSOGAWA Hirofumi struct fat_slot_info *sinfo); 2479e975daeSOGAWA Hirofumi extern int fat_get_dotdot_entry(struct inode *dir, struct buffer_head **bh, 2489e975daeSOGAWA Hirofumi struct msdos_dir_entry **de, loff_t *i_pos); 2499e975daeSOGAWA Hirofumi extern int fat_alloc_new_dir(struct inode *dir, struct timespec *ts); 2509e975daeSOGAWA Hirofumi extern int fat_add_entries(struct inode *dir, void *slots, int nr_slots, 2519e975daeSOGAWA Hirofumi struct fat_slot_info *sinfo); 2529e975daeSOGAWA Hirofumi extern int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo); 2539e975daeSOGAWA Hirofumi 2549e975daeSOGAWA Hirofumi /* fat/fatent.c */ 2559e975daeSOGAWA Hirofumi struct fat_entry { 2569e975daeSOGAWA Hirofumi int entry; 2579e975daeSOGAWA Hirofumi union { 2589e975daeSOGAWA Hirofumi u8 *ent12_p[2]; 2599e975daeSOGAWA Hirofumi __le16 *ent16_p; 2609e975daeSOGAWA Hirofumi __le32 *ent32_p; 2619e975daeSOGAWA Hirofumi } u; 2629e975daeSOGAWA Hirofumi int nr_bhs; 2639e975daeSOGAWA Hirofumi struct buffer_head *bhs[2]; 264b522412aSAl Viro struct inode *fat_inode; 2659e975daeSOGAWA Hirofumi }; 2669e975daeSOGAWA Hirofumi 2679e975daeSOGAWA Hirofumi static inline void fatent_init(struct fat_entry *fatent) 2689e975daeSOGAWA Hirofumi { 2699e975daeSOGAWA Hirofumi fatent->nr_bhs = 0; 2709e975daeSOGAWA Hirofumi fatent->entry = 0; 2719e975daeSOGAWA Hirofumi fatent->u.ent32_p = NULL; 2729e975daeSOGAWA Hirofumi fatent->bhs[0] = fatent->bhs[1] = NULL; 273b522412aSAl Viro fatent->fat_inode = NULL; 2749e975daeSOGAWA Hirofumi } 2759e975daeSOGAWA Hirofumi 2769e975daeSOGAWA Hirofumi static inline void fatent_set_entry(struct fat_entry *fatent, int entry) 2779e975daeSOGAWA Hirofumi { 2789e975daeSOGAWA Hirofumi fatent->entry = entry; 2799e975daeSOGAWA Hirofumi fatent->u.ent32_p = NULL; 2809e975daeSOGAWA Hirofumi } 2819e975daeSOGAWA Hirofumi 2829e975daeSOGAWA Hirofumi static inline void fatent_brelse(struct fat_entry *fatent) 2839e975daeSOGAWA Hirofumi { 2849e975daeSOGAWA Hirofumi int i; 2859e975daeSOGAWA Hirofumi fatent->u.ent32_p = NULL; 2869e975daeSOGAWA Hirofumi for (i = 0; i < fatent->nr_bhs; i++) 2879e975daeSOGAWA Hirofumi brelse(fatent->bhs[i]); 2889e975daeSOGAWA Hirofumi fatent->nr_bhs = 0; 2899e975daeSOGAWA Hirofumi fatent->bhs[0] = fatent->bhs[1] = NULL; 290b522412aSAl Viro fatent->fat_inode = NULL; 2919e975daeSOGAWA Hirofumi } 2929e975daeSOGAWA Hirofumi 2939e975daeSOGAWA Hirofumi extern void fat_ent_access_init(struct super_block *sb); 2949e975daeSOGAWA Hirofumi extern int fat_ent_read(struct inode *inode, struct fat_entry *fatent, 2959e975daeSOGAWA Hirofumi int entry); 2969e975daeSOGAWA Hirofumi extern int fat_ent_write(struct inode *inode, struct fat_entry *fatent, 2979e975daeSOGAWA Hirofumi int new, int wait); 2989e975daeSOGAWA Hirofumi extern int fat_alloc_clusters(struct inode *inode, int *cluster, 2999e975daeSOGAWA Hirofumi int nr_cluster); 3009e975daeSOGAWA Hirofumi extern int fat_free_clusters(struct inode *inode, int cluster); 3019e975daeSOGAWA Hirofumi extern int fat_count_free_clusters(struct super_block *sb); 3029e975daeSOGAWA Hirofumi 3039e975daeSOGAWA Hirofumi /* fat/file.c */ 3047845bc3eSArnd Bergmann extern long fat_generic_ioctl(struct file *filp, unsigned int cmd, 3057845bc3eSArnd Bergmann unsigned long arg); 3069e975daeSOGAWA Hirofumi extern const struct file_operations fat_file_operations; 3079e975daeSOGAWA Hirofumi extern const struct inode_operations fat_file_inode_operations; 3089e975daeSOGAWA Hirofumi extern int fat_setattr(struct dentry * dentry, struct iattr * attr); 309459f6ed3Snpiggin@suse.de extern void fat_truncate_blocks(struct inode *inode, loff_t offset); 3109e975daeSOGAWA Hirofumi extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, 3119e975daeSOGAWA Hirofumi struct kstat *stat); 3127ea80859SChristoph Hellwig extern int fat_file_fsync(struct file *file, int datasync); 3139e975daeSOGAWA Hirofumi 3149e975daeSOGAWA Hirofumi /* fat/inode.c */ 3159e975daeSOGAWA Hirofumi extern void fat_attach(struct inode *inode, loff_t i_pos); 3169e975daeSOGAWA Hirofumi extern void fat_detach(struct inode *inode); 3179e975daeSOGAWA Hirofumi extern struct inode *fat_iget(struct super_block *sb, loff_t i_pos); 3189e975daeSOGAWA Hirofumi extern struct inode *fat_build_inode(struct super_block *sb, 3199e975daeSOGAWA Hirofumi struct msdos_dir_entry *de, loff_t i_pos); 3209e975daeSOGAWA Hirofumi extern int fat_sync_inode(struct inode *inode); 3219e975daeSOGAWA Hirofumi extern int fat_fill_super(struct super_block *sb, void *data, int silent, 322*3d23985dSAl Viro const struct inode_operations *fs_dir_inode_ops, 323*3d23985dSAl Viro int isvfat, void (*setup)(struct super_block *)); 3249e975daeSOGAWA Hirofumi 3259e975daeSOGAWA Hirofumi extern int fat_flush_inodes(struct super_block *sb, struct inode *i1, 3269e975daeSOGAWA Hirofumi struct inode *i2); 3279e975daeSOGAWA Hirofumi /* fat/misc.c */ 328aaa04b48SOGAWA Hirofumi extern void 329aaa04b48SOGAWA Hirofumi __fat_fs_error(struct super_block *s, int report, const char *fmt, ...) 330aaa04b48SOGAWA Hirofumi __attribute__ ((format (printf, 3, 4))) __cold; 331aaa04b48SOGAWA Hirofumi #define fat_fs_error(s, fmt, args...) \ 332aaa04b48SOGAWA Hirofumi __fat_fs_error(s, 1, fmt , ## args) 333aaa04b48SOGAWA Hirofumi #define fat_fs_error_ratelimit(s, fmt, args...) \ 334aaa04b48SOGAWA Hirofumi __fat_fs_error(s, __ratelimit(&MSDOS_SB(s)->ratelimit), fmt , ## args) 335ed248b29SOGAWA Hirofumi extern int fat_clusters_flush(struct super_block *sb); 3369e975daeSOGAWA Hirofumi extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster); 3377decd1cbSOGAWA Hirofumi extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts, 3387decd1cbSOGAWA Hirofumi __le16 __time, __le16 __date, u8 time_cs); 3397decd1cbSOGAWA Hirofumi extern void fat_time_unix2fat(struct msdos_sb_info *sbi, struct timespec *ts, 3407decd1cbSOGAWA Hirofumi __le16 *time, __le16 *date, u8 *time_cs); 3419e975daeSOGAWA Hirofumi extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); 3429e975daeSOGAWA Hirofumi 3439e975daeSOGAWA Hirofumi int fat_cache_init(void); 3449e975daeSOGAWA Hirofumi void fat_cache_destroy(void); 3459e975daeSOGAWA Hirofumi 346c3302931SOGAWA Hirofumi /* helper for printk */ 347c3302931SOGAWA Hirofumi typedef unsigned long long llu; 348c3302931SOGAWA Hirofumi 3499e975daeSOGAWA Hirofumi #endif /* !_FAT_H */ 350