[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC 2/6] posix: add linux-only memfd fallback
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH RFC 2/6] posix: add linux-only memfd fallback |
Date: |
Tue, 28 Jul 2015 10:11:30 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
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 == _MIPS_SIM_ABI32
>> +# define __NR_memfd_create 4354
>> +# endif
>> +# if _MIPS_SIM == _MIPS_SIM_NABI32
>> +# define __NR_memfd_create 6318
>> +# endif
>> +# if _MIPS_SIM == _MIPS_SIM_ABI64
>> +# define __NR_memfd_create 5314
>> +# endif
>
> 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
[Qemu-devel] [PATCH RFC 3/6] osdep: add memfd helpers, Marc-André Lureau, 2015/07/22
[Qemu-devel] [PATCH RFC 4/6] vhost: alloc shareable log, Marc-André Lureau, 2015/07/22
[Qemu-devel] [PATCH RFC 5/6] vhost-user: send log shm fd along with log_base, Marc-André Lureau, 2015/07/22