[PATCH v4 3/4] lxc: remove domain definition from lxc network struct
Julio Faracco
jcfaracco at gmail.com
Mon Feb 3 14:34:42 UTC 2020
I agree, Michal.
I reviewed the logic and it is impossible to get a NULL pointer using
both approaches.
Thanks!
--
Julio Cesar Faracco
Em seg., 3 de fev. de 2020 às 07:06, Michal Privoznik
<mprivozn at redhat.com> escreveu:
>
> On 2/3/20 2:28 AM, Julio Faracco wrote:
> > Domain definition is useless now inside network structure. This pointer
> > was required because new network definition was being added each time
> > that a new network type appeared. So, this should be processed into
> > old function `lxcNetworkParseDataType()`. Now, as it was moved to an
> > array, it can be handle together each interface pointer.
> >
> > Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
> > ---
> > src/lxc/lxc_native.c | 17 +++++++++--------
> > 1 file changed, 9 insertions(+), 8 deletions(-)
> >
> > diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
> > index 8bbe205659..99539a0205 100644
> > --- a/src/lxc/lxc_native.c
> > +++ b/src/lxc/lxc_native.c
> > @@ -414,7 +414,6 @@ lxcCreateHostdevDef(int mode, int type, const char *data)
> > typedef struct _lxcNetworkParseData lxcNetworkParseData;
> > typedef lxcNetworkParseData *lxcNetworkParseDataPtr;
> > struct _lxcNetworkParseData {
> > - virDomainDefPtr def;
> > char *type;
> > char *link;
> > char *mac;
> > @@ -470,13 +469,16 @@ lxcAddNetworkRouteDefinition(const char *address,
> > }
> >
> > static int
> > -lxcAddNetworkDefinition(lxcNetworkParseData *data)
> > +lxcAddNetworkDefinition(virDomainDefPtr def, lxcNetworkParseData *data)
> > {
> > virDomainNetDefPtr net = NULL;
> > virDomainHostdevDefPtr hostdev = NULL;
> > bool isPhys, isVlan = false;
> > size_t i;
> >
> > + if (!data)
> > + return -1;
>
> Is this check really necessary? I mean, can @data be NULL? Because from
> my understanding of the code it can not. But even if it can, we need to
> report an error here because the caller doesn't.
>
> You don't need to resend, I can fix it before pushing. The rest looks good.
>
> Michal
>
More information about the libvir-list
mailing list