diff mbox series

[013/173] ramfs: support O_TMPFILE

Message ID 20210224200051.MRGrUqyzj%akpm@linux-foundation.org (mailing list archive)
State New, archived
Headers show
Series [001/173] hexagon: remove CONFIG_EXPERIMENTAL from defconfigs | expand

Commit Message

Andrew Morton Feb. 24, 2021, 8 p.m. UTC
From: Alexey Dobriyan <adobriyan@gmail.com>
Subject: ramfs: support O_TMPFILE

[akpm@linux-foundation.org: update inode_operations.tmpfile]
Link: http://lkml.kernel.org/r/20190206073349.GA15311@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/ramfs/inode.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Christian Brauner Feb. 24, 2021, 8:21 p.m. UTC | #1
On Wed, Feb 24, 2021 at 12:00:51PM -0800, Andrew Morton wrote:
> From: Alexey Dobriyan <adobriyan@gmail.com>
> Subject: ramfs: support O_TMPFILE
> 
> [akpm@linux-foundation.org: update inode_operations.tmpfile]
> Link: http://lkml.kernel.org/r/20190206073349.GA15311@avx2
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> Cc: Christian Brauner <christian.brauner@ubuntu.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---

Looks good, thank you for porting this patch!
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
diff mbox series

Patch

--- a/fs/ramfs/inode.c~ramfs-support-o_tmpfile
+++ a/fs/ramfs/inode.c
@@ -151,6 +151,18 @@  static int ramfs_symlink(struct user_nam
 	return error;
 }
 
+static int ramfs_tmpfile(struct user_namespace *mnt_userns,
+			 struct inode *dir, struct dentry *dentry, umode_t mode)
+{
+	struct inode *inode;
+
+	inode = ramfs_get_inode(dir->i_sb, dir, mode, 0);
+	if (!inode)
+		return -ENOSPC;
+	d_tmpfile(dentry, inode);
+	return 0;
+}
+
 static const struct inode_operations ramfs_dir_inode_operations = {
 	.create		= ramfs_create,
 	.lookup		= simple_lookup,
@@ -161,6 +173,7 @@  static const struct inode_operations ram
 	.rmdir		= simple_rmdir,
 	.mknod		= ramfs_mknod,
 	.rename		= simple_rename,
+	.tmpfile	= ramfs_tmpfile,
 };
 
 /*