Skip to contentSkip to conversation

fat: restructure export operations

PATCH New Namjae Jeon 1 participant 1 message Oct 27, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/6 fat: restructure export operations

From: Namjae Jeon <[email protected]>

Define two nfs export_operation structures,one for 'stale_rw' mounts and the other for 'nostale_ro'.The former uses the generic export_encode_fh function to encode file handle, while the latter uses fat_encode_fh.

Since inode number is not needed for nostale_ro, remove it from struct fat_fid and repack other needed info viz. i_pos and i_generation.

---
 fs/fat/fat.h   |    2 +
 fs/fat/inode.c |   12 ++----
 fs/fat/nfs.c   |  127 +++++++++++++++++++++++++++++++++++++++++++-------------
 3 files changed, 104 insertions(+), 37 deletions(-)
fs/fat/fat.h +2 -0
index febc1cca..65f9149 100644
@@ -391,6 +391,8 @@ void fat_cache_destroy(void);
 
 /* fat/nfs.c */
 struct fid;
+extern const struct export_operations fat_export_ops;
+extern const struct export_operations fat_export_ops_nostale;
 extern int fat_encode_fh(struct inode *inode, __u32 *fh, int *lenp,
 			 struct inode *parent);
 extern struct dentry *fat_fh_to_dentry(struct super_block *sb, struct fid *fid,
fs/fat/inode.c +3 -9
index 80c6fdd..34253dc 100644
@@ -18,7 +18,6 @@
 #include <linux/pagemap.h>
 #include <linux/mpage.h>
 #include <linux/buffer_head.h>
-#include <linux/exportfs.h>
 #include <linux/mount.h>
 #include <linux/vfs.h>
 #include <linux/parser.h>
@@ -703,13 +702,6 @@ static const struct super_operations fat_sops = {
 	.show_options	= fat_show_options,
 };
 
-static const struct export_operations fat_export_ops = {
-	.encode_fh      = fat_encode_fh,
-	.fh_to_dentry	= fat_fh_to_dentry,
-	.fh_to_parent	= fat_fh_to_parent,
-	.get_parent	= fat_get_parent,
-};
-
 static int fat_show_options(struct seq_file *m, struct dentry *root)
 {
 	struct msdos_sb_info *sbi = MSDOS_SB(root->d_sb);
@@ -1118,8 +1110,10 @@ out:
 		opts->allow_utime = ~opts->fs_dmask & (S_IWGRP | S_IWOTH);
 	if (opts->unicode_xlate)
 		opts->utf8 = 0;
-	if (opts->nfs == FAT_NFS_NOSTALE_RO)
+	if (opts->nfs == FAT_NFS_NOSTALE_RO) {
 		sb->s_flags |= MS_RDONLY;
+		sb->s_export_op = &fat_export_ops_nostale;
+	}
 
 	return 0;
 }
fs/fat/nfs.c +99 -28

193 lines not on this page · raw message

Signature · 1 line
1.7.9.5