While pretty simplistic, it appears to serve the purpose at the moment
(i.e. it spotted two places where a GNU extension was used withou
proper preprocessor conditionals). The "simplistic" here includes that
the checking gets only done for native builds, and ia64 gets excluded
due to its arch-specific header intentionally (for whatever reason)
checking that anonymous struct/unions can be used.
The two places needing adjustment were io/fsif.h's struct fsif_response
and platform.h's struct xenpf_set_processor_pminfo. For the former, I
tried adjusting minios sources, but stubdom fails to build in my
environment (for other reasons), so I couldn't verify it really builds.
For the latter, I'll try to put together a corresponding Linux side
patch shortly.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
--- 2009-06-10.orig/extras/mini-os/fs-front.c 2009-06-16 16:38:02.000000000
+0200
+++ 2009-06-10/extras/mini-os/fs-front.c 2009-06-16 16:27:25.000000000
+0200
@@ -218,7 +218,7 @@ int fs_open(struct fs_import *import, ch
schedule();
/* Read the response */
- fd = (int)fsr->shadow_rsp.ret_val;
+ fd = (int)fsr->shadow_rsp.u.ret_val;
DEBUG("The following FD returned: %d\n", fd);
free_buffer_page(fsr);
add_id_to_freelist(priv_req_id, import->freelist);
@@ -256,7 +256,7 @@ int fs_close(struct fs_import *import, i
schedule();
/* Read the response */
- ret = (int)fsr->shadow_rsp.ret_val;
+ ret = (int)fsr->shadow_rsp.u.ret_val;
DEBUG("Close returned: %d\n", ret);
add_id_to_freelist(priv_req_id, import->freelist);
@@ -313,7 +313,7 @@ ssize_t fs_read(struct fs_import *import
schedule();
/* Read the response */
- ret = (ssize_t)fsr->shadow_rsp.ret_val;
+ ret = (ssize_t)fsr->shadow_rsp.u.ret_val;
DEBUG("The following ret value returned %d\n", ret);
if(ret > 0)
{
@@ -391,7 +391,7 @@ ssize_t fs_write(struct fs_import *impor
schedule();
/* Read the response */
- ret = (ssize_t)fsr->shadow_rsp.ret_val;
+ ret = (ssize_t)fsr->shadow_rsp.u.ret_val;
DEBUG("The following ret value returned %d\n", ret);
for(i=0; i<gnts.count; i++)
{
@@ -435,10 +435,10 @@ int fs_stat(struct fs_import *import,
schedule();
/* Read the response */
- ret = (int)fsr->shadow_rsp.ret_val;
+ ret = (int)fsr->shadow_rsp.u.ret_val;
DEBUG("Following ret from fstat: %d\n", ret);
memcpy(stat,
- &fsr->shadow_rsp.fstat,
+ &fsr->shadow_rsp.u.fstat,
sizeof(struct fsif_stat_response));
add_id_to_freelist(priv_req_id, import->freelist);
@@ -478,7 +478,7 @@ int fs_truncate(struct fs_import *import
schedule();
/* Read the response */
- ret = (int)fsr->shadow_rsp.ret_val;
+ ret = (int)fsr->shadow_rsp.u.ret_val;
DEBUG("Following ret from ftruncate: %d\n", ret);
add_id_to_freelist(priv_req_id, import->freelist);
@@ -520,7 +520,7 @@ int fs_remove(struct fs_import *import,
schedule();
/* Read the response */
- ret = (int)fsr->shadow_rsp.ret_val;
+ ret = (int)fsr->shadow_rsp.u.ret_val;
DEBUG("The following ret: %d\n", ret);
free_buffer_page(fsr);
add_id_to_freelist(priv_req_id, import->freelist);
@@ -575,7 +575,7 @@ int fs_rename(struct fs_import *import,
schedule();
/* Read the response */
- ret = (int)fsr->shadow_rsp.ret_val;
+ ret = (int)fsr->shadow_rsp.u.ret_val;
DEBUG("The following ret: %d\n", ret);
free_buffer_page(fsr);
add_id_to_freelist(priv_req_id, import->freelist);
@@ -621,7 +621,7 @@ int fs_create(struct fs_import *import,
schedule();
/* Read the response */
- ret = (int)fsr->shadow_rsp.ret_val;
+ ret = (int)fsr->shadow_rsp.u.ret_val;
DEBUG("The following ret: %d\n", ret);
free_buffer_page(fsr);
add_id_to_freelist(priv_req_id, import->freelist);
@@ -670,7 +670,7 @@ char** fs_list(struct fs_import *import,
schedule();
/* Read the response */
- *nr_files = (fsr->shadow_rsp.ret_val & NR_FILES_MASK) >> NR_FILES_SHIFT;
+ *nr_files = (fsr->shadow_rsp.u.ret_val & NR_FILES_MASK) >> NR_FILES_SHIFT;
files = NULL;
if(*nr_files <= 0) goto exit;
files = malloc(sizeof(char*) * (*nr_files));
@@ -681,7 +681,7 @@ char** fs_list(struct fs_import *import,
current_file += strlen(current_file) + 1;
}
if(has_more != NULL)
- *has_more = fsr->shadow_rsp.ret_val & HAS_MORE_FLAG;
+ *has_more = fsr->shadow_rsp.u.ret_val & HAS_MORE_FLAG;
free_buffer_page(fsr);
add_id_to_freelist(priv_req_id, import->freelist);
exit:
@@ -719,7 +719,7 @@ int fs_chmod(struct fs_import *import, i
schedule();
/* Read the response */
- ret = (int)fsr->shadow_rsp.ret_val;
+ ret = (int)fsr->shadow_rsp.u.ret_val;
DEBUG("The following returned: %d\n", ret);
add_id_to_freelist(priv_req_id, import->freelist);
@@ -761,7 +761,7 @@ int64_t fs_space(struct fs_import *impor
schedule();
/* Read the response */
- ret = (int64_t)fsr->shadow_rsp.ret_val;
+ ret = (int64_t)fsr->shadow_rsp.u.ret_val;
DEBUG("The following returned: %lld\n", ret);
free_buffer_page(fsr);
add_id_to_freelist(priv_req_id, import->freelist);
@@ -799,7 +799,7 @@ int fs_sync(struct fs_import *import, in
schedule();
/* Read the response */
- ret = (int)fsr->shadow_rsp.ret_val;
+ ret = (int)fsr->shadow_rsp.u.ret_val;
DEBUG("Close returned: %d\n", ret);
add_id_to_freelist(priv_req_id, import->freelist);
@@ -852,7 +852,7 @@ moretodo:
rsp = RING_GET_RESPONSE(&import->ring, cons);
DEBUG("Response at idx=%d to request id=%d, ret_val=%lx\n",
- cons, rsp->id, rsp->ret_val);
+ cons, rsp->id, rsp->u.ret_val);
req = &import->requests[rsp->id];
memcpy(&req->shadow_rsp, rsp, sizeof(struct fsif_response));
DEBUG("Waking up: %s\n", req->thread->name);
--- 2009-06-10.orig/tools/fs-back/fs-ops.c 2009-06-16 16:38:02.000000000
+0200
+++ 2009-06-10/tools/fs-back/fs-ops.c 2009-06-16 16:27:05.000000000 +0200
@@ -89,7 +89,7 @@ static void dispatch_file_open(struct fs
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = (uint64_t)fd;
+ rsp->u.ret_val = (uint64_t)fd;
}
static void dispatch_file_close(struct fs_mount *mount, struct fsif_request
*req)
@@ -119,7 +119,7 @@ static void dispatch_file_close(struct f
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = (uint64_t)ret;
+ rsp->u.ret_val = (uint64_t)ret;
}
#define MAX_GNTS 16
@@ -190,7 +190,7 @@ static void end_file_read(struct fs_moun
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = (uint64_t)aio_return(&priv_req->aiocb);
+ rsp->u.ret_val = (uint64_t)aio_return(&priv_req->aiocb);
}
static void dispatch_file_write(struct fs_mount *mount, struct fsif_request
*req)
@@ -261,7 +261,7 @@ static void end_file_write(struct fs_mou
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = (uint64_t)aio_return(&priv_req->aiocb);
+ rsp->u.ret_val = (uint64_t)aio_return(&priv_req->aiocb);
}
static void dispatch_stat(struct fs_mount *mount, struct fsif_request *req)
@@ -294,24 +294,24 @@ static void dispatch_stat(struct fs_moun
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->fstat.stat_ret = (uint32_t)ret;
- rsp->fstat.stat_mode = stat.st_mode;
- rsp->fstat.stat_uid = stat.st_uid;
- rsp->fstat.stat_gid = stat.st_gid;
+ rsp->u.fstat.stat_ret = (uint32_t)ret;
+ rsp->u.fstat.stat_mode = stat.st_mode;
+ rsp->u.fstat.stat_uid = stat.st_uid;
+ rsp->u.fstat.stat_gid = stat.st_gid;
#ifdef BLKGETSIZE
if (S_ISBLK(stat.st_mode)) {
unsigned long sectors;
if (ioctl(fd, BLKGETSIZE, §ors)) {
perror("getting device size\n");
- rsp->fstat.stat_size = 0;
+ rsp->u.fstat.stat_size = 0;
} else
- rsp->fstat.stat_size = sectors << 9;
+ rsp->u.fstat.stat_size = sectors << 9;
} else
#endif
- rsp->fstat.stat_size = stat.st_size;
- rsp->fstat.stat_atime = stat.st_atime;
- rsp->fstat.stat_mtime = stat.st_mtime;
- rsp->fstat.stat_ctime = stat.st_ctime;
+ rsp->u.fstat.stat_size = stat.st_size;
+ rsp->u.fstat.stat_atime = stat.st_atime;
+ rsp->u.fstat.stat_mtime = stat.st_mtime;
+ rsp->u.fstat.stat_ctime = stat.st_ctime;
}
@@ -344,7 +344,7 @@ static void dispatch_truncate(struct fs_
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = (uint64_t)ret;
+ rsp->u.ret_val = (uint64_t)ret;
}
static void dispatch_remove(struct fs_mount *mount, struct fsif_request *req)
@@ -382,7 +382,7 @@ static void dispatch_remove(struct fs_mo
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = (uint64_t)ret;
+ rsp->u.ret_val = (uint64_t)ret;
}
@@ -429,7 +429,7 @@ static void dispatch_rename(struct fs_mo
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = (uint64_t)ret;
+ rsp->u.ret_val = (uint64_t)ret;
}
@@ -490,7 +490,7 @@ static void dispatch_create(struct fs_mo
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = (uint64_t)ret;
+ rsp->u.ret_val = (uint64_t)ret;
}
static void dispatch_list(struct fs_mount *mount, struct fsif_request *req)
@@ -560,7 +560,7 @@ error_out:
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = ret_val;
+ rsp->u.ret_val = ret_val;
}
static void dispatch_chmod(struct fs_mount *mount, struct fsif_request *req)
@@ -591,7 +591,7 @@ static void dispatch_chmod(struct fs_mou
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = (uint64_t)ret;
+ rsp->u.ret_val = (uint64_t)ret;
}
static void dispatch_fs_space(struct fs_mount *mount, struct fsif_request *req)
@@ -632,7 +632,7 @@ static void dispatch_fs_space(struct fs_
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = (uint64_t)ret;
+ rsp->u.ret_val = (uint64_t)ret;
}
static void dispatch_file_sync(struct fs_mount *mount, struct fsif_request
*req)
@@ -681,7 +681,7 @@ static void end_file_sync(struct fs_moun
FS_DEBUG("Writing response at: idx=%d, id=%d\n", rsp_idx, req_id);
rsp = RING_GET_RESPONSE(&mount->ring, rsp_idx);
rsp->id = req_id;
- rsp->ret_val = (uint64_t)aio_return(&priv_req->aiocb);
+ rsp->u.ret_val = (uint64_t)aio_return(&priv_req->aiocb);
}
struct fs_op fopen_op = {.type = REQ_FILE_OPEN,
--- 2009-06-10.orig/xen/arch/ia64/xen/platform_hypercall.c 2008-10-24
11:21:38.000000000 +0200
+++ 2009-06-10/xen/arch/ia64/xen/platform_hypercall.c 2009-06-16
17:11:16.000000000 +0200
@@ -48,7 +48,7 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
break;
}
ret = set_px_pminfo(op->u.set_pminfo.id,
- &op->u.set_pminfo.perf);
+ &op->u.set_pminfo.u.perf);
break;
case XEN_PM_CX:
--- 2009-06-10.orig/xen/arch/x86/platform_hypercall.c 2009-06-16
16:38:02.000000000 +0200
+++ 2009-06-10/xen/arch/x86/platform_hypercall.c 2009-06-16
16:19:18.000000000 +0200
@@ -360,7 +360,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
ret = -ENOSYS;
break;
}
- ret = set_px_pminfo(op->u.set_pminfo.id, &op->u.set_pminfo.perf);
+ ret = set_px_pminfo(op->u.set_pminfo.id, &op->u.set_pminfo.u.perf);
break;
case XEN_PM_CX:
@@ -369,7 +369,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
ret = -ENOSYS;
break;
}
- ret = set_cx_pminfo(op->u.set_pminfo.id, &op->u.set_pminfo.power);
+ ret = set_cx_pminfo(op->u.set_pminfo.id,
&op->u.set_pminfo.u.power);
break;
case XEN_PM_TX:
--- 2009-06-10.orig/xen/include/Makefile 2009-06-16 16:38:02.000000000
+0200
+++ 2009-06-10/xen/include/Makefile 2009-06-16 16:36:16.000000000 +0200
@@ -1,3 +1,6 @@
+XEN_ROOT:=$(BASEDIR)/..
+include $(XEN_ROOT)/Config.mk
+
ifneq ($(CONFIG_COMPAT),)
compat-arch-$(CONFIG_X86) := x86_32
@@ -35,6 +38,9 @@ suffix-$(CONFIG_X86) := \#pragma pa
endif
+public-$(CONFIG_X86) := $(wildcard public/arch-x86/*.h public/arch-x86/*/*.h)
+public-$(CONFIG_IA64) := $(wildcard public/arch-ia64/*.h
public/arch-ia64/*/*.h)
+
.PHONY: all
all: $(headers-y)
@@ -67,5 +73,19 @@ compat/xlat.h: xlat.lst $(filter-out com
done >$@.new
mv -f $@.new $@
+ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))
+# public/arch-ia64.h explicitly bails on __STRICT_ANSI__
+ifeq ($(CONFIG_IA64),)
+
+all: headers.chk
+
+headers.chk: $(filter-out public/arch-% public/%ctl.h public/xsm/%
public/%hvm/save.h, \
+ $(wildcard public/*.h public/*/*.h) $(public-y))
Makefile
+ for i in $(filter %.h,$^); do $(CC) -ansi -include stdint.h -Wall -W
-Werror -S -o /dev/null -xc $$i || exit 1; echo $$i; done >$@.new
+ mv $@.new $@
+
+endif
+endif
+
clean::
rm -rf compat
--- 2009-06-10.orig/xen/include/public/event_channel.h 2009-06-16
16:38:02.000000000 +0200
+++ 2009-06-10/xen/include/public/event_channel.h 2009-06-16
16:05:01.000000000 +0200
@@ -27,6 +27,8 @@
#ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
#define __XEN_PUBLIC_EVENT_CHANNEL_H__
+#include "xen.h"
+
/*
* Prototype for this hypercall is:
* int event_channel_op(int cmd, void *args)
--- 2009-06-10.orig/xen/include/public/grant_table.h 2009-06-16
16:38:02.000000000 +0200
+++ 2009-06-10/xen/include/public/grant_table.h 2009-06-16 16:05:25.000000000
+0200
@@ -28,6 +28,7 @@
#ifndef __XEN_PUBLIC_GRANT_TABLE_H__
#define __XEN_PUBLIC_GRANT_TABLE_H__
+#include "xen.h"
/***********************************
* GRANT TABLE REPRESENTATION
--- 2009-06-10.orig/xen/include/public/hvm/hvm_op.h 2009-06-16
16:38:02.000000000 +0200
+++ 2009-06-10/xen/include/public/hvm/hvm_op.h 2009-06-16 16:07:58.000000000
+0200
@@ -21,6 +21,8 @@
#ifndef __XEN_PUBLIC_HVM_HVM_OP_H__
#define __XEN_PUBLIC_HVM_HVM_OP_H__
+#include "../xen.h"
+
/* Get/set subcommands: extra argument == pointer to xen_hvm_param struct. */
#define HVMOP_set_param 0
#define HVMOP_get_param 1
--- 2009-06-10.orig/xen/include/public/io/fsif.h 2009-06-16
16:38:02.000000000 +0200
+++ 2009-06-10/xen/include/public/io/fsif.h 2009-06-16 16:11:21.000000000
+0200
@@ -169,7 +169,7 @@ struct fsif_response {
union {
uint64_t ret_val;
struct fsif_stat_response fstat;
- };
+ } u;
};
typedef struct fsif_response fsif_response_t;
--- 2009-06-10.orig/xen/include/public/io/xs_wire.h 2009-06-16
16:38:02.000000000 +0200
+++ 2009-06-10/xen/include/public/io/xs_wire.h 2009-06-16 16:14:00.000000000
+0200
@@ -60,6 +60,7 @@ struct xsd_errors
int errnum;
const char *errstring;
};
+#ifdef EINVAL
#define XSD_ERROR(x) { x, #x }
/* LINTED: static unused */
static struct xsd_errors xsd_errors[]
@@ -82,6 +83,7 @@ __attribute__((unused))
XSD_ERROR(EAGAIN),
XSD_ERROR(EISCONN)
};
+#endif
struct xsd_sockmsg
{
--- 2009-06-10.orig/xen/include/public/memory.h 2009-06-16 16:38:02.000000000
+0200
+++ 2009-06-10/xen/include/public/memory.h 2009-06-16 16:06:03.000000000
+0200
@@ -27,6 +27,8 @@
#ifndef __XEN_PUBLIC_MEMORY_H__
#define __XEN_PUBLIC_MEMORY_H__
+#include "xen.h"
+
/*
* Increase or decrease the specified domain's memory reservation. Returns the
* number of extents successfully allocated or freed.
--- 2009-06-10.orig/xen/include/public/nmi.h 2009-06-16 16:38:02.000000000
+0200
+++ 2009-06-10/xen/include/public/nmi.h 2009-06-16 16:06:33.000000000 +0200
@@ -27,6 +27,8 @@
#ifndef __XEN_PUBLIC_NMI_H__
#define __XEN_PUBLIC_NMI_H__
+#include "xen.h"
+
/*
* NMI reason codes:
* Currently these are x86-specific, stored in arch_shared_info.nmi_reason.
--- 2009-06-10.orig/xen/include/public/physdev.h 2009-06-16
16:38:02.000000000 +0200
+++ 2009-06-10/xen/include/public/physdev.h 2009-06-16 16:07:10.000000000
+0200
@@ -21,6 +21,8 @@
#ifndef __XEN_PUBLIC_PHYSDEV_H__
#define __XEN_PUBLIC_PHYSDEV_H__
+#include "xen.h"
+
/*
* Prototype for this hypercall is:
* int physdev_op(int cmd, void *args)
--- 2009-06-10.orig/xen/include/public/platform.h 2009-06-16
16:38:02.000000000 +0200
+++ 2009-06-10/xen/include/public/platform.h 2009-06-16 16:03:19.000000000
+0200
@@ -307,7 +307,7 @@ struct xenpf_set_processor_pminfo {
union {
struct xen_processor_power power;/* Cx: _CST/_CSD */
struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */
- };
+ } u;
};
typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t;
DEFINE_XEN_GUEST_HANDLE(xenpf_set_processor_pminfo_t);
--- 2009-06-10.orig/xen/include/public/vcpu.h 2009-06-16 16:38:02.000000000
+0200
+++ 2009-06-10/xen/include/public/vcpu.h 2009-06-16 16:07:28.000000000
+0200
@@ -27,6 +27,8 @@
#ifndef __XEN_PUBLIC_VCPU_H__
#define __XEN_PUBLIC_VCPU_H__
+#include "xen.h"
+
/*
* Prototype for this hypercall is:
* int vcpu_op(int cmd, int vcpuid, void *extra_args)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|