Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755175Ab1BUOXs (ORCPT ); Mon, 21 Feb 2011 09:23:48 -0500 Received: from smtp4-g21.free.fr ([212.27.42.4]:39287 "EHLO smtp4-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754953Ab1BUOXq (ORCPT ); Mon, 21 Feb 2011 09:23:46 -0500 Message-ID: <4D627562.7050002@free.fr> Date: Mon, 21 Feb 2011 15:23:30 +0100 From: Daniel Lezcano User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: "Serge E. Hallyn" CC: Oleg Nesterov , Andrew Morton , LSM , James Morris , Kees Cook , containers@lists.linux-foundation.org, kernel list , "Eric W. Biederman" , Alexey Dobriyan , Michael Kerrisk , xemul@parallels.com, dhowells@redhat.com Subject: Re: [PATCH 1/4] userns: let clone_uts_ns() handle setting uts->user_ns References: <20110221040156.GA12580@mail.hallyn.com> <4D623886.3010505@free.fr> <20110221134129.GA15563@redhat.com> <20110221135803.GA15871@mail.hallyn.com> In-Reply-To: <20110221135803.GA15871@mail.hallyn.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1574 Lines: 38 On 02/21/2011 02:58 PM, Serge E. Hallyn wrote: > Quoting Oleg Nesterov (oleg@redhat.com): >> On 02/21, Daniel Lezcano wrote: >>> On 02/21/2011 05:01 AM, Serge E. Hallyn wrote: >>>> To do so we need to pass in the task_struct who'll get the utsname, >>>> so we can get its user_ns. >>>> >>>> -extern struct uts_namespace *copy_utsname(unsigned long flags, >>>> - struct uts_namespace *ns); >>>> +extern struct uts_namespace *copy_utsname(struct task_struct *tsk, >>>> + unsigned long flags, >>>> + struct uts_namespace *ns); >>> Why don't we pass 'user_ns' instead of 'tsk' ? that will look >>> semantically clearer for the caller no ? >>> (example below). >>> ... >>> >>> new_nsp->uts_ns = copy_utsname(flags, tsk->nsproxy->uts_ns, task_cred_xxx(tsk, user)->user_ns); >> To me tsk looks more readable, I mean >> >> new_nsp->uts_ns = copy_utsname(flags, tsk); >> >> copy_utsname() can find both uts_ns and user_ns looking at task_strcut. > Uh, yeah. I should remove the 'ns' argument there shouldn't I. > > Daniel, does that sway your opinion then? Well, I prefer to pass the needed parameters to a function. AFAICS, 'tsk' is not really needed but 'user_ns'. But it is a detail, so if passing the tsk parameter in the other copy_* functions helps to cleanup, that will be consistent. So I am fine with that. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/