minix: replace inode uid,gid,mode init with helper
- also redesign minix_new_inode interface Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
		
							parent
							
								
									b10b852090
								
							
						
					
					
						commit
						9eed1fb721
					
				| @ -221,7 +221,7 @@ void minix_free_inode(struct inode * inode) | ||||
| 	clear_inode(inode);		/* clear in-memory copy */ | ||||
| } | ||||
| 
 | ||||
| struct inode * minix_new_inode(const struct inode * dir, int * error) | ||||
| struct inode *minix_new_inode(const struct inode *dir, int mode, int *error) | ||||
| { | ||||
| 	struct super_block *sb = dir->i_sb; | ||||
| 	struct minix_sb_info *sbi = minix_sb(sb); | ||||
| @ -263,8 +263,7 @@ struct inode * minix_new_inode(const struct inode * dir, int * error) | ||||
| 		iput(inode); | ||||
| 		return NULL; | ||||
| 	} | ||||
| 	inode->i_uid = current_fsuid(); | ||||
| 	inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current_fsgid(); | ||||
| 	inode_init_owner(inode, dir, mode); | ||||
| 	inode->i_ino = j; | ||||
| 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; | ||||
| 	inode->i_blocks = 0; | ||||
|  | ||||
| @ -46,7 +46,7 @@ struct minix_sb_info { | ||||
| extern struct inode *minix_iget(struct super_block *, unsigned long); | ||||
| extern struct minix_inode * minix_V1_raw_inode(struct super_block *, ino_t, struct buffer_head **); | ||||
| extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **); | ||||
| extern struct inode * minix_new_inode(const struct inode * dir, int * error); | ||||
| extern struct inode * minix_new_inode(const struct inode *, int, int *); | ||||
| extern void minix_free_inode(struct inode * inode); | ||||
| extern unsigned long minix_count_free_inodes(struct minix_sb_info *sbi); | ||||
| extern int minix_new_block(struct inode * inode); | ||||
|  | ||||
| @ -46,10 +46,9 @@ static int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, dev_ | ||||
| 	if (!old_valid_dev(rdev)) | ||||
| 		return -EINVAL; | ||||
| 
 | ||||
| 	inode = minix_new_inode(dir, &error); | ||||
| 	inode = minix_new_inode(dir, mode, &error); | ||||
| 
 | ||||
| 	if (inode) { | ||||
| 		inode->i_mode = mode; | ||||
| 		minix_set_inode(inode, rdev); | ||||
| 		mark_inode_dirty(inode); | ||||
| 		error = add_nondir(dentry, inode); | ||||
| @ -73,11 +72,10 @@ static int minix_symlink(struct inode * dir, struct dentry *dentry, | ||||
| 	if (i > dir->i_sb->s_blocksize) | ||||
| 		goto out; | ||||
| 
 | ||||
| 	inode = minix_new_inode(dir, &err); | ||||
| 	inode = minix_new_inode(dir, S_IFLNK | 0777, &err); | ||||
| 	if (!inode) | ||||
| 		goto out; | ||||
| 
 | ||||
| 	inode->i_mode = S_IFLNK | 0777; | ||||
| 	minix_set_inode(inode, 0); | ||||
| 	err = page_symlink(inode, symname, i); | ||||
| 	if (err) | ||||
| @ -117,13 +115,10 @@ static int minix_mkdir(struct inode * dir, struct dentry *dentry, int mode) | ||||
| 
 | ||||
| 	inode_inc_link_count(dir); | ||||
| 
 | ||||
| 	inode = minix_new_inode(dir, &err); | ||||
| 	inode = minix_new_inode(dir, mode, &err); | ||||
| 	if (!inode) | ||||
| 		goto out_dir; | ||||
| 
 | ||||
| 	inode->i_mode = S_IFDIR | mode; | ||||
| 	if (dir->i_mode & S_ISGID) | ||||
| 		inode->i_mode |= S_ISGID; | ||||
| 	minix_set_inode(inode, 0); | ||||
| 
 | ||||
| 	inode_inc_link_count(inode); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user