From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 3/3] xl: convert cpupool related return codes to EXIT_[SUCCESS|FAILURE] Date: Fri, 23 Oct 2015 14:10:57 +0200 Message-ID: <1445602257.5117.115.camel@citrix.com> References: <1445586491-15093-1-git-send-email-write.harmandeep@gmail.com> <1445586491-15093-3-git-send-email-write.harmandeep@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6453657636903681224==" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZpbBY-0001ar-No for xen-devel@lists.xenproject.org; Fri, 23 Oct 2015 12:11:04 +0000 In-Reply-To: <1445586491-15093-3-git-send-email-write.harmandeep@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Harmandeep Kaur , xen-devel@lists.xenproject.org Cc: ian.jackson@eu.citrix.com, stefano.stebellini@eu.citrix.com, wei.liu2@citrix.com, ian.campbell@citrix.com, george.dunlap@citrix.com List-Id: xen-devel@lists.xenproject.org --===============6453657636903681224== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-BvfS+DHepfRQBLHoeq9B" --=-BvfS+DHepfRQBLHoeq9B Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable And here we are at the last patch of this series. Allow me to say that this is quite good a first contribution! Thanks for this, and I'm looking forward to seeing version 2!! :-D About this patch, a few comments below. On Fri, 2015-10-23 at 13:18 +0530, Harmandeep Kaur wrote: > turning cpupools related functions xl exit codes towards using the > EXIT_[SUCCESS|FAILURE] macros, instead of instead of arbitrary > numbers > or libxl return codes. >=20 > Signed-off-by: Harmandeep Kaur > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -7497,7 +7497,7 @@ out: > free(name); > free(config_data); > free(extra_config); > - return rc; > + return rc ? EXIT_FAILURE : EXIT_SUCCESS; > } >=20 I think you can just initialize rc with EXIT_FAILURE, assign EXIT_SUCCESS to it near the end, if everything went ok, and then keep the 'return rc'; =20 > int main_cpupooldestroy(int argc, char **argv) > @@ -7580,13 +7580,13 @@ int main_cpupooldestroy(int argc, char > **argv) > if (libxl_cpupool_qualifier_to_cpupoolid(ctx, pool, &poolid, > NULL) || > !libxl_cpupoolid_is_valid(ctx, poolid)) { > fprintf(stderr, "unknown cpupool '%s'\n", pool); > - return 1; > + return EXIT_FAILURE; > } > =20 > if (libxl_cpupool_destroy(ctx, poolid)) > - return 1; > + return EXIT_FAILURE; > =20 > - return 0; > + return EXIT_SUCCESS; > } >=20 For this one: I've sent a patch for another reason yesterday, and while there I did the exit code adjustment myself. So, update your tree and, if my patch has been committed already, just skip this function. https://www.mail-archive.com/xen-devel@lists.xen.org/msg42850.html Which brings up a question: what git tree are you using for development? You should stay either on master or staging branches (and I recommend staging) of the official repository: http://wiki.xenproject.org/wiki/Xen_Project_Repositories =20 > @@ -7653,7 +7653,7 @@ int main_cpupoolcpuadd(int argc, char **argv) > =20 > out: > libxl_bitmap_dispose(&cpumap); > - return rc; > + return rc ? EXIT_FAILURE : EXIT_SUCCESS; > Same as already said for main_cpupoolcreate, just us rc. > @@ -7691,7 +7691,7 @@ int main_cpupoolcpuremove(int argc, char > **argv) > =20 > out: > libxl_bitmap_dispose(&cpumap); > - return rc; > + return rc ? EXIT_FAILURE : EXIT_SUCCESS; > And here. > int main_cpupoolnumasplit(int argc, char **argv) > @@ -7758,7 +7758,7 @@ int main_cpupoolnumasplit(int argc, char > **argv) > poolinfo =3D libxl_list_cpupool(ctx, &n_pools); > if (!poolinfo) { > fprintf(stderr, "error getting cpupool info\n"); > - return 1; > + return EXIT_FAILURE; > } > poolid =3D poolinfo[0].poolid; > sched =3D poolinfo[0].sched; > @@ -7766,13 +7766,13 @@ int main_cpupoolnumasplit(int argc, char > **argv) > =20 > if (n_pools > 1) { > fprintf(stderr, "splitting not possible, already cpupools in > use\n"); > - return 1; > + return EXIT_FAILURE; > } > =20 > topology =3D libxl_get_cpu_topology(ctx, &n_cpus); > if (topology =3D=3D NULL) { > fprintf(stderr, "libxl_get_topologyinfo failed\n"); > - return 1; > + return EXIT_FAILURE; > } > =20 > if (libxl_cpu_bitmap_alloc(ctx, &cpumap, 0)) { > @@ -7869,7 +7869,7 @@ out: > libxl_dominfo_dispose(&info); > free(name); > =20 > - return rc; > + return rc ? EXIT_FAILURE : EXIT_SUCCESS; > } >=20 And here too. Thanks and regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-BvfS+DHepfRQBLHoeq9B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlYqI9EACgkQk4XaBE3IOsSK8wCgp0J76XrgfgcMa80IKr+FdLZx uwsAniYNBsia7MM+eggFWqseJBPGartb =iSrq -----END PGP SIGNATURE----- --=-BvfS+DHepfRQBLHoeq9B-- --===============6453657636903681224== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============6453657636903681224==--