os-cmpi-xen

changeset 123:3e8654ff41d1

Remove local add_strings_to_map function and start using xen_utils one.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author Jim Fehlig <jfehlig@novell.com>
date Mon Jun 11 14:52:47 2007 -0600 (2007-06-11)
parents 28e8c94e92de
children 7d3fcd10080c
files src/Xen_VirtualSystemManagementService.c
line diff
     1.1 --- a/src/Xen_VirtualSystemManagementService.c	Mon Jun 11 14:19:07 2007 -0600
     1.2 +++ b/src/Xen_VirtualSystemManagementService.c	Mon Jun 11 14:52:47 2007 -0600
     1.3 @@ -110,8 +110,6 @@ static int nic_rasd2vmconfig(CMPIInstanc
     1.4                               CMPIStatus *status);
     1.5  static int con_rasd2vmconfig(CMPIInstance *instance, xen_console_record *con_rec,
     1.6                               CMPIStatus *status);
     1.7 -static int add_strings_to_map(const char *key, const char *val,
     1.8 -                              xen_string_string_map **map);
     1.9  static CMPIInstance *parse_embedded_instance(char *instanceStr);
    1.10  
    1.11  
    1.12 @@ -1687,7 +1685,7 @@ static int vssd2xenconfig(CMPIInstance *
    1.13        else
    1.14           plat_val = "0";
    1.15  
    1.16 -      if (!add_strings_to_map("localtime", plat_val, &(vm_rec->platform))) {
    1.17 +      if (!xen_utils_add_to_string_string_map("localtime", plat_val, &(vm_rec->platform))) {
    1.18           _SBLIM_TRACE(1,
    1.19                        ("Cannot malloc memory for xend platform settings list"));
    1.20           CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM,
    1.21 @@ -1775,7 +1773,7 @@ static int vssd2xenconfig(CMPIInstance *
    1.22           return 0;
    1.23        }
    1.24        //vm_rec->hvm_boot_params = strdup(CMGetCharPtr(propertyvalue.value.string));
    1.25 -      add_strings_to_map("order", CMGetCharPtr(propertyvalue.value.string),&(vm_rec->hvm_boot_params ));
    1.26 +      xen_utils_add_to_string_string_map("order", CMGetCharPtr(propertyvalue.value.string),&(vm_rec->hvm_boot_params ));
    1.27        /* Default stdvga to 0 */
    1.28        plat_val = "0";
    1.29        propertyvalue = CMGetProperty(vssd, "stdvga", status);
    1.30 @@ -1785,7 +1783,7 @@ static int vssd2xenconfig(CMPIInstance *
    1.31           else
    1.32              plat_val = "0";
    1.33        }
    1.34 -      if (!add_strings_to_map("stdvga", plat_val, &(vm_rec->platform))) {
    1.35 +      if (!xen_utils_add_to_string_string_map("stdvga", plat_val, &(vm_rec->platform))) {
    1.36           _SBLIM_TRACE(1,
    1.37                        ("Cannot malloc memory for xend platform settings list"));
    1.38           CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM,
    1.39 @@ -1800,7 +1798,7 @@ static int vssd2xenconfig(CMPIInstance *
    1.40           else
    1.41              plat_val = "0";
    1.42  
    1.43 -         if (!add_strings_to_map("apic", plat_val, &(vm_rec->platform))) {
    1.44 +         if (!xen_utils_add_to_string_string_map("apic", plat_val, &(vm_rec->platform))) {
    1.45              _SBLIM_TRACE(1,
    1.46                           ("Cannot malloc memory for xend platform settings list"));
    1.47              CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM,
    1.48 @@ -1816,7 +1814,7 @@ static int vssd2xenconfig(CMPIInstance *
    1.49           else
    1.50              plat_val = "0";
    1.51  
    1.52 -         if (!add_strings_to_map("acpi", plat_val, &(vm_rec->platform))) {
    1.53 +         if (!xen_utils_add_to_string_string_map("acpi", plat_val, &(vm_rec->platform))) {
    1.54              _SBLIM_TRACE(1,
    1.55                           ("Cannot malloc memory for xend platform settings list"));
    1.56              CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM,
    1.57 @@ -1832,7 +1830,7 @@ static int vssd2xenconfig(CMPIInstance *
    1.58           else
    1.59              plat_val = "0";
    1.60  
    1.61 -         if (!add_strings_to_map("pae", plat_val, &(vm_rec->platform))) {
    1.62 +         if (!xen_utils_add_to_string_string_map("pae", plat_val, &(vm_rec->platform))) {
    1.63              _SBLIM_TRACE(1,
    1.64                           ("Cannot malloc memory for xend platform settings list"));
    1.65              CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM,
    1.66 @@ -1848,7 +1846,7 @@ static int vssd2xenconfig(CMPIInstance *
    1.67           else
    1.68              plat_val = "0";
    1.69  
    1.70 -         if (!add_strings_to_map("usb", plat_val, &(vm_rec->platform))) {
    1.71 +         if (!xen_utils_add_to_string_string_map("usb", plat_val, &(vm_rec->platform))) {
    1.72              _SBLIM_TRACE(1,
    1.73                           ("Cannot malloc memory for xend platform settings list"));
    1.74              CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM,
    1.75 @@ -1861,7 +1859,7 @@ static int vssd2xenconfig(CMPIInstance *
    1.76        if ((status->rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
    1.77           plat_val = CMGetCharPtr(propertyvalue.value.string);
    1.78  
    1.79 -         if (!add_strings_to_map("usbdevice", plat_val, &(vm_rec->platform))) {
    1.80 +         if (!xen_utils_add_to_string_string_map("usbdevice", plat_val, &(vm_rec->platform))) {
    1.81              _SBLIM_TRACE(1,
    1.82                           ("Cannot malloc memory for xend platform settings list"));
    1.83              CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM,
    1.84 @@ -2168,38 +2166,6 @@ static int con_rasd2vmconfig(CMPIInstanc
    1.85  }
    1.86  
    1.87  
    1.88 -/*
    1.89 - * Private function to support adding strings to a string map.
    1.90 - */
    1.91 -static int add_strings_to_map(const char *key, const char *val,
    1.92 -                              xen_string_string_map **map)
    1.93 -{
    1.94 -   if (*map == NULL) {
    1.95 -      *map = xen_string_string_map_alloc(1);
    1.96 -      if (*map == NULL)
    1.97 -         return 0;
    1.98 -      
    1.99 -      (*map)->size = 1;
   1.100 -      (*map)->contents[0].key = strdup(key);
   1.101 -      (*map)->contents[0].val = strdup(val);
   1.102 -      return 1;
   1.103 -   }
   1.104 -   
   1.105 -   /* Map is not empty.  Grow the map and add the new strings */
   1.106 -   int new_len = sizeof(xen_string_string_map) +
   1.107 -         (((*map)->size + 1) * sizeof(xen_string_string_map_contents));
   1.108 -   *map = realloc(*map, new_len);
   1.109 -   if (*map == NULL) 
   1.110 -      return 0;
   1.111 -
   1.112 -   (*map)->contents[(*map)->size].key = strdup(key);
   1.113 -   (*map)->contents[(*map)->size].val = strdup(val);
   1.114 -   (*map)->size++;
   1.115 -
   1.116 -   return 1;
   1.117 -}
   1.118 -
   1.119 -
   1.120  
   1.121  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
   1.122  // THE FOLLOWING CODE IS REQUIRED UNTIL EMBEDDEDOBJECT SUPPORT IS WORKING!!!