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

[XenPPC] [xenppc-unstable] [ppc] get domctl building again



# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 39539f462cd7f4d3e000c290264e33462a683627
# Parent  4b042ad0755362c22d7a6f54773e59481a990628
[ppc] get domctl building again

libxc has introduced its own DEBUG so we have switched to DBG() for printing.

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 tools/domctrl/Makefile  |    3 ++
 tools/domctrl/console.c |   24 +++++++++++------------
 tools/domctrl/create.c  |   50 +++++++++++++++++++++++-------------------------
 tools/domctrl/destroy.c |    2 -
 tools/domctrl/domctrl.c |    8 +++----
 tools/domctrl/domctrl.h |    8 ++++---
 tools/domctrl/list.c    |    2 -
 tools/domctrl/regs.c    |    2 -
 tools/domctrl/version.c |    8 +++----
 9 files changed, 55 insertions(+), 52 deletions(-)

diff -r 4b042ad07553 -r 39539f462cd7 tools/domctrl/Makefile
--- a/tools/domctrl/Makefile    Wed Jun 14 18:32:40 2006 -0400
+++ b/tools/domctrl/Makefile    Thu Jun 15 13:33:04 2006 -0400
@@ -10,6 +10,9 @@ CFLAGS := -m64 \
        -I. -I$(VPATH) \
        -DELFSIZE=64 \
        -D__XEN_TOOLS__
+
+DEBUG-$(debug) = -DDEBUG
+CFLAGS += $(DEBUG-y)
 
 LDFLAGS := -m64 \
        -static
diff -r 4b042ad07553 -r 39539f462cd7 tools/domctrl/console.c
--- a/tools/domctrl/console.c   Wed Jun 14 18:32:40 2006 -0400
+++ b/tools/domctrl/console.c   Thu Jun 15 13:33:04 2006 -0400
@@ -39,14 +39,14 @@ int console(char *argv[], int argc)
         console_pfn = 0x3ffd;
     }
 
-    DEBUG(printf("get_page_array(0x%lx)\n", domid));
+    DBG("get_page_array(0x%lx)\n", domid);
     if (get_page_array(domid, &page_array))
         return -1;
 
     console_mfn = page_array[console_pfn];
 
-    DEBUG(printf("xc_map_foreign_range(0x%lx, 0x%x, 0x%x, 0x%lx)\n",
-                domid, getpagesize(), PROT_READ|PROT_WRITE, console_mfn));
+    DBG("xc_map_foreign_range(0x%lx, 0x%x, 0x%x, 0x%lx)\n",
+        domid, getpagesize(), PROT_READ|PROT_WRITE, console_mfn);
     intf = xc_map_foreign_range(xc_handle, domid, getpagesize(),
             PROT_READ|PROT_WRITE, console_mfn);
     if (intf == NULL) {
@@ -54,17 +54,17 @@ int console(char *argv[], int argc)
         return -1;
     }
 
-    DEBUG(printf("ringbuffer:\n"
-                 "    in_cons %x\n"
-                 "    in_prod %x\n"
-                 "    out_cons %x\n"
-                 "    out_prod %x\n",
-                 intf->in_cons, intf->in_prod,
-                 intf->out_cons, intf->out_prod));
+    DBG("ringbuffer:\n"
+        "    in_cons %x\n"
+        "    in_prod %x\n"
+        "    out_cons %x\n"
+        "    out_prod %x\n",
+        intf->in_cons, intf->in_prod,
+        intf->out_cons, intf->out_prod);
 
     if (intf->out_cons == intf->out_prod) {
         intf->out_cons = intf->out_prod - (intf->out_prod & sizeof(intf->out));
-        DEBUG(printf("out_cons adjusted to: %x\n", intf->out_cons));
+        DBG("out_cons adjusted to: %x\n", intf->out_cons);
     }
 
     flgs = fcntl(STDIN_FILENO, F_GETFL);
@@ -81,7 +81,7 @@ int console(char *argv[], int argc)
         struct sigaction  sa;
         struct termios term_raw;
 
-        DEBUG(printf("stdin is a tty\n"));
+        DBG("stdin is a tty\n");
         printf("Going raw: ^] will get you out\n");
         tcgetattr(STDIN_FILENO, &term_orig);
         term_raw = term_orig;
diff -r 4b042ad07553 -r 39539f462cd7 tools/domctrl/create.c
--- a/tools/domctrl/create.c    Wed Jun 14 18:32:40 2006 -0400
+++ b/tools/domctrl/create.c    Thu Jun 15 13:33:04 2006 -0400
@@ -29,7 +29,7 @@ static void *load_file(const char *path,
        ssize_t size;
        int fd;
 
-       DEBUG(printf("load_file(%s)\n", path));
+       DBG("load_file(%s)\n", path);
 
        fd = open(path, O_RDONLY);
        if (fd < 0) {
@@ -77,7 +77,7 @@ static int create_domain(unsigned *domid
        int rc;
 
        /* create the empty domain */
-       DEBUG(printf("xc_domain_create()\n"));
+       DBG("xc_domain_create()\n");
        rc = xc_domain_create(xc_handle, 0, dummy, domid);
        if (rc == -1) {
                perror("xc_domain_create");
@@ -86,7 +86,7 @@ static int create_domain(unsigned *domid
        printf("new domid = %d\n", *domid);
 
        /* set memory limit */
-       DEBUG(printf("xc_domain_setmaxmem(0x%lx)\n", MEMSIZE >> 10));
+       DBG("xc_domain_setmaxmem(0x%lx)\n", MEMSIZE >> 10);
        rc = xc_domain_setmaxmem(xc_handle, *domid, MEMSIZE >> 10);
        if (rc == -1) {
                perror("xc_domain_setmaxmem");
@@ -94,8 +94,7 @@ static int create_domain(unsigned *domid
        }
 
        /* finally give the domain some memory */
-       DEBUG(printf("xc_domain_memory_increase_reservation(0x%lx)\n",
-                       MEMSIZE >> 10));
+       DBG("xc_domain_memory_increase_reservation(0x%lx)\n", MEMSIZE >> 10);
        rc = xc_domain_memory_increase_reservation(xc_handle, *domid,
                                                        MEMSIZE >> 12,
                                                        0, 0, NULL);
@@ -124,16 +123,16 @@ static int init_boot_vcpu(
        ctxt.user_regs.gprs[4] = kaddr;
        ctxt.user_regs.gprs[5] = 0;
 
-       DEBUG(printf("xc_vcpu_setvcpucontext:\n"
-                 "  pc 0x%"PRIx64", msr 0x016%"PRIx64"\n"
-                 "  r1-5 %016"PRIx64" %016"PRIx64" %016"PRIx64
-                 " %016"PRIx64" %016"PRIx64"\n",
-                 ctxt.user_regs.pc, ctxt.user_regs.msr,
-                 ctxt.user_regs.gprs[1],
-                 ctxt.user_regs.gprs[2],
-                 ctxt.user_regs.gprs[3],
-                 ctxt.user_regs.gprs[4],
-                 ctxt.user_regs.gprs[5]));
+       DBG("xc_vcpu_setvcpucontext:\n"
+        "  pc 0x%"PRIx64", msr 0x016%"PRIx64"\n"
+        "  r1-5 %016"PRIx64" %016"PRIx64" %016"PRIx64
+        " %016"PRIx64" %016"PRIx64"\n",
+        ctxt.user_regs.pc, ctxt.user_regs.msr,
+        ctxt.user_regs.gprs[1],
+        ctxt.user_regs.gprs[2],
+        ctxt.user_regs.gprs[3],
+        ctxt.user_regs.gprs[4],
+        ctxt.user_regs.gprs[5]);
        rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt);
        if (rc < 0)
                perror("setdomaininfo");
@@ -180,8 +179,7 @@ static int load_dtb(
 
        img = load_file(dtb_path, &dtb_size);
     if (img != NULL) {
-        DEBUG(printf("copying device tree to 0x%lx[0x%lx]\n",
-                     dtb_addr, dtb_size));
+        DBG("copying device tree to 0x%lx[0x%lx]\n", dtb_addr, dtb_size);
         if (install_image(domid, page_array, img, dtb_addr, dtb_size) != 0)
             printf("%s: install_image(): failed\n", __func__);
     } else
@@ -241,7 +239,7 @@ static int load_kernel(
 
        hack_kernel_img(kernel_img);
 
-       DEBUG(printf("probe_elf\n"));
+       DBG("probe_elf\n");
        rc = probe_elf(kernel_img, kernel_size, &load_funcs);
        if (rc < 0) {
         rc = -1;
@@ -249,22 +247,22 @@ static int load_kernel(
                goto out;
        }
 
-       DEBUG(printf("parseimage\n"));
+       DBG("parseimage\n");
        rc = (load_funcs.parseimage)(kernel_img, kernel_size, dsi);
        if (rc < 0) {
         rc = -1;
                goto out;
        }
 
-       DEBUG(printf("loadimage\n"));
+       DBG("loadimage\n");
        (load_funcs.loadimage)(kernel_img, kernel_size, xc_handle, domid,
                        page_array, dsi);
 
-       DEBUG(printf("  v_start     %lx\n", dsi->v_start));
-       DEBUG(printf("  v_end       %lx\n", dsi->v_end));
-       DEBUG(printf("  v_kernstart %lx\n", dsi->v_kernstart));
-       DEBUG(printf("  v_kernend   %lx\n", dsi->v_kernend));
-       DEBUG(printf("  v_kernentry %lx\n", dsi->v_kernentry));
+       DBG("  v_start     %lx\n", dsi->v_start);
+       DBG("  v_end       %lx\n", dsi->v_end);
+       DBG("  v_kernstart %lx\n", dsi->v_kernstart);
+       DBG("  v_kernend   %lx\n", dsi->v_kernend);
+       DBG("  v_kernentry %lx\n", dsi->v_kernentry);
 
 out:
        free_file(kernel_img);
@@ -353,7 +351,7 @@ static int start_domain(int xc_handle, i
 {
        int rc;
 
-       DEBUG(printf("xc_domain_unpause(%d)\n", domid));
+       DBG("xc_domain_unpause(%d)\n", domid);
        rc = xc_domain_unpause(xc_handle, domid);
        if (0 > rc) {
                perror("xc_domain_unpause");
diff -r 4b042ad07553 -r 39539f462cd7 tools/domctrl/destroy.c
--- a/tools/domctrl/destroy.c   Wed Jun 14 18:32:40 2006 -0400
+++ b/tools/domctrl/destroy.c   Thu Jun 15 13:33:04 2006 -0400
@@ -18,7 +18,7 @@ int destroy(char *argv[], int argc)
 
        domid = strtoul(argv[1], NULL, 0);
 
-       DEBUG(printf("xc_domain_destroy(%ld)\n", domid));
+       DBG("xc_domain_destroy(%ld)\n", domid);
        if (0 > xc_domain_destroy(xc_handle, domid)) {
                perror("destroy");
                rc = -1;
diff -r 4b042ad07553 -r 39539f462cd7 tools/domctrl/domctrl.c
--- a/tools/domctrl/domctrl.c   Wed Jun 14 18:32:40 2006 -0400
+++ b/tools/domctrl/domctrl.c   Thu Jun 15 13:33:04 2006 -0400
@@ -82,9 +82,9 @@ int get_page_array(int domid, xen_pfn_t 
        int rc;
        int i;
 
-       DEBUG(printf("xc_get_tot_pages\n"));
+       DBG("xc_get_tot_pages\n");
        nr_pages = xc_get_tot_pages(xc_handle, domid);
-       DEBUG(printf("  0x%x\n", nr_pages));
+       DBG("  0x%x\n", nr_pages);
 
        page_array = malloc(nr_pages * sizeof(xen_pfn_t));
        if (page_array == NULL) {
@@ -94,7 +94,7 @@ int get_page_array(int domid, xen_pfn_t 
 
 #define GETPFNLIST_FIXED
 #ifdef GETPFNLIST_FIXED
-       DEBUG(printf("xc_get_pfn_list\n"));
+       DBG("xc_get_pfn_list\n");
        rc = xc_get_pfn_list(xc_handle, domid, page_array, nr_pages);
        if (rc != nr_pages) {
                perror("Could not get the page frame list");
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
 {
        int index = 1;
 
-       DEBUG(printf("open %s\n", privcmd_path));
+       DBG("open %s\n", privcmd_path);
        xc_handle = open(privcmd_path, O_RDWR);
        if (xc_handle < 0) {
                perror(privcmd_path);
diff -r 4b042ad07553 -r 39539f462cd7 tools/domctrl/domctrl.h
--- a/tools/domctrl/domctrl.h   Wed Jun 14 18:32:40 2006 -0400
+++ b/tools/domctrl/domctrl.h   Thu Jun 15 13:33:04 2006 -0400
@@ -16,9 +16,11 @@ extern int xc_handle;
 extern int xc_handle;
 
 extern int verbose;
-#define DEBUG(stuff, ...) \
-       if (verbose) \
-               stuff __VA_ARGS__;
+#ifdef DEBUG
+#define DBG(fmt...) printf(fmt)
+#else
+#define DBG(fmt...)
+#endif
 
 extern int create(char *argv[], int argc);
 extern int list(char *argv[], int argc);
diff -r 4b042ad07553 -r 39539f462cd7 tools/domctrl/list.c
--- a/tools/domctrl/list.c      Wed Jun 14 18:32:40 2006 -0400
+++ b/tools/domctrl/list.c      Thu Jun 15 13:33:04 2006 -0400
@@ -18,7 +18,7 @@ int list(char *argv[], int argc)
        int rc;
        int i;
 
-       DEBUG(printf("xc_domain_getinfo(%d, %p)\n", max_nr_doms, dominfo));
+       DBG("xc_domain_getinfo(%d, %p)\n", max_nr_doms, dominfo);
        rc = xc_domain_getinfo(xc_handle, 0, max_nr_doms, dominfo);
        if (rc == -1) {
                perror("xc_domain_getinfo");
diff -r 4b042ad07553 -r 39539f462cd7 tools/domctrl/regs.c
--- a/tools/domctrl/regs.c      Wed Jun 14 18:32:40 2006 -0400
+++ b/tools/domctrl/regs.c      Thu Jun 15 13:33:04 2006 -0400
@@ -14,7 +14,7 @@ static int get_vcpu_state(int domid, int
        dom0_op_t op;
        int rc;
 
-       DEBUG(printf("getvcpucontext(%d, %d)\n", domid, vcpuid));
+       DBG("getvcpucontext(%d, %d)\n", domid, vcpuid);
        op.cmd = DOM0_GETVCPUCONTEXT;
        op.u.getvcpucontext.domain = domid;
        op.u.getvcpucontext.vcpu = vcpuid;
diff -r 4b042ad07553 -r 39539f462cd7 tools/domctrl/version.c
--- a/tools/domctrl/version.c   Wed Jun 14 18:32:40 2006 -0400
+++ b/tools/domctrl/version.c   Thu Jun 15 13:33:04 2006 -0400
@@ -22,23 +22,23 @@ int version(char *argv[], int argc)
     int cmd;
 
     cmd = XENVER_version;
-    DEBUG(printf("xc_version(%x)\n", cmd));
+    DBG("xc_version(%x)\n", cmd);
     xen_version = xc_version(xc_handle, cmd, NULL);
 
     cmd = XENVER_extraversion;
-    DEBUG(printf("xc_version(%x)\n", cmd));
+    DBG("xc_version(%x)\n", cmd);
     rc = xc_version(xc_handle, cmd, &xen_extra);
     if (rc)
         goto error;
 
     cmd = XENVER_compile_info;
-    DEBUG(printf("xc_version(%x)\n", cmd));
+    DBG("xc_version(%x)\n", cmd);
     rc = xc_version(xc_handle, cmd, &xen_cc);
     if (rc)
         goto error;
 
     cmd = XENVER_changeset;
-    DEBUG(printf("xc_version(%x)\n", cmd));
+    DBG("xc_version(%x)\n", cmd);
     rc = xc_version(xc_handle, cmd, &xen_chgset);
     if (rc)
         goto error;

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


 


Rackspace

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