From: Wei Liu Subject: Re: [PATCH v2 14/18] libxl: introduce libxl_get_memory_static_max Date: Thu, 28 Aug 2014 12:31:33 +0100 Message-ID: <20140828113133.GL13165@zion.uk.xensource.com> References: <1406744639-28782-1-git-send-email-wei.liu2@citrix.com> <1406744639-28782-15-git-send-email-wei.liu2@citrix.com> <1409105349.28009.78.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1409105349.28009.78.camel@citrix.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: Ian Campbell Cc: ian.jackson@eu.citrix.com, Wei Liu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Aug 27, 2014 at 03:09:09AM +0100, Ian Campbell wrote: > On Wed, 2014-07-30 at 19:23 +0100, Wei Liu wrote: > > +/* type determines which node to return: > > + * 1 "target" > > + * 2 "static-max" > > You've just invented enums ;-) > > Either use an actual enum, or a bool flag (since this is internal only I > don't mind which) > Bool flag it is. > > +int libxl_get_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t *out_target) > > +{ > > + GC_INIT(ctx); > > + int rc; > > + > > + rc = libxl__get_memory_target(gc, domid, out_target, 1); > > FWIW for trivial helper wrappers like this where the wrapper does > nothing I think it can be acceptable to bend the usual rule about > internal things taking a gc a bit. Although that can just be saving > problems for later when someone adds some new magic to a wrapper. > I would rather keep the code as it is now. > > @@ -884,6 +891,7 @@ int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t domid, > > int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint32_t target_memkb); > > int libxl_set_memory_target(libxl_ctx *ctx, uint32_t domid, int32_t target_memkb, int relative, int enforce); > > int libxl_get_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t *out_target); > > +int libxl_get_memory_static_max(libxl_ctx *ctx, uint32_t domid, uint32_t *out_static_max); > > Do you need this to be public, or did you just do it for consistency? > I did it for consistency, in case it's useful to library users. If you would rather not expose this I can make it internal. Wei. > Ian.