All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabian Frederick <fabf@skynet.be>
To: linux-kernel@vger.kernel.org
Cc: Fabian Frederick <fabf@skynet.be>,
	Andrew Morton <akpm@linux-foundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>
Subject: [PATCH 2/2 linux-next] AFFS: add tmpfile support
Date: Tue,  5 May 2015 20:06:10 +0200	[thread overview]
Message-ID: <1430849170-1171-2-git-send-email-fabf@skynet.be> (raw)
In-Reply-To: <1430849170-1171-1-git-send-email-fabf@skynet.be>

Based on the following patch:
commit 60545d0d4610 ("[O_TMPFILE] it's still short a few helpers,
 but infrastructure should be OK now...")

Tested with xfstests generic/004

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/affs/affs.h  |  1 +
 fs/affs/dir.c   |  1 +
 fs/affs/namei.c | 23 +++++++++++++++++++++++
 3 files changed, 25 insertions(+)

diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index cffe837..c3f60a5 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -180,6 +180,7 @@ extern int	affs_rename(struct inode *old_dir, struct dentry *old_dentry,
 extern unsigned long		 affs_parent_ino(struct inode *dir);
 extern struct inode		*affs_new_inode(struct inode *dir);
 extern int			 affs_notify_change(struct dentry *dentry, struct iattr *attr);
+extern int affs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode);
 extern void			 affs_evict_inode(struct inode *inode);
 extern struct inode		*affs_iget(struct super_block *sb,
 					unsigned long ino);
diff --git a/fs/affs/dir.c b/fs/affs/dir.c
index ac4f318..2b0e5ea 100644
--- a/fs/affs/dir.c
+++ b/fs/affs/dir.c
@@ -37,6 +37,7 @@ const struct inode_operations affs_dir_inode_operations = {
 	.rmdir		= affs_rmdir,
 	.rename		= affs_rename,
 	.setattr	= affs_notify_change,
+	.tmpfile	= affs_tmpfile,
 };
 
 static int
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index b183540..7c3909a 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -466,3 +466,26 @@ done:
 	affs_brelse(bh);
 	return retval;
 }
+
+int affs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
+{
+
+	struct super_block *sb = dir->i_sb;
+	struct affs_sb_info *sbi = AFFS_SB(sb);
+	struct inode *inode;
+
+	inode = affs_new_inode(dir);
+	if (!inode)
+		return -ENOSPC;
+
+	inode->i_mode = mode;
+	mode_to_prot(inode);
+	inode->i_mapping->a_ops = affs_test_opt(sbi->s_flags, SF_OFS) ?
+				  &affs_aops_ofs : &affs_aops;
+	inode->i_op = &affs_file_inode_operations;
+	inode->i_fop = &affs_file_operations;
+	mark_inode_dirty(inode);
+	d_tmpfile(dentry, inode);
+	unlock_new_inode(inode);
+	return 0;
+}
-- 
1.9.1


  reply	other threads:[~2015-05-05 18:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 18:06 [PATCH 1/2 linux-next] fs/affs/inode.c: mark new inode before hashtable insertion Fabian Frederick
2015-05-05 18:06 ` Fabian Frederick [this message]
2015-05-06  7:34   ` [PATCH 2/2 linux-next] AFFS: add tmpfile support Jan Kara
2015-05-06  7:04 ` [PATCH 1/2 linux-next] fs/affs/inode.c: mark new inode before hashtable insertion Jan Kara

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=1430849170-1171-2-git-send-email-fabf@skynet.be \
    --to=fabf@skynet.be \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.