domctl.domain = domid;
domctl.cmd = XEN_DOMCTL_set_address_size;
- for ( i = 0; i < sizeof(types)/sizeof(types[0]); i++ )
+ for ( i = 0; i < ARRAY_SIZE(types); i++ )
if ( !strcmp(types[i].guest, guest_type) )
domctl.u.address_size.size = types[i].size;
if ( domctl.u.address_size.size == 0 )
memset(&domctl, 0, sizeof(domctl));
domctl.domain = domid;
domctl.cmd = XEN_DOMCTL_set_address_size;
- for ( i = 0; i < sizeof(types)/sizeof(types[0]); i++ )
+ for ( i = 0; i < ARRAY_SIZE(types); i++ )
if ( !strcmp(types[i].guest, guest_type) )
domctl.u.address_size.size = types[i].size;
if ( domctl.u.address_size.size == 0 )
xen_pfn_t shinfo;
int i, rc;
- for ( i = 0; i < sizeof(types) / sizeof(types[0]); i++ )
+ for ( i = 0; i < ARRAY_SIZE(types); i++ )
if ( !strcmp(types[i].guest, dom->guest_type) )
pgd_type = types[i].pgd_type;
int i, ret;
call.op = hypercall->op;
- for (i = 0; i < sizeof(hypercall->arg) / sizeof(*hypercall->arg); i++)
+ for (i = 0; i < ARRAY_SIZE(hypercall->arg); i++)
call.args[i] = hypercall->arg[i];
ret = HYPERVISOR_multicall(&call, 1);
#define XC_BUILD_BUG_ON(p) ((void)sizeof(struct { int:-!!(p); }))
#endif
+#ifndef ARRAY_SIZE /* MiniOS leaks ARRAY_SIZE into our namespace as part of a
+ * stubdom build. It shouldn't... */
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#endif
+
/*
** Define max dirty page cache to permit during save/restore -- need to balance
** keeping cache usage down with CPU impact of invalidating too often.
#include <xenstore.h>
#include <unistd.h>
+#undef ARRAY_SIZE /* We shouldn't be including xc_private.h */
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
static xc_interface *xch;
#include "xg_save_restore.h"
+#undef ARRAY_SIZE /* We shouldn't be including xc_private.h */
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
static xc_interface *xch;