Re: [PATCH 05/11] Add an API for iterating over disk paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 12, 2010 at 02:30:42PM +0100, Daniel P. Berrange wrote:
> There is duplicated code which iterates over disk backing stores
> performing some action. Provide a convenient helper for doing
> this to eliminate duplication & risk of mistakes with disk format
> probing
> 
> * src/conf/domain_conf.c, src/conf/domain_conf.h,
>   src/libvirt_private.syms: Add virDomainDiskDefForeachPath()
[...]
> +        if ((fd = open(path, O_RDONLY)) < 0) {

> +        if (virStorageFileGetMetadataFromFD(path, fd, format, &meta) < 0) {
> +            close(fd);
> +            goto cleanup;
> +        }
> +        close(fd);

  stylistic
           ret = f(... fd, )
           close(fd);
           if (ret < 0)
               goto cleanup;

looks simpler to me, but it's a matter of taste :-)

ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]