xl tmem-freeable
PATCH 1/1 xl tmem-freeable
(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 <[email protected]>
tools/libxl/libxl.c +14 -0
@@ -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; +} +
tools/libxl/libxl.h +1 -0
@@ -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;
tools/libxl/xl.h +1 -0
@@ -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);
tools/libxl/xl_cmdimpl.c +23 -0
@@ -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 ); +}
tools/libxl/xl_cmdtable.c +5 -0
@@ -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",
tools/libxl/libxl.c +14 -0
@@ -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; +} +
tools/libxl/libxl.h +1 -0
@@ -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;
tools/libxl/xl.h +1 -0
@@ -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);
tools/libxl/xl_cmdimpl.c +23 -0
@@ -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 ); +}
tools/libxl/xl_cmdtable.c +5 -0
@@ -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
[email protected]
http://lists.xensource.com/xen-devel