[libvirt] [PATCHv2] pci: properly handle out-of-order SRIOV virtual functions

Ján Tomko jtomko at redhat.com
Fri Nov 8 08:20:42 UTC 2013


On 11/08/2013 08:47 AM, Niilona wrote:
> @@ -2412,15 +2420,16 @@ virPCIGetVirtualFunctions(const char *sy
>          return ret;
>      }
> 
> -    while ((entry = readdir(dir))) {
> -        if (STRPREFIX(entry->d_name, "virtfn")) {
> +    entry_count = scandir(sysfs_path, &namelist, virtfn_select, alphasort);

alphasort will make sure that the order is always wrong if there are more than
10 functions.

Hopefully we can use versionsort thanks to gnulib.

> +
> +    while ( current_entry < entry_count ) {
>              virPCIDeviceAddress *config_addr = NULL;
> 
> -            if (virBuildPath(&device_link, sysfs_path, entry->d_name) == -1) {
> +            if (virBuildPath(&device_link, sysfs_path, namelist[
> current_entry ]->d_name ) == -1) {
>                  virReportOOMError();
>                  goto error;
>              }
> -
> +            current_entry ++;
>              VIR_DEBUG("Number of virtual functions: %d",
>                        *num_virtual_functions);
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131108/d69c9a86/attachment-0001.sig>


More information about the libvir-list mailing list