Patchwork [1/2] fs: implement inode uid/gid setting function

login
register
mail settings
Submitter Rui Xiang
Date Aug. 23, 2013, 2:48 a.m.
Message ID <1377226118-43756-2-git-send-email-rui.xiang@huawei.com>
Download mbox | patch
Permalink /patch/269564/
State Not Applicable
Headers show

Comments

Rui Xiang - Aug. 23, 2013, 2:48 a.m.
Supply a interface inode_set_user  to set uid/gid of inode
structs.

Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
---
 fs/inode.c         | 7 +++++++
 include/linux/fs.h | 1 +
 2 files changed, 8 insertions(+)

Patch

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 *);