Skip to content

Commit 677018a

Browse files
dhowellsAl Viro
authored andcommitted
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>
1 parent 26a7655 commit 677018a

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

fs/afs/super.c

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ static void afs_kill_super(struct super_block *sb);
3737
static struct inode *afs_alloc_inode(struct super_block *sb);
3838
static void afs_destroy_inode(struct inode *inode);
3939
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);
4042

4143
struct file_system_type afs_fs_type = {
4244
.owner = THIS_MODULE,
@@ -53,7 +55,8 @@ static const struct super_operations afs_super_ops = {
5355
.drop_inode = afs_drop_inode,
5456
.destroy_inode = afs_destroy_inode,
5557
.evict_inode = afs_evict_inode,
56-
.show_options = generic_show_options,
58+
.show_devname = afs_show_devname,
59+
.show_options = afs_show_options,
5760
};
5861

5962
static struct kmem_cache *afs_inode_cachep;
@@ -135,6 +138,45 @@ void __exit afs_fs_exit(void)
135138
_leave("");
136139
}
137140

141+
/*
142+
* Display the mount device name in /proc/mounts.
143+
*/
144+
static int afs_show_devname(struct seq_file *m, struct dentry *root)
145+
{
146+
struct afs_super_info *as = root->d_sb->s_fs_info;
147+
struct afs_volume *volume = as->volume;
148+
struct afs_cell *cell = volume->cell;
149+
const char *suf = "";
150+
char pref = '%';
151+
152+
switch (volume->type) {
153+
case AFSVL_RWVOL:
154+
break;
155+
case AFSVL_ROVOL:
156+
pref = '#';
157+
if (volume->type_force)
158+
suf = ".readonly";
159+
break;
160+
case AFSVL_BACKVOL:
161+
pref = '#';
162+
suf = ".backup";
163+
break;
164+
}
165+
166+
seq_printf(m, "%c%s:%s%s", pref, cell->name, volume->vlocation->vldb.name, suf);
167+
return 0;
168+
}
169+
170+
/*
171+
* Display the mount options in /proc/mounts.
172+
*/
173+
static int afs_show_options(struct seq_file *m, struct dentry *root)
174+
{
175+
if (test_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(d_inode(root))->flags))
176+
seq_puts(m, "autocell");
177+
return 0;
178+
}
179+
138180
/*
139181
* parse the mount options
140182
* - this function has been shamelessly adapted from the ext3 fs which
@@ -426,7 +468,6 @@ static struct dentry *afs_mount(struct file_system_type *fs_type,
426468
deactivate_locked_super(sb);
427469
goto error;
428470
}
429-
save_mount_options(sb, new_opts);
430471
sb->s_flags |= MS_ACTIVE;
431472
} else {
432473
_debug("reuse");

0 commit comments

Comments
 (0)