# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1280865789 -3600
# Node ID 38aee6139719686ae2f98e4e7a6a71a0c674a25d
# Parent 668f712242410d1d8d4613ae7ec2f608b4f0f4c2
# Parent d7ec0e180601228f92d9d46d822e8ebeaf8bf803
Merge.
---
tools/blktap2/control/tap-ctl-list.c | 6 +++---
tools/libxc/xc_private.c | 15 +++++++++++++++
tools/libxl/libxl.c | 2 +-
tools/libxl/libxl_pci.c | 4 ++--
tools/libxl/libxl_utils.c | 11 +++++++----
tools/libxl/xl_cmdimpl.c | 23 +++++++++++++++++++++--
6 files changed, 49 insertions(+), 12 deletions(-)
diff -r 668f71224241 -r 38aee6139719 tools/blktap2/control/tap-ctl-list.c
--- a/tools/blktap2/control/tap-ctl-list.c Mon Aug 02 16:58:50 2010 +0100
+++ b/tools/blktap2/control/tap-ctl-list.c Tue Aug 03 21:03:09 2010 +0100
@@ -385,9 +385,9 @@ _tap_ctl_free_tapdisks(struct tapdisk *t
struct tapdisk *tap;
for (tap = tapv; tap < &tapv[n_taps]; ++tap) {
- struct tapdisk_list *tl;
-
- list_for_each_entry(tl, &tap->list, entry) {
+ struct tapdisk_list *tl, *next;
+
+ list_for_each_entry_safe(tl, next, &tap->list, entry) {
free(tl->params);
free(tl);
}
diff -r 668f71224241 -r 38aee6139719 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Mon Aug 02 16:58:50 2010 +0100
+++ b/tools/libxc/xc_private.c Tue Aug 03 21:03:09 2010 +0100
@@ -57,6 +57,8 @@ xc_interface *xc_interface_open(xentooll
return 0;
}
+static void xc_clean_hcall_buf(void);
+
int xc_interface_close(xc_interface *xch)
{
int rc = 0;
@@ -68,6 +70,9 @@ int xc_interface_close(xc_interface *xch
rc = xc_interface_close_core(xch, xch->fd);
if (rc) PERROR("Could not close hypervisor interface");
}
+
+ xc_clean_hcall_buf();
+
free(xch);
return rc;
}
@@ -180,6 +185,8 @@ int hcall_buf_prep(void **addr, size_t l
int hcall_buf_prep(void **addr, size_t len) { return 0; }
void hcall_buf_release(void **addr, size_t len) { }
+static void xc_clean_hcall_buf(void) { }
+
#else /* !__sun__ */
int lock_pages(void *addr, size_t len)
@@ -223,6 +230,14 @@ static void _xc_clean_hcall_buf(void *m)
}
pthread_setspecific(hcall_buf_pkey, NULL);
+}
+
+static void xc_clean_hcall_buf(void)
+{
+ void *hcall_buf = pthread_getspecific(hcall_buf_pkey);
+
+ if (hcall_buf)
+ _xc_clean_hcall_buf(hcall_buf);
}
static void _xc_init_hcall_buf(void)
diff -r 668f71224241 -r 38aee6139719 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Mon Aug 02 16:58:50 2010 +0100
+++ b/tools/libxl/libxl.c Tue Aug 03 21:03:09 2010 +0100
@@ -1473,7 +1473,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
backend_type = device_disk_backend_type_of_phystype(disk->phystype);
devid = device_disk_dev_number(disk->virtpath);
if (devid==-1) {
- XL_LOG(ctx, XL_LOG_ERROR, "Invalid or unuspported"
+ XL_LOG(ctx, XL_LOG_ERROR, "Invalid or unsupported"
" virtual disk identifier %s", disk->virtpath);
return ERROR_INVAL;
}
diff -r 668f71224241 -r 38aee6139719 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c Mon Aug 02 16:58:50 2010 +0100
+++ b/tools/libxl/libxl_pci.c Tue Aug 03 21:03:09 2010 +0100
@@ -416,7 +416,7 @@ out:
out:
if (!libxl_is_stubdom(ctx, domid, NULL)) {
rc = xc_assign_device(ctx->xch, domid, pcidev->value);
- if (rc < 0) {
+ if (rc < 0 && (hvm || errno != ENOSYS)) {
XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_assign_device failed");
return ERROR_FAIL;
}
@@ -541,7 +541,7 @@ out:
if (!libxl_is_stubdom(ctx, domid, NULL)) {
rc = xc_deassign_device(ctx->xch, domid, pcidev->value);
- if (rc < 0)
+ if (rc < 0 && (hvm || errno != ENOSYS))
XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_deassign_device
failed");
}
diff -r 668f71224241 -r 38aee6139719 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Mon Aug 02 16:58:50 2010 +0100
+++ b/tools/libxl/libxl_utils.c Tue Aug 03 21:03:09 2010 +0100
@@ -61,6 +61,7 @@ int libxl_name_to_domid(libxl_ctx *ctx,
int i, nb_domains;
char *domname;
libxl_dominfo *dominfo;
+ int ret = -1;
dominfo = libxl_list_domain(ctx, &nb_domains);
if (!dominfo)
@@ -72,10 +73,12 @@ int libxl_name_to_domid(libxl_ctx *ctx,
continue;
if (strcmp(domname, name) == 0) {
*domid = dominfo[i].domid;
- return 0;
- }
- }
- return -1;
+ ret = 0;
+ break;
+ }
+ }
+ free(dominfo);
+ return ret;
}
char *libxl_poolid_to_name(libxl_ctx *ctx, uint32_t poolid)
diff -r 668f71224241 -r 38aee6139719 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Mon Aug 02 16:58:50 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c Tue Aug 03 21:03:09 2010 +0100
@@ -142,6 +142,16 @@ struct domain_config {
enum action_on_shutdown on_watchdog;
enum action_on_shutdown on_crash;
};
+
+static void free_domain_config(struct domain_config *d_config)
+{
+ free(d_config->disks);
+ free(d_config->vifs);
+ free(d_config->vif2s);
+ free(d_config->pcidevs);
+ free(d_config->vfbs);
+ free(d_config->vkbs);
+}
/* Optional data, in order:
* 4 bytes uint32_t config file size
@@ -1346,8 +1356,9 @@ static int create_domain(struct domain_c
parse_config_data(config_file, config_data, config_len, &d_config,
&dm_info);
+ ret = 0;
if (dom_info->dryrun)
- return 0;
+ goto out;
if (migrate_fd >= 0) {
if (d_config.c_info.name) {
@@ -1477,8 +1488,9 @@ start:
if (!paused)
libxl_domain_unpause(&ctx, domid);
+ ret = domid; /* caller gets success in parent */
if (!daemonize)
- return domid; /* caller gets success in parent */
+ goto out;
if (need_daemon) {
char *fullname, *name;
@@ -1605,6 +1617,12 @@ error_out:
error_out:
if (domid)
libxl_domain_destroy(&ctx, domid, 0);
+out:
+
+ free_domain_config(&d_config);
+
+ free(config_data);
+
return ret;
}
@@ -2143,6 +2161,7 @@ void list_domains_details(const libxl_do
memset(&d_config, 0x00, sizeof(d_config));
parse_config_data(config_file, (char *)data, len, &d_config, &dm_info);
printf_info(info[i].domid, &d_config, &dm_info);
+ free_domain_config(&d_config);
free(data);
free(config_file);
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|