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

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



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


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