From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wsa3s-00018h-2S for kexec@lists.infradead.org; Thu, 05 Jun 2014 15:58:40 +0000 Date: Thu, 5 Jun 2014 11:22:09 -0400 From: Vivek Goyal Subject: Re: [PATCH 06/13] kexec: New syscall kexec_file_load() declaration Message-ID: <20140605152209.GC14083@redhat.com> References: <1401800822-27425-1-git-send-email-vgoyal@redhat.com> <1401800822-27425-7-git-send-email-vgoyal@redhat.com> <20140605095603.GD3876@dhcp-17-89.nay.redhat.com> <20140605151639.GB14083@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140605151639.GB14083@redhat.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: WANG Chao Cc: mjg59@srcf.ucam.org, bhe@redhat.com, jkosina@suse.cz, greg@kroah.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, bp@alien8.de, ebiederm@xmission.com, hpa@zytor.com, akpm@linux-foundation.org, dyoung@redhat.com On Thu, Jun 05, 2014 at 11:16:39AM -0400, Vivek Goyal wrote: > On Thu, Jun 05, 2014 at 05:56:03PM +0800, WANG Chao wrote: > > [..] > > > diff --git a/kernel/kexec.c b/kernel/kexec.c > > > index c435c5f..a3044e6 100644 > > > --- a/kernel/kexec.c > > > +++ b/kernel/kexec.c > > > @@ -1098,6 +1098,13 @@ COMPAT_SYSCALL_DEFINE4(kexec_load, compat_ulong_t, entry, > > > } > > > #endif > > > > > > +SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd, > > > + const char __user *, cmdline_ptr, unsigned long, > > > + cmdline_len, unsigned long, flags) > > > > initrd is optional for system boot. > > > > How about using int *kernel_fd and int *initrd_fd as the argument? Then > > if I don't need initrd, in userspace I can do this: > > Hi Chao, > > I really am not too keen converting plain int fd arguments into pointers. > > Given the fact that fd is int, that means all valid values are greater > than 0. How about using -1 to denote that initrd is not being loaded? > > This does create one little anomaly and that is for all -ve values we > will return -EBADF except -1 which we special cased. Or we could do. - Define extra flag which should be set by user if valid initrd fd is not being passed. Say, KEXEC_FILE_NO_INITRAMFS. And if kernel sees that flag it will not try to parse value passed in argument initrd_fd at all. I think I like this better. Thanks Vivek _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec