[libvirt] [PATCH v3 08/12] nodedev: Dereference the obj/def in virNodeDeviceObjListFind* APIs
Erik Skultety
eskultet at redhat.com
Fri Jun 30 12:06:23 UTC 2017
On Sat, Jun 03, 2017 at 09:11:58AM -0400, John Ferlan wrote:
> Create local @obj and @def for the API's rather than referencing the
> devs->objs[i][->def->]. It'll make future patches easier to read.
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
> src/conf/virnodedeviceobj.c | 60 ++++++++++++++++++++++++++++-----------------
> 1 file changed, 37 insertions(+), 23 deletions(-)
>
> diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
> index fab1cfd..a9187be 100644
> --- a/src/conf/virnodedeviceobj.c
> +++ b/src/conf/virnodedeviceobj.c
> @@ -172,12 +172,16 @@ virNodeDeviceObjListFindBySysfsPath(virNodeDeviceObjListPtr devs,
> size_t i;
>
> for (i = 0; i < devs->count; i++) {
> - virNodeDeviceObjLock(devs->objs[i]);
> - if ((devs->objs[i]->def->sysfs_path != NULL) &&
> - (STREQ(devs->objs[i]->def->sysfs_path, sysfs_path))) {
> - return devs->objs[i];
> + virNodeDeviceObjPtr obj = devs->objs[i];
> + virNodeDeviceDefPtr def;
Although with good intension, I think having virNodeDeviceObjPtr obj = foo only
will make all the difference, thus dereferencing @def is IMHO not that much
more beneficial.
ACK with that.
Erik
More information about the libvir-list
mailing list