From patchwork Fri Aug 23 02:48:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Xiang X-Patchwork-Id: 2848518 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0F29D9F239 for ; Fri, 23 Aug 2013 02:51:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F03CF202FE for ; Fri, 23 Aug 2013 02:51:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4066320360 for ; Fri, 23 Aug 2013 02:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753486Ab3HWCtq (ORCPT ); Thu, 22 Aug 2013 22:49:46 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:61386 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752672Ab3HWCtp (ORCPT ); Thu, 22 Aug 2013 22:49:45 -0400 Received: from 172.24.2.119 (EHLO szxeml207-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BGI21971; Fri, 23 Aug 2013 10:49:39 +0800 (CST) Received: from SZXEML460-HUB.china.huawei.com (10.82.67.203) by szxeml207-edg.china.huawei.com (172.24.2.56) with Microsoft SMTP Server (TLS) id 14.1.323.7; Fri, 23 Aug 2013 10:49:34 +0800 Received: from localhost (10.135.72.188) by szxeml460-hub.china.huawei.com (10.82.67.203) with Microsoft SMTP Server id 14.1.323.7; Fri, 23 Aug 2013 10:49:28 +0800 From: Rui Xiang To: , CC: , , , , , , , , , , Rui Xiang Subject: [PATCH 1/2] fs: implement inode uid/gid setting function Date: Fri, 23 Aug 2013 10:48:37 +0800 Message-ID: <1377226118-43756-2-git-send-email-rui.xiang@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 In-Reply-To: <1377226118-43756-1-git-send-email-rui.xiang@huawei.com> References: <1377226118-43756-1-git-send-email-rui.xiang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.135.72.188] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Supply a interface inode_set_user to set uid/gid of inode structs. Signed-off-by: Rui Xiang --- fs/inode.c | 7 +++++++ include/linux/fs.h | 1 + 2 files changed, 8 insertions(+) diff --git a/fs/inode.c b/fs/inode.c index e315c0a..3f90499 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -343,6 +343,13 @@ void inc_nlink(struct inode *inode) } EXPORT_SYMBOL(inc_nlink); +void inode_set_user(struct inode *inode, kuid_t uid, kgid_t gid) +{ + inode->i_uid = uid; + inode->i_gid = gid; +} +EXPORT_SYMBOL(inode_set_user); + void address_space_init_once(struct address_space *mapping) { memset(mapping, 0, sizeof(*mapping)); diff --git a/include/linux/fs.h b/include/linux/fs.h index 729e81b..36ac51b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2619,6 +2619,7 @@ void __inode_sub_bytes(struct inode *inode, loff_t bytes); void inode_sub_bytes(struct inode *inode, loff_t bytes); loff_t inode_get_bytes(struct inode *inode); void inode_set_bytes(struct inode *inode, loff_t bytes); +void inode_set_user(struct inode *inode, kuid_t uid, kgid_t gid); extern int vfs_readdir(struct file *, filldir_t, void *); extern int iterate_dir(struct file *, struct dir_context *);