[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 26/27] tools/libxc: Drop all XG_LIBXL_HVM_COMPAT code from libxc



Libxl has now been fully adjusted not to need it.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxc/xc_sr_common.h          |    5 --
 tools/libxc/xc_sr_restore.c         |   18 -----
 tools/libxc/xc_sr_restore_x86_hvm.c |  124 -----------------------------------
 tools/libxc/xc_sr_save_x86_hvm.c    |   36 ----------
 4 files changed, 183 deletions(-)

diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h
index 08c66db..42af55b 100644
--- a/tools/libxc/xc_sr_common.h
+++ b/tools/libxc/xc_sr_common.h
@@ -306,11 +306,6 @@ struct xc_sr_context
                     /* HVM context blob. */
                     void *context;
                     size_t contextsz;
-
-/* #ifdef XG_LIBXL_HVM_COMPAT */
-                    uint32_t qlen;
-                    void *qbuf;
-/* #endif */
                 } restore;
             };
         } x86_hvm;
diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
index 5e0f817..fd45775 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xc_sr_restore.c
@@ -632,9 +632,6 @@ static void cleanup(struct xc_sr_context *ctx)
         PERROR("Failed to clean up");
 }
 
-#ifdef XG_LIBXL_HVM_COMPAT
-extern int read_qemu(struct xc_sr_context *ctx);
-#endif
 /*
  * Restore a domain.
  */
@@ -661,21 +658,6 @@ static int restore(struct xc_sr_context *ctx)
                 goto err;
         }
 
-#ifdef XG_LIBXL_HVM_COMPAT
-        if ( ctx->dominfo.hvm &&
-             (rec.type == REC_TYPE_END || rec.type == REC_TYPE_CHECKPOINT) )
-        {
-            rc = read_qemu(ctx);
-            if ( rc )
-            {
-                if ( ctx->restore.buffer_all_records )
-                    goto remus_failover;
-                else
-                    goto err;
-            }
-        }
-#endif
-
         if ( ctx->restore.buffer_all_records &&
              rec.type != REC_TYPE_END &&
              rec.type != REC_TYPE_CHECKPOINT )
diff --git a/tools/libxc/xc_sr_restore_x86_hvm.c 
b/tools/libxc/xc_sr_restore_x86_hvm.c
index 6f5af0e..49d22c7 100644
--- a/tools/libxc/xc_sr_restore_x86_hvm.c
+++ b/tools/libxc/xc_sr_restore_x86_hvm.c
@@ -3,24 +3,6 @@
 
 #include "xc_sr_common_x86.h"
 
-#ifdef XG_LIBXL_HVM_COMPAT
-static int handle_toolstack(struct xc_sr_context *ctx, struct xc_sr_record 
*rec)
-{
-    xc_interface *xch = ctx->xch;
-    int rc;
-
-    if ( !ctx->restore.callbacks || !ctx->restore.callbacks->toolstack_restore 
)
-        return 0;
-
-    rc = ctx->restore.callbacks->toolstack_restore(
-        ctx->domid, rec->data, rec->length, ctx->restore.callbacks->data);
-
-    if ( rc < 0 )
-        PERROR("restoring toolstack");
-    return rc;
-}
-#endif
-
 /*
  * Process an HVM_CONTEXT record from the stream.
  */
@@ -93,98 +75,6 @@ static int handle_hvm_params(struct xc_sr_context *ctx,
     return 0;
 }
 
-#ifdef XG_LIBXL_HVM_COMPAT
-int read_qemu(struct xc_sr_context *ctx);
-int read_qemu(struct xc_sr_context *ctx)
-{
-    xc_interface *xch = ctx->xch;
-    char qemusig[21];
-    uint32_t qlen;
-    void *qbuf = NULL;
-    int rc = -1;
-
-    if ( read_exact(ctx->fd, qemusig, sizeof(qemusig)) )
-    {
-        PERROR("Error reading QEMU signature");
-        goto out;
-    }
-
-    if ( !memcmp(qemusig, "DeviceModelRecord0002", sizeof(qemusig)) )
-    {
-        if ( read_exact(ctx->fd, &qlen, sizeof(qlen)) )
-        {
-            PERROR("Error reading QEMU record length");
-            goto out;
-        }
-
-        qbuf = malloc(qlen);
-        if ( !qbuf )
-        {
-            PERROR("no memory for device model state");
-            goto out;
-        }
-
-        if ( read_exact(ctx->fd, qbuf, qlen) )
-        {
-            PERROR("Error reading device model state");
-            goto out;
-        }
-    }
-    else
-    {
-        ERROR("Invalid device model state signature '%*.*s'",
-              (int)sizeof(qemusig), (int)sizeof(qemusig), qemusig);
-        goto out;
-    }
-
-    /* With Remus, this could be read many times */
-    if ( ctx->x86_hvm.restore.qbuf )
-        free(ctx->x86_hvm.restore.qbuf);
-    ctx->x86_hvm.restore.qbuf = qbuf;
-    ctx->x86_hvm.restore.qlen = qlen;
-    rc = 0;
-
-out:
-    if (rc)
-        free(qbuf);
-    return rc;
-}
-
-static int handle_qemu(struct xc_sr_context *ctx)
-{
-    xc_interface *xch = ctx->xch;
-    char path[256];
-    uint32_t qlen = ctx->x86_hvm.restore.qlen;
-    void *qbuf = ctx->x86_hvm.restore.qbuf;
-    int rc = -1;
-    FILE *fp = NULL;
-
-    sprintf(path, XC_DEVICE_MODEL_RESTORE_FILE".%u", ctx->domid);
-    fp = fopen(path, "wb");
-    if ( !fp )
-    {
-        PERROR("Failed to open '%s' for writing", path);
-        goto out;
-    }
-
-    DPRINTF("Writing %u bytes of QEMU data", qlen);
-    if ( fwrite(qbuf, 1, qlen, fp) != qlen )
-    {
-        PERROR("Failed to write %u bytes of QEMU data", qlen);
-        goto out;
-    }
-
-    rc = 0;
-
- out:
-    if ( fp )
-        fclose(fp);
-    free(qbuf);
-
-    return rc;
-}
-#endif
-
 /* restore_ops function. */
 static bool x86_hvm_pfn_is_valid(const struct xc_sr_context *ctx, xen_pfn_t 
pfn)
 {
@@ -260,11 +150,6 @@ static int x86_hvm_process_record(struct xc_sr_context 
*ctx,
     case REC_TYPE_HVM_PARAMS:
         return handle_hvm_params(ctx, rec);
 
-#ifdef XG_LIBXL_HVM_COMPAT
-    case REC_TYPE_TOOLSTACK:
-        return handle_toolstack(ctx, rec);
-#endif
-
     default:
         return RECORD_NOT_PROCESSED;
     }
@@ -314,15 +199,6 @@ static int x86_hvm_stream_complete(struct xc_sr_context 
*ctx)
         return rc;
     }
 
-#ifdef XG_LIBXL_HVM_COMPAT
-    rc = handle_qemu(ctx);
-    if ( rc )
-    {
-        ERROR("Failed to dump qemu");
-        return rc;
-    }
-#endif
-
     return rc;
 }
 
diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xc_sr_save_x86_hvm.c
index f4604db..cdee774 100644
--- a/tools/libxc/xc_sr_save_x86_hvm.c
+++ b/tools/libxc/xc_sr_save_x86_hvm.c
@@ -118,36 +118,6 @@ static int write_hvm_params(struct xc_sr_context *ctx)
     return rc;
 }
 
-#ifdef XG_LIBXL_HVM_COMPAT
-static int write_toolstack(struct xc_sr_context *ctx)
-{
-    xc_interface *xch = ctx->xch;
-    struct xc_sr_record rec = {
-        .type = REC_TYPE_TOOLSTACK,
-        .length = 0,
-    };
-    uint8_t *buf;
-    uint32_t len;
-    int rc;
-
-    if ( !ctx->save.callbacks || !ctx->save.callbacks->toolstack_save )
-        return 0;
-
-    if ( ctx->save.callbacks->toolstack_save(
-             ctx->domid, &buf, &len, ctx->save.callbacks->data) < 0 )
-    {
-        PERROR("Error calling toolstack_save");
-        return -1;
-    }
-
-    rc = write_split_record(ctx, &rec, buf, len);
-    if ( rc < 0 )
-        PERROR("Error writing TOOLSTACK record");
-    free(buf);
-    return rc;
-}
-#endif
-
 static xen_pfn_t x86_hvm_pfn_to_gfn(const struct xc_sr_context *ctx,
                                     xen_pfn_t pfn)
 {
@@ -199,12 +169,6 @@ static int x86_hvm_end_of_checkpoint(struct xc_sr_context 
*ctx)
     if ( rc )
         return rc;
 
-#ifdef XG_LIBXL_HVM_COMPAT
-    rc = write_toolstack(ctx);
-    if ( rc )
-        return rc;
-#endif
-
     /* Write the HVM_CONTEXT record. */
     rc = write_hvm_context(ctx);
     if ( rc )
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.