qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix net.c coding style (with regard to tabs)
@ 2009-06-19 21:22 Jean-Christophe DUBOIS
  2009-06-22  8:29 ` Kevin Wolf
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Christophe DUBOIS @ 2009-06-19 21:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jean-Christophe DUBOIS

This patch will replace existing tab in net.c with spaces
in accordance with qemu CODING_STYLE.

Note: This first patch is more of a test to see if it
will be accepted and if it is worth spending my time on
fixing the same issue in other files.

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
---
 net.c |  118 ++++++++++++++++++++++++++++++++--------------------------------
 1 files changed, 59 insertions(+), 59 deletions(-)

diff --git a/net.c b/net.c
index 1daa62b..fb0a2a8 100644
--- a/net.c
+++ b/net.c
@@ -290,7 +290,7 @@ static int parse_unix_path(struct sockaddr_un *uaddr, const char *str)
     len = MIN(108, strlen(str));
     p = strchr(str, ',');
     if (p)
-	len = MIN(len, p - str);
+        len = MIN(len, p - str);
 
     memset(uaddr, 0, sizeof(*uaddr));
 
@@ -1220,7 +1220,7 @@ static int tap_alloc(char *dev, size_t dev_size)
     }
 
     if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) < 0)
-	syslog(LOG_ERR, "Can't get flags\n");
+        syslog(LOG_ERR, "Can't get flags\n");
 
     snprintf (actual_name, 32, "tap%d", ppa);
     pstrcpy(ifr.lifr_name, sizeof(ifr.lifr_name), actual_name);
@@ -1391,8 +1391,8 @@ static int net_tap_init(VLANState *vlan, const char *model,
     if (!setup_script || !strcmp(setup_script, "no"))
         setup_script = "";
     if (setup_script[0] != '\0') {
-	if (launch_script(setup_script, ifname, fd))
-	    return -1;
+        if (launch_script(setup_script, ifname, fd))
+            return -1;
     }
     s = net_tap_fd_init(vlan, model, name, fd);
     snprintf(s->vc->info_str, sizeof(s->vc->info_str),
@@ -1598,10 +1598,10 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr)
     int fd;
     int val, ret;
     if (!IN_MULTICAST(ntohl(mcastaddr->sin_addr.s_addr))) {
-	fprintf(stderr, "qemu: error: specified mcastaddr \"%s\" (0x%08x) does not contain a multicast address\n",
-		inet_ntoa(mcastaddr->sin_addr),
+        fprintf(stderr, "qemu: error: specified mcastaddr \"%s\" (0x%08x) does not contain a multicast address\n",
+                inet_ntoa(mcastaddr->sin_addr),
                 (int)ntohl(mcastaddr->sin_addr.s_addr));
-	return -1;
+        return -1;
 
     }
     fd = socket(PF_INET, SOCK_DGRAM, 0);
@@ -1614,8 +1614,8 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr)
     ret=setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
                    (const char *)&val, sizeof(val));
     if (ret < 0) {
-	perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
-	goto fail;
+        perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
+        goto fail;
     }
 
     ret = bind(fd, (struct sockaddr *)mcastaddr, sizeof(*mcastaddr));
@@ -1631,8 +1631,8 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr)
     ret = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
                      (const char *)&imr, sizeof(struct ip_mreq));
     if (ret < 0) {
-	perror("setsockopt(IP_ADD_MEMBERSHIP)");
-	goto fail;
+        perror("setsockopt(IP_ADD_MEMBERSHIP)");
+        goto fail;
     }
 
     /* Force mcast msgs to loopback (eg. several QEMUs in same host */
@@ -1640,8 +1640,8 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr)
     ret=setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
                    (const char *)&val, sizeof(val));
     if (ret < 0) {
-	perror("setsockopt(SOL_IP, IP_MULTICAST_LOOP)");
-	goto fail;
+        perror("setsockopt(SOL_IP, IP_MULTICAST_LOOP)");
+        goto fail;
     }
 
     socket_set_nonblock(fd);
@@ -1676,29 +1676,29 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan,
      */
 
     if (is_connected) {
-	if (getsockname(fd, (struct sockaddr *) &saddr, &saddr_len) == 0) {
-	    /* must be bound */
-	    if (saddr.sin_addr.s_addr==0) {
-		fprintf(stderr, "qemu: error: init_dgram: fd=%d unbound, cannot setup multicast dst addr\n",
-			fd);
-		return NULL;
-	    }
-	    /* clone dgram socket */
-	    newfd = net_socket_mcast_create(&saddr);
-	    if (newfd < 0) {
-		/* error already reported by net_socket_mcast_create() */
-		close(fd);
-		return NULL;
-	    }
-	    /* clone newfd to fd, close newfd */
-	    dup2(newfd, fd);
-	    close(newfd);
-
-	} else {
-	    fprintf(stderr, "qemu: error: init_dgram: fd=%d failed getsockname(): %s\n",
-		    fd, strerror(errno));
-	    return NULL;
-	}
+        if (getsockname(fd, (struct sockaddr *) &saddr, &saddr_len) == 0) {
+            /* must be bound */
+            if (saddr.sin_addr.s_addr==0) {
+                fprintf(stderr, "qemu: error: init_dgram: fd=%d unbound, cannot setup multicast dst addr\n",
+                        fd);
+                return NULL;
+            }
+            /* clone dgram socket */
+            newfd = net_socket_mcast_create(&saddr);
+            if (newfd < 0) {
+                /* error already reported by net_socket_mcast_create() */
+                close(fd);
+                return NULL;
+            }
+            /* clone newfd to fd, close newfd */
+            dup2(newfd, fd);
+            close(newfd);
+
+        } else {
+            fprintf(stderr, "qemu: error: init_dgram: fd=%d failed getsockname(): %s\n",
+                    fd, strerror(errno));
+            return NULL;
+        }
     }
 
     s = qemu_mallocz(sizeof(NetSocketState));
@@ -1712,9 +1712,9 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan,
     if (is_connected) s->dgram_dst=saddr;
 
     snprintf(s->vc->info_str, sizeof(s->vc->info_str),
-	    "socket: fd=%d (%s mcast=%s:%d)",
-	    fd, is_connected? "cloned" : "",
-	    inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
+            "socket: fd=%d (%s mcast=%s:%d)",
+            fd, is_connected? "cloned" : "",
+            inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
     return s;
 }
 
@@ -1752,8 +1752,8 @@ static NetSocketState *net_socket_fd_init(VLANState *vlan,
 
     if(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&so_type,
         (socklen_t *)&optlen)< 0) {
-	fprintf(stderr, "qemu: error: getsockopt(SO_TYPE) for fd=%d failed\n", fd);
-	return NULL;
+        fprintf(stderr, "qemu: error: getsockopt(SO_TYPE) for fd=%d failed\n", fd);
+        return NULL;
     }
     switch(so_type) {
     case SOCK_DGRAM:
@@ -1903,7 +1903,7 @@ static int net_socket_mcast_init(VLANState *vlan,
 
     fd = net_socket_mcast_create(&saddr);
     if (fd < 0)
-	return -1;
+        return -1;
 
     s = net_socket_fd_init(vlan, model, name, fd, 0);
     if (!s)
@@ -2324,7 +2324,7 @@ int net_client_init(Monitor *mon, const char *device, const char *p)
             "vlan", "name", "sock", "port", "group", "mode", NULL
         };
         char vde_sock[1024], vde_group[512];
-	int vde_port, vde_mode;
+        int vde_port, vde_mode;
 
         if (check_params(buf, sizeof(buf), vde_params, p) < 0) {
             config_error(mon, "invalid parameter '%s' in '%s'\n", buf, p);
@@ -2333,22 +2333,22 @@ int net_client_init(Monitor *mon, const char *device, const char *p)
         }
         vlan->nb_host_devs++;
         if (get_param_value(vde_sock, sizeof(vde_sock), "sock", p) <= 0) {
-	    vde_sock[0] = '\0';
-	}
-	if (get_param_value(buf, sizeof(buf), "port", p) > 0) {
-	    vde_port = strtol(buf, NULL, 10);
-	} else {
-	    vde_port = 0;
-	}
-	if (get_param_value(vde_group, sizeof(vde_group), "group", p) <= 0) {
-	    vde_group[0] = '\0';
-	}
-	if (get_param_value(buf, sizeof(buf), "mode", p) > 0) {
-	    vde_mode = strtol(buf, NULL, 8);
-	} else {
-	    vde_mode = 0700;
-	}
-	ret = net_vde_init(vlan, device, name, vde_sock, vde_port, vde_group, vde_mode);
+            vde_sock[0] = '\0';
+        }
+        if (get_param_value(buf, sizeof(buf), "port", p) > 0) {
+            vde_port = strtol(buf, NULL, 10);
+        } else {
+            vde_port = 0;
+        }
+        if (get_param_value(vde_group, sizeof(vde_group), "group", p) <= 0) {
+            vde_group[0] = '\0';
+        }
+        if (get_param_value(buf, sizeof(buf), "mode", p) > 0) {
+            vde_mode = strtol(buf, NULL, 8);
+        } else {
+            vde_mode = 0700;
+        }
+        ret = net_vde_init(vlan, device, name, vde_sock, vde_port, vde_group, vde_mode);
     } else
 #endif
     if (!strcmp(device, "dump")) {
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-23  8:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-19 21:22 [Qemu-devel] [PATCH] Fix net.c coding style (with regard to tabs) Jean-Christophe DUBOIS
2009-06-22  8:29 ` Kevin Wolf
2009-06-22 18:46   ` Jean-Christophe Dubois
2009-06-23  8:09     ` Kevin Wolf

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).