Linux Container Development
 help / color / mirror / Atom feed
From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman)
To: Zhao Hongjiang <zhaohongjiang37-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH 17/25] userns: Convert minix to use kuid/kgid where appropriate
Date: Tue, 25 Sep 2012 03:05:40 -0700	[thread overview]
Message-ID: <87obkupgcr.fsf@xmission.com> (raw)
In-Reply-To: <506176B5.9020104-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> (Zhao Hongjiang's message of "Tue, 25 Sep 2012 17:17:41 +0800")

Zhao Hongjiang <zhaohongjiang37-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> On 2012-9-20 19:41, Eric W. Biederman wrote:
>> From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
>> 
>> Acked-by: Serge Hallyn <serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
>> Signed-off-by: Eric W. Biederman <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
>> ---
>>  fs/minix/inode.c |   16 ++++++++--------
>>  init/Kconfig     |    1 -
>>  2 files changed, 8 insertions(+), 9 deletions(-)
>> 
>> diff --git a/fs/minix/inode.c b/fs/minix/inode.c
>> index 2a503ad..d0e42c6 100644
>> --- a/fs/minix/inode.c
>> +++ b/fs/minix/inode.c
>> @@ -460,8 +460,8 @@ static struct inode *V1_minix_iget(struct inode *inode)
>>  		return ERR_PTR(-EIO);
>>  	}
>>  	inode->i_mode = raw_inode->i_mode;
>> -	inode->i_uid = (uid_t)raw_inode->i_uid;
>> -	inode->i_gid = (gid_t)raw_inode->i_gid;
>> +	i_uid_write(inode, raw_inode->i_uid);
>> +	i_gid_write(inode, raw_inode->i_gid);
>
>
> 	i_uid_write(inode, (uid_t)raw_inode->i_uid);
> 	i_gid_write(inode, (gid_t)raw_inode->i_gid);
>
> is more better?

An extra cast to uid_t or gid_t is redundant.  i_uid_write takes
a uid_t paramenter and i_gid_write takes a gid_t paramenter so
we already have the casts implicitly.

Eric


>>  	set_nlink(inode, raw_inode->i_nlinks);
>>  	inode->i_size = raw_inode->i_size;
>>  	inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec = raw_inode->i_time;
>> @@ -493,8 +493,8 @@ static struct inode *V2_minix_iget(struct inode *inode)
>>  		return ERR_PTR(-EIO);
>>  	}
>>  	inode->i_mode = raw_inode->i_mode;
>> -	inode->i_uid = (uid_t)raw_inode->i_uid;
>> -	inode->i_gid = (gid_t)raw_inode->i_gid;
>> +	i_uid_write(inode, raw_inode->i_uid);
>> +	i_gid_write(inode, raw_inode->i_gid);
>>  	set_nlink(inode, raw_inode->i_nlinks);
>>  	inode->i_size = raw_inode->i_size;
>>  	inode->i_mtime.tv_sec = raw_inode->i_mtime;
>> @@ -545,8 +545,8 @@ static struct buffer_head * V1_minix_update_inode(struct inode * inode)
>>  	if (!raw_inode)
>>  		return NULL;
>>  	raw_inode->i_mode = inode->i_mode;
>> -	raw_inode->i_uid = fs_high2lowuid(inode->i_uid);
>> -	raw_inode->i_gid = fs_high2lowgid(inode->i_gid);
>> +	raw_inode->i_uid = fs_high2lowuid(i_uid_read(inode));
>> +	raw_inode->i_gid = fs_high2lowgid(i_gid_read(inode));
>>  	raw_inode->i_nlinks = inode->i_nlink;
>>  	raw_inode->i_size = inode->i_size;
>>  	raw_inode->i_time = inode->i_mtime.tv_sec;
>> @@ -572,8 +572,8 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode)
>>  	if (!raw_inode)
>>  		return NULL;
>>  	raw_inode->i_mode = inode->i_mode;
>> -	raw_inode->i_uid = fs_high2lowuid(inode->i_uid);
>> -	raw_inode->i_gid = fs_high2lowgid(inode->i_gid);
>> +	raw_inode->i_uid = fs_high2lowuid(i_uid_read(inode));
>> +	raw_inode->i_gid = fs_high2lowgid(i_gid_read(inode));
>>  	raw_inode->i_nlinks = inode->i_nlink;
>>  	raw_inode->i_size = inode->i_size;
>>  	raw_inode->i_mtime = inode->i_mtime.tv_sec;
>> diff --git a/init/Kconfig b/init/Kconfig
>> index 80edba8..c69e085 100644
>> --- a/init/Kconfig
>> +++ b/init/Kconfig
>> @@ -946,7 +946,6 @@ config UIDGID_CONVERTED
>>  	depends on HPFS_FS = n
>>  	depends on JFFS2_FS = n
>>  	depends on JFS_FS = n
>> -	depends on MINIX_FS = n
>>  	depends on NCP_FS = n
>>  	depends on NFSD = n
>>  	depends on NFS_FS = n
>> 

  parent reply	other threads:[~2012-09-25 10:05 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <877grox6ql.fsf@xmission.com>
     [not found] ` <877grox6ql.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-20 11:41   ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
     [not found]     ` <1348141326-23355-1-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-20 11:41       ` [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid " Eric W. Biederman
     [not found]         ` <1348141326-23355-2-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-20 11:58           ` Greg Kroah-Hartman
2012-09-21  9:33           ` Felipe Balbi
2012-09-20 11:41       ` [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid " Eric W. Biederman
     [not found]         ` <1348141326-23355-3-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-20 11:58           ` Greg Kroah-Hartman
2012-09-21  9:32           ` Felipe Balbi
2012-09-20 11:41       ` [PATCH 04/25] userns: Convert devtmpfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID Eric W. Biederman
     [not found]         ` <1348141326-23355-4-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-20 11:58           ` Greg Kroah-Hartman
2012-09-20 11:41       ` [PATCH 05/25] userns: Convert hugetlbfs to use kuid/kgid where appropriate Eric W. Biederman
2012-09-20 11:41       ` [PATCH 06/25] userns: Convert xenfs to use kuid and kgid " Eric W. Biederman
2012-09-20 11:41       ` [PATCH 07/25] userns: Convert adfs " Eric W. Biederman
2012-09-20 11:41       ` [PATCH 08/25] userns: Convert befs to use kuid/kgid " Eric W. Biederman
2012-09-20 11:41       ` [PATCH 09/25] userns: Convert cramfs " Eric W. Biederman
2012-09-20 11:41       ` [PATCH 10/25] userns: Convert ecryptfs " Eric W. Biederman
2012-09-20 11:41       ` [PATCH 11/25] userns: Convert efs " Eric W. Biederman
2012-09-20 11:41       ` [PATCH 12/25] userns: Convert exofs " Eric W. Biederman
     [not found]         ` <1348141326-23355-12-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-20 12:20           ` Boaz Harrosh
2012-09-20 11:41       ` [PATCH 13/25] userns: Convert hfs to use kuid and kgid " Eric W. Biederman
2012-09-20 11:41       ` [PATCH 14/25] userns: Convert hfsplus " Eric W. Biederman
2012-09-20 11:41       ` [PATCH 15/25] userns: Convert isofs to use kuid/kgid " Eric W. Biederman
2012-09-20 11:41       ` [PATCH 16/25] userns: Convert logfs " Eric W. Biederman
2012-09-20 11:41       ` [PATCH 17/25] userns: Convert minix " Eric W. Biederman
2012-09-20 11:41       ` [PATCH 18/25] userns: Convert nillfs2 " Eric W. Biederman
     [not found]         ` <1348141326-23355-18-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-20 14:34           ` Ryusuke Konishi
2012-09-20 11:42       ` [PATCH 19/25] userns: Convert ntfs to use kuid and kgid " Eric W. Biederman
2012-09-20 11:42       ` [PATCH 20/25] userns: Convert omfs " Eric W. Biederman
     [not found]         ` <1348141326-23355-20-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-20 12:50           ` Bob Copeland
2012-09-20 13:13             ` Eric W. Biederman
     [not found]               ` <87obl0vnu7.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-20 13:19                 ` Bob Copeland
2012-09-20 11:42       ` [PATCH 21/25] userns: Convert the qnx4 filesystem to use kuid/kgid " Eric W. Biederman
2012-09-20 11:42       ` [PATCH 22/25] userns: Convert the qnx6 " Eric W. Biederman
2012-09-20 11:42       ` [PATCH 23/25] userns: Convert the sysv " Eric W. Biederman
2012-09-20 11:42       ` [PATCH 24/25] userns: Convert freevxfs " Eric W. Biederman
2012-09-20 11:42       ` [PATCH 25/25] userns: Convert ipathfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID Eric W. Biederman
     [not found]         ` <1348141326-23355-25-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-20 16:47           ` Marciniszyn, Mike
     [not found]     ` <87pq5gx60i.fsf@devron.myhome.or.jp>
     [not found]       ` <87pq5gx60i.fsf-x/W9pkDDSe1TgC2z9Sl/nXf5DAMn2ifp@public.gmane.org>
2012-09-20 12:04         ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
     [not found]     ` <1348141326-23355-21-git-send-email-ebiederm@xmission.com>
     [not found]       ` <1348141326-23355-21-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-20 12:34         ` [PATCH 21/25] userns: Convert the qnx4 filesystem " Anders Larsen
     [not found]     ` <1348141326-23355-17-git-send-email-ebiederm@xmission.com>
     [not found]       ` <1348141326-23355-17-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-25  9:17         ` [PATCH 17/25] userns: Convert minix " Zhao Hongjiang
     [not found]           ` <506176B5.9020104-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-09-25 10:05             ` Eric W. Biederman [this message]
     [not found]               ` <87obkupgcr.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-25 10:42                 ` Zhao Hongjiang
     [not found]                   ` <50618A93.1040202-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-09-25 10:51                     ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87obkupgcr.fsf@xmission.com \
    --to=ebiederm-as9lmozglivwk0htik3j/w@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=zhaohongjiang37-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox