Re: [PATCH 2/5] Added function pciSysfsFile to enable access to the PCI SYSFS files.

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

 



On Tue, Nov 29, 2011 at 03:48:52PM +0000, Shradha Shah wrote:
> ---
>  src/util/pci.c |   17 +++++++++++++++++
>  src/util/pci.h |    2 ++
>  2 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/src/util/pci.c b/src/util/pci.c
> index 857078d..89a9d12 100644
> --- a/src/util/pci.c
> +++ b/src/util/pci.c
> @@ -39,6 +39,7 @@
>  #include "command.h"
>  #include "virterror_internal.h"
>  #include "virfile.h"
> +#include "virnetdev.h"

I think this can be removed.

> @@ -1991,6 +1992,22 @@ out:
>      return ret;
>  }
>  
> + /*
> +  * Returns a path to the PCI sysfs file given the BDF of the PCI function
> +  */
> +
> +int
> +pciSysfsFile(char **pci_sysfs_device_link, char *pciDeviceName)
> +{
> +    if (virAsprintf(pci_sysfs_device_link, PCI_SYSFS "devices/%s",
> +                    pciDeviceName) < 0) {
> +        virReportOOMError();
> +        return -1;
> +    }
> +    
> +    return 0;
> +}
> +
>  /*
>   * Returns the network device name of a pci device
>   */
> diff --git a/src/util/pci.h b/src/util/pci.h
> index 8e47fc2..3800d98 100644
> --- a/src/util/pci.h
> +++ b/src/util/pci.h
> @@ -143,4 +143,6 @@ int pciGetVirtualFunctionIndex(const char *pf_sysfs_device_link,
>  
>  int pciDeviceNetName(char *device_link_sysfs_path, char **netname);
>  
> +int pciSysfsFile(char **pci_sysfs_device_link, char *pciDeviceName);

My preference would be to swap the order of these two args, so the
out parameter is last. Functionally though, the patch is fine.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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