Re: [PATCH v2 1/3] virsh-nodedev: makes struct and functions for NodeDevice list available

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

 



$SUBJ: Expose virshNodeDeviceList{Collect|Free} and virshNodeDeviceList
struct

On 10/27/2015 11:01 AM, Pavel Hrdina wrote:
> Next patch will use those function to collect NodeDevice list and find a
> specific device.  Make functions virshNodeDeviceListCollect() and
> virshNodeDeviceListFree() together with struct virshNodeDeviceList
> available to reuse existing code.
> 

Exposing virshNodeDeviceListCollect, virshNodeDeviceListFree, and
virshNodeDeviceList allows the data returned to be available to other
virsh API's that may need them in the future.

> Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> ---
>  tools/virsh-nodedev.c | 16 +++++-----------
>  tools/virsh-nodedev.h | 11 +++++++++++
>  2 files changed, 16 insertions(+), 11 deletions(-)
> 

OK - all that said, but your future patches don't use these functions,
so is there really any use for this patch yet?  It seems your 2/3 has
removed what was in the 3/4 in your prior series related to calling
virshNodeDeviceListCollect (and noted in your cover letter as being
removed).

I don't oppose the change, but it doesn't seem necessary.

John
> diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
> index cc359e2..26f2c7b 100644
> --- a/tools/virsh-nodedev.c
> +++ b/tools/virsh-nodedev.c
> @@ -194,13 +194,7 @@ virshNodeDeviceSorter(const void *a, const void *b)
>                           virNodeDeviceGetName(*nb));
>  }
>  
> -struct virshNodeDeviceList {
> -    virNodeDevicePtr *devices;
> -    size_t ndevices;
> -};
> -typedef struct virshNodeDeviceList *virshNodeDeviceListPtr;
> -
> -static void
> +void
>  virshNodeDeviceListFree(virshNodeDeviceListPtr list)
>  {
>      size_t i;
> @@ -215,11 +209,11 @@ virshNodeDeviceListFree(virshNodeDeviceListPtr list)
>      VIR_FREE(list);
>  }
>  
> -static virshNodeDeviceListPtr
> +virshNodeDeviceListPtr
>  virshNodeDeviceListCollect(vshControl *ctl,
> -                         char **capnames,
> -                         int ncapnames,
> -                         unsigned int flags)
> +                           char **capnames,
> +                           int ncapnames,
> +                           unsigned int flags)
>  {
>      virshNodeDeviceListPtr list = vshMalloc(ctl, sizeof(*list));
>      size_t i;
> diff --git a/tools/virsh-nodedev.h b/tools/virsh-nodedev.h
> index c64f7df..1d2337b 100644
> --- a/tools/virsh-nodedev.h
> +++ b/tools/virsh-nodedev.h
> @@ -30,4 +30,15 @@
>  
>  extern const vshCmdDef nodedevCmds[];
>  
> +struct virshNodeDeviceList {
> +    virNodeDevicePtr *devices;
> +    size_t ndevices;
> +};
> +typedef struct virshNodeDeviceList *virshNodeDeviceListPtr;
> +
> +virshNodeDeviceListPtr virshNodeDeviceListCollect(vshControl *ctl,
> +                                                  char **capnames,
> +                                                  int ncapnames,
> +                                                  unsigned int flags);
> +void virshNodeDeviceListFree(virshNodeDeviceListPtr list);
>  #endif /* VIRSH_NODEDEV_H */
> 

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