diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-05-20 08:44:57 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2019-05-25 17:59:24 -0400 |
commit | 1f58bb18f6f28d1df0b7144d90bc90ee5672416d (patch) | |
tree | 42f98ffbdf6a0f0612204052223770c2bf66d41e /fs/libfs.c | |
parent | 1a6e9e76b713d9632783efe78295ed3507fdad64 (diff) |
mount_pseudo(): drop 'name' argument, switch to d_make_root()
Once upon a time we used to set ->d_name of e.g. pipefs root
so that d_path() on pipes would work. These days it's
completely pointless - dentries of pipes are not even connected
to pipefs root. However, mount_pseudo() had set the root
dentry name (passed as the second argument) and callers
kept inventing names to pass to it. Including those that
didn't *have* any non-root dentries to start with...
All of that had been pointless for about 8 years now; it's
time to get rid of that cargo-culting...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/libfs.c')
-rw-r--r-- | fs/libfs.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/fs/libfs.c b/fs/libfs.c index 4b59b1816efb..030e545f586e 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -239,14 +239,12 @@ static const struct super_operations simple_super_operations = { | |||
239 | * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that | 239 | * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that |
240 | * will never be mountable) | 240 | * will never be mountable) |
241 | */ | 241 | */ |
242 | struct dentry *mount_pseudo_xattr(struct file_system_type *fs_type, char *name, | 242 | struct dentry *mount_pseudo_xattr(struct file_system_type *fs_type, |
243 | const struct super_operations *ops, const struct xattr_handler **xattr, | 243 | const struct super_operations *ops, const struct xattr_handler **xattr, |
244 | const struct dentry_operations *dops, unsigned long magic) | 244 | const struct dentry_operations *dops, unsigned long magic) |
245 | { | 245 | { |
246 | struct super_block *s; | 246 | struct super_block *s; |
247 | struct dentry *dentry; | ||
248 | struct inode *root; | 247 | struct inode *root; |
249 | struct qstr d_name = QSTR_INIT(name, strlen(name)); | ||
250 | 248 | ||
251 | s = sget_userns(fs_type, NULL, set_anon_super, SB_KERNMOUNT|SB_NOUSER, | 249 | s = sget_userns(fs_type, NULL, set_anon_super, SB_KERNMOUNT|SB_NOUSER, |
252 | &init_user_ns, NULL); | 250 | &init_user_ns, NULL); |
@@ -271,13 +269,9 @@ struct dentry *mount_pseudo_xattr(struct file_system_type *fs_type, char *name, | |||
271 | root->i_ino = 1; | 269 | root->i_ino = 1; |
272 | root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR; | 270 | root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR; |
273 | root->i_atime = root->i_mtime = root->i_ctime = current_time(root); | 271 | root->i_atime = root->i_mtime = root->i_ctime = current_time(root); |
274 | dentry = __d_alloc(s, &d_name); | 272 | s->s_root = d_make_root(root); |
275 | if (!dentry) { | 273 | if (!s->s_root) |
276 | iput(root); | ||
277 | goto Enomem; | 274 | goto Enomem; |
278 | } | ||
279 | d_instantiate(dentry, root); | ||
280 | s->s_root = dentry; | ||
281 | s->s_d_op = dops; | 275 | s->s_d_op = dops; |
282 | s->s_flags |= SB_ACTIVE; | 276 | s->s_flags |= SB_ACTIVE; |
283 | return dget(s->s_root); | 277 | return dget(s->s_root); |