On 05/03/2012 11:13 AM, Guido Günther wrote:
> ---
> Changes since last time:
>     * check sysconf return value before division
>     * use virStrToLong_ull instead of sscanf
> 
> O.k. to apply?
> Cheers,
>  -- Guido

ACK.


> +    long kb_per_pages;
> +    unsigned long long barrier, limit, val;
> +
> +    virCheckFlags(0, -1);
> +
> +    kb_per_pages = sysconf(_SC_PAGESIZE);

A minor optimization is possible, since sysconf() won't change:

static long kb_per_pages;
if (!kb_per_pages) {
    kb_per_pages = sysconf(_SC_PAGESIZE):
    if (kb_per_pages > 0)
        kb_per_pages /= 1024;
}
if (kb_per_pages <= 0)
    error...

for fewer syscalls over the life of the program.  But what you have is
correct, and not worth a respin just for that tweak, so feel free to
push as-is if you'd like.

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to