aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2010-03-04 09:32:22 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2010-05-21 18:31:27 -0400
commita6c5a0342a95f9c7cf18adef79ca52a35cd5e4da (patch)
treeb653744e21077ebaf8ea0d7d9deff828e30d42de /fs
parentabf5d08acaca942b49daf0ed87a9deddc94b183a (diff)
udf: replace inode uid,gid,mode init with helper
Acked-by: Jan Kara <jack@suse.cz> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/udf/ialloc.c11
-rw-r--r--fs/udf/namei.c10
2 files changed, 4 insertions, 17 deletions
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index fb68c9cd0c3e..2b5586c7f02a 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -124,15 +124,8 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
124 udf_updated_lvid(sb); 124 udf_updated_lvid(sb);
125 } 125 }
126 mutex_unlock(&sbi->s_alloc_mutex); 126 mutex_unlock(&sbi->s_alloc_mutex);
127 inode->i_mode = mode; 127
128 inode->i_uid = current_fsuid(); 128 inode_init_owner(inode, dir, mode);
129 if (dir->i_mode & S_ISGID) {
130 inode->i_gid = dir->i_gid;
131 if (S_ISDIR(mode))
132 mode |= S_ISGID;
133 } else {
134 inode->i_gid = current_fsgid();
135 }
136 129
137 iinfo->i_location.logicalBlockNum = block; 130 iinfo->i_location.logicalBlockNum = block;
138 iinfo->i_location.partitionReferenceNum = 131 iinfo->i_location.partitionReferenceNum =
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 75816025f95f..585f733615dc 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -579,7 +579,6 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode,
579 inode->i_data.a_ops = &udf_aops; 579 inode->i_data.a_ops = &udf_aops;
580 inode->i_op = &udf_file_inode_operations; 580 inode->i_op = &udf_file_inode_operations;
581 inode->i_fop = &udf_file_operations; 581 inode->i_fop = &udf_file_operations;
582 inode->i_mode = mode;
583 mark_inode_dirty(inode); 582 mark_inode_dirty(inode);
584 583
585 fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); 584 fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err);
@@ -627,7 +626,6 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode,
627 goto out; 626 goto out;
628 627
629 iinfo = UDF_I(inode); 628 iinfo = UDF_I(inode);
630 inode->i_uid = current_fsuid();
631 init_special_inode(inode, mode, rdev); 629 init_special_inode(inode, mode, rdev);
632 fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); 630 fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err);
633 if (!fi) { 631 if (!fi) {
@@ -674,7 +672,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode)
674 goto out; 672 goto out;
675 673
676 err = -EIO; 674 err = -EIO;
677 inode = udf_new_inode(dir, S_IFDIR, &err); 675 inode = udf_new_inode(dir, S_IFDIR | mode, &err);
678 if (!inode) 676 if (!inode)
679 goto out; 677 goto out;
680 678
@@ -697,9 +695,6 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode)
697 FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT; 695 FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT;
698 udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL); 696 udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL);
699 brelse(fibh.sbh); 697 brelse(fibh.sbh);
700 inode->i_mode = S_IFDIR | mode;
701 if (dir->i_mode & S_ISGID)
702 inode->i_mode |= S_ISGID;
703 mark_inode_dirty(inode); 698 mark_inode_dirty(inode);
704 699
705 fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); 700 fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err);
@@ -912,7 +907,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
912 dquot_initialize(dir); 907 dquot_initialize(dir);
913 908
914 lock_kernel(); 909 lock_kernel();
915 inode = udf_new_inode(dir, S_IFLNK, &err); 910 inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err);
916 if (!inode) 911 if (!inode)
917 goto out; 912 goto out;
918 913
@@ -923,7 +918,6 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
923 } 918 }
924 919
925 iinfo = UDF_I(inode); 920 iinfo = UDF_I(inode);
926 inode->i_mode = S_IFLNK | S_IRWXUGO;
927 inode->i_data.a_ops = &udf_symlink_aops; 921 inode->i_data.a_ops = &udf_symlink_aops;
928 inode->i_op = &udf_symlink_inode_operations; 922 inode->i_op = &udf_symlink_inode_operations;
929 923