switch posix_acl_equiv_mode() to umode_t *
... so that &inode->i_mode could be passed to it Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
		
					parent
					
						
							
								d3fb612076
							
						
					
				
			
			
				commit
				
					
						d6952123b5
					
				
			
		
					 14 changed files with 15 additions and 32 deletions
				
			
		|  | @ -319,7 +319,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name, | ||||||
| 	case ACL_TYPE_ACCESS: | 	case ACL_TYPE_ACCESS: | ||||||
| 		name = POSIX_ACL_XATTR_ACCESS; | 		name = POSIX_ACL_XATTR_ACCESS; | ||||||
| 		if (acl) { | 		if (acl) { | ||||||
| 			mode_t mode = inode->i_mode; | 			umode_t mode = inode->i_mode; | ||||||
| 			retval = posix_acl_equiv_mode(acl, &mode); | 			retval = posix_acl_equiv_mode(acl, &mode); | ||||||
| 			if (retval < 0) | 			if (retval < 0) | ||||||
| 				goto err_out; | 				goto err_out; | ||||||
|  |  | ||||||
|  | @ -111,7 +111,6 @@ static int btrfs_set_acl(struct btrfs_trans_handle *trans, | ||||||
| 	int ret, size = 0; | 	int ret, size = 0; | ||||||
| 	const char *name; | 	const char *name; | ||||||
| 	char *value = NULL; | 	char *value = NULL; | ||||||
| 	mode_t mode; |  | ||||||
| 
 | 
 | ||||||
| 	if (acl) { | 	if (acl) { | ||||||
| 		ret = posix_acl_valid(acl); | 		ret = posix_acl_valid(acl); | ||||||
|  | @ -122,13 +121,11 @@ static int btrfs_set_acl(struct btrfs_trans_handle *trans, | ||||||
| 
 | 
 | ||||||
| 	switch (type) { | 	switch (type) { | ||||||
| 	case ACL_TYPE_ACCESS: | 	case ACL_TYPE_ACCESS: | ||||||
| 		mode = inode->i_mode; |  | ||||||
| 		name = POSIX_ACL_XATTR_ACCESS; | 		name = POSIX_ACL_XATTR_ACCESS; | ||||||
| 		if (acl) { | 		if (acl) { | ||||||
| 			ret = posix_acl_equiv_mode(acl, &mode); | 			ret = posix_acl_equiv_mode(acl, &inode->i_mode); | ||||||
| 			if (ret < 0) | 			if (ret < 0) | ||||||
| 				return ret; | 				return ret; | ||||||
| 			inode->i_mode = mode; |  | ||||||
| 		} | 		} | ||||||
| 		ret = 0; | 		ret = 0; | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
|  | @ -194,12 +194,10 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl) | ||||||
| 		case ACL_TYPE_ACCESS: | 		case ACL_TYPE_ACCESS: | ||||||
| 			name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; | 			name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; | ||||||
| 			if (acl) { | 			if (acl) { | ||||||
| 				mode_t mode = inode->i_mode; | 				error = posix_acl_equiv_mode(acl, &inode->i_mode); | ||||||
| 				error = posix_acl_equiv_mode(acl, &mode); |  | ||||||
| 				if (error < 0) | 				if (error < 0) | ||||||
| 					return error; | 					return error; | ||||||
| 				else { | 				else { | ||||||
| 					inode->i_mode = mode; |  | ||||||
| 					inode->i_ctime = CURRENT_TIME_SEC; | 					inode->i_ctime = CURRENT_TIME_SEC; | ||||||
| 					mark_inode_dirty(inode); | 					mark_inode_dirty(inode); | ||||||
| 					if (error == 0) | 					if (error == 0) | ||||||
|  |  | ||||||
|  | @ -199,12 +199,10 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type, | ||||||
| 		case ACL_TYPE_ACCESS: | 		case ACL_TYPE_ACCESS: | ||||||
| 			name_index = EXT3_XATTR_INDEX_POSIX_ACL_ACCESS; | 			name_index = EXT3_XATTR_INDEX_POSIX_ACL_ACCESS; | ||||||
| 			if (acl) { | 			if (acl) { | ||||||
| 				mode_t mode = inode->i_mode; | 				error = posix_acl_equiv_mode(acl, &inode->i_mode); | ||||||
| 				error = posix_acl_equiv_mode(acl, &mode); |  | ||||||
| 				if (error < 0) | 				if (error < 0) | ||||||
| 					return error; | 					return error; | ||||||
| 				else { | 				else { | ||||||
| 					inode->i_mode = mode; |  | ||||||
| 					inode->i_ctime = CURRENT_TIME_SEC; | 					inode->i_ctime = CURRENT_TIME_SEC; | ||||||
| 					ext3_mark_inode_dirty(handle, inode); | 					ext3_mark_inode_dirty(handle, inode); | ||||||
| 					if (error == 0) | 					if (error == 0) | ||||||
|  |  | ||||||
|  | @ -198,12 +198,10 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type, | ||||||
| 	case ACL_TYPE_ACCESS: | 	case ACL_TYPE_ACCESS: | ||||||
| 		name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS; | 		name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS; | ||||||
| 		if (acl) { | 		if (acl) { | ||||||
| 			mode_t mode = inode->i_mode; | 			error = posix_acl_equiv_mode(acl, &inode->i_mode); | ||||||
| 			error = posix_acl_equiv_mode(acl, &mode); |  | ||||||
| 			if (error < 0) | 			if (error < 0) | ||||||
| 				return error; | 				return error; | ||||||
| 			else { | 			else { | ||||||
| 				inode->i_mode = mode; |  | ||||||
| 				inode->i_ctime = ext4_current_time(inode); | 				inode->i_ctime = ext4_current_time(inode); | ||||||
| 				ext4_mark_inode_dirty(handle, inode); | 				ext4_mark_inode_dirty(handle, inode); | ||||||
| 				if (error == 0) | 				if (error == 0) | ||||||
|  |  | ||||||
|  | @ -82,18 +82,14 @@ generic_acl_set(struct dentry *dentry, const char *name, const void *value, | ||||||
| 			return PTR_ERR(acl); | 			return PTR_ERR(acl); | ||||||
| 	} | 	} | ||||||
| 	if (acl) { | 	if (acl) { | ||||||
| 		mode_t mode; |  | ||||||
| 
 |  | ||||||
| 		error = posix_acl_valid(acl); | 		error = posix_acl_valid(acl); | ||||||
| 		if (error) | 		if (error) | ||||||
| 			goto failed; | 			goto failed; | ||||||
| 		switch (type) { | 		switch (type) { | ||||||
| 		case ACL_TYPE_ACCESS: | 		case ACL_TYPE_ACCESS: | ||||||
| 			mode = inode->i_mode; | 			error = posix_acl_equiv_mode(acl, &inode->i_mode); | ||||||
| 			error = posix_acl_equiv_mode(acl, &mode); |  | ||||||
| 			if (error < 0) | 			if (error < 0) | ||||||
| 				goto failed; | 				goto failed; | ||||||
| 			inode->i_mode = mode; |  | ||||||
| 			inode->i_ctime = CURRENT_TIME; | 			inode->i_ctime = CURRENT_TIME; | ||||||
| 			if (error == 0) { | 			if (error == 0) { | ||||||
| 				posix_acl_release(acl); | 				posix_acl_release(acl); | ||||||
|  |  | ||||||
|  | @ -276,7 +276,7 @@ static int gfs2_xattr_system_set(struct dentry *dentry, const char *name, | ||||||
| 		goto out_release; | 		goto out_release; | ||||||
| 
 | 
 | ||||||
| 	if (type == ACL_TYPE_ACCESS) { | 	if (type == ACL_TYPE_ACCESS) { | ||||||
| 		mode_t mode = inode->i_mode; | 		umode_t mode = inode->i_mode; | ||||||
| 		error = posix_acl_equiv_mode(acl, &mode); | 		error = posix_acl_equiv_mode(acl, &mode); | ||||||
| 
 | 
 | ||||||
| 		if (error <= 0) { | 		if (error <= 0) { | ||||||
|  |  | ||||||
|  | @ -227,7 +227,7 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl) | ||||||
| 	case ACL_TYPE_ACCESS: | 	case ACL_TYPE_ACCESS: | ||||||
| 		xprefix = JFFS2_XPREFIX_ACL_ACCESS; | 		xprefix = JFFS2_XPREFIX_ACL_ACCESS; | ||||||
| 		if (acl) { | 		if (acl) { | ||||||
| 			mode_t mode = inode->i_mode; | 			umode_t mode = inode->i_mode; | ||||||
| 			rc = posix_acl_equiv_mode(acl, &mode); | 			rc = posix_acl_equiv_mode(acl, &mode); | ||||||
| 			if (rc < 0) | 			if (rc < 0) | ||||||
| 				return rc; | 				return rc; | ||||||
|  |  | ||||||
|  | @ -693,8 +693,7 @@ static int can_set_system_xattr(struct inode *inode, const char *name, | ||||||
| 			return rc; | 			return rc; | ||||||
| 		} | 		} | ||||||
| 		if (acl) { | 		if (acl) { | ||||||
| 			mode_t mode = inode->i_mode; | 			rc = posix_acl_equiv_mode(acl, &inode->i_mode); | ||||||
| 			rc = posix_acl_equiv_mode(acl, &mode); |  | ||||||
| 			posix_acl_release(acl); | 			posix_acl_release(acl); | ||||||
| 			if (rc < 0) { | 			if (rc < 0) { | ||||||
| 				printk(KERN_ERR | 				printk(KERN_ERR | ||||||
|  | @ -702,7 +701,6 @@ static int can_set_system_xattr(struct inode *inode, const char *name, | ||||||
| 				       rc); | 				       rc); | ||||||
| 				return rc; | 				return rc; | ||||||
| 			} | 			} | ||||||
| 			inode->i_mode = mode; |  | ||||||
| 			mark_inode_dirty(inode); | 			mark_inode_dirty(inode); | ||||||
| 		} | 		} | ||||||
| 		/*
 | 		/*
 | ||||||
|  |  | ||||||
|  | @ -247,7 +247,7 @@ static int ocfs2_set_acl(handle_t *handle, | ||||||
| 	case ACL_TYPE_ACCESS: | 	case ACL_TYPE_ACCESS: | ||||||
| 		name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS; | 		name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS; | ||||||
| 		if (acl) { | 		if (acl) { | ||||||
| 			mode_t mode = inode->i_mode; | 			umode_t mode = inode->i_mode; | ||||||
| 			ret = posix_acl_equiv_mode(acl, &mode); | 			ret = posix_acl_equiv_mode(acl, &mode); | ||||||
| 			if (ret < 0) | 			if (ret < 0) | ||||||
| 				return ret; | 				return ret; | ||||||
|  |  | ||||||
|  | @ -149,10 +149,10 @@ posix_acl_valid(const struct posix_acl *acl) | ||||||
|  * file mode permission bits, or else 1. Returns -E... on error. |  * file mode permission bits, or else 1. Returns -E... on error. | ||||||
|  */ |  */ | ||||||
| int | int | ||||||
| posix_acl_equiv_mode(const struct posix_acl *acl, mode_t *mode_p) | posix_acl_equiv_mode(const struct posix_acl *acl, umode_t *mode_p) | ||||||
| { | { | ||||||
| 	const struct posix_acl_entry *pa, *pe; | 	const struct posix_acl_entry *pa, *pe; | ||||||
| 	mode_t mode = 0; | 	umode_t mode = 0; | ||||||
| 	int not_equiv = 0; | 	int not_equiv = 0; | ||||||
| 
 | 
 | ||||||
| 	FOREACH_ACL_ENTRY(pa, acl, pe) { | 	FOREACH_ACL_ENTRY(pa, acl, pe) { | ||||||
|  |  | ||||||
|  | @ -272,12 +272,10 @@ reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode, | ||||||
| 	case ACL_TYPE_ACCESS: | 	case ACL_TYPE_ACCESS: | ||||||
| 		name = POSIX_ACL_XATTR_ACCESS; | 		name = POSIX_ACL_XATTR_ACCESS; | ||||||
| 		if (acl) { | 		if (acl) { | ||||||
| 			mode_t mode = inode->i_mode; | 			error = posix_acl_equiv_mode(acl, &inode->i_mode); | ||||||
| 			error = posix_acl_equiv_mode(acl, &mode); |  | ||||||
| 			if (error < 0) | 			if (error < 0) | ||||||
| 				return error; | 				return error; | ||||||
| 			else { | 			else { | ||||||
| 				inode->i_mode = mode; |  | ||||||
| 				if (error == 0) | 				if (error == 0) | ||||||
| 					acl = NULL; | 					acl = NULL; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | @ -381,7 +381,7 @@ xfs_xattr_acl_set(struct dentry *dentry, const char *name, | ||||||
| 		goto out_release; | 		goto out_release; | ||||||
| 
 | 
 | ||||||
| 	if (type == ACL_TYPE_ACCESS) { | 	if (type == ACL_TYPE_ACCESS) { | ||||||
| 		mode_t mode = inode->i_mode; | 		umode_t mode = inode->i_mode; | ||||||
| 		error = posix_acl_equiv_mode(acl, &mode); | 		error = posix_acl_equiv_mode(acl, &mode); | ||||||
| 
 | 
 | ||||||
| 		if (error <= 0) { | 		if (error <= 0) { | ||||||
|  |  | ||||||
|  | @ -76,7 +76,7 @@ extern struct posix_acl *posix_acl_alloc(int, gfp_t); | ||||||
| extern int posix_acl_valid(const struct posix_acl *); | extern int posix_acl_valid(const struct posix_acl *); | ||||||
| extern int posix_acl_permission(struct inode *, const struct posix_acl *, int); | extern int posix_acl_permission(struct inode *, const struct posix_acl *, int); | ||||||
| extern struct posix_acl *posix_acl_from_mode(mode_t, gfp_t); | extern struct posix_acl *posix_acl_from_mode(mode_t, gfp_t); | ||||||
| extern int posix_acl_equiv_mode(const struct posix_acl *, mode_t *); | extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *); | ||||||
| extern int posix_acl_create(struct posix_acl **, gfp_t, umode_t *); | extern int posix_acl_create(struct posix_acl **, gfp_t, umode_t *); | ||||||
| extern int posix_acl_chmod(struct posix_acl **, gfp_t, mode_t); | extern int posix_acl_chmod(struct posix_acl **, gfp_t, mode_t); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Al Viro
				Al Viro