WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 4/6]xl: Add 'xl tmem-thaw' command

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 4/6]xl: Add 'xl tmem-thaw' command
From: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
Date: Wed, 19 May 2010 16:32:29 +0800
Cc: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Wed, 19 May 2010 01:35:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4BF39FB9.3050005@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4BF39FB9.3050005@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100415 Thunderbird/3.0.4
Add 'xl tmem-thaw' command

Signed-off-by: Yang Hongyang<yanghy@xxxxxxxxxxxxxx> 

diff -r 6997a436e0ed tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed May 19 23:33:08 2010 +0800
+++ b/tools/libxl/libxl.c       Wed May 19 23:35:06 2010 +0800
@@ -2870,3 +2870,18 @@
 
     return rc;
 }
+
+int libxl_tmem_thaw(struct libxl_ctx *ctx, uint32_t domid)
+{
+    int rc;
+
+    rc = xc_tmem_control(ctx->xch, -1, TMEMC_THAW, domid, 0, 0,
+                         0, NULL);
+    if (rc < 0) {
+        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+            "Can not thaw tmem pools");
+        return -1;
+    }
+
+    return rc;
+}
diff -r 6997a436e0ed tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Wed May 19 23:33:08 2010 +0800
+++ b/tools/libxl/libxl.h       Wed May 19 23:35:06 2010 +0800
@@ -516,5 +516,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);
+int libxl_tmem_thaw(struct libxl_ctx *ctx, uint32_t domid);
 #endif /* LIBXL_H */
 
diff -r 6997a436e0ed tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed May 19 23:33:08 2010 +0800
+++ b/tools/libxl/xl_cmdimpl.c  Wed May 19 23:35:06 2010 +0800
@@ -3786,3 +3786,39 @@
     exit(0);
 }
 
+int main_tmem_thaw(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-thaw");
+            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-thaw");
+        exit(1);
+    }
+
+    if (all)
+        domid = -1;
+    else
+        find_domain(dom);
+
+    libxl_tmem_thaw(&ctx, domid);
+    exit(0);
+}
+
diff -r 6997a436e0ed tools/libxl/xl_cmdimpl.h
--- a/tools/libxl/xl_cmdimpl.h  Wed May 19 23:33:08 2010 +0800
+++ b/tools/libxl/xl_cmdimpl.h  Wed May 19 23:35:06 2010 +0800
@@ -55,6 +55,7 @@
 int main_tmem_list(int argc, char **argv);
 int main_tmem_freeze(int argc, char **argv);
 int main_tmem_destroy(int argc, char **argv);
+int main_tmem_thaw(int argc, char **argv);
 
 void help(char *command);
 
diff -r 6997a436e0ed tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Wed May 19 23:33:08 2010 +0800
+++ b/tools/libxl/xl_cmdtable.c Wed May 19 23:35:06 2010 +0800
@@ -242,6 +242,12 @@
       "[<Domain>|-a]",
       "  -a                             Destroy all tmem",
     },
+    { "tmem-thaw",
+      &main_tmem_thaw,
+      "Thaw tmem pools",
+      "[<Domain>|-a]",
+      "  -a                             Thaw 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