GNU/Hurd support
v4 cover GNU/Hurd support
Hi all,
Thank you for quick review. I have addressed the comments and am sending you v4 in this thread.
TESTED: Compiles and runs qemu-system-{i386,x86_64} on GNU/Hurd x86_64 (TPM compiled in)
Thanks,
Damien
PATCH v4 1/5 Include new arbitrary limits if not already defined
From: Manolo de Medici <[email protected]>
Although GNU/Hurd supports unlimited path lengths
only bounded by available memory, for now we can use an arbitrary limit on PATH_MAX that matches what POSIX requires. We don't have bandwidth to fix this properly right now.
Author: Manolo de Medici <[email protected]>
--- include/qemu/osdep.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
include/qemu/osdep.h +11 -4
@@ -385,6 +385,17 @@ void QEMU_ERROR("code path is reachable")#define TIME_MAX TYPE_MAXIMUM(time_t)#endif +#ifndef PATH_MAX +#define PATH_MAX 1024 +#endif + +/* +* Use the same value as Linux for now. +*/ +#ifndef IOV_MAX +#define IOV_MAX 1024 +#endif +/* Mac OSX has a <stdint.h> bug that incorrectly defines SIZE_MAX with * the wrong type. Our replacement isn't usable in preprocessor * expressions, but it is sufficient for our needs. */
@@ -661,10 +672,6 @@ struct iovec {void *iov_base;size_t iov_len; }; -/* -* Use the same value as Linux for now. -*/ -#define IOV_MAX 1024ssize_t readv (int fd,const struct iovec *iov,int iov_cnt);ssize_t writev (int fd,const struct iovec *iov,int iov_cnt);
Signature · 1 line
2.51.0
PATCH v4 2/5 Add GNU/Hurd host_os=gnu
In reply to Damien Zammit--- configure | 2 ++ 1 file changed, 2 insertions(+)
configure +2 -0
@@ -372,6 +372,8 @@ elif check_define __APPLE__; then elif check_define EMSCRIPTEN ; then host_os=emscripten cross_compile="yes" +elif check_define __GNU__; then + host_os=gnu else # This is a fatal error, but don't report it yet, because we # might be going to just print the --help text, or it might
Signature · 1 line
2.51.0
PATCH v4 3/5 tpm: Remove unused ioctl enum and includes
In reply to Damien ZammitFrom: Manolo de Medici <[email protected]>
On GNU/Hurd, compilation fails due to missing _IO* symbols. As these are unused, remove them.
--- backends/tpm/tpm_ioctl.h | 33 --------------------------------- 1 file changed, 33 deletions(-)
backends/tpm/tpm_ioctl.h +0 -33
@@ -12,15 +12,6 @@# define __USE_LINUX_IOCTL_DEFS#endif -#ifndef _WIN32 -#include <sys/uio.h> -#include <sys/ioctl.h> -#endif - -#ifdef HAVE_SYS_IOCCOM_H -#include <sys/ioccom.h> -#endif -/* * Every response from a command involving a TPM command execution must hold * the ptm_res as the first element.
@@ -285,30 +276,6 @@ typedef struct ptm_lockstorage ptm_lockstorage;#define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)#define PTM_CAP_LOCK_STORAGE (1 << 16) -#ifndef _WIN32 -enum { -PTM_GET_CAPABILITY =_IOR ('P' ,0 , ptm_cap), -PTM_INIT =_IOWR ('P' ,1 , ptm_init), -PTM_SHUTDOWN =_IOR ('P' ,2 , ptm_res), -PTM_GET_TPMESTABLISHED =_IOR ('P' ,3 , ptm_est), -PTM_SET_LOCALITY =_IOWR ('P' ,4 , ptm_loc), -PTM_HASH_START =_IOR ('P' ,5 , ptm_res), -PTM_HASH_DATA =_IOWR ('P' ,6 , ptm_hdata), -PTM_HASH_END =_IOR ('P' ,7 , ptm_res), -PTM_CANCEL_TPM_CMD =_IOR ('P' ,8 , ptm_res), -PTM_STORE_VOLATILE =_IOR ('P' ,9 , ptm_res), -PTM_RESET_TPMESTABLISHED =_IOWR ('P' ,10 , ptm_reset_est), -PTM_GET_STATEBLOB =_IOWR ('P' ,11 , ptm_getstate), -PTM_SET_STATEBLOB =_IOWR ('P' ,12 , ptm_setstate), -PTM_STOP =_IOR ('P' ,13 , ptm_res), -PTM_GET_CONFIG =_IOR ('P' ,14 , ptm_getconfig), -PTM_SET_DATAFD =_IOR ('P' ,15 , ptm_res), -PTM_SET_BUFFERSIZE =_IOWR ('P' ,16 , ptm_setbuffersize), -PTM_GET_INFO =_IOWR ('P' ,17 , ptm_getinfo), -PTM_LOCK_STORAGE =_IOWR ('P' ,18 , ptm_lockstorage), -}; -#endif -/* * Commands used by the non-CUSE TPMs *
Signature · 1 line
2.51.0
PATCH v4 4/5 block/file-posix: Clean up sys/ioctl import
In reply to Damien ZammitSince all platforms except sun include this header, clean up the ifdefs.
--- block/file-posix.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
block/file-posix.c +4 -11
@@ -43,9 +43,11 @@#include "scsi/constants.h" #include "scsi/utils.h" -#if defined(__APPLE__) && (__MACH__) +#ifndef __sun__#include <sys/ioctl.h> -#if defined(HAVE_HOST_BLOCK_DEVICE ) +#endif + +#if defined(__APPLE__) && (__MACH__) && defined(HAVE_HOST_BLOCK_DEVICE )#include <paths.h> #include <sys/param.h> #include <sys/mount.h>
@@ -57,7 +59,6 @@//#include <IOKit/storage/IOCDTypes.h> #include <IOKit/storage/IODVDMedia.h> #include <CoreFoundation/CoreFoundation.h> -#endif /* defined(HAVE_HOST_BLOCK_DEVICE) */ #endif #ifdef __sun__
@@ -65,7 +66,6 @@#include <sys/dkio.h> #endif #ifdef __linux__ -#include <sys/ioctl.h> #include <sys/param.h> #include <sys/syscall.h> #include <sys/vfs.h>
@@ -95,27 +95,20 @@#endif #ifdef __OpenBSD__ -#include <sys/ioctl.h> #include <sys/disklabel.h> #include <sys/dkio.h> #endif #ifdef __NetBSD__ -#include <sys/ioctl.h> #include <sys/disklabel.h> #include <sys/dkio.h> #include <sys/disk.h> #endif #ifdef __DragonFly__ -#include <sys/ioctl.h> #include <sys/diskslice.h> #endif -#ifdef EMSCRIPTEN -#include <sys/ioctl.h> -#endif -/* OS X does not have O_DSYNC */ #ifndef O_DSYNC #ifdef O_SYNC
Signature · 1 line
2.51.0
PATCH v4 5/5 Make copy_file_range non-static on GNU/Hurd
In reply to Damien Zammitglibc has a stubs mechanism: a function can be declared in the system headers, but only implemented as a stub that always fails with ENOSYS, for example. Therefore when implementing this function we cannot use static.
--- block/file-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/file-posix.c +1 -1
@@ -2106,7 +2106,7 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque) }#ifndef HAVE_COPY_FILE_RANGE -#ifndef EMSCRIPTEN +#if !defined(EMSCRIPTEN ) && !defined(__GNU__) static#endif ssize_t copy_file_range(int in_fd, off_t *in_off, int out_fd,
Signature · 1 line
2.51.0