All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <raistlin@linux.it>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>
Subject: [PATCH] libxl: document the memory ownership of some functions
Date: Fri, 15 Jun 2012 15:52:27 +0200	[thread overview]
Message-ID: <6337a90a11ed2ef48442.1339768347@Solace> (raw)

Specifying they allocate dynamic memory that needs to be explicitly freed.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>

diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -586,8 +586,16 @@ int libxl_primary_console_get_tty(libxl_
 int libxl_domain_info(libxl_ctx*, libxl_dominfo *info_r,
                       uint32_t domid);
 libxl_dominfo * libxl_list_domain(libxl_ctx*, int *nb_domain);
+  /* On success, a list of nb_domain libxl_dominfo elements is
+   * returned. That comes from malloc, thus it is up to the caller
+   * to invoke libxl_dominfo_list_free() on it.
+   */
 void libxl_dominfo_list_free(libxl_dominfo *list, int nr);
 libxl_cpupoolinfo * libxl_list_cpupool(libxl_ctx*, int *nb_pool);
+  /* On success, a list of nb_pool libxl_cpupoolinfo elements is
+   * returned. That comes from malloc, thus it is up to the caller
+   * to invoke libxl_cpupoolinfo_list_free() on it.
+   */
 void libxl_cpupoolinfo_list_free(libxl_cpupoolinfo *list, int nr);
 libxl_vminfo * libxl_list_vm(libxl_ctx *ctx, int *nb_vm);
 void libxl_vminfo_list_free(libxl_vminfo *list, int nr);
@@ -768,9 +776,18 @@ int libxl_userdata_retrieve(libxl_ctx *c
 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo);
 #define LIBXL_CPUTOPOLOGY_INVALID_ENTRY (~(uint32_t)0)
 libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nr);
+  /* On success, the actual machine topology is returned as a
+   * list of nr libxl_cputopology elements. That comes from malloc,
+   * thus it is up to the caller to invoke libxl_cputopology_list_free()
+   * on it.
+   */
 void libxl_cputopology_list_free(libxl_cputopology *, int nr);
 libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,
                                        int *nb_vcpu, int *nrcpus);
+  /* On success, a list of nrcpus libxl_vcpuinfo elements is
+   * returned. That comes from malloc, thus it is up to the
+   * caller to invoke libxl_vcpuinfo_list_free() on it.
+   */
 void libxl_vcpuinfo_list_free(libxl_vcpuinfo *, int nr);
 int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid,
                            libxl_cpumap *cpumap);

             reply	other threads:[~2012-06-15 13:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-15 13:52 Dario Faggioli [this message]
2012-06-15 14:11 ` [PATCH] libxl: document the memory ownership of some functions Ian Jackson
2012-06-15 15:19   ` Dario Faggioli
2012-06-15 16:23     ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6337a90a11ed2ef48442.1339768347@Solace \
    --to=raistlin@linux.it \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.