[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/6]xl: Add 'xl tmem-destroy' command
Add 'xl tmem-destroy' command Signed-off-by: Yang Hongyang<yanghy@xxxxxxxxxxxxxx> diff -r 6b8ccb78dffe tools/libxl/libxl.c --- a/tools/libxl/libxl.c Wed May 19 23:29:07 2010 +0800 +++ b/tools/libxl/libxl.c Wed May 19 23:32:52 2010 +0800 @@ -2855,3 +2855,18 @@ return rc; } + +int libxl_tmem_destroy(struct libxl_ctx *ctx, uint32_t domid) +{ + int rc; + + rc = xc_tmem_control(ctx->xch, -1, TMEMC_DESTROY, domid, 0, 0, + 0, NULL); + if (rc < 0) { + XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, + "Can not destroy tmem pools"); + return -1; + } + + return rc; +} diff -r 6b8ccb78dffe tools/libxl/libxl.h --- a/tools/libxl/libxl.h Wed May 19 23:29:07 2010 +0800 +++ b/tools/libxl/libxl.h Wed May 19 23:32:52 2010 +0800 @@ -515,6 +515,6 @@ char *libxl_tmem_list(struct libxl_ctx *ctx, uint32_t domid, int use_long); int libxl_tmem_freeze(struct libxl_ctx *ctx, uint32_t domid); - +int libxl_tmem_destroy(struct libxl_ctx *ctx, uint32_t domid); #endif /* LIBXL_H */ diff -r 6b8ccb78dffe tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Wed May 19 23:29:07 2010 +0800 +++ b/tools/libxl/xl_cmdimpl.c Wed May 19 23:32:52 2010 +0800 @@ -3750,3 +3750,39 @@ exit(0); } +int main_tmem_destroy(int argc, char **argv) +{ + char *dom = NULL; + int all = 0; + int opt; + + while ((opt = getopt(argc, argv, "ah")) != -1) { + switch (opt) { + case 'a': + all = 1; + break; + case 'h': + help("tmem-destroy"); + exit(0); + default: + fprintf(stderr, "option `%c' not supported.\n", opt); + break; + } + } + + dom = argv[optind]; + if (!dom && all == 0) { + fprintf(stderr, "You must specify -a or a domain id.\n\n"); + help("tmem-destroy"); + exit(1); + } + + if (all) + domid = -1; + else + find_domain(dom); + + libxl_tmem_destroy(&ctx, domid); + exit(0); +} + diff -r 6b8ccb78dffe tools/libxl/xl_cmdimpl.h --- a/tools/libxl/xl_cmdimpl.h Wed May 19 23:29:07 2010 +0800 +++ b/tools/libxl/xl_cmdimpl.h Wed May 19 23:32:52 2010 +0800 @@ -54,6 +54,7 @@ int main_uptime(int argc, char **argv); int main_tmem_list(int argc, char **argv); int main_tmem_freeze(int argc, char **argv); +int main_tmem_destroy(int argc, char **argv); void help(char *command); diff -r 6b8ccb78dffe tools/libxl/xl_cmdtable.c --- a/tools/libxl/xl_cmdtable.c Wed May 19 23:29:07 2010 +0800 +++ b/tools/libxl/xl_cmdtable.c Wed May 19 23:32:52 2010 +0800 @@ -236,6 +236,12 @@ "[<Domain>|-a]", " -a Freeze all tmem", }, + { "tmem-destroy", + &main_tmem_destroy, + "Destroy tmem pools", + "[<Domain>|-a]", + " -a Destroy all tmem", + }, }; int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec); -- Regards Yang Hongyang _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |