ramfs: support O_TMPFILE
diff mbox series

Message ID 20190206073349.GA15311@avx2
State In Next
Commit c4449ea34cb7ecd24ba8a55c5d7bf3a3bee6f055
Headers show
Series
  • ramfs: support O_TMPFILE
Related show

Commit Message

Alexey Dobriyan Feb. 6, 2019, 7:33 a.m. UTC
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

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

Patch
diff mbox series

--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -145,6 +145,17 @@  static int ramfs_symlink(struct inode * dir, struct dentry *dentry, const char *
 	return error;
 }
 
+static int ramfs_tmpfile(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,
@@ -155,6 +166,7 @@  static const struct inode_operations ramfs_dir_inode_operations = {
 	.rmdir		= simple_rmdir,
 	.mknod		= ramfs_mknod,
 	.rename		= simple_rename,
+	.tmpfile	= ramfs_tmpfile,
 };
 
 /*