History

convenience helpers: vfs_get_super() and sget_fc()

the former is an analogue of mount_{single,nodev} for use in ->get_tree() instances, the latter - analogue of sget() for the same. These are fairly similar to the originals, but the callback signature for sget_fc() is different from sget() ones, so getting bits and pieces shared would be too convoluted; we might get around to that later, but for now let's just remember to keep them in sync. They do live next to each other, and changes in either won't be hard to spot.

Al Viro committed 7 years ago

Commit cb50b341 parent 3e1aeb03 files · +190 −0Browse files

Showing the changes to include/linux (2 of 3 files). Show all

Unified · Split

2 files
  1. include/linux/fs.h +4 −0
  2. include/linux/fs_context.h +15 −0
include/linux/fs.h+4−0
@@ -2232,8 +2232,12 @@ void kill_litter_super(struct super_block *sb); · 2231 unmodified lines
22322232 void deactivate_super(struct super_block *sb);
22332233 void deactivate_locked_super(struct super_block *sb);
22342234 int set_anon_super(struct super_block *s, void *data);
2235+int set_anon_super_fc(struct super_block *s, struct fs_context *fc);
22352236 int get_anon_bdev(dev_t *);
22362237 void free_anon_bdev(dev_t);
2238+struct super_block *sget_fc(struct fs_context *fc,
2239+ int (*test)(struct super_block *, struct fs_context *),
2240+ int (*set)(struct super_block *, struct fs_context *));
22372241 struct super_block *sget_userns(struct file_system_type *type,
22382242 int (*test)(struct super_block *,void *),
22392243 int (*set)(struct super_block *,void *),
include/linux/fs_context.h+15−0
@@ -83,11 +83,13 @@ struct fs_context { · 82 unmodified lines
8383 const char *source; /* The source name (eg. dev path) */
8484 const char *subtype; /* The subtype to set on the superblock */
8585 void *security; /* Linux S&M options */
86+ void *s_fs_info; /* Proposed s_fs_info */
8687 unsigned int sb_flags; /* Proposed superblock flags (SB_*) */
8788 unsigned int sb_flags_mask; /* Superblock flags that were changed */
8889 unsigned int lsm_flags; /* Information flags from the fs to the LSM */
8990 enum fs_context_purpose purpose:8;
9091 bool need_free:1; /* Need to call ops->free() */
92+ bool global:1; /* Goes into &init_user_ns */
9193 };
9294
9395 struct fs_context_operations {
@@ -116,6 +118,19 @@ extern int generic_parse_monolithic(struct fs_context *fc, void *data); · 22 unmodified lines
116118 extern int vfs_get_tree(struct fs_context *fc);
117119 extern void put_fs_context(struct fs_context *fc);
118120
121+/*
122+ * sget() wrapper to be called from the ->get_tree() op.
123+ */
124+enum vfs_get_super_keying {
125+ vfs_get_single_super, /* Only one such superblock may exist */
126+ vfs_get_keyed_super, /* Superblocks with different s_fs_info keys may exist */
127+ vfs_get_independent_super, /* Multiple independent superblocks may exist */
128+};
129+extern int vfs_get_super(struct fs_context *fc,
130+ enum vfs_get_super_keying keying,
131+ int (*fill_super)(struct super_block *sb,
132+ struct fs_context *fc));
133+
119134 #define logfc(FC, FMT, ...) pr_notice(FMT, ## __VA_ARGS__)
120135
121136 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t