[Libvirt-cim] [PATCH] Added 2 end points for the ServiceAffectsElement association, both related to the LogicalDevice class

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Dec 22 17:40:05 UTC 2008


> +static CMPIStatus add_devices_to_list(const CMPIObjectPath *ref,
> +                                      const char *host,
> +                                      int type,
> +                                      struct inst_list *list)
> +{
> +        CMPIStatus s = {CMPI_RC_OK, NULL};
> +
> +        s = enum_devices(_BROKER, ref, host, type, list);
> +        
> +        if (s.rc != CMPI_RC_OK)
> +                goto out;

There's not need to check the status here, since you just return 
immediately after.

This reduces the function enough, that you can probably do without 
creating an additional function here.

>  static CMPIStatus service_to_cs(const CMPIObjectPath *ref,
>                                  struct std_assoc_info *info,
> @@ -41,15 +59,60 @@
>  {
>          CMPIStatus s = {CMPI_RC_OK, NULL};
>          CMPIInstance *instance = NULL;
> -
> +        const char *host = NULL;
> +        int i;
> +        int num_of_domains;
> +        
>          if (!match_hypervisor_prefix(ref, info))
> -                return s;
> +                goto out;
> 
>          s = get_console_rs(ref, &instance, _BROKER, info->context, true);
>          if (s.rc != CMPI_RC_OK)
> -                return s;
> +                goto out;
> 
>          s = enum_domains(_BROKER, ref, list);
> +        if (s.rc != CMPI_RC_OK)
> +                goto out;
> +       
> +        num_of_domains = list->cur;
> + 
> +        // For each domain, insert its video and pointer devices into
> +        // the list

For multi-line comments, most of the code uses /* */

-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list