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;
+}
+
int libxl_file_reference_map(struct libxl_ctx *ctx, libxl_file_reference *f)
{
struct stat st_buf;
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;
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);
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);
+}
" (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",