Skip to content

Commit

Permalink
Merge branch 'work.mount0' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/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()
  ...
  • Loading branch information
torvalds committed Jul 19, 2019
2 parents 5f4fc6d + 037f11b commit 933a90b
Show file tree
Hide file tree
Showing 60 changed files with 581 additions and 533 deletions.
17 changes: 10 additions & 7 deletions arch/ia64/kernel/perfmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <linux/smp.h>
#include <linux/pagemap.h>
#include <linux/mount.h>
#include <linux/pseudo_fs.h>
#include <linux/bitops.h>
#include <linux/capability.h>
#include <linux/rcupdate.h>
Expand Down Expand Up @@ -600,17 +601,19 @@ pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f)
/* forward declaration */
static const struct dentry_operations pfmfs_dentry_operations;

static struct dentry *
pfmfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
static int pfmfs_init_fs_context(struct fs_context *fc)
{
return mount_pseudo(fs_type, "pfm:", NULL, &pfmfs_dentry_operations,
PFMFS_MAGIC);
struct pseudo_fs_context *ctx = init_pseudo(fc, PFMFS_MAGIC);
if (!ctx)
return -ENOMEM;
ctx->dops = &pfmfs_dentry_operations;
return 0;
}

static struct file_system_type pfm_fs_type = {
.name = "pfmfs",
.mount = pfmfs_mount,
.kill_sb = kill_anon_super,
.name = "pfmfs",
.init_fs_context = pfmfs_init_fs_context,
.kill_sb = kill_anon_super,
};
MODULE_ALIAS_FS("pfmfs");

Expand Down
3 changes: 1 addition & 2 deletions arch/x86/kernel/cpu/resctrl/rdtgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -2104,8 +2104,7 @@ static int rdt_init_fs_context(struct fs_context *fc)
ctx->kfc.magic = RDTGROUP_SUPER_MAGIC;
fc->fs_private = &ctx->kfc;
fc->ops = &rdt_fs_context_ops;
if (fc->user_ns)
put_user_ns(fc->user_ns);
put_user_ns(fc->user_ns);
fc->user_ns = get_user_ns(&init_user_ns);
fc->global = true;
return 0;
Expand Down
3 changes: 1 addition & 2 deletions drivers/base/devtmpfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,7 @@ int devtmpfs_mount(const char *mntdir)
if (!thread)
return 0;

err = ksys_mount("devtmpfs", (char *)mntdir, "devtmpfs", MS_SILENT,
NULL);
err = ksys_mount("devtmpfs", mntdir, "devtmpfs", MS_SILENT, NULL);
if (err)
printk(KERN_INFO "devtmpfs: error mounting %i\n", err);
else
Expand Down
23 changes: 10 additions & 13 deletions drivers/dax/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <linux/pagemap.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/pseudo_fs.h>
#include <linux/magic.h>
#include <linux/genhd.h>
#include <linux/pfn_t.h>
Expand Down Expand Up @@ -469,16 +470,19 @@ static const struct super_operations dax_sops = {
.drop_inode = generic_delete_inode,
};

static struct dentry *dax_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
static int dax_init_fs_context(struct fs_context *fc)
{
return mount_pseudo(fs_type, "dax:", &dax_sops, NULL, DAXFS_MAGIC);
struct pseudo_fs_context *ctx = init_pseudo(fc, DAXFS_MAGIC);
if (!ctx)
return -ENOMEM;
ctx->ops = &dax_sops;
return 0;
}

static struct file_system_type dax_fs_type = {
.name = "dax",
.mount = dax_mount,
.kill_sb = kill_anon_super,
.name = "dax",
.init_fs_context = dax_init_fs_context,
.kill_sb = kill_anon_super,
};

static int dax_test(struct inode *inode, void *data)
Expand Down Expand Up @@ -665,10 +669,6 @@ static int dax_fs_init(void)
if (!dax_cache)
return -ENOMEM;

rc = register_filesystem(&dax_fs_type);
if (rc)
goto err_register_fs;

dax_mnt = kern_mount(&dax_fs_type);
if (IS_ERR(dax_mnt)) {
rc = PTR_ERR(dax_mnt);
Expand All @@ -679,8 +679,6 @@ static int dax_fs_init(void)
return 0;

err_mount:
unregister_filesystem(&dax_fs_type);
err_register_fs:
kmem_cache_destroy(dax_cache);

return rc;
Expand All @@ -689,7 +687,6 @@ static int dax_fs_init(void)
static void dax_fs_exit(void)
{
kern_unmount(dax_mnt);
unregister_filesystem(&dax_fs_type);
kmem_cache_destroy(dax_cache);
}

Expand Down
15 changes: 10 additions & 5 deletions drivers/dma-buf/dma-buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/reservation.h>
#include <linux/mm.h>
#include <linux/mount.h>
#include <linux/pseudo_fs.h>

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

static struct vfsmount *dma_buf_mnt;

static struct dentry *dma_buf_fs_mount(struct file_system_type *fs_type,
int flags, const char *name, void *data)
static int dma_buf_fs_init_context(struct fs_context *fc)
{
return mount_pseudo(fs_type, "dmabuf:", NULL, &dma_buf_dentry_ops,
DMA_BUF_MAGIC);
struct pseudo_fs_context *ctx;

ctx = init_pseudo(fc, DMA_BUF_MAGIC);
if (!ctx)
return -ENOMEM;
ctx->dops = &dma_buf_dentry_ops;
return 0;
}

static struct file_system_type dma_buf_fs_type = {
.name = "dmabuf",
.mount = dma_buf_fs_mount,
.init_fs_context = dma_buf_fs_init_context,
.kill_sb = kill_anon_super,
};

Expand Down
20 changes: 4 additions & 16 deletions drivers/gpu/drm/drm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mount.h>
#include <linux/pseudo_fs.h>
#include <linux/slab.h>
#include <linux/srcu.h>

Expand Down Expand Up @@ -535,28 +536,15 @@ EXPORT_SYMBOL(drm_dev_unplug);
static int drm_fs_cnt;
static struct vfsmount *drm_fs_mnt;

static const struct dentry_operations drm_fs_dops = {
.d_dname = simple_dname,
};

static const struct super_operations drm_fs_sops = {
.statfs = simple_statfs,
};

static struct dentry *drm_fs_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data)
static int drm_fs_init_fs_context(struct fs_context *fc)
{
return mount_pseudo(fs_type,
"drm:",
&drm_fs_sops,
&drm_fs_dops,
0x010203ff);
return init_pseudo(fc, 0x010203ff) ? 0 : -ENOMEM;
}

static struct file_system_type drm_fs_type = {
.name = "drm",
.owner = THIS_MODULE,
.mount = drm_fs_mount,
.init_fs_context = drm_fs_init_fs_context,
.kill_sb = kill_anon_super,
};

Expand Down
26 changes: 17 additions & 9 deletions drivers/infiniband/hw/qib/qib_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/fs_context.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/init.h>
Expand Down Expand Up @@ -506,7 +507,7 @@ static int remove_device_files(struct super_block *sb,
* after device init. The direct add_cntr_files() call handles adding
* them from the init code, when the fs is already mounted.
*/
static int qibfs_fill_super(struct super_block *sb, void *data, int silent)
static int qibfs_fill_super(struct super_block *sb, struct fs_context *fc)
{
struct qib_devdata *dd;
unsigned long index;
Expand Down Expand Up @@ -534,17 +535,24 @@ static int qibfs_fill_super(struct super_block *sb, void *data, int silent)
return ret;
}

static struct dentry *qibfs_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data)
static int qibfs_get_tree(struct fs_context *fc)
{
struct dentry *ret;

ret = mount_single(fs_type, flags, data, qibfs_fill_super);
if (!IS_ERR(ret))
qib_super = ret->d_sb;
int ret = get_tree_single(fc, qibfs_fill_super);
if (ret == 0)
qib_super = fc->root->d_sb;
return ret;
}

static const struct fs_context_operations qibfs_context_ops = {
.get_tree = qibfs_get_tree,
};

static int qibfs_init_fs_context(struct fs_context *fc)
{
fc->ops = &qibfs_context_ops;
return 0;
}

static void qibfs_kill_super(struct super_block *s)
{
kill_litter_super(s);
Expand Down Expand Up @@ -583,7 +591,7 @@ int qibfs_remove(struct qib_devdata *dd)
static struct file_system_type qibfs_fs_type = {
.owner = THIS_MODULE,
.name = "ipathfs",
.mount = qibfs_mount,
.init_fs_context = qibfs_init_fs_context,
.kill_sb = qibfs_kill_super,
};
MODULE_ALIAS_FS("ipathfs");
Expand Down
13 changes: 4 additions & 9 deletions drivers/misc/cxl/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <misc/cxl.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/pseudo_fs.h>
#include <linux/sched/mm.h>
#include <linux/mmu_context.h>

Expand All @@ -33,21 +34,15 @@
static int cxl_fs_cnt;
static struct vfsmount *cxl_vfs_mount;

static const struct dentry_operations cxl_fs_dops = {
.d_dname = simple_dname,
};

static struct dentry *cxl_fs_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data)
static int cxl_fs_init_fs_context(struct fs_context *fc)
{
return mount_pseudo(fs_type, "cxl:", NULL, &cxl_fs_dops,
CXL_PSEUDO_FS_MAGIC);
return init_pseudo(fc, CXL_PSEUDO_FS_MAGIC) ? 0 : -ENOMEM;
}

static struct file_system_type cxl_fs_type = {
.name = "cxl",
.owner = THIS_MODULE,
.mount = cxl_fs_mount,
.init_fs_context = cxl_fs_init_fs_context,
.kill_sb = kill_anon_super,
};

Expand Down
21 changes: 15 additions & 6 deletions drivers/misc/ibmasm/ibmasmfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
*/

#include <linux/fs.h>
#include <linux/fs_context.h>
#include <linux/pagemap.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
Expand All @@ -74,13 +75,21 @@ static LIST_HEAD(service_processors);

static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode);
static void ibmasmfs_create_files (struct super_block *sb);
static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent);
static int ibmasmfs_fill_super(struct super_block *sb, struct fs_context *fc);

static int ibmasmfs_get_tree(struct fs_context *fc)
{
return get_tree_single(fc, ibmasmfs_fill_super);
}

static struct dentry *ibmasmfs_mount(struct file_system_type *fst,
int flags, const char *name, void *data)
static const struct fs_context_operations ibmasmfs_context_ops = {
.get_tree = ibmasmfs_get_tree,
};

static int ibmasmfs_init_fs_context(struct fs_context *fc)
{
return mount_single(fst, flags, data, ibmasmfs_fill_super);
fc->ops = &ibmasmfs_context_ops;
return 0;
}

static const struct super_operations ibmasmfs_s_ops = {
Expand All @@ -93,12 +102,12 @@ static const struct file_operations *ibmasmfs_dir_ops = &simple_dir_operations;
static struct file_system_type ibmasmfs_type = {
.owner = THIS_MODULE,
.name = "ibmasmfs",
.mount = ibmasmfs_mount,
.init_fs_context = ibmasmfs_init_fs_context,
.kill_sb = kill_litter_super,
};
MODULE_ALIAS_FS("ibmasmfs");

static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent)
static int ibmasmfs_fill_super(struct super_block *sb, struct fs_context *fc)
{
struct inode *root;

Expand Down
18 changes: 6 additions & 12 deletions drivers/misc/vmw_balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/mount.h>
#include <linux/pseudo_fs.h>
#include <linux/balloon_compaction.h>
#include <linux/vmw_vmci_defs.h>
#include <linux/vmw_vmci_api.h>
Expand Down Expand Up @@ -1728,22 +1729,15 @@ static inline void vmballoon_debugfs_exit(struct vmballoon *b)

#ifdef CONFIG_BALLOON_COMPACTION

static struct dentry *vmballoon_mount(struct file_system_type *fs_type,
int flags, const char *dev_name,
void *data)
static int vmballoon_init_fs_context(struct fs_context *fc)
{
static const struct dentry_operations ops = {
.d_dname = simple_dname,
};

return mount_pseudo(fs_type, "balloon-vmware:", NULL, &ops,
BALLOON_VMW_MAGIC);
return init_pseudo(fc, BALLOON_VMW_MAGIC) ? 0 : -ENOMEM;
}

static struct file_system_type vmballoon_fs = {
.name = "balloon-vmware",
.mount = vmballoon_mount,
.kill_sb = kill_anon_super,
.name = "balloon-vmware",
.init_fs_context = vmballoon_init_fs_context,
.kill_sb = kill_anon_super,
};

static struct vfsmount *vmballoon_mnt;
Expand Down
Loading

0 comments on commit 933a90b

Please sign in to comment.