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

Re: [Xen-devel] [PATCH v2 07/10] xl_cmdimpl - Add return codes for pci-detach, pci-attach, pci-asssignable-add, and pci-assignable-remove.



On Wed, 2016-04-06 at 13:46 +0200, Paulina Szubarczyk wrote:
> From: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
> 
> Returning error codes makes it easier for shell scripts to tell if a
> command has failed or succeeded.
> 
> NB this violates the CODING_STYLE preference for not initializing the
> return-value variable at declaration; but in these cases, having a
> "goto out" that jumped over nothing but an "r = 0" seemed
> a bit pointless.
> 
AFAIUI, that rule applies to 'int rc' variables, meant at hosting libxl
error codes and not equally strictly (although it might be a nice to
have) to 'int r' and alike variables meant at hosting return code from
interna functions, syscalls, libxc calls, etc.

Unless I'm missing or misreading something from libxl's CODING_STYLE.
:-)

> Signed-off-by: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
> Signed-off-by: Paulina Szubarczyk <paulinaszubarczyk@xxxxxxxxx>
> 
> ---
> Changed since v1:
> * Changed exit() calls to 'return 1;'
> 
Why do we need to do that? changing exit(<random_number>) in either
exit(EXIT_SUCCESS) or (in most of the cases) exit(EXIT_FAILURE) is much
better, and is the patter we're (slowly :-/) trying to force into xl.

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.