debuggers.hg

changeset 21956:38aee6139719

Merge.
author Keir Fraser <keir.fraser@citrix.com>
date Tue Aug 03 21:03:09 2010 +0100 (2010-08-03)
parents 668f71224241 d7ec0e180601
children 4566d523b10a
files
line diff
     1.1 --- a/tools/blktap2/control/tap-ctl-list.c	Mon Aug 02 16:58:50 2010 +0100
     1.2 +++ b/tools/blktap2/control/tap-ctl-list.c	Tue Aug 03 21:03:09 2010 +0100
     1.3 @@ -385,9 +385,9 @@ void
     1.4  	struct tapdisk *tap;
     1.5  
     1.6  	for (tap = tapv; tap < &tapv[n_taps]; ++tap) {
     1.7 -		struct tapdisk_list *tl;
     1.8 +		struct tapdisk_list *tl, *next;
     1.9  
    1.10 -		list_for_each_entry(tl, &tap->list, entry) {
    1.11 +		list_for_each_entry_safe(tl, next, &tap->list, entry) {
    1.12  			free(tl->params);
    1.13  			free(tl);
    1.14  		}
     2.1 --- a/tools/libxc/xc_private.c	Mon Aug 02 16:58:50 2010 +0100
     2.2 +++ b/tools/libxc/xc_private.c	Tue Aug 03 21:03:09 2010 +0100
     2.3 @@ -57,6 +57,8 @@ xc_interface *xc_interface_open(xentooll
     2.4      return 0;
     2.5  }
     2.6  
     2.7 +static void xc_clean_hcall_buf(void);
     2.8 +
     2.9  int xc_interface_close(xc_interface *xch)
    2.10  {
    2.11      int rc = 0;
    2.12 @@ -68,6 +70,9 @@ int xc_interface_close(xc_interface *xch
    2.13          rc = xc_interface_close_core(xch, xch->fd);
    2.14          if (rc) PERROR("Could not close hypervisor interface");
    2.15      }
    2.16 +
    2.17 +    xc_clean_hcall_buf();
    2.18 +
    2.19      free(xch);
    2.20      return rc;
    2.21  }
    2.22 @@ -180,6 +185,8 @@ void unlock_pages(void *addr, size_t len
    2.23  int hcall_buf_prep(void **addr, size_t len) { return 0; }
    2.24  void hcall_buf_release(void **addr, size_t len) { }
    2.25  
    2.26 +static void xc_clean_hcall_buf(void) { }
    2.27 +
    2.28  #else /* !__sun__ */
    2.29  
    2.30  int lock_pages(void *addr, size_t len)
    2.31 @@ -225,6 +232,14 @@ static void _xc_clean_hcall_buf(void *m)
    2.32      pthread_setspecific(hcall_buf_pkey, NULL);
    2.33  }
    2.34  
    2.35 +static void xc_clean_hcall_buf(void)
    2.36 +{
    2.37 +    void *hcall_buf = pthread_getspecific(hcall_buf_pkey);
    2.38 +
    2.39 +    if (hcall_buf)
    2.40 +        _xc_clean_hcall_buf(hcall_buf);
    2.41 +}
    2.42 +
    2.43  static void _xc_init_hcall_buf(void)
    2.44  {
    2.45      pthread_key_create(&hcall_buf_pkey, _xc_clean_hcall_buf);
     3.1 --- a/tools/libxl/libxl.c	Mon Aug 02 16:58:50 2010 +0100
     3.2 +++ b/tools/libxl/libxl.c	Tue Aug 03 21:03:09 2010 +0100
     3.3 @@ -1473,7 +1473,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
     3.4      backend_type = device_disk_backend_type_of_phystype(disk->phystype);
     3.5      devid = device_disk_dev_number(disk->virtpath);
     3.6      if (devid==-1) {
     3.7 -        XL_LOG(ctx, XL_LOG_ERROR, "Invalid or unuspported"
     3.8 +        XL_LOG(ctx, XL_LOG_ERROR, "Invalid or unsupported"
     3.9                 " virtual disk identifier %s", disk->virtpath);
    3.10          return ERROR_INVAL;
    3.11      }
     4.1 --- a/tools/libxl/libxl_pci.c	Mon Aug 02 16:58:50 2010 +0100
     4.2 +++ b/tools/libxl/libxl_pci.c	Tue Aug 03 21:03:09 2010 +0100
     4.3 @@ -416,7 +416,7 @@ static int do_pci_add(libxl_ctx *ctx, ui
     4.4  out:
     4.5      if (!libxl_is_stubdom(ctx, domid, NULL)) {
     4.6          rc = xc_assign_device(ctx->xch, domid, pcidev->value);
     4.7 -        if (rc < 0) {
     4.8 +        if (rc < 0 && (hvm || errno != ENOSYS)) {
     4.9              XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_assign_device failed");
    4.10              return ERROR_FAIL;
    4.11          }
    4.12 @@ -541,7 +541,7 @@ out:
    4.13  
    4.14      if (!libxl_is_stubdom(ctx, domid, NULL)) {
    4.15          rc = xc_deassign_device(ctx->xch, domid, pcidev->value);
    4.16 -        if (rc < 0)
    4.17 +        if (rc < 0 && (hvm || errno != ENOSYS))
    4.18              XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_deassign_device failed");
    4.19      }
    4.20  
     5.1 --- a/tools/libxl/libxl_utils.c	Mon Aug 02 16:58:50 2010 +0100
     5.2 +++ b/tools/libxl/libxl_utils.c	Tue Aug 03 21:03:09 2010 +0100
     5.3 @@ -61,6 +61,7 @@ int libxl_name_to_domid(libxl_ctx *ctx, 
     5.4      int i, nb_domains;
     5.5      char *domname;
     5.6      libxl_dominfo *dominfo;
     5.7 +    int ret = -1;
     5.8  
     5.9      dominfo = libxl_list_domain(ctx, &nb_domains);
    5.10      if (!dominfo)
    5.11 @@ -72,10 +73,12 @@ int libxl_name_to_domid(libxl_ctx *ctx, 
    5.12              continue;
    5.13          if (strcmp(domname, name) == 0) {
    5.14              *domid = dominfo[i].domid;
    5.15 -            return 0;
    5.16 +            ret = 0;
    5.17 +            break;
    5.18          }
    5.19      }
    5.20 -    return -1;
    5.21 +    free(dominfo);
    5.22 +    return ret;
    5.23  }
    5.24  
    5.25  char *libxl_poolid_to_name(libxl_ctx *ctx, uint32_t poolid)
     6.1 --- a/tools/libxl/xl_cmdimpl.c	Mon Aug 02 16:58:50 2010 +0100
     6.2 +++ b/tools/libxl/xl_cmdimpl.c	Tue Aug 03 21:03:09 2010 +0100
     6.3 @@ -143,6 +143,16 @@ struct domain_config {
     6.4      enum action_on_shutdown on_crash;
     6.5  };
     6.6  
     6.7 +static void free_domain_config(struct domain_config *d_config)
     6.8 +{
     6.9 +    free(d_config->disks);
    6.10 +    free(d_config->vifs);
    6.11 +    free(d_config->vif2s);
    6.12 +    free(d_config->pcidevs);
    6.13 +    free(d_config->vfbs);
    6.14 +    free(d_config->vkbs);
    6.15 +}
    6.16 +
    6.17  /* Optional data, in order:
    6.18   *   4 bytes uint32_t  config file size
    6.19   *   n bytes           config file in Unix text file format
    6.20 @@ -1346,8 +1356,9 @@ static int create_domain(struct domain_c
    6.21  
    6.22      parse_config_data(config_file, config_data, config_len, &d_config, &dm_info);
    6.23  
    6.24 +    ret = 0;
    6.25      if (dom_info->dryrun)
    6.26 -        return 0;
    6.27 +        goto out;
    6.28  
    6.29      if (migrate_fd >= 0) {
    6.30          if (d_config.c_info.name) {
    6.31 @@ -1477,8 +1488,9 @@ start:
    6.32      if (!paused)
    6.33          libxl_domain_unpause(&ctx, domid);
    6.34  
    6.35 +    ret = domid; /* caller gets success in parent */
    6.36      if (!daemonize)
    6.37 -        return domid; /* caller gets success in parent */
    6.38 +        goto out;
    6.39  
    6.40      if (need_daemon) {
    6.41          char *fullname, *name;
    6.42 @@ -1605,6 +1617,12 @@ start:
    6.43  error_out:
    6.44      if (domid)
    6.45          libxl_domain_destroy(&ctx, domid, 0);
    6.46 +out:
    6.47 +
    6.48 +    free_domain_config(&d_config);
    6.49 +
    6.50 +    free(config_data);
    6.51 +
    6.52      return ret;
    6.53  }
    6.54  
    6.55 @@ -2143,6 +2161,7 @@ void list_domains_details(const libxl_do
    6.56          memset(&d_config, 0x00, sizeof(d_config));
    6.57          parse_config_data(config_file, (char *)data, len, &d_config, &dm_info);
    6.58          printf_info(info[i].domid, &d_config, &dm_info);
    6.59 +        free_domain_config(&d_config);
    6.60          free(data);
    6.61          free(config_file);
    6.62      }