Re: [libvirt] [PATCH 4/5] Implement virDomainGetBlockInfo in QEMU driver

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

 



On 04/27/2010 01:35 PM, Daniel P. Berrange wrote:
> * src/qemu/qemu_driver.c: Implementation of virDomainGetBlockInfo
> * src/util/storage_file.h: Add DEV_BSIZE
> * src/storage/storage_backend.c: Remove DEV_BSIZE

> +    if (S_ISREG(sb.st_mode)) {
> +#ifndef __MINGW32__
> +        info->physical = (unsigned long long)sb.st_blocks *
> +            (unsigned long long)DEV_BSIZE;

Is it worth checking sb.st_blksize rather than DEV_BSIZE on XSI systems
where that is part of struct stat?  In particular, POSIX allows the
block size to be file-system dependent, and some file systems (like
NTFS) have 4k rather than 512 as the block size (is anyone daring enough
to use NTFS for raw file storage?).

>  
> +#ifndef DEV_BSIZE
> +# define DEV_BSIZE 512
> +#endif

Maybe the right thing to do is rewrite a macro:

#if HAVE_STRUCT_STAT_ST_BLKSIZE
# define BSIZE(s) ((s).st_blksize)
#elif defined DEV_BSIZE
# define BSIZE(s) DEV_BSIZE
#else
# define BSIZE(s) 512
#endif

and use BSIZE(sb) instead of DEV_BSIZE; it also involves using a
configure check for AC_CHECK_MEMBERS([struct stat.st_blksize]).

But I think that can be an independent patch, so:
ACK.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]