# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1196858495 -3600
# Node ID af64285fa953aca6c4183d0fd6845d110ddd1a1d
# Parent 012fc8655c2b443511ba536ef2b425ac86f69f7b
[RFC] #2 - variable renaming in make_ref() of associations
Suggestion to rename some of the variables in make_ref()
to make the relations clearer.
Also moved the content of make_ref() to make_reference()
in libxkutil to generalize it. This make_reference can
then be used by each association's make_ref().
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r 012fc8655c2b -r af64285fa953 libxkutil/misc_util.c
--- a/libxkutil/misc_util.c Wed Dec 05 12:49:18 2007 +0100
+++ b/libxkutil/misc_util.c Wed Dec 05 13:41:35 2007 +0100
@@ -342,7 +342,30 @@ bool match_hypervisor_prefix(const CMPIO
return rc;
}
-
+CMPIInstance *make_reference(const CMPIBroker *broker,
+ const CMPIObjectPath *source_ref,
+ const CMPIInstance *target_inst,
+ struct std_assoc *assoc,
+ const char *assoc_classname)
+{
+
+ CMPIInstance *ref_inst = NULL;
+
+ ref_inst = get_typed_instance(broker,
+ CLASSNAME(source_ref),
+ assoc_classname,
+ NAMESPACE(source_ref));
+
+ if (ref_inst != NULL) {
+ CMPIObjectPath *target_ref;
+
+ target_ref = CMGetObjectPath(target_inst, NULL);
+
+ set_reference(assoc, ref_inst, source_ref, target_ref);
+ }
+
+ return ref_inst;
+}
bool domain_online(virDomainPtr dom)
{
diff -r 012fc8655c2b -r af64285fa953 libxkutil/misc_util.h
--- a/libxkutil/misc_util.h Wed Dec 05 12:49:18 2007 +0100
+++ b/libxkutil/misc_util.h Wed Dec 05 13:41:35 2007 +0100
@@ -109,6 +109,12 @@ bool match_hypervisor_prefix(const CMPIO
bool match_hypervisor_prefix(const CMPIObjectPath *reference,
struct std_assoc_info *info);
+CMPIInstance *make_reference(const CMPIBroker *broker,
+ const CMPIObjectPath *source_ref,
+ const CMPIInstance *target_inst,
+ struct std_assoc *assoc,
+ const char *assoc_classname);
+
/*
* Local Variables:
* mode: C
diff -r 012fc8655c2b -r af64285fa953 src/Virt_ElementAllocatedFromPool.c
--- a/src/Virt_ElementAllocatedFromPool.c Wed Dec 05 12:49:18 2007 +0100
+++ b/src/Virt_ElementAllocatedFromPool.c Wed Dec 05 13:41:35 2007 +0100
@@ -247,27 +247,20 @@ static CMPIStatus pool_to_vdev(const CMP
return s;
}
-static CMPIInstance *make_ref(const CMPIObjectPath *ref,
- const CMPIInstance *inst,
+static CMPIInstance *make_ref(const CMPIObjectPath *source_ref,
+ const CMPIInstance *target_inst,
struct std_assoc_info *info,
struct std_assoc *assoc)
{
- CMPIInstance *refinst = NULL;
-
- refinst = get_typed_instance(_BROKER,
- CLASSNAME(ref),
- "ElementAllocatedFromPool",
- NAMESPACE(ref));
-
- if (refinst != NULL) {
- CMPIObjectPath *instop;
-
- instop = CMGetObjectPath(inst, NULL);
-
- set_reference(assoc, refinst, ref, instop);
- }
-
- return refinst;
+ CMPIInstance *ref_inst = NULL;
+
+ ref_inst = make_reference(_BROKER,
+ source_ref,
+ target_inst,
+ assoc,
+ "ElementAllocatedFromPool");
+
+ return ref_inst;
}
char* antecedent[] = {