]> xenbits.xensource.com Git - qemu-xen-4.3-testing.git/commitdiff
qemu xen upstream synch (Gerd): [PATCH 3/7]: fix fsf address & compare style
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 19 May 2009 14:38:44 +0000 (15:38 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 19 May 2009 14:38:44 +0000 (15:38 +0100)
changes coming from upstream merge review (style only, no code changes).
 - Update FSF address.
 - Fix strage compare style.

[This is] a series of patches for qemu-xen, making the code identical
to the xen support patches being submitted to upstream qemu.  The review
process on qemu-devel resulted in a number of fixes and cleanups in the
backend code, this is where most of the changes come from.

There are also some xenfb changes due to displaystate reorganization and
xenfb being merged in steps due to that.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/xen_backend.c
hw/xen_console.c
hw/xen_machine_pv.c
hw/xenfb.c

index 2bd443343aab3547eae0bec5ab531fb8554476a4..56b001f875fc9024ccba94c284047bcf79de583f 100644 (file)
@@ -11,9 +11,9 @@
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 /*
@@ -162,7 +162,7 @@ struct XenDevice *xen_be_find_xendev(const char *type, int dom, int dev)
            continue;
        if (xendev->dev != dev)
            continue;
-       if (0 != strcmp(xendev->type, type))
+       if (strcmp(xendev->type, type) != 0)
            continue;
        return xendev;
     }
@@ -278,8 +278,8 @@ static struct XenDevice *xen_be_del_xendev(int dom, int dev)
  */
 static void xen_be_backend_changed(struct XenDevice *xendev, const char *node)
 {
-    if (NULL == node  ||  0 == strcmp(node, "online")) {
-       if (-1 == xenstore_read_be_int(xendev, "online", &xendev->online))
+    if (node == NULL  ||  strcmp(node, "online") == 0) {
+       if (xenstore_read_be_int(xendev, "online", &xendev->online) == -1)
            xendev->online = 0;
     }
 
@@ -294,8 +294,8 @@ static void xen_be_frontend_changed(struct XenDevice *xendev, const char *node)
 {
     int fe_state;
 
-    if (NULL == node  ||  0 == strcmp(node, "state")) {
-       if (-1 == xenstore_read_fe_int(xendev, "state", &fe_state))
+    if (node == NULL  ||  strcmp(node, "state") == 0) {
+       if (xenstore_read_fe_int(xendev, "state", &fe_state) == -1)
            fe_state = XenbusStateUnknown;
        if (xendev->fe_state != fe_state)
            xen_be_printf(xendev, 1, "frontend state: %s -> %s\n",
@@ -303,7 +303,7 @@ static void xen_be_frontend_changed(struct XenDevice *xendev, const char *node)
                          xenbus_strstate(fe_state));
        xendev->fe_state = fe_state;
     }
-    if (NULL == node  ||  0 == strcmp(node, "protocol")) {
+    if (node == NULL  ||  strcmp(node, "protocol") == 0) {
        qemu_free(xendev->protocol);
        xendev->protocol = xenstore_read_fe_str(xendev, "protocol");
        if (xendev->protocol)
@@ -333,7 +333,7 @@ static int xen_be_try_setup(struct XenDevice *xendev)
     char token[XEN_BUFSIZE];
     int be_state;
 
-    if (-1 == xenstore_read_be_int(xendev, "state", &be_state)) {
+    if (xenstore_read_be_int(xendev, "state", &be_state) == -1) {
        xen_be_printf(xendev, 0, "reading backend state failed\n");
        return -1;
     }
@@ -345,7 +345,7 @@ static int xen_be_try_setup(struct XenDevice *xendev)
     }
 
     xendev->fe = xenstore_read_be_str(xendev, "frontend");
-    if (NULL == xendev->fe) {
+    if (xendev->fe == NULL) {
        xen_be_printf(xendev, 0, "reading frontend path failed\n");
        return -1;
     }
@@ -383,7 +383,7 @@ static int xen_be_try_init(struct XenDevice *xendev)
 
     if (xendev->ops->init)
        rc = xendev->ops->init(xendev);
-    if (0 != rc) {
+    if (rc != 0) {
        xen_be_printf(xendev, 1, "init() failed\n");
        return rc;
     }
@@ -416,7 +416,7 @@ static int xen_be_try_connect(struct XenDevice *xendev)
 
     if (xendev->ops->connect)
        rc = xendev->ops->connect(xendev);
-    if (0 != rc) {
+    if (rc != 0) {
        xen_be_printf(xendev, 0, "connect() failed\n");
        return rc;
     }
@@ -485,7 +485,7 @@ void xen_be_check_state(struct XenDevice *xendev)
        default:
            rc = -1;
        }
-       if (0 != rc)
+       if (rc != 0)
            break;
     }
 }
@@ -515,7 +515,7 @@ static int xenstore_scan(const char *type, int dom, struct XenDevOps *ops)
        return 0;
     for (j = 0; j < cdev; j++) {
        xendev = xen_be_get_xendev(type, dom, atoi(dev[j]), ops);
-       if (NULL == xendev)
+       if (xendev == NULL)
            continue;
        xen_be_check_state(xendev);
     }
@@ -533,14 +533,14 @@ static void xenstore_update_be(char *watch, char *type, int dom,
     dom0 = xs_get_domain_path(xenstore, 0);
     len = snprintf(path, sizeof(path), "%s/backend/%s/%d", dom0, type, dom);
     free(dom0);
-    if (0 != strncmp(path, watch, len))
+    if (strncmp(path, watch, len) != 0)
        return;
-    if (2 != sscanf(watch+len, "/%u/%255s", &dev, path)) {
+    if (sscanf(watch+len, "/%u/%255s", &dev, path) != 2) {
        strcpy(path, "");
-       if (1 != sscanf(watch+len, "/%u", &dev))
+       if (sscanf(watch+len, "/%u", &dev) != 1)
            dev = -1;
     }
-    if (-1 == dev)
+    if (dev == -1)
        return;
 
     if (0) {
@@ -549,7 +549,7 @@ static void xenstore_update_be(char *watch, char *type, int dom,
     }
 
     xendev = xen_be_get_xendev(type, dom, dev, ops);
-    if (NULL != xendev) {
+    if (xendev != NULL) {
        xen_be_backend_changed(xendev, path);
        xen_be_check_state(xendev);
     }
@@ -561,7 +561,7 @@ static void xenstore_update_fe(char *watch, struct XenDevice *xendev)
     unsigned int len;
 
     len = strlen(xendev->fe);
-    if (0 != strncmp(xendev->fe, watch, len))
+    if (strncmp(xendev->fe, watch, len) != 0)
        return;
     if (watch[len] != '/')
        return;
@@ -578,13 +578,13 @@ static void xenstore_update(void *unused)
     unsigned int dom, count;
 
     vec = xs_read_watch(xenstore, &count);
-    if (NULL == vec)
+    if (vec == NULL)
        goto cleanup;
 
-    if (3 == sscanf(vec[XS_WATCH_TOKEN], "be:%" PRIxPTR ":%d:%" PRIxPTR,
-                   &type, &dom, &ops))
+    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);
-    if (1 == sscanf(vec[XS_WATCH_TOKEN], "fe:%" PRIxPTR, &ptr))
+    if (sscanf(vec[XS_WATCH_TOKEN], "fe:%" PRIxPTR, &ptr) == 1)
        xenstore_update_fe(vec[XS_WATCH_PATH], (void*)ptr);
 
 cleanup:
@@ -622,7 +622,7 @@ int xen_be_init(void)
        goto err;
 
     xen_xc = xc_interface_open();
-    if (-1 == xen_xc) {
+    if (xen_xc == -1) {
        fprintf(stderr, "can't open xen interface\n");
        goto err;
     }
@@ -647,7 +647,7 @@ int xen_be_bind_evtchn(struct XenDevice *xendev)
        return 0;
     xendev->local_port = xc_evtchn_bind_interdomain
        (xendev->evtchndev, xendev->dom, xendev->remote_port);
-    if (-1 == xendev->local_port) {
+    if (xendev->local_port == -1) {
        xen_be_printf(xendev, 0, "xc_evtchn_bind_interdomain failed\n");
        return -1;
     }
index c172cf2bc9df36ce6c31368a4be0c913eda5f589..707075eef301eaa61af48d2a725d332de8cd5c52 100644 (file)
@@ -15,9 +15,9 @@
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdlib.h>
@@ -214,11 +214,11 @@ static int con_connect(struct XenDevice *xendev)
     struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
     int limit;
 
-    if (-1 == xenstore_read_int(con->console, "ring-ref", &con->ring_ref))
+    if (xenstore_read_int(con->console, "ring-ref", &con->ring_ref) == -1)
        return -1;
-    if (-1 == xenstore_read_int(con->console, "port", &con->xendev.remote_port))
+    if (xenstore_read_int(con->console, "port", &con->xendev.remote_port) == -1)
        return -1;
-    if (0 == xenstore_read_int(con->console, "limit", &limit))
+    if (xenstore_read_int(con->console, "limit", &limit) == 0)
        con->buffer.max_capacity = limit;
 
     con->sring = xc_map_foreign_range(xen_xc, con->xendev.dom,
index 4c0ee924dcbeb976ac5caa0433e788aaa037457f..34fe4d47be8a7238e7433a176ec6f874b01683c1 100644 (file)
@@ -62,7 +62,7 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size,
     env->halted = 1;
 
     /* Initialize backend core & drivers */
-    if (-1 == xen_be_init()) {
+    if (xen_be_init() != 0) {
         fprintf(stderr, "%s: xen backend core setup failed\n", __FUNCTION__);
         exit(1);
     }
index 135764ddee80e4f3762cb52bce6567df9aa5d335..8336c82ed346adb2de573d9cda68413956a291d7 100644 (file)
@@ -20,9 +20,9 @@
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdarg.h>
@@ -102,15 +102,15 @@ static int common_bind(struct common *c)
 {
     int mfn;
 
-    if (-1 == xenstore_read_fe_int(&c->xendev, "page-ref", &mfn))
+    if (xenstore_read_fe_int(&c->xendev, "page-ref", &mfn) == -1)
        return -1;
-    if (-1 == xenstore_read_fe_int(&c->xendev, "event-channel", &c->xendev.remote_port))
+    if (xenstore_read_fe_int(&c->xendev, "event-channel", &c->xendev.remote_port) == -1)
        return -1;
 
     c->page = xc_map_foreign_range(xen_xc, c->xendev.dom,
                                   XC_PAGE_SIZE,
                                   PROT_READ | PROT_WRITE, mfn);
-    if (NULL == c->page)
+    if (c->page == NULL)
        return -1;
 
     xen_be_bind_evtchn(&c->xendev);
@@ -366,11 +366,12 @@ static int input_connect(struct XenDevice *xendev)
     struct XenInput *in = container_of(xendev, struct XenInput, c.xendev);
     int rc;
 
-    if (-1 == xenstore_read_fe_int(xendev, "request-abs-pointer", &in->abs_pointer_wanted))
+    if (xenstore_read_fe_int(xendev, "request-abs-pointer",
+                             &in->abs_pointer_wanted) == -1)
        in->abs_pointer_wanted = 0;
 
     rc = common_bind(&in->c);
-    if (0 != rc)
+    if (rc != 0)
        return rc;
 
     qemu_add_kbd_event_handler(xenfb_key_event, in);
@@ -450,7 +451,7 @@ static int xenfb_map_fb(struct XenFB *xenfb)
        ptr64 = (void*)page->pd;
 #endif
        if (ptr32) {
-           if (0 == ptr32[1]) {
+           if (ptr32[1] == 0) {
                mode = 32;
                pd   = ptr32;
            } else {
@@ -459,12 +460,12 @@ static int xenfb_map_fb(struct XenFB *xenfb)
            }
        }
 #if defined(__x86_64__)
-    } else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_32)) {
+    } else if (strcmp(protocol, XEN_IO_PROTO_ABI_X86_32) == 0) {
        /* 64bit dom0, 32bit domU */
        mode = 32;
        pd   = ((void*)page->pd) - 4;
 #elif defined(__i386__)
-    } else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_64)) {
+    } else if (strcmp(protocol, XEN_IO_PROTO_ABI_X86_64) == 0) {
        /* 32bit dom0, 64bit domU */
        mode = 64;
        pd   = ((void*)page->pd) + 4;
@@ -874,22 +875,22 @@ static int fb_connect(struct XenDevice *xendev)
     int videoram;
     int rc;
 
-    if (-1 == xenstore_read_fe_int(xendev, "videoram", &videoram))
+    if (xenstore_read_fe_int(xendev, "videoram", &videoram) == -1)
        videoram = 0;
 
     rc = common_bind(&fb->c);
-    if (0 != rc)
+    if (rc != 0)
        return rc;
 
     fb_page = fb->c.page;
     rc = xenfb_configure_fb(fb, videoram * 1024 * 1024U,
                            fb_page->width, fb_page->height, fb_page->depth,
                            fb_page->mem_length, 0, fb_page->line_length);
-    if (0 != rc)
+    if (rc != 0)
        return rc;
 
     rc = xenfb_map_fb(fb);
-    if (0 != rc)
+    if (rc != 0)
        return rc;
 
 #if 0  /* handled in xen_init_display() for now */
@@ -903,7 +904,7 @@ static int fb_connect(struct XenDevice *xendev)
     }
 #endif
 
-    if (-1 == xenstore_read_fe_int(xendev, "feature-update", &fb->feature_update))
+    if (xenstore_read_fe_int(xendev, "feature-update", &fb->feature_update) == -1)
        fb->feature_update = 0;
     if (fb->feature_update)
        xenstore_write_be_int(xendev, "request-update", 1);
@@ -939,7 +940,7 @@ static void fb_frontend_changed(struct XenDevice *xendev, const char *node)
      * to connected.  We must trigger the watch a second time to
      * workaround a frontend bug.
      */
-    if (0 == fb->bug_trigger && 0 == strcmp(node, "state") &&
+    if (fb->bug_trigger == 0 && strcmp(node, "state") == 0 &&
         xendev->fe_state == XenbusStateConnected &&
         xendev->be_state == XenbusStateConnected) {
         xen_be_printf(xendev, 2, "re-trigger connected (frontend bug)\n");