Commit c74a1cbb3cac348f276fabc381758f5b0b4713b2
1 parent
f772c4a6a3
Exists in
master
and in
20 other branches
pass default dentry_operations to mount_pseudo()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 8 changed files with 40 additions and 33 deletions Side-by-side Diff
arch/ia64/kernel/perfmon.c
... | ... | @@ -617,11 +617,14 @@ |
617 | 617 | return get_unmapped_area(file, addr, len, pgoff, flags); |
618 | 618 | } |
619 | 619 | |
620 | +/* forward declaration */ | |
621 | +static static const struct dentry_operations pfmfs_dentry_operations; | |
620 | 622 | |
621 | 623 | static struct dentry * |
622 | 624 | pfmfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) |
623 | 625 | { |
624 | - return mount_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC); | |
626 | + return mount_pseudo(fs_type, "pfm:", NULL, &pfmfs_dentry_operations, | |
627 | + PFMFS_MAGIC); | |
625 | 628 | } |
626 | 629 | |
627 | 630 | static struct file_system_type pfm_fs_type = { |
... | ... | @@ -2232,7 +2235,6 @@ |
2232 | 2235 | } |
2233 | 2236 | path.mnt = mntget(pfmfs_mnt); |
2234 | 2237 | |
2235 | - d_set_d_op(path.dentry, &pfmfs_dentry_operations); | |
2236 | 2238 | d_add(path.dentry, inode); |
2237 | 2239 | |
2238 | 2240 | file = alloc_file(&path, FMODE_READ, &pfm_file_ops); |
drivers/mtd/mtdchar.c
... | ... | @@ -1134,7 +1134,7 @@ |
1134 | 1134 | static struct dentry *mtd_inodefs_mount(struct file_system_type *fs_type, |
1135 | 1135 | int flags, const char *dev_name, void *data) |
1136 | 1136 | { |
1137 | - return mount_pseudo(fs_type, "mtd_inode:", NULL, MTD_INODE_FS_MAGIC); | |
1137 | + return mount_pseudo(fs_type, "mtd_inode:", NULL, NULL, MTD_INODE_FS_MAGIC); | |
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | static struct file_system_type mtd_inodefs_type = { |
fs/anon_inodes.c
... | ... | @@ -26,12 +26,6 @@ |
26 | 26 | static struct inode *anon_inode_inode; |
27 | 27 | static const struct file_operations anon_inode_fops; |
28 | 28 | |
29 | -static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type, | |
30 | - int flags, const char *dev_name, void *data) | |
31 | -{ | |
32 | - return mount_pseudo(fs_type, "anon_inode:", NULL, ANON_INODE_FS_MAGIC); | |
33 | -} | |
34 | - | |
35 | 29 | /* |
36 | 30 | * anon_inodefs_dname() is called from d_path(). |
37 | 31 | */ |
38 | 32 | |
... | ... | @@ -41,14 +35,22 @@ |
41 | 35 | dentry->d_name.name); |
42 | 36 | } |
43 | 37 | |
38 | +static const struct dentry_operations anon_inodefs_dentry_operations = { | |
39 | + .d_dname = anon_inodefs_dname, | |
40 | +}; | |
41 | + | |
42 | +static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type, | |
43 | + int flags, const char *dev_name, void *data) | |
44 | +{ | |
45 | + return mount_pseudo(fs_type, "anon_inode:", NULL, | |
46 | + &anon_inodefs_dentry_operations, ANON_INODE_FS_MAGIC); | |
47 | +} | |
48 | + | |
44 | 49 | static struct file_system_type anon_inode_fs_type = { |
45 | 50 | .name = "anon_inodefs", |
46 | 51 | .mount = anon_inodefs_mount, |
47 | 52 | .kill_sb = kill_anon_super, |
48 | 53 | }; |
49 | -static const struct dentry_operations anon_inodefs_dentry_operations = { | |
50 | - .d_dname = anon_inodefs_dname, | |
51 | -}; | |
52 | 54 | |
53 | 55 | /* |
54 | 56 | * nop .set_page_dirty method so that people can use .page_mkwrite on |
... | ... | @@ -113,7 +115,6 @@ |
113 | 115 | */ |
114 | 116 | ihold(anon_inode_inode); |
115 | 117 | |
116 | - d_set_d_op(path.dentry, &anon_inodefs_dentry_operations); | |
117 | 118 | d_instantiate(path.dentry, anon_inode_inode); |
118 | 119 | |
119 | 120 | error = -ENFILE; |
fs/block_dev.c
... | ... | @@ -473,7 +473,7 @@ |
473 | 473 | static struct dentry *bd_mount(struct file_system_type *fs_type, |
474 | 474 | int flags, const char *dev_name, void *data) |
475 | 475 | { |
476 | - return mount_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576); | |
476 | + return mount_pseudo(fs_type, "bdev:", &bdev_sops, NULL, 0x62646576); | |
477 | 477 | } |
478 | 478 | |
479 | 479 | static struct file_system_type bd_type = { |
fs/libfs.c
... | ... | @@ -217,7 +217,8 @@ |
217 | 217 | * will never be mountable) |
218 | 218 | */ |
219 | 219 | struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name, |
220 | - const struct super_operations *ops, unsigned long magic) | |
220 | + const struct super_operations *ops, | |
221 | + const struct dentry_operations *dops, unsigned long magic) | |
221 | 222 | { |
222 | 223 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); |
223 | 224 | struct dentry *dentry; |
... | ... | @@ -254,6 +255,7 @@ |
254 | 255 | dentry->d_parent = dentry; |
255 | 256 | d_instantiate(dentry, root); |
256 | 257 | s->s_root = dentry; |
258 | + s->s_d_op = dops; | |
257 | 259 | s->s_flags |= MS_ACTIVE; |
258 | 260 | return dget(s->s_root); |
259 | 261 |
fs/pipe.c
... | ... | @@ -1004,7 +1004,6 @@ |
1004 | 1004 | goto err_inode; |
1005 | 1005 | path.mnt = mntget(pipe_mnt); |
1006 | 1006 | |
1007 | - d_set_d_op(path.dentry, &pipefs_dentry_operations); | |
1008 | 1007 | d_instantiate(path.dentry, inode); |
1009 | 1008 | |
1010 | 1009 | err = -ENFILE; |
... | ... | @@ -1266,7 +1265,8 @@ |
1266 | 1265 | static struct dentry *pipefs_mount(struct file_system_type *fs_type, |
1267 | 1266 | int flags, const char *dev_name, void *data) |
1268 | 1267 | { |
1269 | - return mount_pseudo(fs_type, "pipe:", &pipefs_ops, PIPEFS_MAGIC); | |
1268 | + return mount_pseudo(fs_type, "pipe:", &pipefs_ops, | |
1269 | + &pipefs_dentry_operations, PIPEFS_MAGIC); | |
1270 | 1270 | } |
1271 | 1271 | |
1272 | 1272 | static struct file_system_type pipe_fs_type = { |
include/linux/fs.h
... | ... | @@ -1835,7 +1835,9 @@ |
1835 | 1835 | int (*set)(struct super_block *,void *), |
1836 | 1836 | void *data); |
1837 | 1837 | extern struct dentry *mount_pseudo(struct file_system_type *, char *, |
1838 | - const struct super_operations *ops, unsigned long); | |
1838 | + const struct super_operations *ops, | |
1839 | + const struct dentry_operations *dops, | |
1840 | + unsigned long); | |
1839 | 1841 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
1840 | 1842 | |
1841 | 1843 | static inline void sb_mark_dirty(struct super_block *sb) |
net/socket.c
... | ... | @@ -306,10 +306,24 @@ |
306 | 306 | .statfs = simple_statfs, |
307 | 307 | }; |
308 | 308 | |
309 | +/* | |
310 | + * sockfs_dname() is called from d_path(). | |
311 | + */ | |
312 | +static char *sockfs_dname(struct dentry *dentry, char *buffer, int buflen) | |
313 | +{ | |
314 | + return dynamic_dname(dentry, buffer, buflen, "socket:[%lu]", | |
315 | + dentry->d_inode->i_ino); | |
316 | +} | |
317 | + | |
318 | +static const struct dentry_operations sockfs_dentry_operations = { | |
319 | + .d_dname = sockfs_dname, | |
320 | +}; | |
321 | + | |
309 | 322 | static struct dentry *sockfs_mount(struct file_system_type *fs_type, |
310 | 323 | int flags, const char *dev_name, void *data) |
311 | 324 | { |
312 | - return mount_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC); | |
325 | + return mount_pseudo(fs_type, "socket:", &sockfs_ops, | |
326 | + &sockfs_dentry_operations, SOCKFS_MAGIC); | |
313 | 327 | } |
314 | 328 | |
315 | 329 | static struct vfsmount *sock_mnt __read_mostly; |
... | ... | @@ -321,19 +335,6 @@ |
321 | 335 | }; |
322 | 336 | |
323 | 337 | /* |
324 | - * sockfs_dname() is called from d_path(). | |
325 | - */ | |
326 | -static char *sockfs_dname(struct dentry *dentry, char *buffer, int buflen) | |
327 | -{ | |
328 | - return dynamic_dname(dentry, buffer, buflen, "socket:[%lu]", | |
329 | - dentry->d_inode->i_ino); | |
330 | -} | |
331 | - | |
332 | -static const struct dentry_operations sockfs_dentry_operations = { | |
333 | - .d_dname = sockfs_dname, | |
334 | -}; | |
335 | - | |
336 | -/* | |
337 | 338 | * Obtains the first available file descriptor and sets it up for use. |
338 | 339 | * |
339 | 340 | * These functions create file structures and maps them to fd space |
... | ... | @@ -368,7 +369,6 @@ |
368 | 369 | } |
369 | 370 | path.mnt = mntget(sock_mnt); |
370 | 371 | |
371 | - d_set_d_op(path.dentry, &sockfs_dentry_operations); | |
372 | 372 | d_instantiate(path.dentry, SOCK_INODE(sock)); |
373 | 373 | SOCK_INODE(sock)->i_fop = &socket_file_ops; |
374 | 374 |