On Mon, Jul 06, 2015 at 13:08:31 -0400, John Ferlan wrote: > Introduce a convenience function to handle formulating the hostdev path > > Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> > --- > src/qemu/qemu_conf.c | 21 ++++++++++++++++----- > 1 file changed, 16 insertions(+), 5 deletions(-) > > diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c > index 48fb74a..f82244f 100644 > --- a/src/qemu/qemu_conf.c > +++ b/src/qemu/qemu_conf.c > @@ -1213,15 +1213,13 @@ qemuIsSharedHostdev(virDomainHostdevDefPtr hostdev) > return false; > } > > - Here you end up with one line between functions ... > static char * > -qemuGetSharedHostdevKey(virDomainHostdevDefPtr hostdev) > +qemuGetHostdevPath(virDomainHostdevDefPtr hostdev) > { > virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi; > virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; > char *dev_name = NULL; > char *dev_path = NULL; > - char *key = NULL; > > if (!(dev_name = virSCSIDeviceGetDevName(NULL, > scsihostsrc->adapter, > @@ -1230,14 +1228,27 @@ qemuGetSharedHostdevKey(virDomainHostdevDefPtr hostdev) > scsihostsrc->unit))) > goto cleanup; > > - if (virAsprintf(&dev_path, "/dev/%s", dev_name) < 0) > + ignore_value(virAsprintf(&dev_path, "/dev/%s", dev_name)); > + > + cleanup: > + VIR_FREE(dev_name); > + return dev_path; > +} > + > + ... and here you add two. > +static char * > +qemuGetSharedHostdevKey(virDomainHostdevDefPtr hostdev) > +{ > + char *key = NULL; > + char *dev_path = NULL; > + > + if (!(dev_path = qemuGetHostdevPath(hostdev))) > goto cleanup; > > if (!(key = qemuGetSharedDeviceKey(dev_path))) > goto cleanup; > > cleanup: > - VIR_FREE(dev_name); > VIR_FREE(dev_path); > > return key; ACK with whitespace consolidated. Peter
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list