[libvirt] [PATCH 3/5] nodedev: Fix sysfs paths for vport operations

Jiri Denemark jdenemar at redhat.com
Wed Aug 18 15:31:50 UTC 2010


> > +    if (stat(operation_path, &st) != 0) {
> > +        VIR_FREE(operation_path);
> > +        if (virAsprintf(&operation_path,
> > +                        "%shost%d%s",
> > +                        LINUX_SYSFS_SCSI_HOST_PREFIX,
> > +                        parent_host,
> > +                        operation_file) < 0) {
> 
> It's slightly more efficient to write:
> 
> virAsprintf(&operation_path, LINUX_SYSFS_SCSI_HOST_PREFIX "host%d%s",
>             parent_host, operation_file)

Yeah, it is but the original version is used on several places in node_device
so guess it's better to be consistent with the rest of the code. And although
it's slightly more efficient, I don't think it's a good idea to rewrite
existing code since it could lead into some ugly long lines, such as

    LINUX_SYSFS_FC_HOST_PREFIX "host%d" LINUX_SYSFS_VPORT_CREATE_POSTFIX

:-)

Jirka




More information about the libvir-list mailing list