import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / fat / fat.h
index e9cc3f0d58e28e54ec820d5116b0d5b154299b12..8180ecef59fc9856bfc6f349e9b03a4b286ca2b1 100644 (file)
@@ -23,6 +23,9 @@
 #define FAT_ERRORS_PANIC       2      /* panic on error */
 #define FAT_ERRORS_RO          3      /* remount r/o on error */
 
+#define FAT_NFS_STALE_RW       1      /* NFS RW support, can cause ESTALE */
+#define FAT_NFS_NOSTALE_RO     2      /* NFS RO support, no ESTALE issue */
+
 struct fat_mount_options {
        kuid_t fs_uid;
        kgid_t fs_gid;
@@ -34,6 +37,7 @@ struct fat_mount_options {
        unsigned short shortname;  /* flags for shortname display/create rule */
        unsigned char name_check;  /* r = relaxed, n = normal, s = strict */
        unsigned char errors;      /* On error: continue, panic, remount-ro */
+       unsigned char nfs;        /* NFS support: nostale_ro, stale_rw */
        unsigned short allow_utime;/* permission for setting the [am]time */
        unsigned quiet:1,          /* set = fake successful chmods and chowns */
                 showexec:1,       /* set = only set x bit for com/exe/bat */
@@ -48,8 +52,7 @@ struct fat_mount_options {
                 usefree:1,        /* Use free_clusters for FAT32 */
                 tz_set:1,         /* Filesystem timestamps' offset set */
                 rodir:1,          /* allow ATTR_RO for directory */
-                discard:1,        /* Issue discard requests on deletions */
-                nfs:1;            /* Do extra work needed for NFS export */
+                discard:1;        /* Issue discard requests on deletions */
 };
 
 #define FAT_HASH_BITS  8
@@ -72,6 +75,7 @@ struct msdos_sb_info {
        unsigned long root_cluster;   /* first cluster of the root directory */
        unsigned long fsinfo_sector;  /* sector number of FAT32 fsinfo */
        struct mutex fat_lock;
+       struct mutex nfs_build_inode_lock;
        struct mutex s_lock;
        unsigned int prev_free;      /* previously allocated cluster number */
        unsigned int free_clusters;  /* -1 if undefined */
@@ -82,6 +86,7 @@ struct msdos_sb_info {
        const void *dir_ops;          /* Opaque; default directory operations */
        int dir_per_block;            /* dir entries per block */
        int dir_per_block_bits;       /* log2(dir_per_block) */
+       unsigned long vol_id;         /* volume ID */
 
        int fatent_shift;
        struct fatent_operations *fatent_ops;
@@ -215,6 +220,27 @@ static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus)
                + sbi->data_start;
 }
 
+static inline void fat_get_blknr_offset(struct msdos_sb_info *sbi,
+                               loff_t i_pos, sector_t *blknr, int *offset)
+{
+       *blknr = i_pos >> sbi->dir_per_block_bits;
+       *offset = i_pos & (sbi->dir_per_block - 1);
+}
+
+static inline loff_t fat_i_pos_read(struct msdos_sb_info *sbi,
+                                       struct inode *inode)
+{
+       loff_t i_pos;
+#if BITS_PER_LONG == 32
+       spin_lock(&sbi->inode_hash_lock);
+#endif
+       i_pos = MSDOS_I(inode)->i_pos;
+#if BITS_PER_LONG == 32
+       spin_unlock(&sbi->inode_hash_lock);
+#endif
+       return i_pos;
+}
+
 static inline void fat16_towchar(wchar_t *dst, const __u8 *src, size_t len)
 {
 #ifdef __BIG_ENDIAN
@@ -271,6 +297,8 @@ extern int fat_dir_empty(struct inode *dir);
 extern int fat_subdirs(struct inode *dir);
 extern int fat_scan(struct inode *dir, const unsigned char *name,
                    struct fat_slot_info *sinfo);
+extern int fat_scan_logstart(struct inode *dir, int i_logstart,
+                            struct fat_slot_info *sinfo);
 extern int fat_get_dotdot_entry(struct inode *dir, struct buffer_head **bh,
                                struct msdos_dir_entry **de);
 extern int fat_alloc_new_dir(struct inode *dir, struct timespec *ts);
@@ -348,6 +376,7 @@ extern struct inode *fat_build_inode(struct super_block *sb,
 extern int fat_sync_inode(struct inode *inode);
 extern int fat_fill_super(struct super_block *sb, void *data, int silent,
                          int isvfat, void (*setup)(struct super_block *));
+extern int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de);
 
 extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
                            struct inode *i2);
@@ -382,12 +411,8 @@ int fat_cache_init(void);
 void fat_cache_destroy(void);
 
 /* fat/nfs.c */
-struct fid;
-extern struct dentry *fat_fh_to_dentry(struct super_block *sb, struct fid *fid,
-                                      int fh_len, int fh_type);
-extern struct dentry *fat_fh_to_parent(struct super_block *sb, struct fid *fid,
-                                      int fh_len, int fh_type);
-extern struct dentry *fat_get_parent(struct dentry *child_dir);
+extern const struct export_operations fat_export_ops;
+extern const struct export_operations fat_export_ops_nostale;
 
 /* helper for printk */
 typedef unsigned long long     llu;