From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: Song Liu <songliubraving@fb.com>,
linux-usb@vger.kernel.org, bpf@vger.kernel.org,
"Rafael J. Wysocki" <rafael@kernel.org>,
David Airlie <airlied@linux.ie>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Alexei Starovoitov <ast@kernel.org>,
dri-devel@lists.freedesktop.org,
"J. Bruce Fields" <bfields@fieldses.org>,
Joseph Qi <joseph.qi@linux.alibaba.com>,
Hugh Dickins <hughd@google.com>,
Paul Mackerras <paulus@samba.org>,
John Johansen <john.johansen@canonical.com>,
netdev@vger.kernel.org, linux-s390@vger.kernel.org,
Christoph Hellwig <hch@lst.de>,
Andrew Donnellan <ajd@linux.ibm.com>,
Emanuele Giuseppe Esposito <eesposit@redhat.com>,
Matthew Garrett <matthew.garrett@nebula.com>,
linux-efi@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Daniel Borkmann <daniel@iogearbox.net>,
Christian Borntraeger <borntraeger@de.ibm.com>,
linux-rdma@vger.kernel.org, Mark Fasheh <mark@fasheh.>
Subject: [PATCH 5/8] simplefs: add alloc_anon_inode wrapper
Date: Tue, 14 Apr 2020 14:42:59 +0200 [thread overview]
Message-ID: <20200414124304.4470-6-eesposit@redhat.com> (raw)
In-Reply-To: <20200414124304.4470-1-eesposit@redhat.com>
Start adding file creation wrappers, the simplest returns an anonymous
inode.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/misc/cxl/api.c | 2 +-
drivers/scsi/cxlflash/ocxl_hw.c | 2 +-
fs/simplefs.c | 6 ++++++
include/linux/simplefs.h | 2 ++
5 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index b4b357725be2..4e4ea1bf312c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -539,7 +539,7 @@ static struct inode *drm_fs_inode_new(void)
return ERR_PTR(r);
}
- inode = alloc_anon_inode(drm_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&drm_fs);
if (IS_ERR(inode))
simple_release_fs(&drm_fs);
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 6c6566d8bc17..a3d2682eb3a7 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -73,7 +73,7 @@ static struct file *cxl_getfile(const char *name,
goto err_module;
}
- inode = alloc_anon_inode(cxl_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&cxl_fs);
if (IS_ERR(inode)) {
file = ERR_CAST(inode);
goto err_fs;
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 23afde0c6c0e..770fdf186028 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -86,7 +86,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err2;
}
- inode = alloc_anon_inode(ocxlflash_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&ocxlflash_fs);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
dev_err(dev, "%s: alloc_anon_inode failed rc=%d\n",
diff --git a/fs/simplefs.c b/fs/simplefs.c
index 790d8beb9cc3..c59eb8d996be 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -36,3 +36,9 @@ void simple_release_fs(struct simple_fs *fs)
mntput(mnt);
}
EXPORT_SYMBOL(simple_release_fs);
+
+struct inode *simple_alloc_anon_inode(struct simple_fs *fs)
+{
+ return alloc_anon_inode(fs->mount->mnt_sb);
+}
+EXPORT_SYMBOL(simple_alloc_anon_inode);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index 18010414a16f..c62ab526414e 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -12,4 +12,6 @@ struct simple_fs {
extern int simple_pin_fs(struct simple_fs *, struct file_system_type *);
extern void simple_release_fs(struct simple_fs *);
+extern struct inode *simple_alloc_anon_inode(struct simple_fs *fs);
+
#endif
--
2.25.2
next prev parent reply other threads:[~2020-04-14 12:42 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 12:42 [PATCH 0/8] Simplefs: group and simplify linux fs code Emanuele Giuseppe Esposito
2020-04-14 12:42 ` [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null Emanuele Giuseppe Esposito
2020-04-16 6:44 ` Luis Chamberlain
2020-04-20 14:00 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` [PATCH 2/8] fs: extract simple_pin/release_fs to separate files Emanuele Giuseppe Esposito
2020-04-14 12:54 ` Greg Kroah-Hartman
2020-04-16 6:52 ` Luis Chamberlain
2020-04-21 11:19 ` Frederic Barrat
2020-04-21 11:26 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct Emanuele Giuseppe Esposito
2020-04-14 13:03 ` Greg Kroah-Hartman
2020-04-14 12:42 ` [PATCH 4/8] fs: introduce simple_new_inode Emanuele Giuseppe Esposito
2020-04-14 13:01 ` Greg Kroah-Hartman
2020-04-20 13:58 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito [this message]
2020-04-14 12:55 ` [PATCH 5/8] simplefs: add alloc_anon_inode wrapper Greg Kroah-Hartman
2020-04-14 12:43 ` [PATCH 6/8] simplefs: add file creation functions Emanuele Giuseppe Esposito
2020-04-14 12:56 ` Greg Kroah-Hartman
2020-04-20 13:57 ` Emanuele Giuseppe Esposito
2020-04-20 14:28 ` Greg Kroah-Hartman
2020-04-20 14:33 ` Paolo Bonzini
2020-04-14 12:43 ` [PATCH 7/8] debugfs: switch to simplefs inode creation API Emanuele Giuseppe Esposito
2020-04-14 12:43 ` [PATCH 8/8] tracefs: " Emanuele Giuseppe Esposito
2020-04-16 6:59 ` [PATCH 0/8] Simplefs: group and simplify linux fs code Luis Chamberlain
2020-04-20 14:01 ` Emanuele Giuseppe Esposito
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200414124304.4470-6-eesposit@redhat.com \
--to=eesposit@redhat.com \
--cc=airlied@linux.ie \
--cc=ajd@linux.ibm.com \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=bfields@fieldses.org \
--cc=borntraeger@de.ibm.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--cc=heiko.carstens@de.ibm.com \
--cc=hughd@google.com \
--cc=john.johansen@canonical.com \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mark@fasheh. \
--cc=matthew.garrett@nebula.com \
--cc=netdev@vger.kernel.org \
--cc=paulus@samba.org \
--cc=rafael@kernel.org \
--cc=songliubraving@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).