[PATCH] Fix externally-visible name of type_from_classname()

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1424173382 28800 # Node ID f922cb6a051d0d4bf0186bb755627e5df981997f # Parent e385d591fa6f8bbe135434117a16039d5693f5b4 Fix externally-visible name of type_from_classname() Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r e385d591fa6f -r f922cb6a051d src/Virt_Device.c --- a/src/Virt_Device.c Tue Oct 30 09:39:29 2007 -0700 +++ b/src/Virt_Device.c Tue Feb 17 03:43:02 2015 -0800 @@ -247,7 +247,7 @@ static CMPIInstance *device_instance(con return instance; } -int type_from_classname(const char *classname) +int device_type_from_classname(const char *classname) { if (strstr(classname, "NetworkPort")) return VIRT_DEV_NET; @@ -321,7 +321,7 @@ static int dom_list_devices(virConnectPt int i; int type; - type = type_from_classname(CLASSNAME(ref)); + type = device_type_from_classname(CLASSNAME(ref)); ndom = get_domain_list(conn, &doms); if (ndom == 0) @@ -458,8 +458,11 @@ static CMPIStatus get_device(const CMPIO CMPIStatus s; virConnectPtr conn; CMPIInstance *inst; + const char *cn; - conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); + cn = CLASSNAME(reference); + + conn = connect_by_classname(_BROKER, cn, &s); if (!conn) return s; @@ -467,7 +470,7 @@ static CMPIStatus get_device(const CMPIO conn, devid, NAMESPACE(reference), - type_from_classname(CLASSNAME(reference))); + device_type_from_classname(cn)); if (inst) { CMReturnInstance(results, inst); CMSetStatus(&s, CMPI_RC_OK); diff -r e385d591fa6f -r f922cb6a051d src/Virt_Device.h --- a/src/Virt_Device.h Tue Oct 30 09:39:29 2007 -0700 +++ b/src/Virt_Device.h Tue Feb 17 03:43:02 2015 -0800 @@ -56,7 +56,7 @@ CMPIInstance *instance_from_devid(const const char *ns, int type); -int type_from_classname(const char *classname); +int device_type_from_classname(const char *classname); #endif diff -r e385d591fa6f -r f922cb6a051d src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Tue Oct 30 09:39:29 2007 -0700 +++ b/src/Virt_SettingsDefineState.c Tue Feb 17 03:43:02 2015 -0800 @@ -148,7 +148,7 @@ static CMPIInstance *_get_typed_device(c conn, id, ns, - type_from_classname(typestr)); + device_type_from_classname(typestr)); out: virConnectClose(conn); diff -r e385d591fa6f -r f922cb6a051d src/Virt_SystemDevice.c --- a/src/Virt_SystemDevice.c Tue Oct 30 09:39:29 2007 -0700 +++ b/src/Virt_SystemDevice.c Tue Feb 17 03:43:02 2015 -0800 @@ -171,7 +171,7 @@ static CMPIStatus sys_to_dev(const CMPIO if (info->result_class) { int type; - type = type_from_classname(info->result_class); + type = device_type_from_classname(info->result_class); ret = get_dom_devices(host, list, type, NAMESPACE(ref)); } else {

Dan Smith wrote:
@@ -458,8 +458,11 @@ static CMPIStatus get_device(const CMPIO CMPIStatus s; virConnectPtr conn; CMPIInstance *inst; + const char *cn;
- conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); + cn = CLASSNAME(reference); + + conn = connect_by_classname(_BROKER, cn, &s);
What is your intention by breaking this one-liner into three lines ?
if (!conn) return s;
I had problems to apply this patch to the latest version from the external libvirt-cim repository. But I checked it and all changes have been applied. Works for me ... +1 (tested on KVM) -- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck@linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

HE> What is your intention by breaking this one-liner into three lines ? Because when I went to make this change: @@ -467,7 +470,7 @@ static CMPIStatus get_device(const CMPIO conn, devid, NAMESPACE(reference), - type_from_classname(CLASSNAME(reference))); + device_type_from_classname(cn)); the line would wrap. By consolidating all the CLASSNAME() calls into a const char * (which is what I should have done in the first place) I avoided wrapping that line :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com
participants (2)
-
Dan Smith
-
Heidi Eckhart