 648abbfbaa
			
		
	
	
		648abbfbaa
		
	
	
	
	
		
			
			On RHEL7, memfd is not supported, and vhost-user-test fails: TEST: tests/vhost-user-test... (pid=10248) /x86_64/vhost-user/migrate: qemu-system-x86_64: -object memory-backend-memfd,id=mem,size=2M,: failed to create memfd FAIL There is a qemu_memfd_check() to prevent running memfd path, but it also checks for fallback implementation. Let's specialize qemu_memfd_check() to check memfd only, while qemu_memfd_alloc_check() checks for the qemu_memfd_alloc() API. Reported-by: Miroslav Rezanina <mrezanin@redhat.com> Tested-by: Miroslav Rezanina <mrezanin@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20180328121804.16203-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
		
			
				
	
	
		
			28 lines
		
	
	
		
			913 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			913 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #ifndef QEMU_MEMFD_H
 | |
| #define QEMU_MEMFD_H
 | |
| 
 | |
| 
 | |
| #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
 | |
| 
 | |
| int qemu_memfd_create(const char *name, size_t size, bool hugetlb,
 | |
|                       uint64_t hugetlbsize, unsigned int seals, Error **errp);
 | |
| bool qemu_memfd_alloc_check(void);
 | |
| void *qemu_memfd_alloc(const char *name, size_t size, unsigned int seals,
 | |
|                        int *fd, Error **errp);
 | |
| void qemu_memfd_free(void *ptr, size_t size, int fd);
 | |
| bool qemu_memfd_check(void);
 | |
| 
 | |
| #endif /* QEMU_MEMFD_H */
 |