Skip to content

Commit 933a90b

Browse files
committed
Merge branch 'work.mount0' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs mount updates from Al Viro: "The first part of mount updates. Convert filesystems to use the new mount API" * 'work.mount0' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits) mnt_init(): call shmem_init() unconditionally constify ksys_mount() string arguments don't bother with registering rootfs init_rootfs(): don't bother with init_ramfs_fs() vfs: Convert smackfs to use the new mount API vfs: Convert selinuxfs to use the new mount API vfs: Convert securityfs to use the new mount API vfs: Convert apparmorfs to use the new mount API vfs: Convert openpromfs to use the new mount API vfs: Convert xenfs to use the new mount API vfs: Convert gadgetfs to use the new mount API vfs: Convert oprofilefs to use the new mount API vfs: Convert ibmasmfs to use the new mount API vfs: Convert qib_fs/ipathfs to use the new mount API vfs: Convert efivarfs to use the new mount API vfs: Convert configfs to use the new mount API vfs: Convert binfmt_misc to use the new mount API convenience helper: get_tree_single() convenience helper get_tree_nodev() vfs: Kill sget_userns() ...
2 parents 5f4fc6d + 037f11b commit 933a90b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+581
-533
lines changed

arch/ia64/kernel/perfmon.c

+10-7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <linux/smp.h>
4040
#include <linux/pagemap.h>
4141
#include <linux/mount.h>
42+
#include <linux/pseudo_fs.h>
4243
#include <linux/bitops.h>
4344
#include <linux/capability.h>
4445
#include <linux/rcupdate.h>
@@ -600,17 +601,19 @@ pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f)
600601
/* forward declaration */
601602
static const struct dentry_operations pfmfs_dentry_operations;
602603

603-
static struct dentry *
604-
pfmfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
604+
static int pfmfs_init_fs_context(struct fs_context *fc)
605605
{
606-
return mount_pseudo(fs_type, "pfm:", NULL, &pfmfs_dentry_operations,
607-
PFMFS_MAGIC);
606+
struct pseudo_fs_context *ctx = init_pseudo(fc, PFMFS_MAGIC);
607+
if (!ctx)
608+
return -ENOMEM;
609+
ctx->dops = &pfmfs_dentry_operations;
610+
return 0;
608611
}
609612

610613
static struct file_system_type pfm_fs_type = {
611-
.name = "pfmfs",
612-
.mount = pfmfs_mount,
613-
.kill_sb = kill_anon_super,
614+
.name = "pfmfs",
615+
.init_fs_context = pfmfs_init_fs_context,
616+
.kill_sb = kill_anon_super,
614617
};
615618
MODULE_ALIAS_FS("pfmfs");
616619

arch/x86/kernel/cpu/resctrl/rdtgroup.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -2104,8 +2104,7 @@ static int rdt_init_fs_context(struct fs_context *fc)
21042104
ctx->kfc.magic = RDTGROUP_SUPER_MAGIC;
21052105
fc->fs_private = &ctx->kfc;
21062106
fc->ops = &rdt_fs_context_ops;
2107-
if (fc->user_ns)
2108-
put_user_ns(fc->user_ns);
2107+
put_user_ns(fc->user_ns);
21092108
fc->user_ns = get_user_ns(&init_user_ns);
21102109
fc->global = true;
21112110
return 0;

drivers/base/devtmpfs.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,7 @@ int devtmpfs_mount(const char *mntdir)
357357
if (!thread)
358358
return 0;
359359

360-
err = ksys_mount("devtmpfs", (char *)mntdir, "devtmpfs", MS_SILENT,
361-
NULL);
360+
err = ksys_mount("devtmpfs", mntdir, "devtmpfs", MS_SILENT, NULL);
362361
if (err)
363362
printk(KERN_INFO "devtmpfs: error mounting %i\n", err);
364363
else

drivers/dax/super.c

+10-13
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <linux/pagemap.h>
66
#include <linux/module.h>
77
#include <linux/mount.h>
8+
#include <linux/pseudo_fs.h>
89
#include <linux/magic.h>
910
#include <linux/genhd.h>
1011
#include <linux/pfn_t.h>
@@ -469,16 +470,19 @@ static const struct super_operations dax_sops = {
469470
.drop_inode = generic_delete_inode,
470471
};
471472

472-
static struct dentry *dax_mount(struct file_system_type *fs_type,
473-
int flags, const char *dev_name, void *data)
473+
static int dax_init_fs_context(struct fs_context *fc)
474474
{
475-
return mount_pseudo(fs_type, "dax:", &dax_sops, NULL, DAXFS_MAGIC);
475+
struct pseudo_fs_context *ctx = init_pseudo(fc, DAXFS_MAGIC);
476+
if (!ctx)
477+
return -ENOMEM;
478+
ctx->ops = &dax_sops;
479+
return 0;
476480
}
477481

478482
static struct file_system_type dax_fs_type = {
479-
.name = "dax",
480-
.mount = dax_mount,
481-
.kill_sb = kill_anon_super,
483+
.name = "dax",
484+
.init_fs_context = dax_init_fs_context,
485+
.kill_sb = kill_anon_super,
482486
};
483487

484488
static int dax_test(struct inode *inode, void *data)
@@ -665,10 +669,6 @@ static int dax_fs_init(void)
665669
if (!dax_cache)
666670
return -ENOMEM;
667671

668-
rc = register_filesystem(&dax_fs_type);
669-
if (rc)
670-
goto err_register_fs;
671-
672672
dax_mnt = kern_mount(&dax_fs_type);
673673
if (IS_ERR(dax_mnt)) {
674674
rc = PTR_ERR(dax_mnt);
@@ -679,8 +679,6 @@ static int dax_fs_init(void)
679679
return 0;
680680

681681
err_mount:
682-
unregister_filesystem(&dax_fs_type);
683-
err_register_fs:
684682
kmem_cache_destroy(dax_cache);
685683

686684
return rc;
@@ -689,7 +687,6 @@ static int dax_fs_init(void)
689687
static void dax_fs_exit(void)
690688
{
691689
kern_unmount(dax_mnt);
692-
unregister_filesystem(&dax_fs_type);
693690
kmem_cache_destroy(dax_cache);
694691
}
695692

drivers/dma-buf/dma-buf.c

+10-5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/reservation.h>
2525
#include <linux/mm.h>
2626
#include <linux/mount.h>
27+
#include <linux/pseudo_fs.h>
2728

2829
#include <uapi/linux/dma-buf.h>
2930
#include <uapi/linux/magic.h>
@@ -59,16 +60,20 @@ static const struct dentry_operations dma_buf_dentry_ops = {
5960

6061
static struct vfsmount *dma_buf_mnt;
6162

62-
static struct dentry *dma_buf_fs_mount(struct file_system_type *fs_type,
63-
int flags, const char *name, void *data)
63+
static int dma_buf_fs_init_context(struct fs_context *fc)
6464
{
65-
return mount_pseudo(fs_type, "dmabuf:", NULL, &dma_buf_dentry_ops,
66-
DMA_BUF_MAGIC);
65+
struct pseudo_fs_context *ctx;
66+
67+
ctx = init_pseudo(fc, DMA_BUF_MAGIC);
68+
if (!ctx)
69+
return -ENOMEM;
70+
ctx->dops = &dma_buf_dentry_ops;
71+
return 0;
6772
}
6873

6974
static struct file_system_type dma_buf_fs_type = {
7075
.name = "dmabuf",
71-
.mount = dma_buf_fs_mount,
76+
.init_fs_context = dma_buf_fs_init_context,
7277
.kill_sb = kill_anon_super,
7378
};
7479

drivers/gpu/drm/drm_drv.c

+4-16
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/module.h>
3232
#include <linux/moduleparam.h>
3333
#include <linux/mount.h>
34+
#include <linux/pseudo_fs.h>
3435
#include <linux/slab.h>
3536
#include <linux/srcu.h>
3637

@@ -535,28 +536,15 @@ EXPORT_SYMBOL(drm_dev_unplug);
535536
static int drm_fs_cnt;
536537
static struct vfsmount *drm_fs_mnt;
537538

538-
static const struct dentry_operations drm_fs_dops = {
539-
.d_dname = simple_dname,
540-
};
541-
542-
static const struct super_operations drm_fs_sops = {
543-
.statfs = simple_statfs,
544-
};
545-
546-
static struct dentry *drm_fs_mount(struct file_system_type *fs_type, int flags,
547-
const char *dev_name, void *data)
539+
static int drm_fs_init_fs_context(struct fs_context *fc)
548540
{
549-
return mount_pseudo(fs_type,
550-
"drm:",
551-
&drm_fs_sops,
552-
&drm_fs_dops,
553-
0x010203ff);
541+
return init_pseudo(fc, 0x010203ff) ? 0 : -ENOMEM;
554542
}
555543

556544
static struct file_system_type drm_fs_type = {
557545
.name = "drm",
558546
.owner = THIS_MODULE,
559-
.mount = drm_fs_mount,
547+
.init_fs_context = drm_fs_init_fs_context,
560548
.kill_sb = kill_anon_super,
561549
};
562550

drivers/infiniband/hw/qib/qib_fs.c

+17-9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#include <linux/module.h>
3636
#include <linux/fs.h>
37+
#include <linux/fs_context.h>
3738
#include <linux/mount.h>
3839
#include <linux/pagemap.h>
3940
#include <linux/init.h>
@@ -506,7 +507,7 @@ static int remove_device_files(struct super_block *sb,
506507
* after device init. The direct add_cntr_files() call handles adding
507508
* them from the init code, when the fs is already mounted.
508509
*/
509-
static int qibfs_fill_super(struct super_block *sb, void *data, int silent)
510+
static int qibfs_fill_super(struct super_block *sb, struct fs_context *fc)
510511
{
511512
struct qib_devdata *dd;
512513
unsigned long index;
@@ -534,17 +535,24 @@ static int qibfs_fill_super(struct super_block *sb, void *data, int silent)
534535
return ret;
535536
}
536537

537-
static struct dentry *qibfs_mount(struct file_system_type *fs_type, int flags,
538-
const char *dev_name, void *data)
538+
static int qibfs_get_tree(struct fs_context *fc)
539539
{
540-
struct dentry *ret;
541-
542-
ret = mount_single(fs_type, flags, data, qibfs_fill_super);
543-
if (!IS_ERR(ret))
544-
qib_super = ret->d_sb;
540+
int ret = get_tree_single(fc, qibfs_fill_super);
541+
if (ret == 0)
542+
qib_super = fc->root->d_sb;
545543
return ret;
546544
}
547545

546+
static const struct fs_context_operations qibfs_context_ops = {
547+
.get_tree = qibfs_get_tree,
548+
};
549+
550+
static int qibfs_init_fs_context(struct fs_context *fc)
551+
{
552+
fc->ops = &qibfs_context_ops;
553+
return 0;
554+
}
555+
548556
static void qibfs_kill_super(struct super_block *s)
549557
{
550558
kill_litter_super(s);
@@ -583,7 +591,7 @@ int qibfs_remove(struct qib_devdata *dd)
583591
static struct file_system_type qibfs_fs_type = {
584592
.owner = THIS_MODULE,
585593
.name = "ipathfs",
586-
.mount = qibfs_mount,
594+
.init_fs_context = qibfs_init_fs_context,
587595
.kill_sb = qibfs_kill_super,
588596
};
589597
MODULE_ALIAS_FS("ipathfs");

drivers/misc/cxl/api.c

+4-9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <misc/cxl.h>
1010
#include <linux/module.h>
1111
#include <linux/mount.h>
12+
#include <linux/pseudo_fs.h>
1213
#include <linux/sched/mm.h>
1314
#include <linux/mmu_context.h>
1415

@@ -33,21 +34,15 @@
3334
static int cxl_fs_cnt;
3435
static struct vfsmount *cxl_vfs_mount;
3536

36-
static const struct dentry_operations cxl_fs_dops = {
37-
.d_dname = simple_dname,
38-
};
39-
40-
static struct dentry *cxl_fs_mount(struct file_system_type *fs_type, int flags,
41-
const char *dev_name, void *data)
37+
static int cxl_fs_init_fs_context(struct fs_context *fc)
4238
{
43-
return mount_pseudo(fs_type, "cxl:", NULL, &cxl_fs_dops,
44-
CXL_PSEUDO_FS_MAGIC);
39+
return init_pseudo(fc, CXL_PSEUDO_FS_MAGIC) ? 0 : -ENOMEM;
4540
}
4641

4742
static struct file_system_type cxl_fs_type = {
4843
.name = "cxl",
4944
.owner = THIS_MODULE,
50-
.mount = cxl_fs_mount,
45+
.init_fs_context = cxl_fs_init_fs_context,
5146
.kill_sb = kill_anon_super,
5247
};
5348

drivers/misc/ibmasm/ibmasmfs.c

+15-6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
*/
6161

6262
#include <linux/fs.h>
63+
#include <linux/fs_context.h>
6364
#include <linux/pagemap.h>
6465
#include <linux/slab.h>
6566
#include <linux/uaccess.h>
@@ -74,13 +75,21 @@ static LIST_HEAD(service_processors);
7475

7576
static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode);
7677
static void ibmasmfs_create_files (struct super_block *sb);
77-
static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent);
78+
static int ibmasmfs_fill_super(struct super_block *sb, struct fs_context *fc);
7879

80+
static int ibmasmfs_get_tree(struct fs_context *fc)
81+
{
82+
return get_tree_single(fc, ibmasmfs_fill_super);
83+
}
7984

80-
static struct dentry *ibmasmfs_mount(struct file_system_type *fst,
81-
int flags, const char *name, void *data)
85+
static const struct fs_context_operations ibmasmfs_context_ops = {
86+
.get_tree = ibmasmfs_get_tree,
87+
};
88+
89+
static int ibmasmfs_init_fs_context(struct fs_context *fc)
8290
{
83-
return mount_single(fst, flags, data, ibmasmfs_fill_super);
91+
fc->ops = &ibmasmfs_context_ops;
92+
return 0;
8493
}
8594

8695
static const struct super_operations ibmasmfs_s_ops = {
@@ -93,12 +102,12 @@ static const struct file_operations *ibmasmfs_dir_ops = &simple_dir_operations;
93102
static struct file_system_type ibmasmfs_type = {
94103
.owner = THIS_MODULE,
95104
.name = "ibmasmfs",
96-
.mount = ibmasmfs_mount,
105+
.init_fs_context = ibmasmfs_init_fs_context,
97106
.kill_sb = kill_litter_super,
98107
};
99108
MODULE_ALIAS_FS("ibmasmfs");
100109

101-
static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent)
110+
static int ibmasmfs_fill_super(struct super_block *sb, struct fs_context *fc)
102111
{
103112
struct inode *root;
104113

drivers/misc/vmw_balloon.c

+6-12
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <linux/slab.h>
3030
#include <linux/spinlock.h>
3131
#include <linux/mount.h>
32+
#include <linux/pseudo_fs.h>
3233
#include <linux/balloon_compaction.h>
3334
#include <linux/vmw_vmci_defs.h>
3435
#include <linux/vmw_vmci_api.h>
@@ -1728,22 +1729,15 @@ static inline void vmballoon_debugfs_exit(struct vmballoon *b)
17281729

17291730
#ifdef CONFIG_BALLOON_COMPACTION
17301731

1731-
static struct dentry *vmballoon_mount(struct file_system_type *fs_type,
1732-
int flags, const char *dev_name,
1733-
void *data)
1732+
static int vmballoon_init_fs_context(struct fs_context *fc)
17341733
{
1735-
static const struct dentry_operations ops = {
1736-
.d_dname = simple_dname,
1737-
};
1738-
1739-
return mount_pseudo(fs_type, "balloon-vmware:", NULL, &ops,
1740-
BALLOON_VMW_MAGIC);
1734+
return init_pseudo(fc, BALLOON_VMW_MAGIC) ? 0 : -ENOMEM;
17411735
}
17421736

17431737
static struct file_system_type vmballoon_fs = {
1744-
.name = "balloon-vmware",
1745-
.mount = vmballoon_mount,
1746-
.kill_sb = kill_anon_super,
1738+
.name = "balloon-vmware",
1739+
.init_fs_context = vmballoon_init_fs_context,
1740+
.kill_sb = kill_anon_super,
17471741
};
17481742

17491743
static struct vfsmount *vmballoon_mnt;

0 commit comments

Comments
 (0)