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-changelog

[Xen-changelog] [xen-unstable] libxl: remove XS transaction from public

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: remove XS transaction from public API.
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 25 Mar 2011 04:45:14 +0000
Delivery-date: Thu, 24 Mar 2011 21:47:02 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1300895713 0
# Node ID 46a66a5301a1838f9f7acacb801067c76193a9bc
# Parent  a23784d60b95255e615713784abdbf6d33c5cee5
libxl: remove XS transaction from public API.

All external users pass 0 anyway so make the version of
libxl_domain_rename which takes a transaction internal and provide an
external facing function which does not expose a transaction.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r a23784d60b95 -r 46a66a5301a1 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Mar 23 15:52:28 2011 +0000
+++ b/tools/libxl/libxl.c       Wed Mar 23 15:55:13 2011 +0000
@@ -116,11 +116,11 @@
 
/******************************************************************************/
 
 
-int libxl_domain_rename(libxl_ctx *ctx, uint32_t domid,
-                        const char *old_name, const char *new_name,
-                        xs_transaction_t trans)
+int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
+                         const char *old_name, const char *new_name,
+                         xs_transaction_t trans)
 {
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    libxl_ctx *ctx = libxl__gc_owner(gc);
     char *dom_path = 0;
     const char *name_path;
     char *got_old_name;
@@ -128,10 +128,10 @@
     xs_transaction_t our_trans = 0;
     int rc;
 
-    dom_path = libxl__xs_get_dompath(&gc, domid);
+    dom_path = libxl__xs_get_dompath(gc, domid);
     if (!dom_path) goto x_nomem;
 
-    name_path= libxl__sprintf(&gc, "%s/name", dom_path);
+    name_path= libxl__sprintf(gc, "%s/name", dom_path);
     if (!name_path) goto x_nomem;
 
  retry_transaction:
@@ -211,11 +211,20 @@
     rc = 0;
  x_rc:
     if (our_trans) xs_transaction_end(ctx->xsh, our_trans, 1);
+    return rc;
+
+ x_fail:  rc = ERROR_FAIL;  goto x_rc;
+ x_nomem: rc = ERROR_NOMEM; goto x_rc;
+}
+
+int libxl_domain_rename(libxl_ctx *ctx, uint32_t domid,
+                        const char *old_name, const char *new_name)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    int rc;
+    rc = libxl__domain_rename(&gc, domid, old_name, new_name, XBT_NULL);
     libxl__free_all(&gc);
     return rc;
-
- x_fail:  rc = ERROR_FAIL;  goto x_rc;
- x_nomem: rc = ERROR_NOMEM; goto x_rc;
 }
 
 int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid)
@@ -303,7 +312,7 @@
     xs_set_permissions(ctx->xsh, t, vm_path, roperm, ARRAY_SIZE(roperm));
 
     xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/vm", dom_path), vm_path, 
strlen(vm_path));
-    rc = libxl_domain_rename(ctx, domid, info->name, preserved_name, t);
+    rc = libxl__domain_rename(&gc, domid, info->name, preserved_name, t);
     if (rc) {
         libxl__free_all(&gc);
         return rc;
diff -r a23784d60b95 -r 46a66a5301a1 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Wed Mar 23 15:52:28 2011 +0000
+++ b/tools/libxl/libxl.h       Wed Mar 23 15:55:13 2011 +0000
@@ -376,8 +376,8 @@
 int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, 
libxl_event *event, libxl_device_disk *disk);
 
 int libxl_domain_rename(libxl_ctx *ctx, uint32_t domid,
-                        const char *old_name, const char *new_name,
-                        xs_transaction_t trans);
+                        const char *old_name, const char *new_name);
+
   /* if old_name is NULL, any old name is OK; otherwise we check
    * transactionally that the domain has the old old name; if
    * trans is not 0 we use caller's transaction and caller must do retries */
diff -r a23784d60b95 -r 46a66a5301a1 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Wed Mar 23 15:52:28 2011 +0000
+++ b/tools/libxl/libxl_create.c        Wed Mar 23 15:55:13 2011 +0000
@@ -354,7 +354,7 @@
     xs_set_permissions(ctx->xsh, t, vm_path, roperm, ARRAY_SIZE(roperm));
 
     xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/vm", dom_path), vm_path, 
strlen(vm_path));
-    rc = libxl_domain_rename(ctx, *domid, 0, info->name, t);
+    rc = libxl__domain_rename(gc, *domid, 0, info->name, t);
     if (rc)
         goto out;
 
diff -r a23784d60b95 -r 46a66a5301a1 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Wed Mar 23 15:52:28 2011 +0000
+++ b/tools/libxl/libxl_internal.h      Wed Mar 23 15:55:13 2011 +0000
@@ -171,6 +171,10 @@
 _hidden int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
               libxl_domain_build_info *info, libxl_domain_build_state *state);
 
+_hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
+                                 const char *old_name, const char *new_name,
+                                 xs_transaction_t trans);
+
 _hidden int libxl__domain_restore_common(libxl__gc *gc, uint32_t domid,
                    libxl_domain_build_info *info, libxl_domain_build_state 
*state, int fd);
 _hidden int libxl__domain_suspend_common(libxl__gc *gc, uint32_t domid, int 
fd, int hvm, int live, int debug);
diff -r a23784d60b95 -r 46a66a5301a1 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed Mar 23 15:52:28 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Wed Mar 23 15:55:13 2011 +0000
@@ -2638,8 +2638,7 @@
     if (common_domname) {
         if (asprintf(&away_domname, "%s--migratedaway", common_domname) < 0)
             goto failed_resume;
-        rc = libxl_domain_rename(&ctx, domid,
-                                 common_domname, away_domname, 0);
+        rc = libxl_domain_rename(&ctx, domid, common_domname, away_domname);
         if (rc) goto failed_resume;
     }
 
@@ -2679,8 +2678,7 @@
         fprintf(stderr, "migration sender: Trying to resume at our end.\n");
 
         if (common_domname) {
-            libxl_domain_rename(&ctx, domid,
-                                away_domname, common_domname, 0);
+            libxl_domain_rename(&ctx, domid, away_domname, common_domname);
         }
         rc = libxl_domain_resume(&ctx, domid);
         if (!rc) fprintf(stderr, "migration sender: Resumed OK.\n");
@@ -2779,8 +2777,7 @@
     fprintf(stderr, "migration target: Got permission, starting domain.\n");
 
     if (migration_domname) {
-        rc = libxl_domain_rename(&ctx, domid,
-                                 migration_domname, common_domname, 0);
+        rc = libxl_domain_rename(&ctx, domid, migration_domname, 
common_domname);
         if (rc) goto perhaps_destroy_notify_rc;
     }
 
@@ -4059,7 +4056,7 @@
     find_domain(dom);
     new_name = argv[optind];
 
-    if (libxl_domain_rename(&ctx, domid, common_domname, new_name, 0)) {
+    if (libxl_domain_rename(&ctx, domid, common_domname, new_name)) {
         fprintf(stderr, "Can't rename domain '%s'.\n", dom);
         return 1;
     }
diff -r a23784d60b95 -r 46a66a5301a1 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c Wed Mar 23 15:52:28 2011 +0000
+++ b/tools/python/xen/lowlevel/xl/xl.c Wed Mar 23 15:55:13 2011 +0000
@@ -1,6 +1,6 @@
 /******************************************************************************
  * xl.c
- * 
+ *
  * Copyright (c) 2010 Citrix Ltd.
  * Author: Gianni Tedesco
  *
@@ -481,7 +481,7 @@
     int domid;
     if ( !PyArg_ParseTuple(args, "is|s", &domid, &new_name, &old_name) )
         return NULL;
-    if ( libxl_domain_rename(&self->ctx, domid, old_name, new_name, 0) ) {
+    if ( libxl_domain_rename(&self->ctx, domid, old_name, new_name) ) {
         PyErr_SetString(xl_error_obj, "cannot rename domain");
         return NULL;
     }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: remove XS transaction from public API., Xen patchbot-unstable <=