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 03 of 18] libxc: remove unnecessary double indirectio

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 03 of 18] libxc: remove unnecessary double indirection from xc_readconsolering
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 12 Oct 2010 15:16:21 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Tue, 12 Oct 2010 07:20:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1286892978@xxxxxxxxxxxxxxxxxxxxx>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1286892401 -3600
# Node ID a577eeeb43690b9df6be4789ced815e0c8e4cf13
# Parent  29a5439889c36e72df0f0828aee8f2b002a545b9
libxc: remove unnecessary double indirection from xc_readconsolering

The double indirection has been unnecessary since 9867:ec61a8c25429,
there is no possibility of the buffer being reallocated now.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 29a5439889c3 -r a577eeeb4369 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Tue Oct 12 15:06:41 2010 +0100
+++ b/tools/console/daemon/io.c Tue Oct 12 15:06:41 2010 +0100
@@ -887,7 +887,7 @@ static void handle_hv_logs(void)
        if ((port = xc_evtchn_pending(xce_handle)) == -1)
                return;
 
-       if (xc_readconsolering(xch, &bufptr, &size, 0, 1, &index) == 0 && size 
> 0) {
+       if (xc_readconsolering(xch, bufptr, &size, 0, 1, &index) == 0 && size > 
0) {
                int logret;
                if (log_time_hv)
                        logret = write_with_timestamp(log_hv_fd, buffer, size,
diff -r 29a5439889c3 -r a577eeeb4369 tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c     Tue Oct 12 15:06:41 2010 +0100
+++ b/tools/libxc/xc_misc.c     Tue Oct 12 15:06:41 2010 +0100
@@ -22,13 +22,12 @@
 #include <xen/hvm/hvm_op.h>
 
 int xc_readconsolering(xc_interface *xch,
-                       char **pbuffer,
+                       char *buffer,
                        unsigned int *pnr_chars,
                        int clear, int incremental, uint32_t *pindex)
 {
     int ret;
     DECLARE_SYSCTL;
-    char *buffer = *pbuffer;
     unsigned int nr_chars = *pnr_chars;
 
     sysctl.cmd = XEN_SYSCTL_readconsole;
diff -r 29a5439889c3 -r a577eeeb4369 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Tue Oct 12 15:06:41 2010 +0100
+++ b/tools/libxc/xenctrl.h     Tue Oct 12 15:06:41 2010 +0100
@@ -729,7 +729,7 @@ int xc_physdev_pci_access_modify(xc_inte
                                  int enable);
 
 int xc_readconsolering(xc_interface *xch,
-                       char **pbuffer,
+                       char *buffer,
                        unsigned int *pnr_chars,
                        int clear, int incremental, uint32_t *pindex);
 
diff -r 29a5439889c3 -r a577eeeb4369 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Oct 12 15:06:41 2010 +0100
+++ b/tools/libxl/libxl.c       Tue Oct 12 15:06:41 2010 +0100
@@ -3464,7 +3464,7 @@ int libxl_xen_console_read_line(libxl_ct
     int ret;
 
     memset(cr->buffer, 0, cr->size);
-    ret = xc_readconsolering(ctx->xch, &cr->buffer, &cr->count,
+    ret = xc_readconsolering(ctx->xch, cr->buffer, &cr->count,
                              cr->clear, cr->incremental, &cr->index);
     if (ret < 0) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "reading console ring buffer");
diff -r 29a5439889c3 -r a577eeeb4369 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Tue Oct 12 15:06:41 2010 +0100
+++ b/tools/python/xen/lowlevel/xc/xc.c Tue Oct 12 15:06:41 2010 +0100
@@ -1116,7 +1116,7 @@ static PyObject *pyxc_readconsolering(Xc
          !str )
         return NULL;
 
-    ret = xc_readconsolering(self->xc_handle, &str, &count, clear,
+    ret = xc_readconsolering(self->xc_handle, str, &count, clear,
                              incremental, &index);
     if ( ret < 0 )
         return pyxc_error_to_exception(self->xc_handle);
@@ -1133,7 +1133,7 @@ static PyObject *pyxc_readconsolering(Xc
 
         str = ptr + count;
         count = size - count;
-        ret = xc_readconsolering(self->xc_handle, &str, &count, clear,
+        ret = xc_readconsolering(self->xc_handle, str, &count, clear,
                                  1, &index);
         if ( ret < 0 )
             break;

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