Re: [libvirt] [PATCH 1/6] nodedev: Expose sysfs path of device

2013-06-06 Thread Osier Yang

On 07/06/13 04:29, John Ferlan wrote:

On 06/03/2013 06:05 AM, Osier Yang wrote:

The name format is constructed by libvirt, it's not that clear to
get what the device's sysfs path should be. This exposes the device's
sysfs path by a new tag .

Since the sysfspath is filled during enumerating the devices by
either udev or HAL. It's an output-only tag.
---
  src/conf/node_device_conf.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 4eeb3b3..cc6f297 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -236,6 +236,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def)
  
  virBufferAddLit(&buf, "\n");

  virBufferEscapeString(&buf, "  %s\n", def->name);
+virBufferEscapeString(&buf, "  %s\n", def->sysfs_path);

Is this necessarily filled in?  EG, do you need to do an "if
(def->sysfs_path)" first?


No. virBufferEscapeString has the checking inside, if the string is NULL, it
does nothing for &buf.



ACK

John

  if (def->parent) {
  virBufferEscapeString(&buf, "  %s\n", def->parent);
  }



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


Re: [libvirt] [PATCH 1/6] nodedev: Expose sysfs path of device

2013-06-06 Thread John Ferlan
On 06/03/2013 06:05 AM, Osier Yang wrote:
> The name format is constructed by libvirt, it's not that clear to
> get what the device's sysfs path should be. This exposes the device's
> sysfs path by a new tag .
> 
> Since the sysfspath is filled during enumerating the devices by
> either udev or HAL. It's an output-only tag.
> ---
>  src/conf/node_device_conf.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
> index 4eeb3b3..cc6f297 100644
> --- a/src/conf/node_device_conf.c
> +++ b/src/conf/node_device_conf.c
> @@ -236,6 +236,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr 
> def)
>  
>  virBufferAddLit(&buf, "\n");
>  virBufferEscapeString(&buf, "  %s\n", def->name);
> +virBufferEscapeString(&buf, "  %s\n", def->sysfs_path);

Is this necessarily filled in?  EG, do you need to do an "if
(def->sysfs_path)" first?

ACK

John
>  if (def->parent) {
>  virBufferEscapeString(&buf, "  %s\n", def->parent);
>  }
> 

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