(Finally getting my feet wet in xl-land!) Implement "xl tmem-freeable" to match "xm tmem-freeable". (Please apply to 4.0-testing also if possible.) Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> diff -r d867eb643fe4 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Tue Jul 13 18:17:28 2010 +0100 +++ b/tools/libxl/libxl.c Fri Jul 16 12:13:46 2010 -0600 @@ -3181,3 +3181,17 @@ return rc; } +int libxl_tmem_freeable(struct libxl_ctx *ctx) +{ + int rc; + + rc = xc_tmem_control(ctx->xch, -1, TMEMC_QUERY_FREEABLE_MB, -1, 0, 0, 0, 0); + if (rc < 0) { + XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, + "Can not get tmem freeable memory"); + return -1; + } + + return rc; +} + diff -r d867eb643fe4 tools/libxl/libxl.h --- a/tools/libxl/libxl.h Tue Jul 13 18:17:28 2010 +0100 +++ b/tools/libxl/libxl.h Fri Jul 16 12:13:46 2010 -0600 @@ -556,6 +556,7 @@ uint32_t set); int libxl_tmem_shared_auth(struct libxl_ctx *ctx, uint32_t domid, char* uuid, int auth); +int libxl_tmem_freeable(struct libxl_ctx *ctx); typedef struct { char *backend; diff -r d867eb643fe4 tools/libxl/xl.h --- a/tools/libxl/xl.h Tue Jul 13 18:17:28 2010 +0100 +++ b/tools/libxl/xl.h Fri Jul 16 12:13:46 2010 -0600 @@ -72,6 +72,7 @@ int main_tmem_thaw(int argc, char **argv); int main_tmem_set(int argc, char **argv); int main_tmem_shared_auth(int argc, char **argv); +int main_tmem_freeable(int argc, char **argv); int main_network2attach(int argc, char **argv); int main_network2list(int argc, char **argv); int main_network2detach(int argc, char **argv); diff -r d867eb643fe4 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Tue Jul 13 18:17:28 2010 +0100 +++ b/tools/libxl/xl_cmdimpl.c Fri Jul 16 12:13:46 2010 -0600 @@ -4537,3 +4537,26 @@ exit(0); } +int main_tmem_freeable(int argc, char **argv) +{ + int opt; + int mb; + + while ((opt = getopt(argc, argv, "h")) != -1) { + switch (opt) { + case ''h'': + help("tmem-freeable"); + exit(0); + default: + fprintf(stderr, "option `%c'' not supported.\n", opt); + break; + } + } + + mb = libxl_tmem_freeable(&ctx); + if (mb == -1) + exit(-1); + + printf("%d\n", mb); + exit(0); +} diff -r d867eb643fe4 tools/libxl/xl_cmdtable.c --- a/tools/libxl/xl_cmdtable.c Tue Jul 13 18:17:28 2010 +0100 +++ b/tools/libxl/xl_cmdtable.c Fri Jul 16 12:13:46 2010 -0600 @@ -295,6 +295,11 @@ " (abcdef01-2345-6789-1234-567890abcdef)\n" " -A AUTH 0=auth,1=deauth", }, + { "tmem-freeable", + &main_tmem_freeable, + "Get information about how much freeable memory (MB) is in-use by tmem", + "", + }, { "network2-attach", &main_network2attach, "Create a new version 2 virtual network device", _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel