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
2232void deactivate_super(struct super_block *sb);2232void deactivate_super(struct super_block *sb);
2233void deactivate_locked_super(struct super_block *sb);2233void deactivate_locked_super(struct super_block *sb);
2234int set_anon_super(struct super_block *s, void *data);2234int set_anon_super(struct super_block *s, void *data);
2235int set_anon_super_fc(struct super_block *s, struct fs_context *fc);
2235int get_anon_bdev(dev_t *);2236int get_anon_bdev(dev_t *);
2236void free_anon_bdev(dev_t);2237void free_anon_bdev(dev_t);
2238struct 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 *));
2237struct super_block *sget_userns(struct file_system_type *type,2241struct super_block *sget_userns(struct file_system_type *type,
2238 int (*test)(struct super_block *,void *),2242 int (*test)(struct super_block *,void *),
2239 int (*set)(struct super_block *,void *),2243 int (*set)(struct super_block *,void *),
include/linux/fs_context.h+15−0
@@ -83,11 +83,13 @@ struct fs_context { · 82 unmodified lines
83 const char *source; /* The source name (eg. dev path) */83 const char *source; /* The source name (eg. dev path) */
84 const char *subtype; /* The subtype to set on the superblock */84 const char *subtype; /* The subtype to set on the superblock */
85 void *security; /* Linux S&M options */85 void *security; /* Linux S&M options */
86 void *s_fs_info; /* Proposed s_fs_info */
86 unsigned int sb_flags; /* Proposed superblock flags (SB_*) */87 unsigned int sb_flags; /* Proposed superblock flags (SB_*) */
87 unsigned int sb_flags_mask; /* Superblock flags that were changed */88 unsigned int sb_flags_mask; /* Superblock flags that were changed */
88 unsigned int lsm_flags; /* Information flags from the fs to the LSM */89 unsigned int lsm_flags; /* Information flags from the fs to the LSM */
89 enum fs_context_purpose purpose:8;90 enum fs_context_purpose purpose:8;
90 bool need_free:1; /* Need to call ops->free() */91 bool need_free:1; /* Need to call ops->free() */
92 bool global:1; /* Goes into &init_user_ns */
91};93};
92 94
93struct fs_context_operations {95struct fs_context_operations {
@@ -116,6 +118,19 @@ extern int generic_parse_monolithic(struct fs_context *fc, void *data); · 22 unmodified lines
116extern int vfs_get_tree(struct fs_context *fc);118extern int vfs_get_tree(struct fs_context *fc);
117extern void put_fs_context(struct fs_context *fc);119extern void put_fs_context(struct fs_context *fc);
118 120
121/*
122 * sget() wrapper to be called from the ->get_tree() op.
123 */
124enum 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};
129extern 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
119#define logfc(FC, FMT, ...) pr_notice(FMT, ## __VA_ARGS__)134#define logfc(FC, FMT, ...) pr_notice(FMT, ## __VA_ARGS__)
120 135
121/**136/**

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