[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: consistently use typedef struct {} libxl_$type
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1280330324 -3600 # Node ID bf4d0eb3643d7c86a42ad5265208e6fdf08b01fb # Parent ebede381efe85555412ff541666a4a712d1467a4 libxl: consistently use typedef struct {} libxl_$type typedef struct seems to be the dominant idiom in the mixture currently in use. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/libxl/libxl.c | 224 +++++++++++++++++----------------- tools/libxl/libxl.h | 268 ++++++++++++++++++++--------------------- tools/libxl/libxl_bootloader.c | 8 - tools/libxl/libxl_device.c | 22 +-- tools/libxl/libxl_dom.c | 34 ++--- tools/libxl/libxl_exec.c | 20 +-- tools/libxl/libxl_internal.c | 32 ++-- tools/libxl/libxl_internal.h | 90 ++++++------- tools/libxl/libxl_pci.c | 14 +- tools/libxl/libxl_utils.c | 40 +++--- tools/libxl/libxl_utils.h | 36 ++--- tools/libxl/libxl_xshelp.c | 12 - tools/libxl/xl.h | 2 tools/libxl/xl_cmdimpl.c | 46 +++---- tools/libxl/xl_cmdtable.c | 1 tools/ocaml/libs/xl/xl_stubs.c | 58 ++++---- 16 files changed, 454 insertions(+), 453 deletions(-) diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl.c --- a/tools/libxl/libxl.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl.c Wed Jul 28 16:18:44 2010 +0100 @@ -38,11 +38,11 @@ #define PAGE_TO_MEMKB(pages) ((pages) * 4) -int libxl_ctx_init(struct libxl_ctx *ctx, int version, xentoollog_logger *lg) +int libxl_ctx_init(libxl_ctx *ctx, int version, xentoollog_logger *lg) { if (version != LIBXL_VERSION) return ERROR_VERSION; - memset(ctx, 0, sizeof(struct libxl_ctx)); + memset(ctx, 0, sizeof(libxl_ctx)); ctx->lg = lg; ctx->alloc_maxsize = 256; ctx->alloc_ptrs = calloc(ctx->alloc_maxsize, sizeof(void *)); @@ -69,7 +69,7 @@ int libxl_ctx_init(struct libxl_ctx *ctx return 0; } -int libxl_ctx_free(struct libxl_ctx *ctx) +int libxl_ctx_free(libxl_ctx *ctx) { libxl_free_all(ctx); free(ctx->alloc_ptrs); @@ -80,7 +80,7 @@ int libxl_ctx_free(struct libxl_ctx *ctx /******************************************************************************/ -int libxl_domain_make(struct libxl_ctx *ctx, libxl_domain_create_info *info, +int libxl_domain_make(libxl_ctx *ctx, libxl_domain_create_info *info, uint32_t *domid) { int flags, ret, i, rc; @@ -177,7 +177,7 @@ retry_transaction: return 0; } -int libxl_domain_rename(struct libxl_ctx *ctx, uint32_t domid, +int libxl_domain_rename(libxl_ctx *ctx, uint32_t domid, const char *old_name, const char *new_name, xs_transaction_t trans) { char *dom_path = 0; @@ -255,7 +255,7 @@ int libxl_domain_rename(struct libxl_ctx x_nomem: rc = ERROR_NOMEM; goto x_rc; } -int libxl_domain_build(struct libxl_ctx *ctx, libxl_domain_build_info *info, uint32_t domid, libxl_domain_build_state *state) +int libxl_domain_build(libxl_ctx *ctx, libxl_domain_build_info *info, uint32_t domid, libxl_domain_build_state *state) { char **vments = NULL, **localents = NULL; struct timeval start_time; @@ -307,7 +307,7 @@ out: return ret; } -int libxl_domain_restore(struct libxl_ctx *ctx, libxl_domain_build_info *info, +int libxl_domain_restore(libxl_ctx *ctx, libxl_domain_build_info *info, uint32_t domid, int fd, libxl_domain_build_state *state, libxl_device_model_info *dm_info) { @@ -380,7 +380,7 @@ out: return ret; } -int libxl_domain_resume(struct libxl_ctx *ctx, uint32_t domid) +int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid) { if (is_hvm(ctx, domid)) { XL_LOG(ctx, XL_LOG_DEBUG, "Called domain_resume on " @@ -408,7 +408,7 @@ int libxl_domain_resume(struct libxl_ctx * * Does not modify info so that it may be reused. */ -int libxl_domain_preserve(struct libxl_ctx *ctx, uint32_t domid, +int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid, libxl_domain_create_info *info, const char *name_suffix, uint8_t new_uuid[16]) { struct xs_permissions roperm[2]; @@ -458,7 +458,7 @@ int libxl_domain_preserve(struct libxl_c } static void xcinfo2xlinfo(const xc_domaininfo_t *xcinfo, - struct libxl_dominfo *xlinfo) + libxl_dominfo *xlinfo) { memcpy(&(xlinfo->uuid), xcinfo->handle, sizeof(xen_domain_handle_t)); xlinfo->domid = xcinfo->domain; @@ -480,14 +480,14 @@ static void xcinfo2xlinfo(const xc_domai xlinfo->vcpu_online = xcinfo->nr_online_vcpus; } -struct libxl_dominfo * libxl_list_domain(struct libxl_ctx *ctx, int *nb_domain) -{ - struct libxl_dominfo *ptr; +libxl_dominfo * libxl_list_domain(libxl_ctx *ctx, int *nb_domain) +{ + libxl_dominfo *ptr; int i, ret; xc_domaininfo_t info[1024]; int size = 1024; - ptr = calloc(size, sizeof(struct libxl_dominfo)); + ptr = calloc(size, sizeof(libxl_dominfo)); if (!ptr) { XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "allocating domain info"); return NULL; @@ -506,7 +506,7 @@ struct libxl_dominfo * libxl_list_domain return ptr; } -int libxl_domain_info(struct libxl_ctx *ctx, struct libxl_dominfo *info_r, +int libxl_domain_info(libxl_ctx *ctx, libxl_dominfo *info_r, uint32_t domid) { xc_domaininfo_t xcinfo; int ret; @@ -522,14 +522,14 @@ int libxl_domain_info(struct libxl_ctx * return 0; } -struct libxl_poolinfo * libxl_list_pool(struct libxl_ctx *ctx, int *nb_pool) -{ - struct libxl_poolinfo *ptr; +libxl_poolinfo * libxl_list_pool(libxl_ctx *ctx, int *nb_pool) +{ + libxl_poolinfo *ptr; int i, ret; xc_cpupoolinfo_t info[256]; int size = 256; - ptr = calloc(size, sizeof(struct libxl_poolinfo)); + ptr = calloc(size, sizeof(libxl_poolinfo)); if (!ptr) { XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "allocating cpupool info"); return NULL; @@ -549,14 +549,14 @@ struct libxl_poolinfo * libxl_list_pool( } /* this API call only list VM running on this host. a VM can be an aggregate of multiple domains. */ -struct libxl_vminfo * libxl_list_vm(struct libxl_ctx *ctx, int *nb_vm) -{ - struct libxl_vminfo *ptr; +libxl_vminfo * libxl_list_vm(libxl_ctx *ctx, int *nb_vm) +{ + libxl_vminfo *ptr; int index, i, ret; xc_domaininfo_t info[1024]; int size = 1024; - ptr = calloc(size, sizeof(struct libxl_dominfo)); + ptr = calloc(size, sizeof(libxl_dominfo)); if (!ptr) return NULL; @@ -577,7 +577,7 @@ struct libxl_vminfo * libxl_list_vm(stru return ptr; } -int libxl_domain_suspend(struct libxl_ctx *ctx, libxl_domain_suspend_info *info, +int libxl_domain_suspend(libxl_ctx *ctx, libxl_domain_suspend_info *info, uint32_t domid, int fd) { int hvm = is_hvm(ctx, domid); @@ -590,7 +590,7 @@ int libxl_domain_suspend(struct libxl_ct return 0; } -int libxl_domain_pause(struct libxl_ctx *ctx, uint32_t domid) +int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid) { int ret; ret = xc_domain_pause(ctx->xch, domid); @@ -601,7 +601,7 @@ int libxl_domain_pause(struct libxl_ctx return 0; } -int libxl_domain_core_dump(struct libxl_ctx *ctx, uint32_t domid, +int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t domid, const char *filename) { int ret; @@ -614,7 +614,7 @@ int libxl_domain_core_dump(struct libxl_ return 0; } -int libxl_domain_unpause(struct libxl_ctx *ctx, uint32_t domid) +int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid) { char *path; char *state; @@ -644,7 +644,7 @@ static char *req_table[] = { [4] = "halt", }; -int libxl_domain_shutdown(struct libxl_ctx *ctx, uint32_t domid, int req) +int libxl_domain_shutdown(libxl_ctx *ctx, uint32_t domid, int req) { char *shutdown_path; char *dom_path; @@ -684,13 +684,13 @@ int libxl_domain_shutdown(struct libxl_c return 0; } -int libxl_get_wait_fd(struct libxl_ctx *ctx, int *fd) +int libxl_get_wait_fd(libxl_ctx *ctx, int *fd) { *fd = xs_fileno(ctx->xsh); return 0; } -int libxl_wait_for_domain_death(struct libxl_ctx *ctx, uint32_t domid, libxl_waiter *waiter) +int libxl_wait_for_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_waiter *waiter) { waiter->path = strdup("@releaseDomain"); if (asprintf(&(waiter->token), "%d", LIBXL_EVENT_DOMAIN_DEATH) < 0) @@ -700,7 +700,7 @@ int libxl_wait_for_domain_death(struct l return 0; } -int libxl_wait_for_disk_ejects(struct libxl_ctx *ctx, uint32_t guest_domid, libxl_device_disk *disks, int num_disks, libxl_waiter *waiter) +int libxl_wait_for_disk_ejects(libxl_ctx *ctx, uint32_t guest_domid, libxl_device_disk *disks, int num_disks, libxl_waiter *waiter) { int i; uint32_t domid = libxl_get_stubdom_id(ctx, guest_domid); @@ -720,7 +720,7 @@ int libxl_wait_for_disk_ejects(struct li return 0; } -int libxl_get_event(struct libxl_ctx *ctx, libxl_event *event) +int libxl_get_event(libxl_ctx *ctx, libxl_event *event) { unsigned int num; char **events = xs_read_watch(ctx->xsh, &num); @@ -735,7 +735,7 @@ int libxl_get_event(struct libxl_ctx *ct return 0; } -int libxl_stop_waiting(struct libxl_ctx *ctx, libxl_waiter *waiter) +int libxl_stop_waiting(libxl_ctx *ctx, libxl_waiter *waiter) { if (!xs_unwatch(ctx->xsh, waiter->path, waiter->token)) return ERROR_FAIL; @@ -757,7 +757,7 @@ int libxl_free_waiter(libxl_waiter *wait return 0; } -int libxl_event_get_domain_death_info(struct libxl_ctx *ctx, uint32_t domid, libxl_event *event, struct libxl_dominfo *info) +int libxl_event_get_domain_death_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_dominfo *info) { if (libxl_domain_info(ctx, info, domid) < 0) return 0; @@ -768,7 +768,7 @@ int libxl_event_get_domain_death_info(st return 1; } -int libxl_event_get_disk_eject_info(struct libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_device_disk *disk) +int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_device_disk *disk) { char *path; char *backend; @@ -797,7 +797,7 @@ int libxl_event_get_disk_eject_info(stru return 1; } -static int libxl_destroy_device_model(struct libxl_ctx *ctx, uint32_t domid) +static int libxl_destroy_device_model(libxl_ctx *ctx, uint32_t domid) { char *pid; int ret; @@ -828,7 +828,7 @@ static int libxl_destroy_device_model(st return ret; } -int libxl_domain_destroy(struct libxl_ctx *ctx, uint32_t domid, int force) +int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force) { char *dom_path; char *vm_path; @@ -883,7 +883,7 @@ int libxl_domain_destroy(struct libxl_ct return 0; } -int libxl_console_exec(struct libxl_ctx *ctx, uint32_t domid, int cons_num) +int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num) { char *p = libxl_sprintf(ctx, "%s/xenconsole", libxl_private_bindir_path()); char *domid_s = libxl_sprintf(ctx, "%d", domid); @@ -891,7 +891,7 @@ int libxl_console_exec(struct libxl_ctx return execl(p, p, domid_s, "--num", cons_num_s, (void *)NULL) == 0 ? 0 : ERROR_FAIL; } -int libxl_primary_console_exec(struct libxl_ctx *ctx, uint32_t domid_vm) +int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm) { uint32_t stubdomid = libxl_get_stubdom_id(ctx, domid_vm); if (stubdomid) @@ -900,7 +900,7 @@ int libxl_primary_console_exec(struct li return libxl_console_exec(ctx, domid_vm, 0); } -int libxl_vncviewer_exec(struct libxl_ctx *ctx, uint32_t domid, int autopass) +int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass) { const char *vnc_port, *vfb_back; const char *vnc_listen = NULL, *vnc_pass = NULL; @@ -963,7 +963,7 @@ skip_autopass: return 0; } -static char ** libxl_build_device_model_args(struct libxl_ctx *ctx, +static char ** libxl_build_device_model_args(libxl_ctx *ctx, libxl_device_model_info *info, libxl_device_nic *vifs, int num_vifs) @@ -1103,7 +1103,7 @@ static char ** libxl_build_device_model_ void dm_xenstore_record_pid(void *for_spawn, pid_t innerchild) { - struct libxl_device_model_starting *starting = for_spawn; + libxl_device_model_starting *starting = for_spawn; char *kvs[3]; int rc; struct xs_handle *xsh; @@ -1122,7 +1122,7 @@ void dm_xenstore_record_pid(void *for_sp xs_daemon_close(xsh); } -static int libxl_vfb_and_vkb_from_device_model_info(struct libxl_ctx *ctx, +static int libxl_vfb_and_vkb_from_device_model_info(libxl_ctx *ctx, libxl_device_model_info *info, libxl_device_vfb *vfb, libxl_device_vkb *vkb) @@ -1146,7 +1146,7 @@ static int libxl_vfb_and_vkb_from_device return 0; } -static int libxl_write_dmargs(struct libxl_ctx *ctx, int domid, int guest_domid, char **args) +static int libxl_write_dmargs(libxl_ctx *ctx, int domid, int guest_domid, char **args) { int i; char *vm_path; @@ -1193,7 +1193,7 @@ retry_transaction: return 0; } -static int libxl_create_stubdom(struct libxl_ctx *ctx, +static int libxl_create_stubdom(libxl_ctx *ctx, libxl_device_model_info *info, libxl_device_disk *disks, int num_disks, libxl_device_nic *vifs, int num_vifs, @@ -1320,7 +1320,7 @@ retry_transaction: return 0; } -int libxl_create_device_model(struct libxl_ctx *ctx, +int libxl_create_device_model(libxl_ctx *ctx, libxl_device_model_info *info, libxl_device_disk *disks, int num_disks, libxl_device_nic *vifs, int num_vifs, @@ -1330,7 +1330,7 @@ int libxl_create_device_model(struct lib int logfile_w, null; int rc; char **args; - struct libxl_device_model_starting buf_starting, *p; + libxl_device_model_starting buf_starting, *p; xs_transaction_t t; char *vm_path; char **pass_stuff; @@ -1361,7 +1361,7 @@ int libxl_create_device_model(struct lib *starting_r = libxl_calloc(ctx, sizeof(libxl_device_model_starting), 1); if (!*starting_r) goto xit; p = *starting_r; - p->for_spawn = libxl_calloc(ctx, sizeof(struct libxl_spawn_starting), 1); + p->for_spawn = libxl_calloc(ctx, sizeof(libxl_spawn_starting), 1); } else { p = &buf_starting; p->for_spawn = NULL; @@ -1405,7 +1405,7 @@ int libxl_create_device_model(struct lib return rc; } -int libxl_detach_device_model(struct libxl_ctx *ctx, +int libxl_detach_device_model(libxl_ctx *ctx, libxl_device_model_starting *starting) { int rc; @@ -1416,7 +1416,7 @@ int libxl_detach_device_model(struct lib } -int libxl_confirm_device_model_startup(struct libxl_ctx *ctx, +int libxl_confirm_device_model_startup(libxl_ctx *ctx, libxl_device_model_starting *starting) { int problem = libxl_wait_for_device_model(ctx, starting->domid, "running", @@ -1430,7 +1430,7 @@ int libxl_confirm_device_model_startup(s /******************************************************************************/ -static char *get_blktap2_device(struct libxl_ctx *ctx, +static char *get_blktap2_device(libxl_ctx *ctx, const char *name, const char *type) { int minor = tap_ctl_find_minor(type, name); @@ -1439,7 +1439,7 @@ static char *get_blktap2_device(struct l return libxl_sprintf(ctx, "/dev/xen/blktap-2/tapdev%d", minor); } -static char *make_blktap2_device(struct libxl_ctx *ctx, +static char *make_blktap2_device(libxl_ctx *ctx, const char *name, const char *type) { char *params, *devname = NULL; @@ -1451,7 +1451,7 @@ static char *make_blktap2_device(struct return err ? NULL : devname; } -int libxl_device_disk_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk) +int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk) { flexarray_t *front; flexarray_t *back; @@ -1572,7 +1572,7 @@ int libxl_device_disk_add(struct libxl_c return 0; } -int libxl_device_disk_del(struct libxl_ctx *ctx, +int libxl_device_disk_del(libxl_ctx *ctx, libxl_device_disk *disk, int wait) { libxl_device device; @@ -1589,7 +1589,7 @@ int libxl_device_disk_del(struct libxl_c return libxl_device_del(ctx, &device, wait); } -const char * libxl_device_disk_local_attach(struct libxl_ctx *ctx, libxl_device_disk *disk) +const char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk) { char *dev = NULL; int phystype = disk->phystype; @@ -1619,7 +1619,7 @@ const char * libxl_device_disk_local_att return dev; } -int libxl_device_disk_local_detach(struct libxl_ctx *ctx, libxl_device_disk *disk) +int libxl_device_disk_local_detach(libxl_ctx *ctx, libxl_device_disk *disk) { /* Nothing to do for PHYSTYPE_PHY. */ @@ -1632,7 +1632,7 @@ int libxl_device_disk_local_detach(struc } /******************************************************************************/ -int libxl_device_nic_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic) +int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic) { flexarray_t *front; flexarray_t *back; @@ -1711,7 +1711,7 @@ int libxl_device_nic_add(struct libxl_ct return 0; } -int libxl_device_nic_del(struct libxl_ctx *ctx, +int libxl_device_nic_del(libxl_ctx *ctx, libxl_device_nic *nic, int wait) { libxl_device device; @@ -1726,7 +1726,7 @@ int libxl_device_nic_del(struct libxl_ct return libxl_device_del(ctx, &device, wait); } -libxl_nicinfo *libxl_list_nics(struct libxl_ctx *ctx, uint32_t domid, unsigned int *nb) +libxl_nicinfo *libxl_list_nics(libxl_ctx *ctx, uint32_t domid, unsigned int *nb) { char *dompath, *nic_path_fe; char **l; @@ -1786,7 +1786,7 @@ libxl_nicinfo *libxl_list_nics(struct li } /******************************************************************************/ -int libxl_device_net2_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_net2 *net2) +int libxl_device_net2_add(libxl_ctx *ctx, uint32_t domid, libxl_device_net2 *net2) { flexarray_t *front, *back; unsigned int boffset = 0, foffset = 0; @@ -1889,7 +1889,7 @@ int libxl_device_net2_add(struct libxl_c return 0; } -libxl_net2info *libxl_device_net2_list(struct libxl_ctx *ctx, uint32_t domid, unsigned int *nb) +libxl_net2info *libxl_device_net2_list(libxl_ctx *ctx, uint32_t domid, unsigned int *nb) { char *dompath, *net2_path_fe; char **l; @@ -1951,7 +1951,7 @@ libxl_net2info *libxl_device_net2_list(s return res; } -int libxl_device_net2_del(struct libxl_ctx *ctx, libxl_device_net2 *net2, int wait) +int libxl_device_net2_del(libxl_ctx *ctx, libxl_device_net2 *net2, int wait) { libxl_device device; @@ -1967,7 +1967,7 @@ int libxl_device_net2_del(struct libxl_c /******************************************************************************/ -int libxl_device_console_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_console *console) +int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid, libxl_device_console *console) { flexarray_t *front; flexarray_t *back; @@ -2046,7 +2046,7 @@ retry_transaction: } /******************************************************************************/ -int libxl_device_vkb_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb) +int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb) { flexarray_t *front; flexarray_t *back; @@ -2091,17 +2091,17 @@ int libxl_device_vkb_add(struct libxl_ct return 0; } -int libxl_device_vkb_clean_shutdown(struct libxl_ctx *ctx, uint32_t domid) +int libxl_device_vkb_clean_shutdown(libxl_ctx *ctx, uint32_t domid) { return ERROR_NI; } -int libxl_device_vkb_hard_shutdown(struct libxl_ctx *ctx, uint32_t domid) +int libxl_device_vkb_hard_shutdown(libxl_ctx *ctx, uint32_t domid) { return ERROR_NI; } -libxl_device_disk *libxl_device_disk_list(struct libxl_ctx *ctx, uint32_t domid, int *num) +libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num) { char *be_path_tap, *be_path_vbd; libxl_device_disk *dend, *disks, *ret = NULL; @@ -2158,7 +2158,7 @@ libxl_device_disk *libxl_device_disk_lis return ret; } -int libxl_device_disk_getinfo(struct libxl_ctx *ctx, uint32_t domid, +int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, libxl_diskinfo *diskinfo) { char *dompath, *diskpath; @@ -2190,7 +2190,7 @@ int libxl_device_disk_getinfo(struct lib return 0; } -int libxl_cdrom_insert(struct libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk) +int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk) { int num, i; uint32_t stubdomid; @@ -2224,7 +2224,7 @@ int libxl_cdrom_insert(struct libxl_ctx } /******************************************************************************/ -static int libxl_build_xenpv_qemu_args(struct libxl_ctx *ctx, +static int libxl_build_xenpv_qemu_args(libxl_ctx *ctx, libxl_device_vfb *vfb, int num_console, libxl_device_console *console, @@ -2276,9 +2276,9 @@ static int libxl_build_xenpv_qemu_args(s return 0; } -int libxl_create_xenpv_qemu(struct libxl_ctx *ctx, libxl_device_vfb *vfb, +int libxl_create_xenpv_qemu(libxl_ctx *ctx, libxl_device_vfb *vfb, int num_console, libxl_device_console *console, - struct libxl_device_model_starting **starting_r) + libxl_device_model_starting **starting_r) { libxl_device_model_info info; @@ -2287,7 +2287,7 @@ int libxl_create_xenpv_qemu(struct libxl return 0; } -int libxl_device_vfb_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb) +int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb) { flexarray_t *front; flexarray_t *back; @@ -2354,19 +2354,19 @@ int libxl_device_vfb_add(struct libxl_ct return 0; } -int libxl_device_vfb_clean_shutdown(struct libxl_ctx *ctx, uint32_t domid) +int libxl_device_vfb_clean_shutdown(libxl_ctx *ctx, uint32_t domid) { return ERROR_NI; } -int libxl_device_vfb_hard_shutdown(struct libxl_ctx *ctx, uint32_t domid) +int libxl_device_vfb_hard_shutdown(libxl_ctx *ctx, uint32_t domid) { return ERROR_NI; } /******************************************************************************/ -int libxl_domain_setmaxmem(struct libxl_ctx *ctx, uint32_t domid, uint32_t max_memkb) +int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint32_t max_memkb) { char *mem, *endptr; uint32_t memorykb; @@ -2394,14 +2394,14 @@ int libxl_domain_setmaxmem(struct libxl_ return 0; } -int libxl_set_memory_target(struct libxl_ctx *ctx, uint32_t domid, uint32_t target_memkb, int enforce) +int libxl_set_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t target_memkb, int enforce) { int rc = 0; uint32_t memorykb = 0, videoram = 0; char *memmax, *endptr, *videoram_s = NULL; char *dompath = libxl_xs_get_dompath(ctx, domid); xc_domaininfo_t info; - struct libxl_dominfo ptr; + libxl_dominfo ptr; char *uuid; if (domid) { @@ -2446,7 +2446,7 @@ int libxl_set_memory_target(struct libxl return rc; } -int libxl_button_press(struct libxl_ctx *ctx, uint32_t domid, libxl_button button) +int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button) { int rc = -1; @@ -2464,7 +2464,7 @@ int libxl_button_press(struct libxl_ctx return rc; } -int libxl_get_physinfo(struct libxl_ctx *ctx, struct libxl_physinfo *physinfo) +int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo) { xc_physinfo_t xcphysinfo = { 0 }; int rc; @@ -2489,7 +2489,7 @@ int libxl_get_physinfo(struct libxl_ctx return 0; } -const libxl_version_info* libxl_get_version_info(struct libxl_ctx *ctx) +const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx) { union { xen_extraversion_t xen_extra; @@ -2534,10 +2534,10 @@ const libxl_version_info* libxl_get_vers return info; } -struct libxl_vcpuinfo *libxl_list_vcpu(struct libxl_ctx *ctx, uint32_t domid, +libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid, int *nb_vcpu, int *cpusize) { - struct libxl_vcpuinfo *ptr, *ret; + libxl_vcpuinfo *ptr, *ret; xc_domaininfo_t domaininfo; xc_vcpuinfo_t vcpuinfo; xc_physinfo_t physinfo = { 0 }; @@ -2551,7 +2551,7 @@ struct libxl_vcpuinfo *libxl_list_vcpu(s return NULL; } *cpusize = physinfo.max_cpu_id + 1; - ptr = libxl_calloc(ctx, domaininfo.max_vcpu_id + 1, sizeof (struct libxl_vcpuinfo)); + ptr = libxl_calloc(ctx, domaininfo.max_vcpu_id + 1, sizeof (libxl_vcpuinfo)); if (!ptr) { return NULL; } @@ -2580,7 +2580,7 @@ struct libxl_vcpuinfo *libxl_list_vcpu(s return ret; } -int libxl_set_vcpuaffinity(struct libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid, +int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid, uint64_t *cpumap, int cpusize) { if (xc_vcpu_setaffinity(ctx->xch, domid, vcpuid, cpumap, cpusize)) { @@ -2590,7 +2590,7 @@ int libxl_set_vcpuaffinity(struct libxl_ return 0; } -int libxl_set_vcpucount(struct libxl_ctx *ctx, uint32_t domid, uint32_t count) +int libxl_set_vcpucount(libxl_ctx *ctx, uint32_t domid, uint32_t count) { xc_domaininfo_t domaininfo; char *dompath; @@ -2617,7 +2617,7 @@ int libxl_set_vcpucount(struct libxl_ctx /* * returns one of the XEN_SCHEDULER_* constants from public/domctl.h */ -int libxl_get_sched_id(struct libxl_ctx *ctx) +int libxl_get_sched_id(libxl_ctx *ctx) { int sched, ret; @@ -2628,7 +2628,7 @@ int libxl_get_sched_id(struct libxl_ctx return sched; } -int libxl_sched_credit_domain_get(struct libxl_ctx *ctx, uint32_t domid, struct libxl_sched_credit *scinfo) +int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid, libxl_sched_credit *scinfo) { struct xen_domctl_sched_credit sdom; int rc; @@ -2645,7 +2645,7 @@ int libxl_sched_credit_domain_get(struct return 0; } -int libxl_sched_credit_domain_set(struct libxl_ctx *ctx, uint32_t domid, struct libxl_sched_credit *scinfo) +int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid, libxl_sched_credit *scinfo) { struct xen_domctl_sched_credit sdom; xc_domaininfo_t domaininfo; @@ -2701,7 +2701,7 @@ static int trigger_type_from_string(char return -1; } -int libxl_send_trigger(struct libxl_ctx *ctx, uint32_t domid, char *trigger_name, uint32_t vcpuid) +int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid, char *trigger_name, uint32_t vcpuid) { int rc = -1; int trigger_type = trigger_type_from_string(trigger_name); @@ -2722,7 +2722,7 @@ int libxl_send_trigger(struct libxl_ctx return 0; } -int libxl_send_sysrq(struct libxl_ctx *ctx, uint32_t domid, char sysrq) +int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq) { char *dompath = libxl_xs_get_dompath(ctx, domid); @@ -2731,7 +2731,7 @@ int libxl_send_sysrq(struct libxl_ctx *c return 0; } -int libxl_send_debug_keys(struct libxl_ctx *ctx, char *keys) +int libxl_send_debug_keys(libxl_ctx *ctx, char *keys) { int ret; ret = xc_send_debug_keys(ctx->xch, keys); @@ -2742,10 +2742,10 @@ int libxl_send_debug_keys(struct libxl_c return 0; } -struct libxl_xen_console_reader * - libxl_xen_console_read_start(struct libxl_ctx *ctx, int clear) -{ - struct libxl_xen_console_reader *cr; +libxl_xen_console_reader * + libxl_xen_console_read_start(libxl_ctx *ctx, int clear) +{ + libxl_xen_console_reader *cr; unsigned int size = 16384; char *buf = malloc(size); @@ -2755,13 +2755,13 @@ struct libxl_xen_console_reader * return NULL; } - cr = malloc(sizeof(struct libxl_xen_console_reader)); + cr = malloc(sizeof(libxl_xen_console_reader)); if (!cr) { XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot malloc libxl_xen_console_reader"); return NULL; } - memset(cr, 0, sizeof(struct libxl_xen_console_reader)); + memset(cr, 0, sizeof(libxl_xen_console_reader)); cr->buffer = buf; cr->size = size; cr->count = size; @@ -2779,8 +2779,8 @@ struct libxl_xen_console_reader * * string which is valid until the next call on the same console * reader. The libxl caller may overwrite parts of the string * if it wishes. */ -int libxl_xen_console_read_line(struct libxl_ctx *ctx, - struct libxl_xen_console_reader *cr, +int libxl_xen_console_read_line(libxl_ctx *ctx, + libxl_xen_console_reader *cr, char **line_r) { int ret; @@ -2805,14 +2805,14 @@ int libxl_xen_console_read_line(struct l return ret; } -void libxl_xen_console_read_finish(struct libxl_ctx *ctx, - struct libxl_xen_console_reader *cr) +void libxl_xen_console_read_finish(libxl_ctx *ctx, + libxl_xen_console_reader *cr) { free(cr->buffer); free(cr); } -uint32_t libxl_vm_get_start_time(struct libxl_ctx *ctx, uint32_t domid) +uint32_t libxl_vm_get_start_time(libxl_ctx *ctx, uint32_t domid) { char *dompath = libxl_xs_get_dompath(ctx, domid); char *vm_path, *start_time; @@ -2830,7 +2830,7 @@ uint32_t libxl_vm_get_start_time(struct return strtoul(start_time, NULL, 10); } -char *libxl_tmem_list(struct libxl_ctx *ctx, uint32_t domid, int use_long) +char *libxl_tmem_list(libxl_ctx *ctx, uint32_t domid, int use_long) { int rc; char _buf[32768]; @@ -2846,7 +2846,7 @@ char *libxl_tmem_list(struct libxl_ctx * return strdup(_buf); } -int libxl_tmem_freeze(struct libxl_ctx *ctx, uint32_t domid) +int libxl_tmem_freeze(libxl_ctx *ctx, uint32_t domid) { int rc; @@ -2861,7 +2861,7 @@ int libxl_tmem_freeze(struct libxl_ctx * return rc; } -int libxl_tmem_destroy(struct libxl_ctx *ctx, uint32_t domid) +int libxl_tmem_destroy(libxl_ctx *ctx, uint32_t domid) { int rc; @@ -2876,7 +2876,7 @@ int libxl_tmem_destroy(struct libxl_ctx return rc; } -int libxl_tmem_thaw(struct libxl_ctx *ctx, uint32_t domid) +int libxl_tmem_thaw(libxl_ctx *ctx, uint32_t domid) { int rc; @@ -2903,7 +2903,7 @@ static int32_t tmem_setop_from_string(ch return -1; } -int libxl_tmem_set(struct libxl_ctx *ctx, uint32_t domid, char* name, uint32_t set) +int libxl_tmem_set(libxl_ctx *ctx, uint32_t domid, char* name, uint32_t set) { int rc; int32_t subop = tmem_setop_from_string(name); @@ -2923,7 +2923,7 @@ int libxl_tmem_set(struct libxl_ctx *ctx return rc; } -int libxl_tmem_shared_auth(struct libxl_ctx *ctx, uint32_t domid, +int libxl_tmem_shared_auth(libxl_ctx *ctx, uint32_t domid, char* uuid, int auth) { int rc; @@ -2938,7 +2938,7 @@ int libxl_tmem_shared_auth(struct libxl_ return rc; } -int libxl_tmem_freeable(struct libxl_ctx *ctx) +int libxl_tmem_freeable(libxl_ctx *ctx) { int rc; @@ -2952,7 +2952,7 @@ int libxl_tmem_freeable(struct libxl_ctx return rc; } -int libxl_file_reference_map(struct libxl_ctx *ctx, libxl_file_reference *f) +int libxl_file_reference_map(libxl_ctx *ctx, libxl_file_reference *f) { struct stat st_buf; int ret, fd; @@ -2985,7 +2985,7 @@ out: return ret == 0 ? 0 : ERROR_FAIL; } -int libxl_file_reference_unmap(struct libxl_ctx *ctx, libxl_file_reference *f) +int libxl_file_reference_unmap(libxl_ctx *ctx, libxl_file_reference *f) { int ret; diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl.h --- a/tools/libxl/libxl.h Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl.h Wed Jul 28 16:18:44 2010 +0100 @@ -22,7 +22,7 @@ #include <xs.h> #include <sys/wait.h> /* for pid_t */ -struct libxl_dominfo { +typedef struct { uint8_t uuid[16]; uint32_t domid; uint8_t running:1; @@ -43,16 +43,16 @@ struct libxl_dominfo { uint64_t cpu_time; uint32_t vcpu_max_id; uint32_t vcpu_online; -}; - -struct libxl_poolinfo { +} libxl_dominfo; + +typedef struct { uint32_t poolid; -}; - -struct libxl_vminfo { +} libxl_poolinfo; + +typedef struct { uint8_t uuid[16]; uint32_t domid; -}; +} libxl_vminfo; typedef struct { int xen_version_major; @@ -69,7 +69,7 @@ typedef struct { char *commandline; } libxl_version_info; -struct libxl_ctx { +typedef struct { xentoollog_logger *lg; xc_interface *xch; struct xs_handle *xsh; @@ -83,9 +83,9 @@ struct libxl_ctx { * may leave them untouched */ int (*waitpid_instead)(pid_t pid, int *status, int flags); libxl_version_info version_info; -}; - -const libxl_version_info* libxl_get_version_info(struct libxl_ctx *ctx); +} libxl_ctx; + +const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx); typedef struct { bool hvm; @@ -291,7 +291,7 @@ typedef struct { char *bridge; } libxl_device_net2; -typedef struct { +typedef struct { union { unsigned int value; struct { @@ -322,26 +322,26 @@ enum { #define LIBXL_VERSION 0 /* context functions */ -int libxl_ctx_init(struct libxl_ctx *ctx, int version, xentoollog_logger*); -int libxl_ctx_free(struct libxl_ctx *ctx); -int libxl_ctx_set_log(struct libxl_ctx *ctx, xentoollog_logger*); -int libxl_ctx_postfork(struct libxl_ctx *ctx); +int libxl_ctx_init(libxl_ctx *ctx, int version, xentoollog_logger*); +int libxl_ctx_free(libxl_ctx *ctx); +int libxl_ctx_set_log(libxl_ctx *ctx, xentoollog_logger*); +int libxl_ctx_postfork(libxl_ctx *ctx); /* domain related functions */ -int libxl_domain_make(struct libxl_ctx *ctx, libxl_domain_create_info *info, uint32_t *domid); -int libxl_domain_build(struct libxl_ctx *ctx, libxl_domain_build_info *info, uint32_t domid, /* out */ libxl_domain_build_state *state); -int libxl_domain_restore(struct libxl_ctx *ctx, libxl_domain_build_info *info, +int libxl_domain_make(libxl_ctx *ctx, libxl_domain_create_info *info, uint32_t *domid); +int libxl_domain_build(libxl_ctx *ctx, libxl_domain_build_info *info, uint32_t domid, /* out */ libxl_domain_build_state *state); +int libxl_domain_restore(libxl_ctx *ctx, libxl_domain_build_info *info, uint32_t domid, int fd, libxl_domain_build_state *state, libxl_device_model_info *dm_info); -int libxl_domain_suspend(struct libxl_ctx *ctx, libxl_domain_suspend_info *info, +int libxl_domain_suspend(libxl_ctx *ctx, libxl_domain_suspend_info *info, uint32_t domid, int fd); -int libxl_domain_resume(struct libxl_ctx *ctx, uint32_t domid); -int libxl_domain_shutdown(struct libxl_ctx *ctx, uint32_t domid, int req); -int libxl_domain_destroy(struct libxl_ctx *ctx, uint32_t domid, int force); -int libxl_domain_preserve(struct libxl_ctx *ctx, uint32_t domid, libxl_domain_create_info *info, const char *name_suffix, uint8_t new_uuid[16]); - -int libxl_file_reference_map(struct libxl_ctx *ctx, libxl_file_reference *f); -int libxl_file_reference_unmap(struct libxl_ctx *ctx, libxl_file_reference *f); +int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid); +int libxl_domain_shutdown(libxl_ctx *ctx, uint32_t domid, int req); +int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force); +int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid, libxl_domain_create_info *info, const char *name_suffix, uint8_t new_uuid[16]); + +int libxl_file_reference_map(libxl_ctx *ctx, libxl_file_reference *f); +int libxl_file_reference_unmap(libxl_ctx *ctx, libxl_file_reference *f); /* * Run the configured bootloader for a PV domain and update @@ -355,12 +355,12 @@ int libxl_file_reference_unmap(struct li * ramdisk to cleanup or rely on libxl_domain_{build,restore} to do * it. */ -int libxl_run_bootloader(struct libxl_ctx *ctx, +int libxl_run_bootloader(libxl_ctx *ctx, libxl_domain_build_info *info, libxl_device_disk *disk, uint32_t domid); -char *libxl_uuid2string(struct libxl_ctx *ctx, uint8_t uuid[16]); +char *libxl_uuid2string(libxl_ctx *ctx, uint8_t uuid[16]); /* 0 means ERROR_ENOMEM, which we have logged */ /* events handling */ @@ -384,13 +384,13 @@ typedef struct { } libxl_waiter; -int libxl_get_wait_fd(struct libxl_ctx *ctx, int *fd); +int libxl_get_wait_fd(libxl_ctx *ctx, int *fd); /* waiter is allocated by the caller */ -int libxl_wait_for_domain_death(struct libxl_ctx *ctx, uint32_t domid, libxl_waiter *waiter); +int libxl_wait_for_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_waiter *waiter); /* waiter is a preallocated array of num_disks libxl_waiter elements */ -int libxl_wait_for_disk_ejects(struct libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disks, int num_disks, libxl_waiter *waiter); -int libxl_get_event(struct libxl_ctx *ctx, libxl_event *event); -int libxl_stop_waiting(struct libxl_ctx *ctx, libxl_waiter *waiter); +int libxl_wait_for_disk_ejects(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disks, int num_disks, libxl_waiter *waiter); +int libxl_get_event(libxl_ctx *ctx, libxl_event *event); +int libxl_stop_waiting(libxl_ctx *ctx, libxl_waiter *waiter); int libxl_free_event(libxl_event *event); int libxl_free_waiter(libxl_waiter *waiter); @@ -407,30 +407,30 @@ int libxl_free_waiter(libxl_waiter *wait * guaranteed to be valid since by definition the domain is * (shutdown||dying)) */ -int libxl_event_get_domain_death_info(struct libxl_ctx *ctx, uint32_t domid, libxl_event *event, struct libxl_dominfo *info); +int libxl_event_get_domain_death_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_dominfo *info); /* * Returns true and fills *disk if the caller should eject the disk */ -int libxl_event_get_disk_eject_info(struct libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_device_disk *disk); - -int libxl_domain_rename(struct libxl_ctx *ctx, uint32_t domid, +int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_device_disk *disk); + +int libxl_domain_rename(libxl_ctx *ctx, uint32_t domid, const char *old_name, const char *new_name, xs_transaction_t trans); /* if old_name is NULL, any old name is OK; otherwise we check * transactionally that the domain has the old old name; if * trans is not 0 we use caller's transaction and caller must do retries */ -int libxl_domain_pause(struct libxl_ctx *ctx, uint32_t domid); -int libxl_domain_unpause(struct libxl_ctx *ctx, uint32_t domid); - -int libxl_domain_core_dump(struct libxl_ctx *ctx, uint32_t domid, const char *filename); - -int libxl_domain_setmaxmem(struct libxl_ctx *ctx, uint32_t domid, uint32_t target_memkb); -int libxl_set_memory_target(struct libxl_ctx *ctx, uint32_t domid, uint32_t target_memkb, int enforce); - -int libxl_vncviewer_exec(struct libxl_ctx *ctx, uint32_t domid, int autopass); -int libxl_console_exec(struct libxl_ctx *ctx, uint32_t domid, int cons_num); +int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid); +int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid); + +int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t domid, const char *filename); + +int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint32_t target_memkb); +int libxl_set_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t target_memkb, int enforce); + +int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass); +int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num); /* libxl_primary_console_exec finds the domid and console number * corresponding to the primary console of the given vm, then calls * libxl_console_exec with the right arguments (domid might be different @@ -438,29 +438,29 @@ int libxl_console_exec(struct libxl_ctx * This function can be called after creating the device model, in * case of HVM guests, and before libxl_run_bootloader in case of PV * guests using pygrub. */ -int libxl_primary_console_exec(struct libxl_ctx *ctx, uint32_t domid_vm); - -int libxl_domain_info(struct libxl_ctx*, struct libxl_dominfo *info_r, +int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm); + +int libxl_domain_info(libxl_ctx*, libxl_dominfo *info_r, uint32_t domid); -struct libxl_dominfo * libxl_list_domain(struct libxl_ctx*, int *nb_domain); -struct libxl_poolinfo * libxl_list_pool(struct libxl_ctx*, int *nb_pool); -struct libxl_vminfo * libxl_list_vm(struct libxl_ctx *ctx, int *nb_vm); +libxl_dominfo * libxl_list_domain(libxl_ctx*, int *nb_domain); +libxl_poolinfo * libxl_list_pool(libxl_ctx*, int *nb_pool); +libxl_vminfo * libxl_list_vm(libxl_ctx *ctx, int *nb_vm); typedef struct libxl_device_model_starting libxl_device_model_starting; -int libxl_create_device_model(struct libxl_ctx *ctx, +int libxl_create_device_model(libxl_ctx *ctx, libxl_device_model_info *info, libxl_device_disk *disk, int num_disks, libxl_device_nic *vifs, int num_vifs, libxl_device_model_starting **starting_r); -int libxl_create_xenpv_qemu(struct libxl_ctx *ctx, libxl_device_vfb *vfb, +int libxl_create_xenpv_qemu(libxl_ctx *ctx, libxl_device_vfb *vfb, int num_console, libxl_device_console *console, libxl_device_model_starting **starting_r); /* Caller must either: pass starting_r==0, or on successful * return pass *starting_r (which will be non-0) to * libxl_confirm_device_model or libxl_detach_device_model. */ -int libxl_confirm_device_model_startup(struct libxl_ctx *ctx, +int libxl_confirm_device_model_startup(libxl_ctx *ctx, libxl_device_model_starting *starting); -int libxl_detach_device_model(struct libxl_ctx *ctx, +int libxl_detach_device_model(libxl_ctx *ctx, libxl_device_model_starting *starting); /* DM is detached even if error is returned */ @@ -475,18 +475,18 @@ typedef struct { int rref; } libxl_diskinfo; -int libxl_device_disk_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk); -int libxl_device_disk_del(struct libxl_ctx *ctx, libxl_device_disk *disk, int wait); -libxl_device_disk *libxl_device_disk_list(struct libxl_ctx *ctx, uint32_t domid, int *num); -int libxl_device_disk_getinfo(struct libxl_ctx *ctx, uint32_t domid, +int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk); +int libxl_device_disk_del(libxl_ctx *ctx, libxl_device_disk *disk, int wait); +libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num); +int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, libxl_diskinfo *diskinfo); -int libxl_cdrom_insert(struct libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk); +int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk); /* * Make a disk available in this domain. Returns path to a device. */ -const char * libxl_device_disk_local_attach(struct libxl_ctx *ctx, libxl_device_disk *disk); -int libxl_device_disk_local_detach(struct libxl_ctx *ctx, libxl_device_disk *disk); +const char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk); +int libxl_device_disk_local_detach(libxl_ctx *ctx, libxl_device_disk *disk); typedef struct { char *backend; @@ -502,26 +502,26 @@ typedef struct { int rref_rx; } libxl_nicinfo; -int libxl_device_nic_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic); -int libxl_device_nic_del(struct libxl_ctx *ctx, libxl_device_nic *nic, int wait); -libxl_nicinfo *libxl_list_nics(struct libxl_ctx *ctx, uint32_t domid, unsigned int *nb); - -int libxl_device_console_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_console *console); - -int libxl_device_vkb_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb); -int libxl_device_vkb_clean_shutdown(struct libxl_ctx *ctx, uint32_t domid); -int libxl_device_vkb_hard_shutdown(struct libxl_ctx *ctx, uint32_t domid); - -int libxl_device_vfb_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb); -int libxl_device_vfb_clean_shutdown(struct libxl_ctx *ctx, uint32_t domid); -int libxl_device_vfb_hard_shutdown(struct libxl_ctx *ctx, uint32_t domid); +int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic); +int libxl_device_nic_del(libxl_ctx *ctx, libxl_device_nic *nic, int wait); +libxl_nicinfo *libxl_list_nics(libxl_ctx *ctx, uint32_t domid, unsigned int *nb); + +int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid, libxl_device_console *console); + +int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb); +int libxl_device_vkb_clean_shutdown(libxl_ctx *ctx, uint32_t domid); +int libxl_device_vkb_hard_shutdown(libxl_ctx *ctx, uint32_t domid); + +int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb); +int libxl_device_vfb_clean_shutdown(libxl_ctx *ctx, uint32_t domid); +int libxl_device_vfb_hard_shutdown(libxl_ctx *ctx, uint32_t domid); #define PCI_BDF "%04x:%02x:%02x.%01x" #define PCI_BDF_VDEVFN "%04x:%02x:%02x.%01x@%02x" -int libxl_device_pci_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev); -int libxl_device_pci_remove(struct libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev); -int libxl_device_pci_shutdown(struct libxl_ctx *ctx, uint32_t domid); -libxl_device_pci *libxl_device_pci_list(struct libxl_ctx *ctx, uint32_t domid, int *num); +int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev); +int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev); +int libxl_device_pci_shutdown(libxl_ctx *ctx, uint32_t domid); +libxl_device_pci *libxl_device_pci_list(libxl_ctx *ctx, uint32_t domid, int *num); int libxl_device_pci_init(libxl_device_pci *pcidev, unsigned int domain, unsigned int bus, unsigned int dev, unsigned int func, unsigned int vdevfn); @@ -542,12 +542,12 @@ int libxl_device_pci_init(libxl_device_p * semantics of the data. For specifications of the data formats * see the code or documentation for the libxl caller in question. */ -int libxl_userdata_store(struct libxl_ctx *ctx, uint32_t domid, +int libxl_userdata_store(libxl_ctx *ctx, uint32_t domid, const char *userdata_userid, const uint8_t *data, int datalen); /* If datalen==0, data is not used and the user data for * that domain and userdata_userid is deleted. */ -int libxl_userdata_retrieve(struct libxl_ctx *ctx, uint32_t domid, +int libxl_userdata_retrieve(libxl_ctx *ctx, uint32_t domid, const char *userdata_userid, uint8_t **data_r, int *datalen_r); /* On successful return, *data_r is from malloc. @@ -562,9 +562,9 @@ typedef enum { SLEEP_BUTTON } libxl_button; -int libxl_button_press(struct libxl_ctx *ctx, uint32_t domid, libxl_button button); - -struct libxl_vcpuinfo { +int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button); + +typedef struct { uint32_t vcpuid; /* vcpu's id */ uint32_t cpu; /* current mapping */ uint8_t online:1; /* currently online (not hotplugged)? */ @@ -572,9 +572,9 @@ struct libxl_vcpuinfo { uint8_t running:1; /* currently scheduled on its CPU? */ uint64_t vcpu_time; /* total vcpu time ran (ns) */ uint64_t *cpumap; /* current cpu's affinities */ -}; - -struct libxl_physinfo { +} libxl_vcpuinfo; + +typedef struct { uint32_t threads_per_core; uint32_t cores_per_socket; @@ -589,60 +589,60 @@ struct libxl_physinfo { uint32_t nr_nodes; uint32_t hw_cap[8]; uint32_t phys_cap; -}; - -int libxl_get_physinfo(struct libxl_ctx *ctx, struct libxl_physinfo *physinfo); -struct libxl_vcpuinfo *libxl_list_vcpu(struct libxl_ctx *ctx, uint32_t domid, +} libxl_physinfo; + +int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo); +libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid, int *nb_vcpu, int *cpusize); -int libxl_set_vcpuaffinity(struct libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid, +int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid, uint64_t *cpumap, int cpusize); -int libxl_set_vcpucount(struct libxl_ctx *ctx, uint32_t domid, uint32_t count); - -int libxl_get_sched_id(struct libxl_ctx *ctx); - - -struct libxl_sched_credit { +int libxl_set_vcpucount(libxl_ctx *ctx, uint32_t domid, uint32_t count); + +int libxl_get_sched_id(libxl_ctx *ctx); + + +typedef struct { int weight; int cap; -}; - -int libxl_sched_credit_domain_get(struct libxl_ctx *ctx, uint32_t domid, - struct libxl_sched_credit *scinfo); -int libxl_sched_credit_domain_set(struct libxl_ctx *ctx, uint32_t domid, - struct libxl_sched_credit *scinfo); -int libxl_send_trigger(struct libxl_ctx *ctx, uint32_t domid, +} libxl_sched_credit; + +int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid, + libxl_sched_credit *scinfo); +int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid, + libxl_sched_credit *scinfo); +int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid, char *trigger_name, uint32_t vcpuid); -int libxl_send_sysrq(struct libxl_ctx *ctx, uint32_t domid, char sysrq); -int libxl_send_debug_keys(struct libxl_ctx *ctx, char *keys); - -struct libxl_xen_console_reader { +int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq); +int libxl_send_debug_keys(libxl_ctx *ctx, char *keys); + +typedef struct { char *buffer; unsigned int size; unsigned int count; unsigned int clear; unsigned int incremental; unsigned int index; -}; - -struct libxl_xen_console_reader * - libxl_xen_console_read_start(struct libxl_ctx *ctx, int clear); -int libxl_xen_console_read_line(struct libxl_ctx *ctx, - struct libxl_xen_console_reader *cr, +} libxl_xen_console_reader; + +libxl_xen_console_reader * + libxl_xen_console_read_start(libxl_ctx *ctx, int clear); +int libxl_xen_console_read_line(libxl_ctx *ctx, + libxl_xen_console_reader *cr, char **line_r); -void libxl_xen_console_read_finish(struct libxl_ctx *ctx, - struct libxl_xen_console_reader *cr); - -uint32_t libxl_vm_get_start_time(struct libxl_ctx *ctx, uint32_t domid); - -char *libxl_tmem_list(struct libxl_ctx *ctx, uint32_t domid, int use_long); -int libxl_tmem_freeze(struct libxl_ctx *ctx, uint32_t domid); -int libxl_tmem_destroy(struct libxl_ctx *ctx, uint32_t domid); -int libxl_tmem_thaw(struct libxl_ctx *ctx, uint32_t domid); -int libxl_tmem_set(struct libxl_ctx *ctx, uint32_t domid, char* name, +void libxl_xen_console_read_finish(libxl_ctx *ctx, + libxl_xen_console_reader *cr); + +uint32_t libxl_vm_get_start_time(libxl_ctx *ctx, uint32_t domid); + +char *libxl_tmem_list(libxl_ctx *ctx, uint32_t domid, int use_long); +int libxl_tmem_freeze(libxl_ctx *ctx, uint32_t domid); +int libxl_tmem_destroy(libxl_ctx *ctx, uint32_t domid); +int libxl_tmem_thaw(libxl_ctx *ctx, uint32_t domid); +int libxl_tmem_set(libxl_ctx *ctx, uint32_t domid, char* name, uint32_t set); -int libxl_tmem_shared_auth(struct libxl_ctx *ctx, uint32_t domid, char* uuid, +int libxl_tmem_shared_auth(libxl_ctx *ctx, uint32_t domid, char* uuid, int auth); -int libxl_tmem_freeable(struct libxl_ctx *ctx); +int libxl_tmem_freeable(libxl_ctx *ctx); typedef struct { char *backend; @@ -657,11 +657,11 @@ typedef struct { int filter_mac; } libxl_net2info; -int libxl_device_net2_add(struct libxl_ctx *ctx, uint32_t domid, +int libxl_device_net2_add(libxl_ctx *ctx, uint32_t domid, libxl_device_net2 *net2); -libxl_net2info *libxl_device_net2_list(struct libxl_ctx *ctx, uint32_t domid, +libxl_net2info *libxl_device_net2_list(libxl_ctx *ctx, uint32_t domid, unsigned int *nb); -int libxl_device_net2_del(struct libxl_ctx *ctx, libxl_device_net2 *net2, +int libxl_device_net2_del(libxl_ctx *ctx, libxl_device_net2 *net2, int wait); /* common paths */ diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl_bootloader.c --- a/tools/libxl/libxl_bootloader.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl_bootloader.c Wed Jul 28 16:18:44 2010 +0100 @@ -30,7 +30,7 @@ #define XENCONSOLED_BUF_SIZE 16 #define BOOTLOADER_BUF_SIZE 1024 -static char **make_bootloader_args(struct libxl_ctx *ctx, +static char **make_bootloader_args(libxl_ctx *ctx, libxl_domain_build_info *info, uint32_t domid, const char *fifo, const char *disk) @@ -161,7 +161,7 @@ static pid_t fork_exec_bootloader(int *m * if there is actual data to write, otherwise this would loop too fast, * eating up CPU time. */ -static char * bootloader_interact(struct libxl_ctx *ctx, int xenconsoled_fd, int bootloader_fd, int fifo_fd) +static char * bootloader_interact(libxl_ctx *ctx, int xenconsoled_fd, int bootloader_fd, int fifo_fd) { int ret; @@ -271,7 +271,7 @@ out_err: return NULL; } -static void parse_bootloader_result(struct libxl_ctx *ctx, +static void parse_bootloader_result(libxl_ctx *ctx, libxl_domain_build_info *info, const char *o) { @@ -295,7 +295,7 @@ static void parse_bootloader_result(stru } } -int libxl_run_bootloader(struct libxl_ctx *ctx, +int libxl_run_bootloader(libxl_ctx *ctx, libxl_domain_build_info *info, libxl_device_disk *disk, uint32_t domid) diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl_device.c --- a/tools/libxl/libxl_device.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl_device.c Wed Jul 28 16:18:44 2010 +0100 @@ -39,7 +39,7 @@ static const char *string_of_kinds[] = { [DEVICE_CONSOLE] = "console", }; -int libxl_device_generic_add(struct libxl_ctx *ctx, libxl_device *device, +int libxl_device_generic_add(libxl_ctx *ctx, libxl_device *device, char **bents, char **fents) { char *dom_path_backend, *dom_path, *frontend_path, *backend_path; @@ -219,7 +219,7 @@ int device_disk_dev_number(char *virtpat return -1; } -int libxl_device_destroy(struct libxl_ctx *ctx, char *be_path, int force) +int libxl_device_destroy(libxl_ctx *ctx, char *be_path, int force) { xs_transaction_t t; char *state_path = libxl_sprintf(ctx, "%s/state", be_path); @@ -248,7 +248,7 @@ retry_transaction: return 0; } -int wait_for_dev_destroy(struct libxl_ctx *ctx, struct timeval *tv) +int wait_for_dev_destroy(libxl_ctx *ctx, struct timeval *tv) { int nfds, rc; unsigned int n; @@ -276,14 +276,14 @@ int wait_for_dev_destroy(struct libxl_ct return rc; } -int libxl_devices_destroy(struct libxl_ctx *ctx, uint32_t domid, int force) +int libxl_devices_destroy(libxl_ctx *ctx, uint32_t domid, int force) { char *path, *be_path, *fe_path; unsigned int num1, num2; char **l1 = NULL, **l2 = NULL; int i, j, n = 0, n_watches = 0; flexarray_t *toremove; - struct libxl_ctx clone; + libxl_ctx clone; if (libxl_ctx_init(&clone, LIBXL_VERSION, ctx->lg)) { return -1; @@ -342,11 +342,11 @@ int libxl_devices_destroy(struct libxl_c return 0; } -int libxl_device_del(struct libxl_ctx *ctx, libxl_device *dev, int wait) +int libxl_device_del(libxl_ctx *ctx, libxl_device *dev, int wait) { char *dom_path_backend, *backend_path; int rc; - struct libxl_ctx clone; + libxl_ctx clone; if (libxl_ctx_init(&clone, LIBXL_VERSION, ctx->lg)) { return -1; @@ -377,7 +377,7 @@ int libxl_device_del(struct libxl_ctx *c return 0; } -int libxl_device_pci_reset(struct libxl_ctx *ctx, unsigned int domain, unsigned int bus, +int libxl_device_pci_reset(libxl_ctx *ctx, unsigned int domain, unsigned int bus, unsigned int dev, unsigned int func) { char *reset = "/sys/bus/pci/drivers/pciback/do_flr"; @@ -411,9 +411,9 @@ int libxl_device_pci_reset(struct libxl_ return -1; } -int libxl_wait_for_device_model(struct libxl_ctx *ctx, +int libxl_wait_for_device_model(libxl_ctx *ctx, uint32_t domid, char *state, - int (*check_callback)(struct libxl_ctx *ctx, + int (*check_callback)(libxl_ctx *ctx, void *userdata), void *check_callback_userdata) { @@ -465,7 +465,7 @@ again: return -1; } -int libxl_wait_for_backend(struct libxl_ctx *ctx, char *be_path, char *state) +int libxl_wait_for_backend(libxl_ctx *ctx, char *be_path, char *state) { int watchdog = 100; unsigned int len; diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl_dom.c --- a/tools/libxl/libxl_dom.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl_dom.c Wed Jul 28 16:18:44 2010 +0100 @@ -31,7 +31,7 @@ #include "libxl.h" #include "libxl_internal.h" -int is_hvm(struct libxl_ctx *ctx, uint32_t domid) +int is_hvm(libxl_ctx *ctx, uint32_t domid) { xc_domaininfo_t info; int ret; @@ -44,7 +44,7 @@ int is_hvm(struct libxl_ctx *ctx, uint32 return !!(info.flags & XEN_DOMINF_hvm_guest); } -int get_shutdown_reason(struct libxl_ctx *ctx, uint32_t domid) +int get_shutdown_reason(libxl_ctx *ctx, uint32_t domid) { xc_domaininfo_t info; int ret; @@ -59,7 +59,7 @@ int get_shutdown_reason(struct libxl_ctx return dominfo_get_shutdown_reason(&info); } -int build_pre(struct libxl_ctx *ctx, uint32_t domid, +int build_pre(libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *state) { xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus); @@ -82,7 +82,7 @@ int build_pre(struct libxl_ctx *ctx, uin return 0; } -int build_post(struct libxl_ctx *ctx, uint32_t domid, +int build_post(libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *state, char **vms_ents, char **local_ents) { @@ -136,7 +136,7 @@ retry_transaction: return 0; } -int build_pv(struct libxl_ctx *ctx, uint32_t domid, +int build_pv(libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *state) { struct xc_dom_image *dom; @@ -215,7 +215,7 @@ out: return ret == 0 ? 0 : ERROR_FAIL; } -int build_hvm(struct libxl_ctx *ctx, uint32_t domid, +int build_hvm(libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *state) { int ret; @@ -245,7 +245,7 @@ int build_hvm(struct libxl_ctx *ctx, uin return 0; } -int restore_common(struct libxl_ctx *ctx, uint32_t domid, +int restore_common(libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *state, int fd) { @@ -263,7 +263,7 @@ int restore_common(struct libxl_ctx *ctx } struct suspendinfo { - struct libxl_ctx *ctx; + libxl_ctx *ctx; int xce; /* event channel handle */ int suspend_eventchn; int domid; @@ -345,7 +345,7 @@ static int core_suspend_callback(void *d return 1; } -int core_suspend(struct libxl_ctx *ctx, uint32_t domid, int fd, +int core_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int hvm, int live, int debug) { int flags; @@ -396,7 +396,7 @@ int core_suspend(struct libxl_ctx *ctx, return 0; } -int save_device_model(struct libxl_ctx *ctx, uint32_t domid, int fd) +int save_device_model(libxl_ctx *ctx, uint32_t domid, int fd) { int fd2, c; char buf[1024]; @@ -427,17 +427,17 @@ int save_device_model(struct libxl_ctx * return 0; } -char *libxl_uuid2string(struct libxl_ctx *ctx, uint8_t uuid[16]) { +char *libxl_uuid2string(libxl_ctx *ctx, uint8_t uuid[16]) { char *s = string_of_uuid(ctx, uuid); if (!s) XL_LOG(ctx, XL_LOG_ERROR, "cannot allocate for uuid"); return s; } -static const char *userdata_path(struct libxl_ctx *ctx, uint32_t domid, +static const char *userdata_path(libxl_ctx *ctx, uint32_t domid, const char *userdata_userid, const char *wh) { char *path, *uuid_string; - struct libxl_dominfo info; + libxl_dominfo info; int rc; rc = libxl_domain_info(ctx, &info, domid); @@ -457,7 +457,7 @@ static const char *userdata_path(struct return path; } -static int userdata_delete(struct libxl_ctx *ctx, const char *path) { +static int userdata_delete(libxl_ctx *ctx, const char *path) { int r; r = unlink(path); if (r) { @@ -467,7 +467,7 @@ static int userdata_delete(struct libxl_ return 0; } -void libxl__userdata_destroyall(struct libxl_ctx *ctx, uint32_t domid) { +void libxl__userdata_destroyall(libxl_ctx *ctx, uint32_t domid) { const char *pattern; glob_t gl; int r, i; @@ -488,7 +488,7 @@ void libxl__userdata_destroyall(struct l globfree(&gl); } -int libxl_userdata_store(struct libxl_ctx *ctx, uint32_t domid, +int libxl_userdata_store(libxl_ctx *ctx, uint32_t domid, const char *userdata_userid, const uint8_t *data, int datalen) { const char *filename; @@ -535,7 +535,7 @@ int libxl_userdata_store(struct libxl_ct return ERROR_FAIL; } -int libxl_userdata_retrieve(struct libxl_ctx *ctx, uint32_t domid, +int libxl_userdata_retrieve(libxl_ctx *ctx, uint32_t domid, const char *userdata_userid, uint8_t **data_r, int *datalen_r) { const char *filename; diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl_exec.c --- a/tools/libxl/libxl_exec.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl_exec.c Wed Jul 28 16:18:44 2010 +0100 @@ -57,7 +57,7 @@ void libxl_exec(int stdinfd, int stdoutf _exit(-1); } -void libxl_report_child_exitstatus(struct libxl_ctx *ctx, +void libxl_report_child_exitstatus(libxl_ctx *ctx, xentoollog_level level, const char *what, pid_t pid, int status) { @@ -88,7 +88,7 @@ void libxl_report_child_exitstatus(struc } } -int libxl_spawn_spawn(struct libxl_ctx *ctx, +int libxl_spawn_spawn(libxl_ctx *ctx, libxl_device_model_starting *starting, const char *what, void (*intermediate_hook)(void *for_spawn, @@ -97,7 +97,7 @@ int libxl_spawn_spawn(struct libxl_ctx * pid_t child, got; int status; pid_t intermediate; - struct libxl_spawn_starting *for_spawn = starting->for_spawn; + libxl_spawn_starting *for_spawn = starting->for_spawn; if (for_spawn) { for_spawn->what = libxl_strdup(ctx, what); @@ -135,8 +135,8 @@ int libxl_spawn_spawn(struct libxl_ctx * ? WTERMSIG(status)+128 : -1); } -static void report_spawn_intermediate_status(struct libxl_ctx *ctx, - struct libxl_spawn_starting *for_spawn, +static void report_spawn_intermediate_status(libxl_ctx *ctx, + libxl_spawn_starting *for_spawn, int status) { if (!WIFEXITED(status)) { @@ -149,8 +149,8 @@ static void report_spawn_intermediate_st } } -int libxl_spawn_detach(struct libxl_ctx *ctx, - struct libxl_spawn_starting *for_spawn) +int libxl_spawn_detach(libxl_ctx *ctx, + libxl_spawn_starting *for_spawn) { int r, status; pid_t got; @@ -182,9 +182,9 @@ int libxl_spawn_detach(struct libxl_ctx return rc; } -int libxl_spawn_check(struct libxl_ctx *ctx, void *for_spawn_void) -{ - struct libxl_spawn_starting *for_spawn = for_spawn_void; +int libxl_spawn_check(libxl_ctx *ctx, void *for_spawn_void) +{ + libxl_spawn_starting *for_spawn = for_spawn_void; pid_t got; int status; diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl_internal.c --- a/tools/libxl/libxl_internal.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl_internal.c Wed Jul 28 16:18:44 2010 +0100 @@ -23,12 +23,12 @@ #include "libxl_internal.h" #include "libxl_utils.h" -int libxl_error_set(struct libxl_ctx *ctx, int code) -{ - return 0; -} - -int libxl_ptr_add(struct libxl_ctx *ctx, void *ptr) +int libxl_error_set(libxl_ctx *ctx, int code) +{ + return 0; +} + +int libxl_ptr_add(libxl_ctx *ctx, void *ptr) { int i; void **re; @@ -59,7 +59,7 @@ int libxl_ptr_add(struct libxl_ctx *ctx, return 0; } -int libxl_free(struct libxl_ctx *ctx, void *ptr) +int libxl_free(libxl_ctx *ctx, void *ptr) { int i; @@ -78,7 +78,7 @@ int libxl_free(struct libxl_ctx *ctx, vo return -1; } -int libxl_free_all(struct libxl_ctx *ctx) +int libxl_free_all(libxl_ctx *ctx) { void *ptr; int i; @@ -91,7 +91,7 @@ int libxl_free_all(struct libxl_ctx *ctx return 0; } -void *libxl_zalloc(struct libxl_ctx *ctx, int bytes) +void *libxl_zalloc(libxl_ctx *ctx, int bytes) { void *ptr = calloc(bytes, 1); if (!ptr) { @@ -103,7 +103,7 @@ void *libxl_zalloc(struct libxl_ctx *ctx return ptr; } -void *libxl_calloc(struct libxl_ctx *ctx, size_t nmemb, size_t size) +void *libxl_calloc(libxl_ctx *ctx, size_t nmemb, size_t size) { void *ptr = calloc(nmemb, size); if (!ptr) { @@ -115,7 +115,7 @@ void *libxl_calloc(struct libxl_ctx *ctx return ptr; } -char *libxl_sprintf(struct libxl_ctx *ctx, const char *fmt, ...) +char *libxl_sprintf(libxl_ctx *ctx, const char *fmt, ...) { char *s; va_list ap; @@ -138,7 +138,7 @@ char *libxl_sprintf(struct libxl_ctx *ct return s; } -char *libxl_strdup(struct libxl_ctx *ctx, const char *c) +char *libxl_strdup(libxl_ctx *ctx, const char *c) { char *s = strdup(c); @@ -148,7 +148,7 @@ char *libxl_strdup(struct libxl_ctx *ctx return s; } -char *libxl_dirname(struct libxl_ctx *ctx, const char *s) +char *libxl_dirname(libxl_ctx *ctx, const char *s) { char *c; char *ptr = libxl_strdup(ctx, s); @@ -160,7 +160,7 @@ char *libxl_dirname(struct libxl_ctx *ct return ptr; } -void xl_logv(struct libxl_ctx *ctx, xentoollog_level msglevel, int errnoval, +void xl_logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval, const char *file, int line, const char *func, char *fmt, va_list ap) { @@ -187,7 +187,7 @@ void xl_logv(struct libxl_ctx *ctx, xent errno = esave; } -void xl_log(struct libxl_ctx *ctx, xentoollog_level msglevel, int errnoval, +void xl_log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval, const char *file, int line, const char *func, char *fmt, ...) { @@ -197,7 +197,7 @@ void xl_log(struct libxl_ctx *ctx, xento va_end(ap); } -char *libxl_abs_path(struct libxl_ctx *ctx, char *s, const char *path) +char *libxl_abs_path(libxl_ctx *ctx, char *s, const char *path) { if (!s || s[0] == '/') return s; diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl_internal.h Wed Jul 28 16:18:44 2010 +0100 @@ -51,13 +51,13 @@ /* all of these macros preserve errno (saving and restoring) */ /* logging */ -void xl_logv(struct libxl_ctx *ctx, xentoollog_level msglevel, int errnoval, +void xl_logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval, const char *file /* may be 0 */, int line /* ignored if !file */, const char *func /* may be 0 */, char *fmt, va_list al) __attribute__((format(printf,7,0))); -void xl_log(struct libxl_ctx *ctx, xentoollog_level msglevel, int errnoval, +void xl_log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval, const char *file /* may be 0 */, int line /* ignored if !file */, const char *func /* may be 0 */, char *fmt, ...) @@ -105,45 +105,45 @@ int xs_writev(struct xs_handle *xsh, xs_ int xs_writev(struct xs_handle *xsh, xs_transaction_t t, char *dir, char *kvs[]); /* memory allocation tracking/helpers */ -int libxl_ptr_add(struct libxl_ctx *ctx, void *ptr); -int libxl_free(struct libxl_ctx *ctx, void *ptr); -int libxl_free_all(struct libxl_ctx *ctx); -void *libxl_zalloc(struct libxl_ctx *ctx, int bytes); -void *libxl_calloc(struct libxl_ctx *ctx, size_t nmemb, size_t size); -char *libxl_sprintf(struct libxl_ctx *ctx, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3); -char *libxl_strdup(struct libxl_ctx *ctx, const char *c); -char *libxl_dirname(struct libxl_ctx *ctx, const char *s); - -char **libxl_xs_kvs_of_flexarray(struct libxl_ctx *ctx, flexarray_t *array, int length); -int libxl_xs_writev(struct libxl_ctx *ctx, xs_transaction_t t, +int libxl_ptr_add(libxl_ctx *ctx, void *ptr); +int libxl_free(libxl_ctx *ctx, void *ptr); +int libxl_free_all(libxl_ctx *ctx); +void *libxl_zalloc(libxl_ctx *ctx, int bytes); +void *libxl_calloc(libxl_ctx *ctx, size_t nmemb, size_t size); +char *libxl_sprintf(libxl_ctx *ctx, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3); +char *libxl_strdup(libxl_ctx *ctx, const char *c); +char *libxl_dirname(libxl_ctx *ctx, const char *s); + +char **libxl_xs_kvs_of_flexarray(libxl_ctx *ctx, flexarray_t *array, int length); +int libxl_xs_writev(libxl_ctx *ctx, xs_transaction_t t, char *dir, char **kvs); -int libxl_xs_write(struct libxl_ctx *ctx, xs_transaction_t t, +int libxl_xs_write(libxl_ctx *ctx, xs_transaction_t t, char *path, char *fmt, ...) PRINTF_ATTRIBUTE(4, 5); -char *libxl_xs_get_dompath(struct libxl_ctx *ctx, uint32_t domid); // logs errs -char *libxl_xs_read(struct libxl_ctx *ctx, xs_transaction_t t, char *path); -char **libxl_xs_directory(struct libxl_ctx *ctx, xs_transaction_t t, char *path, unsigned int *nb); +char *libxl_xs_get_dompath(libxl_ctx *ctx, uint32_t domid); // logs errs +char *libxl_xs_read(libxl_ctx *ctx, xs_transaction_t t, char *path); +char **libxl_xs_directory(libxl_ctx *ctx, xs_transaction_t t, char *path, unsigned int *nb); /* from xl_dom */ -int is_hvm(struct libxl_ctx *ctx, uint32_t domid); -int get_shutdown_reason(struct libxl_ctx *ctx, uint32_t domid); +int is_hvm(libxl_ctx *ctx, uint32_t domid); +int get_shutdown_reason(libxl_ctx *ctx, uint32_t domid); #define dominfo_get_shutdown_reason(info) (((info)->flags >> XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask) -int build_pre(struct libxl_ctx *ctx, uint32_t domid, +int build_pre(libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *state); -int build_post(struct libxl_ctx *ctx, uint32_t domid, +int build_post(libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *state, char **vms_ents, char **local_ents); -int build_pv(struct libxl_ctx *ctx, uint32_t domid, +int build_pv(libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *state); -int build_hvm(struct libxl_ctx *ctx, uint32_t domid, +int build_hvm(libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *state); -int restore_common(struct libxl_ctx *ctx, uint32_t domid, +int restore_common(libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *state, int fd); -int core_suspend(struct libxl_ctx *ctx, uint32_t domid, int fd, int hvm, int live, int debug); -int save_device_model(struct libxl_ctx *ctx, uint32_t domid, int fd); -void libxl__userdata_destroyall(struct libxl_ctx *ctx, uint32_t domid); +int core_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int hvm, int live, int debug); +int save_device_model(libxl_ctx *ctx, uint32_t domid, int fd); +void libxl__userdata_destroyall(libxl_ctx *ctx, uint32_t domid); /* from xl_device */ char *device_disk_backend_type_of_phystype(libxl_disk_phystype phystype); @@ -152,18 +152,18 @@ int device_physdisk_major_minor(const ch int device_physdisk_major_minor(const char *physpath, int *major, int *minor); int device_disk_dev_number(char *virtpath); -int libxl_device_generic_add(struct libxl_ctx *ctx, libxl_device *device, +int libxl_device_generic_add(libxl_ctx *ctx, libxl_device *device, char **bents, char **fents); -int libxl_device_del(struct libxl_ctx *ctx, libxl_device *dev, int wait); -int libxl_device_destroy(struct libxl_ctx *ctx, char *be_path, int force); -int libxl_devices_destroy(struct libxl_ctx *ctx, uint32_t domid, int force); -int libxl_wait_for_device_model(struct libxl_ctx *ctx, +int libxl_device_del(libxl_ctx *ctx, libxl_device *dev, int wait); +int libxl_device_destroy(libxl_ctx *ctx, char *be_path, int force); +int libxl_devices_destroy(libxl_ctx *ctx, uint32_t domid, int force); +int libxl_wait_for_device_model(libxl_ctx *ctx, uint32_t domid, char *state, - int (*check_callback)(struct libxl_ctx *ctx, + int (*check_callback)(libxl_ctx *ctx, void *userdata), void *check_callback_userdata); -int libxl_wait_for_backend(struct libxl_ctx *ctx, char *be_path, char *state); -int libxl_device_pci_reset(struct libxl_ctx *ctx, unsigned int domain, unsigned int bus, +int libxl_wait_for_backend(libxl_ctx *ctx, char *be_path, char *state); +int libxl_device_pci_reset(libxl_ctx *ctx, unsigned int domain, unsigned int bus, unsigned int dev, unsigned int func); /* from xenguest (helper */ @@ -175,20 +175,20 @@ int hvm_build_set_params(xc_interface *h /* higher-level double-fork and separate detach eg as for device models */ -struct libxl_spawn_starting { +typedef struct { /* put this in your own status structure as returned to application */ /* all fields are private to libxl_spawn_... */ pid_t intermediate; char *what; /* malloc'd in spawn_spawn */ -}; +} libxl_spawn_starting; struct libxl_device_model_starting { - struct libxl_spawn_starting *for_spawn; /* first! */ + libxl_spawn_starting *for_spawn; /* first! */ char *dom_path; /* from libxl_malloc, only for dm_xenstore_record_pid */ int domid; }; -int libxl_spawn_spawn(struct libxl_ctx *ctx, +int libxl_spawn_spawn(libxl_ctx *ctx, libxl_device_model_starting *starting, const char *what, void (*intermediate_hook)(void *for_spawn, pid_t innerchild)); @@ -198,24 +198,24 @@ int libxl_spawn_spawn(struct libxl_ctx * * 0 caller is now the inner child, should probably call libxl_exec * Caller, may pass 0 for for_spawn, in which case no need to detach. */ -int libxl_spawn_detach(struct libxl_ctx *ctx, - struct libxl_spawn_starting *for_spawn); +int libxl_spawn_detach(libxl_ctx *ctx, + libxl_spawn_starting *for_spawn); /* Logs errors. Idempotent, but only permitted after successful * call to libxl_spawn_spawn, and no point calling it again if it fails. */ -int libxl_spawn_check(struct libxl_ctx *ctx, +int libxl_spawn_check(libxl_ctx *ctx, void *for_spawn); /* Logs errors but also returns them. - * for_spawn must actually be a struct libxl_spawn_starting* but + * for_spawn must actually be a libxl_spawn_starting* but * we take void* so you can pass this function directly to * libxl_wait_for_device_model. Caller must still call detach. */ /* low-level stuff, for synchronous subprocesses etc. */ void libxl_exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args); // logs errors, never returns -void libxl_log_child_exitstatus(struct libxl_ctx *ctx, +void libxl_log_child_exitstatus(libxl_ctx *ctx, const char *what, pid_t pid, int status); -char *libxl_abs_path(struct libxl_ctx *ctx, char *s, const char *path); +char *libxl_abs_path(libxl_ctx *ctx, char *s, const char *path); #define XL_LOG_DEBUG XTL_DEBUG #define XL_LOG_INFO XTL_INFO diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl_pci.c --- a/tools/libxl/libxl_pci.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl_pci.c Wed Jul 28 16:18:44 2010 +0100 @@ -35,7 +35,7 @@ #include "libxl_internal.h" #include "flexarray.h" -static int libxl_create_pci_backend(struct libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev, int num) +static int libxl_create_pci_backend(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev, int num) { flexarray_t *front; flexarray_t *back; @@ -100,7 +100,7 @@ static int libxl_create_pci_backend(stru return 0; } -static int libxl_device_pci_add_xenstore(struct libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev) +static int libxl_device_pci_add_xenstore(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev) { flexarray_t *back; char *num_devs, *be_path; @@ -153,7 +153,7 @@ retry_transaction: return 0; } -static int libxl_device_pci_remove_xenstore(struct libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev) +static int libxl_device_pci_remove_xenstore(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev) { char *be_path, *num_devs_path, *num_devs, *xsdev, *tmp, *tmppath; int num, i, j; @@ -258,7 +258,7 @@ retry_transaction2: return 0; } -int libxl_device_pci_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev) +int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev) { char *path; char *state, *vdevfn; @@ -370,7 +370,7 @@ out: return 0; } -int libxl_device_pci_remove(struct libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev) +int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev) { char *path; char *state; @@ -466,7 +466,7 @@ out: return 0; } -libxl_device_pci *libxl_device_pci_list(struct libxl_ctx *ctx, uint32_t domid, int *num) +libxl_device_pci *libxl_device_pci_list(libxl_ctx *ctx, uint32_t domid, int *num) { char *be_path, *num_devs, *xsdev, *xsvdevfn, *xsopts; int n, i; @@ -510,7 +510,7 @@ libxl_device_pci *libxl_device_pci_list( return pcidevs; } -int libxl_device_pci_shutdown(struct libxl_ctx *ctx, uint32_t domid) +int libxl_device_pci_shutdown(libxl_ctx *ctx, uint32_t domid) { libxl_device_pci *pcidevs; int num, i; diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl_utils.c --- a/tools/libxl/libxl_utils.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl_utils.c Wed Jul 28 16:18:44 2010 +0100 @@ -43,7 +43,7 @@ unsigned long libxl_get_required_shadow_ return 4 * (256 * smp_cpus + 2 * (maxmem_kb / 1024)); } -char *libxl_domid_to_name(struct libxl_ctx *ctx, uint32_t domid) +char *libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid) { unsigned int len; char path[strlen("/local/domain") + 12]; @@ -55,12 +55,12 @@ char *libxl_domid_to_name(struct libxl_c return s; } -int libxl_name_to_domid(struct libxl_ctx *ctx, const char *name, +int libxl_name_to_domid(libxl_ctx *ctx, const char *name, uint32_t *domid) { int i, nb_domains; char *domname; - struct libxl_dominfo *dominfo; + libxl_dominfo *dominfo; dominfo = libxl_list_domain(ctx, &nb_domains); if (!dominfo) @@ -78,7 +78,7 @@ int libxl_name_to_domid(struct libxl_ctx return -1; } -char *libxl_poolid_to_name(struct libxl_ctx *ctx, uint32_t poolid) +char *libxl_poolid_to_name(libxl_ctx *ctx, uint32_t poolid) { unsigned int len; char path[strlen("/local/pool") + 12]; @@ -92,12 +92,12 @@ char *libxl_poolid_to_name(struct libxl_ return s; } -int libxl_name_to_poolid(struct libxl_ctx *ctx, const char *name, +int libxl_name_to_poolid(libxl_ctx *ctx, const char *name, uint32_t *poolid) { int i, nb_pools; char *poolname; - struct libxl_poolinfo *poolinfo; + libxl_poolinfo *poolinfo; poolinfo = libxl_list_pool(ctx, &nb_pools); if (!poolinfo) @@ -115,7 +115,7 @@ int libxl_name_to_poolid(struct libxl_ct return -1; } -int libxl_get_stubdom_id(struct libxl_ctx *ctx, int guest_domid) +int libxl_get_stubdom_id(libxl_ctx *ctx, int guest_domid) { char * stubdom_id_s = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/image/device-model-domid", libxl_xs_get_dompath(ctx, guest_domid))); if (stubdom_id_s) @@ -124,7 +124,7 @@ int libxl_get_stubdom_id(struct libxl_ct return 0; } -int libxl_is_stubdom(struct libxl_ctx *ctx, uint32_t domid, uint32_t *target_domid) +int libxl_is_stubdom(libxl_ctx *ctx, uint32_t domid, uint32_t *target_domid) { char *target, *endptr; uint32_t value; @@ -140,7 +140,7 @@ int libxl_is_stubdom(struct libxl_ctx *c return 1; } -static int logrename(struct libxl_ctx *ctx, const char *old, const char *new) { +static int logrename(libxl_ctx *ctx, const char *old, const char *new) { int r; r = rename(old, new); @@ -154,7 +154,7 @@ static int logrename(struct libxl_ctx *c return 0; } -int libxl_create_logfile(struct libxl_ctx *ctx, char *name, char **full_name) +int libxl_create_logfile(libxl_ctx *ctx, char *name, char **full_name) { struct stat stat_buf; char *logfile, *logfile_new; @@ -186,7 +186,7 @@ int libxl_create_logfile(struct libxl_ct return 0; } -int libxl_string_to_phystype(struct libxl_ctx *ctx, char *s, libxl_disk_phystype *phystype) +int libxl_string_to_phystype(libxl_ctx *ctx, char *s, libxl_disk_phystype *phystype) { char *p; int rc = 0; @@ -216,7 +216,7 @@ out: return rc; } -int libxl_read_file_contents(struct libxl_ctx *ctx, const char *filename, +int libxl_read_file_contents(libxl_ctx *ctx, const char *filename, void **data_r, int *datalen_r) { FILE *f = 0; uint8_t *data = 0; @@ -289,7 +289,7 @@ int libxl_read_file_contents(struct libx #define READ_WRITE_EXACTLY(rw, zero_is_eof, constdata) \ \ - int libxl_##rw##_exactly(struct libxl_ctx *ctx, int fd, \ + int libxl_##rw##_exactly(libxl_ctx *ctx, int fd, \ constdata void *data, ssize_t sz, \ const char *filename, const char *what) { \ ssize_t got; \ @@ -322,14 +322,14 @@ READ_WRITE_EXACTLY(write, 0, const) READ_WRITE_EXACTLY(write, 0, const) -int libxl_ctx_postfork(struct libxl_ctx *ctx) { +int libxl_ctx_postfork(libxl_ctx *ctx) { if (ctx->xsh) xs_daemon_destroy_postfork(ctx->xsh); ctx->xsh = xs_daemon_open(); if (!ctx->xsh) return ERROR_FAIL; return 0; } -pid_t libxl_fork(struct libxl_ctx *ctx) +pid_t libxl_fork(libxl_ctx *ctx) { pid_t pid; @@ -350,7 +350,7 @@ pid_t libxl_fork(struct libxl_ctx *ctx) return pid; } -int libxl_pipe(struct libxl_ctx *ctx, int pipes[2]) +int libxl_pipe(libxl_ctx *ctx, int pipes[2]) { if (pipe(pipes) < 0) { XL_LOG(ctx, XL_LOG_ERROR, "Failed to create a pipe"); @@ -359,7 +359,7 @@ int libxl_pipe(struct libxl_ctx *ctx, in return 0; } -int libxl_mac_to_device_nic(struct libxl_ctx *ctx, uint32_t domid, +int libxl_mac_to_device_nic(libxl_ctx *ctx, uint32_t domid, const char *mac, libxl_device_nic *nic) { libxl_nicinfo *nics; @@ -400,7 +400,7 @@ int libxl_mac_to_device_nic(struct libxl return 0; } -int libxl_devid_to_device_nic(struct libxl_ctx *ctx, uint32_t domid, +int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid, const char *devid, libxl_device_nic *nic) { char *tok, *val; @@ -433,7 +433,7 @@ int libxl_devid_to_device_nic(struct lib return 0; } -int libxl_devid_to_device_disk(struct libxl_ctx *ctx, uint32_t domid, +int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid, const char *devid, libxl_device_disk *disk) { char *endptr, *val; @@ -470,7 +470,7 @@ int libxl_devid_to_device_disk(struct li return 0; } -int libxl_devid_to_device_net2(struct libxl_ctx *ctx, uint32_t domid, +int libxl_devid_to_device_net2(libxl_ctx *ctx, uint32_t domid, const char *devid, libxl_device_net2 *net2) { char *tok, *endptr, *val; diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl_utils.h --- a/tools/libxl/libxl_utils.h Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl_utils.h Wed Jul 28 16:18:44 2010 +0100 @@ -19,16 +19,16 @@ #include "libxl.h" unsigned long libxl_get_required_shadow_memory(unsigned long maxmem_kb, unsigned int smp_cpus); -int libxl_name_to_domid(struct libxl_ctx *ctx, const char *name, uint32_t *domid); -char *libxl_domid_to_name(struct libxl_ctx *ctx, uint32_t domid); -int libxl_name_to_poolid(struct libxl_ctx *ctx, const char *name, uint32_t *poolid); -char *libxl_poolid_to_name(struct libxl_ctx *ctx, uint32_t poolid); -int libxl_get_stubdom_id(struct libxl_ctx *ctx, int guest_domid); -int libxl_is_stubdom(struct libxl_ctx *ctx, uint32_t domid, uint32_t *target_domid); -int libxl_create_logfile(struct libxl_ctx *ctx, char *name, char **full_name); -int libxl_string_to_phystype(struct libxl_ctx *ctx, char *s, libxl_disk_phystype *phystype); +int libxl_name_to_domid(libxl_ctx *ctx, const char *name, uint32_t *domid); +char *libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid); +int libxl_name_to_poolid(libxl_ctx *ctx, const char *name, uint32_t *poolid); +char *libxl_poolid_to_name(libxl_ctx *ctx, uint32_t poolid); +int libxl_get_stubdom_id(libxl_ctx *ctx, int guest_domid); +int libxl_is_stubdom(libxl_ctx *ctx, uint32_t domid, uint32_t *target_domid); +int libxl_create_logfile(libxl_ctx *ctx, char *name, char **full_name); +int libxl_string_to_phystype(libxl_ctx *ctx, char *s, libxl_disk_phystype *phystype); -int libxl_read_file_contents(struct libxl_ctx *ctx, const char *filename, +int libxl_read_file_contents(libxl_ctx *ctx, const char *filename, void **data_r, int *datalen_r); /* Reads the contents of the plain file filename into a mallocd * buffer. Returns 0 or errno. Any errors other than ENOENT are logged. @@ -37,35 +37,35 @@ int libxl_read_file_contents(struct libx * data_r and/or datalen_r may be 0. */ -int libxl_read_exactly(struct libxl_ctx *ctx, int fd, void *data, ssize_t sz, +int libxl_read_exactly(libxl_ctx *ctx, int fd, void *data, ssize_t sz, const char *filename, const char *what); -int libxl_write_exactly(struct libxl_ctx *ctx, int fd, const void *data, +int libxl_write_exactly(libxl_ctx *ctx, int fd, const void *data, ssize_t sz, const char *filename, const char *what); /* Returns 0 or errno. If file is truncated on reading, returns * EPROTO and you have no way to tell how much was read. Errors are * logged using filename (which is only used for logging) and what * (which may be 0). */ -pid_t libxl_fork(struct libxl_ctx *ctx); -int libxl_pipe(struct libxl_ctx *ctx, int pipes[2]); +pid_t libxl_fork(libxl_ctx *ctx); +int libxl_pipe(libxl_ctx *ctx, int pipes[2]); /* Just like fork(2), pipe(2), but log errors. */ -void libxl_report_child_exitstatus(struct libxl_ctx *ctx, xentoollog_level, +void libxl_report_child_exitstatus(libxl_ctx *ctx, xentoollog_level, const char *what, pid_t pid, int status); /* treats all exit statuses as errors; if that's not what you want, * check status yourself first */ -int libxl_mac_to_device_nic(struct libxl_ctx *ctx, uint32_t domid, +int libxl_mac_to_device_nic(libxl_ctx *ctx, uint32_t domid, const char *mac, libxl_device_nic *nic); -int libxl_devid_to_device_nic(struct libxl_ctx *ctx, uint32_t domid, +int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid, const char *devid, libxl_device_nic *nic); -int libxl_devid_to_device_disk(struct libxl_ctx *ctx, uint32_t domid, +int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid, const char *devid, libxl_device_disk *disk); int libxl_strtomac(const char *mac_s, uint8_t *mac); -int libxl_devid_to_device_net2(struct libxl_ctx *ctx, uint32_t domid, +int libxl_devid_to_device_net2(libxl_ctx *ctx, uint32_t domid, const char *devid, libxl_device_net2 *net2); #endif diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/libxl_xshelp.c --- a/tools/libxl/libxl_xshelp.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/libxl_xshelp.c Wed Jul 28 16:18:44 2010 +0100 @@ -44,7 +44,7 @@ int xs_writev(struct xs_handle *xsh, xs_ return 0; } -char **libxl_xs_kvs_of_flexarray(struct libxl_ctx *ctx, flexarray_t *array, int length) +char **libxl_xs_kvs_of_flexarray(libxl_ctx *ctx, flexarray_t *array, int length) { char **kvs; int i; @@ -65,7 +65,7 @@ char **libxl_xs_kvs_of_flexarray(struct return kvs; } -int libxl_xs_writev(struct libxl_ctx *ctx, xs_transaction_t t, +int libxl_xs_writev(libxl_ctx *ctx, xs_transaction_t t, char *dir, char *kvs[]) { char *path; @@ -85,7 +85,7 @@ int libxl_xs_writev(struct libxl_ctx *ct return 0; } -int libxl_xs_write(struct libxl_ctx *ctx, xs_transaction_t t, +int libxl_xs_write(libxl_ctx *ctx, xs_transaction_t t, char *path, char *fmt, ...) { char *s; @@ -103,7 +103,7 @@ int libxl_xs_write(struct libxl_ctx *ctx return 0; } -char * libxl_xs_read(struct libxl_ctx *ctx, xs_transaction_t t, char *path) +char * libxl_xs_read(libxl_ctx *ctx, xs_transaction_t t, char *path) { unsigned int len; char *ptr; @@ -116,7 +116,7 @@ char * libxl_xs_read(struct libxl_ctx *c return 0; } -char *libxl_xs_get_dompath(struct libxl_ctx *ctx, uint32_t domid) +char *libxl_xs_get_dompath(libxl_ctx *ctx, uint32_t domid) { char *s = xs_get_domain_path(ctx->xsh, domid); if (!s) { @@ -128,7 +128,7 @@ char *libxl_xs_get_dompath(struct libxl_ return s; } -char **libxl_xs_directory(struct libxl_ctx *ctx, xs_transaction_t t, char *path, unsigned int *nb) +char **libxl_xs_directory(libxl_ctx *ctx, xs_transaction_t t, char *path, unsigned int *nb) { char **ret = NULL; ret = xs_directory(ctx->xsh, XBT_NULL, path, nb); diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/xl.h --- a/tools/libxl/xl.h Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/xl.h Wed Jul 28 16:18:44 2010 +0100 @@ -86,7 +86,7 @@ extern int cmdtable_len; /* Look up a command in the table, allowing unambiguous truncation */ struct cmd_spec *cmdtable_lookup(const char *s); -extern struct libxl_ctx ctx; +extern libxl_ctx ctx; extern xentoollog_logger_stdiostream *logger; #endif /* XL_H */ diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/xl_cmdimpl.c Wed Jul 28 16:18:44 2010 +0100 @@ -64,7 +64,7 @@ int logfile = 2; int logfile = 2; /* every libxl action in xl uses this same libxl context */ -struct libxl_ctx ctx; +libxl_ctx ctx; /* when we operate on a domain, it is this one: */ static uint32_t domid; @@ -1092,8 +1092,8 @@ int autoconnect_console(int hvm) } /* Returns 1 if domain should be restarted, 2 if domain should be renamed then restarted */ -static int handle_domain_death(struct libxl_ctx *ctx, uint32_t domid, libxl_event *event, - struct domain_config *d_config, struct libxl_dominfo *info) +static int handle_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_event *event, + struct domain_config *d_config, libxl_dominfo *info) { int restart = 0; enum action_on_shutdown action; @@ -1161,8 +1161,8 @@ static int handle_domain_death(struct li return restart; } -static int preserve_domain(struct libxl_ctx *ctx, uint32_t domid, libxl_event *event, - struct domain_config *d_config, struct libxl_dominfo *info) +static int preserve_domain(libxl_ctx *ctx, uint32_t domid, libxl_event *event, + struct domain_config *d_config, libxl_dominfo *info) { time_t now; struct tm tm; @@ -1542,7 +1542,7 @@ start: while (1) { int ret; fd_set rfds; - struct libxl_dominfo info; + libxl_dominfo info; libxl_event event; libxl_device_disk disk; @@ -2093,7 +2093,7 @@ void reboot_domain(char *p) void list_domains_details(void) { - struct libxl_dominfo *info; + libxl_dominfo *info; struct domain_config d_config; char *config_file; @@ -2123,7 +2123,7 @@ void list_domains_details(void) void list_domains(int verbose) { - struct libxl_dominfo *info; + libxl_dominfo *info; int nb_domain, i; info = libxl_list_domain(&ctx, &nb_domain); @@ -2157,7 +2157,7 @@ void list_domains(int verbose) void list_vm(void) { - struct libxl_vminfo *info; + libxl_vminfo *info; int nb_vm, i; info = libxl_list_vm(&ctx, &nb_vm); @@ -3139,7 +3139,7 @@ int main_button_press(int argc, char **a } static void print_vcpuinfo(uint32_t tdomid, - const struct libxl_vcpuinfo *vcpuinfo, + const libxl_vcpuinfo *vcpuinfo, uint32_t nr_cpus) { int i, l; @@ -3206,9 +3206,9 @@ static void print_vcpuinfo(uint32_t tdom void vcpulist(int argc, char **argv) { - struct libxl_dominfo *dominfo; - struct libxl_vcpuinfo *vcpuinfo; - struct libxl_physinfo physinfo; + libxl_dominfo *dominfo; + libxl_vcpuinfo *vcpuinfo; + libxl_physinfo physinfo; int nb_vcpu, nb_domain, cpusize; if (libxl_get_physinfo(&ctx, &physinfo) != 0) { @@ -3270,8 +3270,8 @@ int main_vcpulist(int argc, char **argv) void vcpupin(char *d, const char *vcpu, char *cpu) { - struct libxl_vcpuinfo *vcpuinfo; - struct libxl_physinfo physinfo; + libxl_vcpuinfo *vcpuinfo; + libxl_physinfo physinfo; uint64_t *cpumap = NULL; uint32_t vcpuid, cpuida, cpuidb; @@ -3463,7 +3463,7 @@ static void output_nodeinfo(void) static void output_physinfo(void) { - struct libxl_physinfo info; + libxl_physinfo info; const libxl_version_info *vinfo; unsigned int i; @@ -3529,7 +3529,7 @@ int main_info(int argc, char **argv) } static int sched_credit_domain_get( - int domid, struct libxl_sched_credit *scinfo) + int domid, libxl_sched_credit *scinfo) { int rc; @@ -3541,7 +3541,7 @@ static int sched_credit_domain_get( } static int sched_credit_domain_set( - int domid, struct libxl_sched_credit *scinfo) + int domid, libxl_sched_credit *scinfo) { int rc; @@ -3553,7 +3553,7 @@ static int sched_credit_domain_set( } static void sched_credit_domain_output( - int domid, struct libxl_sched_credit *scinfo) + int domid, libxl_sched_credit *scinfo) { printf("%-33s %4d %6d %4d\n", libxl_domid_to_name(&ctx, domid), @@ -3564,8 +3564,8 @@ static void sched_credit_domain_output( int main_sched_credit(int argc, char **argv) { - struct libxl_dominfo *info; - struct libxl_sched_credit scinfo; + libxl_dominfo *info; + libxl_sched_credit scinfo; int nb_domain, i; char *dom = NULL; int weight = 256, cap = 0, opt_w = 0, opt_c = 0; @@ -3859,7 +3859,7 @@ int main_dmesg(int argc, char **argv) int main_dmesg(int argc, char **argv) { unsigned int clear = 0; - struct libxl_xen_console_reader *cr; + libxl_xen_console_reader *cr; char *line; int opt, ret = 1; @@ -4538,7 +4538,7 @@ static void print_domU_uptime(uint32_t d static void print_uptime(int short_mode, uint32_t doms[], int nb_doms) { - struct libxl_vminfo *info; + libxl_vminfo *info; time_t now; int nb_vm, i; diff -r ebede381efe8 -r bf4d0eb3643d tools/libxl/xl_cmdtable.c --- a/tools/libxl/xl_cmdtable.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/libxl/xl_cmdtable.c Wed Jul 28 16:18:44 2010 +0100 @@ -14,6 +14,7 @@ #include <string.h> +#include "libxl.h" #include "xl.h" struct cmd_spec cmd_table[] = { diff -r ebede381efe8 -r bf4d0eb3643d tools/ocaml/libs/xl/xl_stubs.c --- a/tools/ocaml/libs/xl/xl_stubs.c Tue Jul 27 18:09:22 2010 +0100 +++ b/tools/ocaml/libs/xl/xl_stubs.c Wed Jul 28 16:18:44 2010 +0100 @@ -238,7 +238,7 @@ static int device_pci_val(libxl_device_p CAMLreturn(0); } -static int sched_credit_val(struct libxl_sched_credit *c_val, value v) +static int sched_credit_val(libxl_sched_credit *c_val, value v) { CAMLparam1(v); c_val->weight = Int_val(Field(v, 0)); @@ -258,7 +258,7 @@ static int domain_build_state_val(libxl_ CAMLreturn(0); } -static value Val_sched_credit(struct libxl_sched_credit *c_val) +static value Val_sched_credit(libxl_sched_credit *c_val) { CAMLparam0(); CAMLlocal1(v); @@ -286,7 +286,7 @@ static value Val_domain_build_state(libx CAMLreturn(v); } -static value Val_physinfo(struct libxl_physinfo *c_val) +static value Val_physinfo(libxl_physinfo *c_val) { CAMLparam0(); CAMLlocal2(v, hwcap); @@ -315,7 +315,7 @@ value stub_xl_domain_make(value info) value stub_xl_domain_make(value info) { CAMLparam1(info); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; uint32_t domid; libxl_domain_create_info c_info; int ret; @@ -340,7 +340,7 @@ value stub_xl_domain_build(value info, v { CAMLparam2(info, domid); CAMLlocal1(result); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; libxl_domain_build_info c_info; libxl_domain_build_state c_state; int ret; @@ -365,7 +365,7 @@ value stub_xl_disk_add(value info, value { CAMLparam2(info, domid); libxl_device_disk c_info; - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; int ret; device_disk_val(&c_info, info); @@ -383,7 +383,7 @@ value stub_xl_disk_remove(value info, va { CAMLparam2(info, domid); libxl_device_disk c_info; - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; int ret; device_disk_val(&c_info, info); @@ -400,7 +400,7 @@ value stub_xl_nic_add(value info, value value stub_xl_nic_add(value info, value domid) { CAMLparam2(info, domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; libxl_device_nic c_info; int ret; @@ -418,7 +418,7 @@ value stub_xl_nic_remove(value info, val value stub_xl_nic_remove(value info, value domid) { CAMLparam2(info, domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; libxl_device_nic c_info; int ret; @@ -436,7 +436,7 @@ value stub_xl_console_add(value info, va value stub_xl_console_add(value info, value state, value domid) { CAMLparam3(info, state, domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; libxl_device_console c_info; libxl_domain_build_state c_state; int ret; @@ -457,7 +457,7 @@ value stub_xl_vkb_add(value info, value value stub_xl_vkb_add(value info, value domid) { CAMLparam2(info, domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; libxl_device_vkb c_info; int ret; @@ -476,7 +476,7 @@ value stub_xl_vkb_clean_shutdown(value d value stub_xl_vkb_clean_shutdown(value domid) { CAMLparam1(domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; int ret; INIT_CTX(); @@ -491,7 +491,7 @@ value stub_xl_vkb_hard_shutdown(value do value stub_xl_vkb_hard_shutdown(value domid) { CAMLparam1(domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; int ret; INIT_CTX(); @@ -506,7 +506,7 @@ value stub_xl_vfb_add(value info, value value stub_xl_vfb_add(value info, value domid) { CAMLparam2(info, domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; libxl_device_vfb c_info; int ret; @@ -525,7 +525,7 @@ value stub_xl_vfb_clean_shutdown(value d value stub_xl_vfb_clean_shutdown(value domid) { CAMLparam1(domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; int ret; INIT_CTX(); @@ -540,7 +540,7 @@ value stub_xl_vfb_hard_shutdown(value do value stub_xl_vfb_hard_shutdown(value domid) { CAMLparam1(domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; int ret; INIT_CTX(); @@ -555,7 +555,7 @@ value stub_xl_pci_add(value info, value value stub_xl_pci_add(value info, value domid) { CAMLparam2(info, domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; libxl_device_pci c_info; int ret; @@ -573,7 +573,7 @@ value stub_xl_pci_remove(value info, val value stub_xl_pci_remove(value info, value domid) { CAMLparam2(info, domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; libxl_device_pci c_info; int ret; @@ -591,7 +591,7 @@ value stub_xl_pci_shutdown(value domid) value stub_xl_pci_shutdown(value domid) { CAMLparam1(domid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; int ret; INIT_CTX(); @@ -606,7 +606,7 @@ value stub_xl_button_press(value domid, value stub_xl_button_press(value domid, value button) { CAMLparam2(domid, button); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; int ret; INIT_CTX(); @@ -622,8 +622,8 @@ value stub_xl_physinfo(value unit) { CAMLparam1(unit); CAMLlocal1(physinfo); - struct libxl_ctx ctx; struct caml_logger lg; - struct libxl_physinfo c_physinfo; + libxl_ctx ctx; struct caml_logger lg; + libxl_physinfo c_physinfo; int ret; INIT_CTX(); @@ -640,8 +640,8 @@ value stub_xl_sched_credit_domain_get(va { CAMLparam1(domid); CAMLlocal1(scinfo); - struct libxl_ctx ctx; struct caml_logger lg; - struct libxl_sched_credit c_scinfo; + libxl_ctx ctx; struct caml_logger lg; + libxl_sched_credit c_scinfo; int ret; INIT_CTX(); @@ -657,8 +657,8 @@ value stub_xl_sched_credit_domain_set(va value stub_xl_sched_credit_domain_set(value domid, value scinfo) { CAMLparam2(domid, scinfo); - struct libxl_ctx ctx; struct caml_logger lg; - struct libxl_sched_credit c_scinfo; + libxl_ctx ctx; struct caml_logger lg; + libxl_sched_credit c_scinfo; int ret; sched_credit_val(&c_scinfo, scinfo); @@ -675,7 +675,7 @@ value stub_xl_send_trigger(value domid, value stub_xl_send_trigger(value domid, value trigger, value vcpuid) { CAMLparam3(domid, trigger, vcpuid); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; int ret; INIT_CTX(); @@ -689,7 +689,7 @@ value stub_xl_send_sysrq(value domid, va value stub_xl_send_sysrq(value domid, value sysrq) { CAMLparam2(domid, sysrq); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; int ret; INIT_CTX(); @@ -703,7 +703,7 @@ value stub_xl_send_debug_keys(value keys value stub_xl_send_debug_keys(value keys) { CAMLparam1(keys); - struct libxl_ctx ctx; struct caml_logger lg; + libxl_ctx ctx; struct caml_logger lg; int ret; INIT_CTX(); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |