Re: [RFC REPOST 1/7] conf: extract appid validation to virDomainDefResourceAppidValidate

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

 



On Fri, Sep 10, 2021 at 01:49:24PM +0200, Michal Prívozník wrote:
> On 9/9/21 6:13 PM, Pavel Hrdina wrote:
> > This will be needed by future patches adding appid API to allow changing
> > it for running VMs.
> > 
> > Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> > ---
> >  src/conf/domain_validate.c | 42 +++++++++++++++++++++++---------------
> >  src/conf/domain_validate.h |  2 ++
> >  src/libvirt_private.syms   |  1 +
> >  3 files changed, 28 insertions(+), 17 deletions(-)
> > 
> > diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
> > index 1bc62c364d..3ab864bbeb 100644
> > --- a/src/conf/domain_validate.c
> > +++ b/src/conf/domain_validate.c
> 
> 
> > +    if (def->resource->appid)
> > +        return virDomainDefResourceAppidValidate(def->resource->appid);
> >  
> 
> I'd write this as:
> 
>   if (def->resource->appid &&
>       virDomainDefResourceAppidValidate() < 0)
>       return -1;
> 
> so that this line doesn't have to be changed when something new is added
> to this function. Moreover, you can have
> virDomainDefResourceAppidValidate() to be NOP if appid == NULL and write
> this check as:
> 
>   if (virDomainDefResourceAppidValidate() < 0)
>     return -1;

True, I'll fix that. Thanks.

Pavel

Attachment: signature.asc
Description: PGP signature


[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