qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Emil Condrea <emilcondrea@gmail.com>
To: qemu-devel@nongnu.org
Cc: xuquan8@huawei.com, anthony.perard@citrix.com,
	wei.liu2@citrix.com, stefanb@linux.vnet.ibm.com,
	sstabellini@kernel.org, xen-devel@lists.xen.org,
	dgdegra@tycho.nsa.gov, eblake@redhat.com
Subject: [Qemu-devel] [PATCH v2 01/13] xen: Fix coding style errors
Date: Thu, 13 Oct 2016 09:01:42 +0300	[thread overview]
Message-ID: <1476338514-14492-2-git-send-email-emilcondrea@gmail.com> (raw)
In-Reply-To: <1476338514-14492-1-git-send-email-emilcondrea@gmail.com>

Fixes the following errors:
 * ERROR: line over 90 characters
 * ERROR: code indent should never use tabs
 * ERROR: space prohibited after that open square bracket '['
 * ERROR: do not initialise statics to 0 or NULL
 * ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Emil Condrea <emilcondrea@gmail.com>
---
 hw/char/xen_console.c | 20 ++++++-------
 hw/display/xenfb.c    | 83 ++++++++++++++++++++++++++-------------------------
 hw/net/xen_nic.c      |  8 +++--
 hw/xen/xen_backend.c  | 20 ++++++-------
 4 files changed, 67 insertions(+), 64 deletions(-)

diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c
index 83108b0..4e35c82 100644
--- a/hw/char/xen_console.c
+++ b/hw/char/xen_console.c
@@ -154,16 +154,16 @@ static void xencons_send(struct XenConsole *con)
     else
         len = size;
     if (len < 1) {
-	if (!con->backlog) {
-	    con->backlog = 1;
-	    xen_be_printf(&con->xendev, 1, "backlog piling up, nobody listening?\n");
-	}
+        if (!con->backlog) {
+            con->backlog = 1;
+            xen_be_printf(&con->xendev, 1, "backlog piling up, nobody listening?\n");
+        }
     } else {
-	buffer_advance(&con->buffer, len);
-	if (con->backlog && len == size) {
-	    con->backlog = 0;
-	    xen_be_printf(&con->xendev, 1, "backlog is gone\n");
-	}
+        buffer_advance(&con->buffer, len);
+        if (con->backlog && len == size) {
+            con->backlog = 0;
+            xen_be_printf(&con->xendev, 1, "backlog is gone\n");
+        }
     }
 }
 
@@ -187,7 +187,7 @@ static int con_init(struct XenDevice *xendev)
 
     type = xenstore_read_str(con->console, "type");
     if (!type || strcmp(type, "ioemu") != 0) {
-	xen_be_printf(xendev, 1, "not for me (type=%s)\n", type);
+        xen_be_printf(xendev, 1, "not for me (type=%s)\n", type);
         ret = -1;
         goto out;
     }
diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index 46b7d5e..a9a93f9 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -90,21 +90,22 @@ static int common_bind(struct common *c)
     xen_pfn_t mfn;
 
     if (xenstore_read_fe_uint64(&c->xendev, "page-ref", &val) == -1)
-	return -1;
+        return -1;
     mfn = (xen_pfn_t)val;
     assert(val == mfn);
 
     if (xenstore_read_fe_int(&c->xendev, "event-channel", &c->xendev.remote_port) == -1)
-	return -1;
+        return -1;
 
     c->page = xenforeignmemory_map(xen_fmem, c->xendev.dom,
                                    PROT_READ | PROT_WRITE, 1, &mfn, NULL);
     if (c->page == NULL)
-	return -1;
+        return -1;
 
     xen_be_bind_evtchn(&c->xendev);
-    xen_be_printf(&c->xendev, 1, "ring mfn %"PRI_xen_pfn", remote-port %d, local-port %d\n",
-		  mfn, c->xendev.remote_port, c->xendev.local_port);
+    xen_be_printf(&c->xendev, 1,
+                 "ring mfn %"PRI_xen_pfn", remote-port %d, local-port %d\n",
+                  mfn, c->xendev.remote_port, c->xendev.local_port);
 
     return 0;
 }
@@ -500,8 +501,8 @@ out:
 }
 
 static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim,
-			      int width, int height, int depth,
-			      size_t fb_len, int offset, int row_stride)
+                              int width, int height, int depth,
+                              size_t fb_len, int offset, int row_stride)
 {
     size_t mfn_sz = sizeof(*((struct xenfb_page *)0)->pd);
     size_t pd_len = sizeof(((struct xenfb_page *)0)->pd) / mfn_sz;
@@ -510,40 +511,40 @@ static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim,
     int max_width, max_height;
 
     if (fb_len_lim > fb_len_max) {
-	xen_be_printf(&xenfb->c.xendev, 0, "fb size limit %zu exceeds %zu, corrected\n",
-		      fb_len_lim, fb_len_max);
-	fb_len_lim = fb_len_max;
+        xen_be_printf(&xenfb->c.xendev, 0, "fb size limit %zu exceeds %zu, corrected\n",
+                      fb_len_lim, fb_len_max);
+        fb_len_lim = fb_len_max;
     }
     if (fb_len_lim && fb_len > fb_len_lim) {
-	xen_be_printf(&xenfb->c.xendev, 0, "frontend fb size %zu limited to %zu\n",
-		      fb_len, fb_len_lim);
-	fb_len = fb_len_lim;
+        xen_be_printf(&xenfb->c.xendev, 0, "frontend fb size %zu limited to %zu\n",
+                      fb_len, fb_len_lim);
+        fb_len = fb_len_lim;
     }
     if (depth != 8 && depth != 16 && depth != 24 && depth != 32) {
-	xen_be_printf(&xenfb->c.xendev, 0, "can't handle frontend fb depth %d\n",
-		      depth);
-	return -1;
+        xen_be_printf(&xenfb->c.xendev, 0, "can't handle frontend fb depth %d\n",
+                      depth);
+        return -1;
     }
     if (row_stride <= 0 || row_stride > fb_len) {
-	xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend stride %d\n", row_stride);
-	return -1;
+        xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend stride %d\n", row_stride);
+        return -1;
     }
     max_width = row_stride / (depth / 8);
     if (width < 0 || width > max_width) {
-	xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend width %d limited to %d\n",
-		      width, max_width);
-	width = max_width;
+        xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend width %d limited to %d\n",
+                      width, max_width);
+        width = max_width;
     }
     if (offset < 0 || offset >= fb_len) {
-	xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend offset %d (max %zu)\n",
-		      offset, fb_len - 1);
-	return -1;
+        xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend offset %d (max %zu)\n",
+                      offset, fb_len - 1);
+        return -1;
     }
     max_height = (fb_len - offset) / row_stride;
     if (height < 0 || height > max_height) {
-	xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend height %d limited to %d\n",
-		      height, max_height);
-	height = max_height;
+        xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend height %d limited to %d\n",
+                      height, max_height);
+        height = max_height;
     }
     xenfb->fb_len = fb_len;
     xenfb->row_stride = row_stride;
@@ -554,7 +555,7 @@ static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim,
     xenfb->up_fullscreen = 1;
     xenfb->do_resize = 1;
     xen_be_printf(&xenfb->c.xendev, 1, "framebuffer %dx%dx%d offset %d stride %d\n",
-		  width, height, depth, offset, row_stride);
+                  width, height, depth, offset, row_stride);
     return 0;
 }
 
@@ -696,9 +697,9 @@ static void xenfb_update(void *opaque)
         return;
 
     if (!xenfb->feature_update) {
-	/* we don't get update notifications, thus use the
-	 * sledge hammer approach ... */
-	xenfb->up_fullscreen = 1;
+        /* we don't get update notifications, thus use the
+         * sledge hammer approach ... */
+        xenfb->up_fullscreen = 1;
     }
 
     /* resize if needed */
@@ -729,18 +730,18 @@ static void xenfb_update(void *opaque)
 
     /* run queued updates */
     if (xenfb->up_fullscreen) {
-	xen_be_printf(&xenfb->c.xendev, 3, "update: fullscreen\n");
-	xenfb_guest_copy(xenfb, 0, 0, xenfb->width, xenfb->height);
+        xen_be_printf(&xenfb->c.xendev, 3, "update: fullscreen\n");
+        xenfb_guest_copy(xenfb, 0, 0, xenfb->width, xenfb->height);
     } else if (xenfb->up_count) {
-	xen_be_printf(&xenfb->c.xendev, 3, "update: %d rects\n", xenfb->up_count);
-	for (i = 0; i < xenfb->up_count; i++)
-	    xenfb_guest_copy(xenfb,
-			     xenfb->up_rects[i].x,
-			     xenfb->up_rects[i].y,
-			     xenfb->up_rects[i].w,
-			     xenfb->up_rects[i].h);
+        xen_be_printf(&xenfb->c.xendev, 3, "update: %d rects\n", xenfb->up_count);
+        for (i = 0; i < xenfb->up_count; i++)
+            xenfb_guest_copy(xenfb,
+                             xenfb->up_rects[i].x,
+                             xenfb->up_rects[i].y,
+                             xenfb->up_rects[i].w,
+                             xenfb->up_rects[i].h);
     } else {
-	xen_be_printf(&xenfb->c.xendev, 3, "update: nothing\n");
+        xen_be_printf(&xenfb->c.xendev, 3, "update: nothing\n");
     }
     xenfb->up_count = 0;
     xenfb->up_fullscreen = 0;
diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c
index 6856b52..f401cd2 100644
--- a/hw/net/xen_nic.c
+++ b/hw/net/xen_nic.c
@@ -151,7 +151,8 @@ static void net_tx_packets(struct XenNetDev *netdev)
                 continue;
             }
 
-            xen_be_printf(&netdev->xendev, 3, "tx packet ref %d, off %d, len %d, flags 0x%x%s%s%s%s\n",
+            xen_be_printf(&netdev->xendev, 3,
+                         "tx packet ref %d, off %d, len %d, flags 0x%x%s%s%s%s\n",
                           txreq.gref, txreq.offset, txreq.size, txreq.flags,
                           (txreq.flags & NETTXF_csum_blank)     ? " csum_blank"     : "",
                           (txreq.flags & NETTXF_data_validated) ? " data_validated" : "",
@@ -162,8 +163,9 @@ static void net_tx_packets(struct XenNetDev *netdev)
                                            netdev->xendev.dom,
                                            txreq.gref, PROT_READ);
             if (page == NULL) {
-                xen_be_printf(&netdev->xendev, 0, "error: tx gref dereference failed (%d)\n",
-                              txreq.gref);
+                xen_be_printf(&netdev->xendev, 0,
+                             "error: tx gref dereference failed (%d)\n",
+                             txreq.gref);
                 net_tx_error(netdev, &txreq, rc);
                 continue;
             }
diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index 69a2388..545ee47 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -54,7 +54,7 @@ static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup =
     QTAILQ_HEAD_INITIALIZER(xs_cleanup);
 
 static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = QTAILQ_HEAD_INITIALIZER(xendevs);
-static int debug = 0;
+static int debug;
 
 /* ------------------------------------------------------------- */
 
@@ -215,13 +215,13 @@ int xenstore_read_fe_uint64(struct XenDevice *xendev, const char *node, uint64_t
 const char *xenbus_strstate(enum xenbus_state state)
 {
     static const char *const name[] = {
-        [ XenbusStateUnknown      ] = "Unknown",
-        [ XenbusStateInitialising ] = "Initialising",
-        [ XenbusStateInitWait     ] = "InitWait",
-        [ XenbusStateInitialised  ] = "Initialised",
-        [ XenbusStateConnected    ] = "Connected",
-        [ XenbusStateClosing      ] = "Closing",
-        [ XenbusStateClosed       ] = "Closed",
+        [XenbusStateUnknown]       = "Unknown",
+        [XenbusStateInitialising]  = "Initialising",
+        [XenbusStateInitWait]      = "InitWait",
+        [XenbusStateInitialised]   = "Initialised",
+        [XenbusStateConnected]     = "Connected",
+        [XenbusStateClosing]       = "Closing",
+        [XenbusStateClosed]        = "Closed",
     };
     return (state < ARRAY_SIZE(name)) ? name[state] : "INVALID";
 }
@@ -702,10 +702,10 @@ static void xenstore_update(void *unused)
 
     if (sscanf(vec[XS_WATCH_TOKEN], "be:%" PRIxPTR ":%d:%" PRIxPTR,
                &type, &dom, &ops) == 3) {
-        xenstore_update_be(vec[XS_WATCH_PATH], (void*)type, dom, (void*)ops);
+        xenstore_update_be(vec[XS_WATCH_PATH], (void *)type, dom, (void*)ops);
     }
     if (sscanf(vec[XS_WATCH_TOKEN], "fe:%" PRIxPTR, &ptr) == 1) {
-        xenstore_update_fe(vec[XS_WATCH_PATH], (void*)ptr);
+        xenstore_update_fe(vec[XS_WATCH_PATH], (void *)ptr);
     }
 
 cleanup:
-- 
1.9.1

  reply	other threads:[~2016-10-13  6:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13  6:01 [Qemu-devel] [PATCH v2 00/13] Refactor common part of xen backend and frontend Emil Condrea
2016-10-13  6:01 ` Emil Condrea [this message]
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 02/13] xen: Fix coding style warnings Emil Condrea
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 03/13] xen: Create a new file xen_pvdev.c Emil Condrea
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 04/13] xen: Move xenstore_update to xen_pvdev.c Emil Condrea
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 05/13] xen: Move evtchn functions " Emil Condrea
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 06/13] xen: Prepare xendev qtail to be shared with frontends Emil Condrea
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 07/13] xen: Move xenstore cleanup and mkdir functions Emil Condrea
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 08/13] xen: Rename xen_be_printf to xen_pv_printf Emil Condrea
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 09/13] xen: Rename xen_be_unbind_evtchn Emil Condrea
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 10/13] xen: Rename xen_be_send_notify Emil Condrea
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 11/13] xen: Rename xen_be_evtchn_event Emil Condrea
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 12/13] xen: Rename xen_be_find_xendev Emil Condrea
2016-10-13  6:01 ` [Qemu-devel] [PATCH v2 13/13] xen: Rename xen_be_del_xendev Emil Condrea
2016-10-13  6:06 ` [Qemu-devel] [PATCH v2 00/13] Refactor common part of xen backend and frontend Emil Condrea
2016-10-25  9:11 ` Xuquan (Quan Xu)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476338514-14492-2-git-send-email-emilcondrea@gmail.com \
    --to=emilcondrea@gmail.com \
    --cc=anthony.perard@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xuquan8@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).