Re: [PATCH v2 1/6] Introduce virFileFindHugeTLBFS

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

 



On 07/23/14 21:06, Daniel P. Berrange wrote:
> On Wed, Jul 23, 2014 at 05:37:17PM +0200, Michal Privoznik wrote:
>> +int
>> +virFileFindHugeTLBFS(virHugeTLBFSPtr *ret_fs,
>> +                     size_t *ret_nfs)
>> +{
>> +    int ret = -1;
>> +    FILE *f = NULL;
>> +    struct mntent mb;
>> +    char mntbuf[1024];
>> +    virHugeTLBFSPtr fs = NULL;
>> +    size_t nfs = 0;
>> +    unsigned long long default_hugepagesz;
>> +
>> +    if (virFileGetDefaultHugepageSize(&default_hugepagesz) < 0)
>> +        goto cleanup;
>> +
>> +    if (!(f = setmntent(PROC_MOUNTS, "r"))) {
>> +        virReportSystemError(errno,
>> +                             _("Unable to open %s"),
>> +                             PROC_MOUNTS);
>> +        goto cleanup;
>> +    }
>> +
>> +    while (getmntent_r(f, &mb, mntbuf, sizeof(mntbuf))) {
>> +        virHugeTLBFSPtr tmp;
>> +
>> +        if (STRNEQ(mb.mnt_type, "hugetlbfs"))
>> +            continue;
>> +
>> +        if (VIR_REALLOC_N(fs, nfs + 1) < 0)
>> +            goto cleanup;
>> +
>> +        tmp = &fs[nfs];
>> +        nfs++;
> 
> Stilll think we should be using VIR_EXPAND_N here to ensure
> new space is fully zerod.

Or perhaps use VIR_APPEND_ELEMENT?

> 
>> +
>> +        if (VIR_STRDUP(tmp->mnt_dir, mb.mnt_dir) < 0)
>> +            goto cleanup;


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]