Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762434AbbEESGX (ORCPT ); Tue, 5 May 2015 14:06:23 -0400 Received: from mailrelay109.isp.belgacom.be ([195.238.20.136]:30602 "EHLO mailrelay109.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756133AbbEESGW (ORCPT ); Tue, 5 May 2015 14:06:22 -0400 X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=hkFBDakPHWYIOok4y3pcivnmCJQbEK2MeX2RAJ8hs1E= c=1 sm=2 a=Z4Rwk6OoAAAA:8 a=drOt6m5kAAAA:8 a=SNHYoMgFZDt3h7oDMzYA:9 a=dTcP65teM8Y3XVNZ:21 a=e_X6Z5gOb48r4BlI:21 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2DNEAClBUlV/5ETQFdcgwyBL7QQAQEBAQEFAYECmEkCgTtNAQEBAQEBgQtBBYNbAQEEJy8jEFE5HhmIMAHEdQEBAQcihheKJwcWhBcFkXeKfJYvI2CBJxyBUzwxgkUBAQE From: Fabian Frederick To: linux-kernel@vger.kernel.org Cc: Fabian Frederick , Andrew Morton , Alexander Viro , Jan Kara Subject: [PATCH 2/2 linux-next] AFFS: add tmpfile support Date: Tue, 5 May 2015 20:06:10 +0200 Message-Id: <1430849170-1171-2-git-send-email-fabf@skynet.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430849170-1171-1-git-send-email-fabf@skynet.be> References: <1430849170-1171-1-git-send-email-fabf@skynet.be> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2446 Lines: 79 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 Cc: Alexander Viro Cc: Jan Kara Signed-off-by: Fabian Frederick --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/