mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 02:34:01 +08:00
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>
This commit is contained in:
parent
26a7655e6a
commit
677018a6ce
@ -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;
|
||||
@ -135,6 +138,45 @@ void __exit afs_fs_exit(void)
|
||||
_leave("");
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user