Re: [PATCH v2 1/6] lxc: Rebase lxcNetworkParseData struct to support indexes.

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

 




On 3/4/19 8:54 PM, Julio Faracco wrote:
> The current logic of lxcNetworkParseData uses one single structure to
> record data over the network definitions inside config files. The logic
> consider the entry 'type' as a new network definition, every time that
> algorithm find this tag.
> 
> This new structure was designed to consider network definitions as an
> array of network structures.
> 
> Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx>
> ---
>  src/lxc/lxc_native.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 

This fails to build alone...

> diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
> index 2fd349ac1d..bf82cd1e98 100644
> --- a/src/lxc/lxc_native.c
> +++ b/src/lxc/lxc_native.c
> @@ -423,8 +423,9 @@ lxcCreateHostdevDef(int mode, int type, const char *data)
>      return hostdev;
>  }
>  
> -typedef struct {
> -    virDomainDefPtr def;

Removing @def causes build failure

> +typedef struct _lxcNetworkParseData lxcNetworkParseData;
> +typedef lxcNetworkParseData *lxcNetworkParseDataPtr;
> +struct _lxcNetworkParseData {

I do think there is value in just adding the *Ptr value and then using
within the code rather than "lxcNetworkParseData *data".

That is introduce the lxcNetworkParseDataPtr in the same patch as you
change anything that uses "lxcNetworkParseData *data" to use
"lxcNetworkParseDataPtr data" instead.

>      char *type;
>      char *link;
>      char *mac;
> @@ -436,9 +437,14 @@ typedef struct {
>      size_t nips;
>      char *gateway_ipv4;
>      char *gateway_ipv6;
> -    bool privnet;
> -    size_t networks;

In order to compile these 2 would need to be restored and the subsequent
index removed.  These would be adjusted you 'needed to' adjust them in
the patch that makes them obsolete.

> -} lxcNetworkParseData;
> +    size_t index;
> +};
> +

The following should be separated into its own patch with the similar
format as above using:

typedef struct _lxcNetworkParseArray lxcNetworkParseArray;
typedef lxcNetworkParseArray *lxcNetworkParseArrayPtr;
struct _lxcNetworkParseArray {


> +typedef struct {
> +    lxcNetworkParseDataPtr *data;

This should be "networks" not "data" for the normal naming scheme used.

It is also arguably separable since it's new and introducing a new concept.

John

> +    size_t nnetworks;
> +} lxcNetworkParseArray;
> +
>  
>  static int
>  lxcAddNetworkRouteDefinition(const char *address,
> 

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

  Powered by Linux