Kaitlin Rupert wrote:
Heidi Eckhart wrote:.
>
> But your comments made me rethink about the patch. So I've
> consolidated and reordered a bit.
> - added a new function to libcmpiutil - cu_validate_ref(ref, inst) -
> that does the check between the system instance and the client given
> instance
I think this is a good idea. It seems like it'll be useful in other
places as well.
> - get_domain() is now using the new libcmpiutil function
> - the parameter CMPIInstance **inst is now used to "configure"
> get_domain(); for internal usage the inst is returned and for
> external usage this can be ignored by setting it to NULL
> - validate_domain_ref() is now only an interface name for the client;
> this could also be removed and the provider has then to call
> get_domain(broker, ref, NULL) or simply ignores the returned
> instance; but what I do not really like is, that this can confuse the
> reader of the code; but I'm open for discussion and opinions
As far as readability, I'm fine with this method. As an alternative,
you could have get_domain() return an instance and take a CMPIStatus
variable as a parameter. The provider can then choose to ignore the
returned instance.
Ok, then it might not be that big issue to simply ignore the
returned
instance in case of success.
But that doesn't really fit with our existing code style.
If we leave get_domain() as it is now and only make it external, this
would follow the coding style of e.g. DevicePool - get_pool_inst(...) -
and EnabledLogicalElementCapabilities - get_ele_cap(...). So removing
validate_domain_ref() and making get_domain() externally available is a
good compromise.
--
Regards
Heidi Eckhart
Software Engineer
IBM Linux Technology Center - Open Hypervisor