Skip to content

Commit 4cc7c18

Browse files
dhowellsAl Viro
authored andcommitted
bpf: Implement show_options
Implement the show_options superblock op for bpf 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. Signed-off-by: David Howells <[email protected]> cc: Alexei Starovoitov <[email protected]> cc: Daniel Borkmann <[email protected]> cc: [email protected] Signed-off-by: Al Viro <[email protected]>
1 parent 604ecf4 commit 4cc7c18

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

kernel/bpf/inode.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,22 @@ static void bpf_evict_inode(struct inode *inode)
377377
bpf_any_put(inode->i_private, type);
378378
}
379379

380+
/*
381+
* Display the mount options in /proc/mounts.
382+
*/
383+
static int bpf_show_options(struct seq_file *m, struct dentry *root)
384+
{
385+
umode_t mode = d_inode(root)->i_mode & S_IALLUGO & ~S_ISVTX;
386+
387+
if (mode != S_IRWXUGO)
388+
seq_printf(m, ",mode=%o", mode);
389+
return 0;
390+
}
391+
380392
static const struct super_operations bpf_super_ops = {
381393
.statfs = simple_statfs,
382394
.drop_inode = generic_delete_inode,
383-
.show_options = generic_show_options,
395+
.show_options = bpf_show_options,
384396
.evict_inode = bpf_evict_inode,
385397
};
386398

@@ -434,8 +446,6 @@ static int bpf_fill_super(struct super_block *sb, void *data, int silent)
434446
struct inode *inode;
435447
int ret;
436448

437-
save_mount_options(sb, data);
438-
439449
ret = bpf_parse_options(data, &opts);
440450
if (ret)
441451
return ret;

0 commit comments

Comments
 (0)