Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1681600

[PATCH 10/14] afs: Implement show_options

From David Howells <dhowells@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 10/14] afs: Implement show_options
Date 2017-07-05 17:30 +0200
Message-ID <tZUpB-83i-53@gated-at.bofh.it> (permalink)
References <tZUpz-83i-3@gated-at.bofh.it>
Organization Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903

Show all headers | View raw


Implement the show_options superblock op for afs as part of a bid to get
rid of s_options and generic_show_options() to make it easier to implement
a context-based mount where the mount options can be passed individually
over a file descriptor.

Also implement the show_devname op to display the correct device name and thus
avoid the need to display the cell= and volume= options.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-afs@lists.infradead.org
---

 fs/afs/super.c |   45 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/fs/afs/super.c b/fs/afs/super.c
index c79633e5cfd8..35d7e550b29c 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -37,6 +37,8 @@ static void afs_kill_super(struct super_block *sb);
 static struct inode *afs_alloc_inode(struct super_block *sb);
 static void afs_destroy_inode(struct inode *inode);
 static int afs_statfs(struct dentry *dentry, struct kstatfs *buf);
+static int afs_show_devname(struct seq_file *m, struct dentry *root);
+static int afs_show_options(struct seq_file *m, struct dentry *root);
 
 struct file_system_type afs_fs_type = {
 	.owner		= THIS_MODULE,
@@ -53,7 +55,8 @@ static const struct super_operations afs_super_ops = {
 	.drop_inode	= afs_drop_inode,
 	.destroy_inode	= afs_destroy_inode,
 	.evict_inode	= afs_evict_inode,
-	.show_options	= generic_show_options,
+	.show_devname	= afs_show_devname,
+	.show_options	= afs_show_options,
 };
 
 static struct kmem_cache *afs_inode_cachep;
@@ -136,6 +139,45 @@ void __exit afs_fs_exit(void)
 }
 
 /*
+ * Display the mount device name in /proc/mounts.
+ */
+static int afs_show_devname(struct seq_file *m, struct dentry *root)
+{
+	struct afs_super_info *as = root->d_sb->s_fs_info;
+	struct afs_volume *volume = as->volume;
+	struct afs_cell *cell = volume->cell;
+	const char *suf = "";
+	char pref = '%';
+
+	switch (volume->type) {
+	case AFSVL_RWVOL:
+		break;
+	case AFSVL_ROVOL:
+		pref = '#';
+		if (volume->type_force)
+			suf = ".readonly";
+		break;
+	case AFSVL_BACKVOL:
+		pref = '#';
+		suf = ".backup";
+		break;
+	}
+
+	seq_printf(m, "%c%s:%s%s", pref, cell->name, volume->vlocation->vldb.name, suf);
+	return 0;
+}
+
+/*
+ * Display the mount options in /proc/mounts.
+ */
+static int afs_show_options(struct seq_file *m, struct dentry *root)
+{
+	if (test_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(d_inode(root))->flags))
+		seq_puts(m, "autocell");
+	return 0;
+}
+
+/*
  * parse the mount options
  * - this function has been shamelessly adapted from the ext3 fs which
  *   shamelessly adapted it from the msdos fs
@@ -426,7 +468,6 @@ static struct dentry *afs_mount(struct file_system_type *fs_type,
 			deactivate_locked_super(sb);
 			goto error;
 		}
-		save_mount_options(sb, new_opts);
 		sb->s_flags |= MS_ACTIVE;
 	} else {
 		_debug("reuse");

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC][PATCH 00/14] VFS: Make all filesystems implement  ->show_options() David Howells <dhowells@redhat.com> - 2017-07-05 17:30 +0200
  [PATCH 11/14] isofs: Implement show_options David Howells <dhowells@redhat.com> - 2017-07-05 17:30 +0200
    [PATCH] isofs: Fix isofs_show_options() David Howells <dhowells@redhat.com> - 2017-07-11 17:30 +0200
  [PATCH 04/14] pstore: Implement show_options David Howells <dhowells@redhat.com> - 2017-07-05 17:30 +0200
    Re: [PATCH 04/14] pstore: Implement show_options Kees Cook <keescook@chromium.org> - 2017-07-05 19:20 +0200
      Re: [PATCH 04/14] pstore: Implement show_options David Howells <dhowells@redhat.com> - 2017-07-07 18:10 +0200
  [PATCH 07/14] spufs: Implement show_options David Howells <dhowells@redhat.com> - 2017-07-05 17:30 +0200
  [PATCH 10/14] afs: Implement show_options David Howells <dhowells@redhat.com> - 2017-07-05 17:30 +0200
  [PATCH 08/14] befs: Implement show_options David Howells <dhowells@redhat.com> - 2017-07-05 17:30 +0200
  [PATCH 06/14] bpf: Implement show_options David Howells <dhowells@redhat.com> - 2017-07-05 17:30 +0200
    Re: [PATCH 06/14] bpf: Implement show_options Daniel Borkmann <daniel@iogearbox.net> - 2017-07-06 10:10 +0200
  Re: [RFC][PATCH 00/14] VFS: Make all filesystems implement ->show_options() ebiederm@xmission.com (Eric W. Biederman) - 2017-07-05 18:50 +0200
    Re: [RFC][PATCH 00/14] VFS: Make all filesystems implement ->show_options() David Howells <dhowells@redhat.com> - 2017-07-07 18:00 +0200
      Re: [RFC][PATCH 00/14] VFS: Make all filesystems implement  ->show_options() Theodore Ts'o <tytso@mit.edu> - 2017-07-08 17:40 +0200

csiph-web