From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJzzC-0006JD-IW for qemu-devel@nongnu.org; Tue, 28 Jul 2015 04:11:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJzz8-0003zq-HT for qemu-devel@nongnu.org; Tue, 28 Jul 2015 04:11:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJzz8-0003zY-C6 for qemu-devel@nongnu.org; Tue, 28 Jul 2015 04:11:38 -0400 References: <1437615403-13554-1-git-send-email-marcandre.lureau@redhat.com> <1437615403-13554-3-git-send-email-marcandre.lureau@redhat.com> <20150723181931-mutt-send-email-mst@redhat.com> From: Paolo Bonzini Message-ID: <55B73932.5000809@redhat.com> Date: Tue, 28 Jul 2015 10:11:30 +0200 MIME-Version: 1.0 In-Reply-To: <20150723181931-mutt-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC 2/6] posix: add linux-only memfd fallback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= Cc: thibaut.collet@6wind.com, qemu-devel@nongnu.org, haifeng.lin@huawei.com On 23/07/2015 17:25, Michael S. Tsirkin wrote: > > +#ifdef CONFIG_LINUX > > + > > +#ifndef F_LINUX_SPECIFIC_BASE > > +#define F_LINUX_SPECIFIC_BASE 1024 > > +#endif > > + > > +#ifndef F_ADD_SEALS > > +#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9) > > +#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10) > > + > > +#define F_SEAL_SEAL 0x0001 /* prevent further seals from being = set */ > > +#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */ > > +#define F_SEAL_GROW 0x0004 /* prevent file from growing */ > > +#define F_SEAL_WRITE 0x0008 /* prevent writes */ > > +#endif > > These are from include/uapi/linux/fcntl.h, > they should be imported into linux-headers I think. linux-headers is usually used for virt-related features that we want in QEMU a few weeks before they are distributed upstream. Here, I think just including linux/fcntl.h is enough. >> +#ifndef __NR_memfd_create >> +# if defined __x86_64__ >> +# define __NR_memfd_create 319 >> +# elif defined __arm__ >> +# define __NR_memfd_create 385 >> +# elif defined __aarch64__ >> +# define __NR_memfd_create 279 >> +# elif defined _MIPS_SIM >> +# if _MIPS_SIM =3D=3D _MIPS_SIM_ABI32 >> +# define __NR_memfd_create 4354 >> +# endif >> +# if _MIPS_SIM =3D=3D _MIPS_SIM_NABI32 >> +# define __NR_memfd_create 6318 >> +# endif >> +# if _MIPS_SIM =3D=3D _MIPS_SIM_ABI64 >> +# define __NR_memfd_create 5314 >> +# endif >=20 > What's defining all these macros? They're in asm/unistd.h. I think that, instead of making qemu/osdep.h the new qemu-common.h, the wrappers added by patch 3 should be declared in a new header qemu/memfd.h. The implementation in util/memfd.c can include both linux/fcntl.h and asm/unistd.h. Paolo