afs: Implement show_options

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
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by David Howells and committed by Al Viro 677018a6 26a7655e

+43 -2
+43 -2
fs/afs/super.c
··· 37 37 static struct inode *afs_alloc_inode(struct super_block *sb); 38 38 static void afs_destroy_inode(struct inode *inode); 39 39 static int afs_statfs(struct dentry *dentry, struct kstatfs *buf); 40 + static int afs_show_devname(struct seq_file *m, struct dentry *root); 41 + static int afs_show_options(struct seq_file *m, struct dentry *root); 40 42 41 43 struct file_system_type afs_fs_type = { 42 44 .owner = THIS_MODULE, ··· 55 53 .drop_inode = afs_drop_inode, 56 54 .destroy_inode = afs_destroy_inode, 57 55 .evict_inode = afs_evict_inode, 58 - .show_options = generic_show_options, 56 + .show_devname = afs_show_devname, 57 + .show_options = afs_show_options, 59 58 }; 60 59 61 60 static struct kmem_cache *afs_inode_cachep; ··· 136 133 rcu_barrier(); 137 134 kmem_cache_destroy(afs_inode_cachep); 138 135 _leave(""); 136 + } 137 + 138 + /* 139 + * Display the mount device name in /proc/mounts. 140 + */ 141 + static int afs_show_devname(struct seq_file *m, struct dentry *root) 142 + { 143 + struct afs_super_info *as = root->d_sb->s_fs_info; 144 + struct afs_volume *volume = as->volume; 145 + struct afs_cell *cell = volume->cell; 146 + const char *suf = ""; 147 + char pref = '%'; 148 + 149 + switch (volume->type) { 150 + case AFSVL_RWVOL: 151 + break; 152 + case AFSVL_ROVOL: 153 + pref = '#'; 154 + if (volume->type_force) 155 + suf = ".readonly"; 156 + break; 157 + case AFSVL_BACKVOL: 158 + pref = '#'; 159 + suf = ".backup"; 160 + break; 161 + } 162 + 163 + seq_printf(m, "%c%s:%s%s", pref, cell->name, volume->vlocation->vldb.name, suf); 164 + return 0; 165 + } 166 + 167 + /* 168 + * Display the mount options in /proc/mounts. 169 + */ 170 + static int afs_show_options(struct seq_file *m, struct dentry *root) 171 + { 172 + if (test_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(d_inode(root))->flags)) 173 + seq_puts(m, "autocell"); 174 + return 0; 139 175 } 140 176 141 177 /* ··· 468 426 deactivate_locked_super(sb); 469 427 goto error; 470 428 } 471 - save_mount_options(sb, new_opts); 472 429 sb->s_flags |= MS_ACTIVE; 473 430 } else { 474 431 _debug("reuse");