* [Qemu-devel] [PATCH 1/4] More whitespace cleanup in preparation for future commits.
2012-03-21 21:02 [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes Peter Portante
@ 2012-03-21 21:02 ` Peter Portante
2012-03-21 21:02 ` [Qemu-devel] [PATCH 2/4] More work to fix up the formatting and the whitespace of this module to conform to the coding standard Peter Portante
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Peter Portante @ 2012-03-21 21:02 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Peter Portante
Signed-off-by: Peter Portante <pportant@redhat.com>
---
block_int.h | 4 +-
qemu-timer.c | 6 +-
slirp/slirp.c | 526 ++++++++++++++++++++++++++++----------------------------
3 files changed, 268 insertions(+), 268 deletions(-)
diff --git a/block_int.h b/block_int.h
index b460c36..64e8b82 100644
--- a/block_int.h
+++ b/block_int.h
@@ -31,8 +31,8 @@
#include "qemu-timer.h"
#include "qapi-types.h"
-#define BLOCK_FLAG_ENCRYPT 1
-#define BLOCK_FLAG_COMPAT6 4
+#define BLOCK_FLAG_ENCRYPT 1
+#define BLOCK_FLAG_COMPAT6 4
#define BLOCK_IO_LIMIT_READ 0
#define BLOCK_IO_LIMIT_WRITE 1
diff --git a/qemu-timer.c b/qemu-timer.c
index d7f56e5..0eedf6e 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -65,7 +65,7 @@ struct QEMUClock {
struct QEMUTimer {
QEMUClock *clock;
- int64_t expire_time; /* in nanoseconds */
+ int64_t expire_time; /* in nanoseconds */
int scale;
QEMUTimerCB *cb;
void *opaque;
@@ -231,7 +231,7 @@ void configure_alarms(char const *opt)
/* Ignore */
goto next;
- /* Swap */
+ /* Swap */
tmp = alarm_timers[i];
alarm_timers[i] = alarm_timers[cur];
alarm_timers[cur] = tmp;
@@ -492,7 +492,7 @@ static void host_alarm_handler(int host_signum)
{
struct qemu_alarm_timer *t = alarm_timer;
if (!t)
- return;
+ return;
if (alarm_has_dynticks(t) ||
qemu_next_alarm_deadline () <= 0) {
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 1502830..ca0ff94 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -275,107 +275,107 @@ void slirp_select_fill(int *pnfds,
global_xfds = NULL;
nfds = *pnfds;
- /*
- * First, TCP sockets
- */
- do_slowtimo = 0;
-
- QTAILQ_FOREACH(slirp, &slirp_instances, entry) {
- /*
- * *_slowtimo needs calling if there are IP fragments
- * in the fragment queue, or there are TCP connections active
- */
- do_slowtimo |= ((slirp->tcb.so_next != &slirp->tcb) ||
- (&slirp->ipq.ip_link != slirp->ipq.ip_link.next));
-
- for (so = slirp->tcb.so_next; so != &slirp->tcb;
- so = so_next) {
- so_next = so->so_next;
-
- /*
- * See if we need a tcp_fasttimo
- */
- if (time_fasttimo == 0 && so->so_tcpcb->t_flags & TF_DELACK)
- time_fasttimo = curtime; /* Flag when we want a fasttimo */
-
- /*
- * NOFDREF can include still connecting to local-host,
- * newly socreated() sockets etc. Don't want to select these.
- */
- if (so->so_state & SS_NOFDREF || so->s == -1)
- continue;
-
- /*
- * Set for reading sockets which are accepting
- */
- if (so->so_state & SS_FACCEPTCONN) {
+ /*
+ * First, TCP sockets
+ */
+ do_slowtimo = 0;
+
+ QTAILQ_FOREACH(slirp, &slirp_instances, entry) {
+ /*
+ * *_slowtimo needs calling if there are IP fragments
+ * in the fragment queue, or there are TCP connections active
+ */
+ do_slowtimo |= ((slirp->tcb.so_next != &slirp->tcb) ||
+ (&slirp->ipq.ip_link != slirp->ipq.ip_link.next));
+
+ for (so = slirp->tcb.so_next; so != &slirp->tcb;
+ so = so_next) {
+ so_next = so->so_next;
+
+ /*
+ * See if we need a tcp_fasttimo
+ */
+ if (time_fasttimo == 0 && so->so_tcpcb->t_flags & TF_DELACK)
+ time_fasttimo = curtime; /* Flag when we want a fasttimo */
+
+ /*
+ * NOFDREF can include still connecting to local-host,
+ * newly socreated() sockets etc. Don't want to select these.
+ */
+ if (so->so_state & SS_NOFDREF || so->s == -1)
+ continue;
+
+ /*
+ * Set for reading sockets which are accepting
+ */
+ if (so->so_state & SS_FACCEPTCONN) {
FD_SET(so->s, readfds);
- UPD_NFDS(so->s);
- continue;
- }
-
- /*
- * Set for writing sockets which are connecting
- */
- if (so->so_state & SS_ISFCONNECTING) {
- FD_SET(so->s, writefds);
- UPD_NFDS(so->s);
- continue;
- }
-
- /*
- * Set for writing if we are connected, can send more, and
- * we have something to send
- */
- if (CONN_CANFSEND(so) && so->so_rcv.sb_cc) {
- FD_SET(so->s, writefds);
- UPD_NFDS(so->s);
- }
-
- /*
- * Set for reading (and urgent data) if we are connected, can
- * receive more, and we have room for it XXX /2 ?
- */
- if (CONN_CANFRCV(so) && (so->so_snd.sb_cc < (so->so_snd.sb_datalen/2))) {
- FD_SET(so->s, readfds);
- FD_SET(so->s, xfds);
- UPD_NFDS(so->s);
- }
- }
-
- /*
- * UDP sockets
- */
- for (so = slirp->udb.so_next; so != &slirp->udb;
- so = so_next) {
- so_next = so->so_next;
-
- /*
- * See if it's timed out
- */
- if (so->so_expire) {
- if (so->so_expire <= curtime) {
- udp_detach(so);
- continue;
- } else
- do_slowtimo = 1; /* Let socket expire */
- }
-
- /*
- * When UDP packets are received from over the
- * link, they're sendto()'d straight away, so
- * no need for setting for writing
- * Limit the number of packets queued by this session
- * to 4. Note that even though we try and limit this
- * to 4 packets, the session could have more queued
- * if the packets needed to be fragmented
- * (XXX <= 4 ?)
- */
- if ((so->so_state & SS_ISFCONNECTED) && so->so_queued <= 4) {
- FD_SET(so->s, readfds);
- UPD_NFDS(so->s);
- }
- }
+ UPD_NFDS(so->s);
+ continue;
+ }
+
+ /*
+ * Set for writing sockets which are connecting
+ */
+ if (so->so_state & SS_ISFCONNECTING) {
+ FD_SET(so->s, writefds);
+ UPD_NFDS(so->s);
+ continue;
+ }
+
+ /*
+ * Set for writing if we are connected, can send more, and
+ * we have something to send
+ */
+ if (CONN_CANFSEND(so) && so->so_rcv.sb_cc) {
+ FD_SET(so->s, writefds);
+ UPD_NFDS(so->s);
+ }
+
+ /*
+ * Set for reading (and urgent data) if we are connected, can
+ * receive more, and we have room for it XXX /2 ?
+ */
+ if (CONN_CANFRCV(so) && (so->so_snd.sb_cc < (so->so_snd.sb_datalen/2))) {
+ FD_SET(so->s, readfds);
+ FD_SET(so->s, xfds);
+ UPD_NFDS(so->s);
+ }
+ }
+
+ /*
+ * UDP sockets
+ */
+ for (so = slirp->udb.so_next; so != &slirp->udb;
+ so = so_next) {
+ so_next = so->so_next;
+
+ /*
+ * See if it's timed out
+ */
+ if (so->so_expire) {
+ if (so->so_expire <= curtime) {
+ udp_detach(so);
+ continue;
+ } else
+ do_slowtimo = 1; /* Let socket expire */
+ }
+
+ /*
+ * When UDP packets are received from over the
+ * link, they're sendto()'d straight away, so
+ * no need for setting for writing
+ * Limit the number of packets queued by this session
+ * to 4. Note that even though we try and limit this
+ * to 4 packets, the session could have more queued
+ * if the packets needed to be fragmented
+ * (XXX <= 4 ?)
+ */
+ if ((so->so_state & SS_ISFCONNECTED) && so->so_queued <= 4) {
+ FD_SET(so->s, readfds);
+ UPD_NFDS(so->s);
+ }
+ }
/*
* ICMP sockets
@@ -401,7 +401,7 @@ void slirp_select_fill(int *pnfds,
UPD_NFDS(so->s);
}
}
- }
+ }
*pnfds = nfds;
}
@@ -424,152 +424,152 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
curtime = qemu_get_clock_ms(rt_clock);
QTAILQ_FOREACH(slirp, &slirp_instances, entry) {
- /*
- * See if anything has timed out
- */
- if (time_fasttimo && ((curtime - time_fasttimo) >= 2)) {
- tcp_fasttimo(slirp);
- time_fasttimo = 0;
- }
- if (do_slowtimo && ((curtime - last_slowtimo) >= 499)) {
- ip_slowtimo(slirp);
- tcp_slowtimo(slirp);
- last_slowtimo = curtime;
- }
-
- /*
- * Check sockets
- */
- if (!select_error) {
- /*
- * Check TCP sockets
- */
- for (so = slirp->tcb.so_next; so != &slirp->tcb;
- so = so_next) {
- so_next = so->so_next;
-
- /*
- * FD_ISSET is meaningless on these sockets
- * (and they can crash the program)
- */
- if (so->so_state & SS_NOFDREF || so->s == -1)
- continue;
-
- /*
- * Check for URG data
- * This will soread as well, so no need to
- * test for readfds below if this succeeds
- */
- if (FD_ISSET(so->s, xfds))
- sorecvoob(so);
- /*
- * Check sockets for reading
- */
- else if (FD_ISSET(so->s, readfds)) {
- /*
- * Check for incoming connections
- */
- if (so->so_state & SS_FACCEPTCONN) {
- tcp_connect(so);
- continue;
- } /* else */
- ret = soread(so);
-
- /* Output it if we read something */
- if (ret > 0)
- tcp_output(sototcpcb(so));
- }
-
- /*
- * Check sockets for writing
- */
- if (FD_ISSET(so->s, writefds)) {
- /*
- * Check for non-blocking, still-connecting sockets
- */
- if (so->so_state & SS_ISFCONNECTING) {
- /* Connected */
- so->so_state &= ~SS_ISFCONNECTING;
-
- ret = send(so->s, (const void *) &ret, 0, 0);
- if (ret < 0) {
- /* XXXXX Must fix, zero bytes is a NOP */
- if (errno == EAGAIN || errno == EWOULDBLOCK ||
- errno == EINPROGRESS || errno == ENOTCONN)
- continue;
-
- /* else failed */
- so->so_state &= SS_PERSISTENT_MASK;
- so->so_state |= SS_NOFDREF;
- }
- /* else so->so_state &= ~SS_ISFCONNECTING; */
-
- /*
- * Continue tcp_input
- */
- tcp_input((struct mbuf *)NULL, sizeof(struct ip), so);
- /* continue; */
- } else
- ret = sowrite(so);
- /*
- * XXXXX If we wrote something (a lot), there
- * could be a need for a window update.
- * In the worst case, the remote will send
- * a window probe to get things going again
- */
- }
-
- /*
- * Probe a still-connecting, non-blocking socket
- * to check if it's still alive
- */
+ /*
+ * See if anything has timed out
+ */
+ if (time_fasttimo && ((curtime - time_fasttimo) >= 2)) {
+ tcp_fasttimo(slirp);
+ time_fasttimo = 0;
+ }
+ if (do_slowtimo && ((curtime - last_slowtimo) >= 499)) {
+ ip_slowtimo(slirp);
+ tcp_slowtimo(slirp);
+ last_slowtimo = curtime;
+ }
+
+ /*
+ * Check sockets
+ */
+ if (!select_error) {
+ /*
+ * Check TCP sockets
+ */
+ for (so = slirp->tcb.so_next; so != &slirp->tcb;
+ so = so_next) {
+ so_next = so->so_next;
+
+ /*
+ * FD_ISSET is meaningless on these sockets
+ * (and they can crash the program)
+ */
+ if (so->so_state & SS_NOFDREF || so->s == -1)
+ continue;
+
+ /*
+ * Check for URG data
+ * This will soread as well, so no need to
+ * test for readfds below if this succeeds
+ */
+ if (FD_ISSET(so->s, xfds))
+ sorecvoob(so);
+ /*
+ * Check sockets for reading
+ */
+ else if (FD_ISSET(so->s, readfds)) {
+ /*
+ * Check for incoming connections
+ */
+ if (so->so_state & SS_FACCEPTCONN) {
+ tcp_connect(so);
+ continue;
+ } /* else */
+ ret = soread(so);
+
+ /* Output it if we read something */
+ if (ret > 0)
+ tcp_output(sototcpcb(so));
+ }
+
+ /*
+ * Check sockets for writing
+ */
+ if (FD_ISSET(so->s, writefds)) {
+ /*
+ * Check for non-blocking, still-connecting sockets
+ */
+ if (so->so_state & SS_ISFCONNECTING) {
+ /* Connected */
+ so->so_state &= ~SS_ISFCONNECTING;
+
+ ret = send(so->s, (const void *) &ret, 0, 0);
+ if (ret < 0) {
+ /* XXXXX Must fix, zero bytes is a NOP */
+ if (errno == EAGAIN || errno == EWOULDBLOCK ||
+ errno == EINPROGRESS || errno == ENOTCONN)
+ continue;
+
+ /* else failed */
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF;
+ }
+ /* else so->so_state &= ~SS_ISFCONNECTING; */
+
+ /*
+ * Continue tcp_input
+ */
+ tcp_input((struct mbuf *)NULL, sizeof(struct ip), so);
+ /* continue; */
+ } else
+ ret = sowrite(so);
+ /*
+ * XXXXX If we wrote something (a lot), there
+ * could be a need for a window update.
+ * In the worst case, the remote will send
+ * a window probe to get things going again
+ */
+ }
+
+ /*
+ * Probe a still-connecting, non-blocking socket
+ * to check if it's still alive
+ */
#ifdef PROBE_CONN
- if (so->so_state & SS_ISFCONNECTING) {
+ if (so->so_state & SS_ISFCONNECTING) {
ret = qemu_recv(so->s, &ret, 0,0);
- if (ret < 0) {
- /* XXX */
- if (errno == EAGAIN || errno == EWOULDBLOCK ||
- errno == EINPROGRESS || errno == ENOTCONN)
- continue; /* Still connecting, continue */
-
- /* else failed */
- so->so_state &= SS_PERSISTENT_MASK;
- so->so_state |= SS_NOFDREF;
-
- /* tcp_input will take care of it */
- } else {
- ret = send(so->s, &ret, 0,0);
- if (ret < 0) {
- /* XXX */
- if (errno == EAGAIN || errno == EWOULDBLOCK ||
- errno == EINPROGRESS || errno == ENOTCONN)
- continue;
- /* else failed */
- so->so_state &= SS_PERSISTENT_MASK;
- so->so_state |= SS_NOFDREF;
- } else
- so->so_state &= ~SS_ISFCONNECTING;
-
- }
- tcp_input((struct mbuf *)NULL, sizeof(struct ip),so);
- } /* SS_ISFCONNECTING */
+ if (ret < 0) {
+ /* XXX */
+ if (errno == EAGAIN || errno == EWOULDBLOCK ||
+ errno == EINPROGRESS || errno == ENOTCONN)
+ continue; /* Still connecting, continue */
+
+ /* else failed */
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF;
+
+ /* tcp_input will take care of it */
+ } else {
+ ret = send(so->s, &ret, 0,0);
+ if (ret < 0) {
+ /* XXX */
+ if (errno == EAGAIN || errno == EWOULDBLOCK ||
+ errno == EINPROGRESS || errno == ENOTCONN)
+ continue;
+ /* else failed */
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF;
+ } else
+ so->so_state &= ~SS_ISFCONNECTING;
+
+ }
+ tcp_input((struct mbuf *)NULL, sizeof(struct ip),so);
+ } /* SS_ISFCONNECTING */
#endif
- }
-
- /*
- * Now UDP sockets.
- * Incoming packets are sent straight away, they're not buffered.
- * Incoming UDP data isn't buffered either.
- */
- for (so = slirp->udb.so_next; so != &slirp->udb;
- so = so_next) {
- so_next = so->so_next;
-
- if (so->s != -1 && FD_ISSET(so->s, readfds)) {
+ }
+
+ /*
+ * Now UDP sockets.
+ * Incoming packets are sent straight away, they're not buffered.
+ * Incoming UDP data isn't buffered either.
+ */
+ for (so = slirp->udb.so_next; so != &slirp->udb;
+ so = so_next) {
+ so_next = so->so_next;
+
+ if (so->s != -1 && FD_ISSET(so->s, readfds)) {
sorecvfrom(so);
}
- }
+ }
/*
* Check incoming ICMP relies.
@@ -582,19 +582,19 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
icmp_receive(so);
}
}
- }
+ }
if_start(slirp);
}
- /* clear global file descriptor sets.
- * these reside on the stack in vl.c
- * so they're unusable if we're not in
- * slirp_select_fill or slirp_select_poll.
- */
- global_readfds = NULL;
- global_writefds = NULL;
- global_xfds = NULL;
+ /* clear global file descriptor sets.
+ * these reside on the stack in vl.c
+ * so they're unusable if we're not in
+ * slirp_select_fill or slirp_select_poll.
+ */
+ global_readfds = NULL;
+ global_writefds = NULL;
+ global_xfds = NULL;
}
static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
@@ -815,12 +815,12 @@ int slirp_add_exec(Slirp *slirp, int do_pty, const void *args,
ssize_t slirp_send(struct socket *so, const void *buf, size_t len, int flags)
{
- if (so->s == -1 && so->extra) {
- qemu_chr_fe_write(so->extra, buf, len);
- return len;
- }
+ if (so->s == -1 && so->extra) {
+ qemu_chr_fe_write(so->extra, buf, len);
+ return len;
+ }
- return send(so->s, buf, len, flags);
+ return send(so->s, buf, len, flags);
}
static struct socket *
@@ -840,18 +840,18 @@ slirp_find_ctl_socket(Slirp *slirp, struct in_addr guest_addr, int guest_port)
size_t slirp_socket_can_recv(Slirp *slirp, struct in_addr guest_addr,
int guest_port)
{
- struct iovec iov[2];
- struct socket *so;
+ struct iovec iov[2];
+ struct socket *so;
- so = slirp_find_ctl_socket(slirp, guest_addr, guest_port);
+ so = slirp_find_ctl_socket(slirp, guest_addr, guest_port);
- if (!so || so->so_state & SS_NOFDREF)
- return 0;
+ if (!so || so->so_state & SS_NOFDREF)
+ return 0;
- if (!CONN_CANFRCV(so) || so->so_snd.sb_cc >= (so->so_snd.sb_datalen/2))
- return 0;
+ if (!CONN_CANFRCV(so) || so->so_snd.sb_cc >= (so->so_snd.sb_datalen/2))
+ return 0;
- return sopreprbuf(so, iov, NULL);
+ return sopreprbuf(so, iov, NULL);
}
void slirp_socket_recv(Slirp *slirp, struct in_addr guest_addr, int guest_port,
--
1.7.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH 2/4] More work to fix up the formatting and the whitespace of this module to conform to the coding standard.
2012-03-21 21:02 [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes Peter Portante
2012-03-21 21:02 ` [Qemu-devel] [PATCH 1/4] More whitespace cleanup in preparation for future commits Peter Portante
@ 2012-03-21 21:02 ` Peter Portante
2012-03-21 21:02 ` [Qemu-devel] [PATCH 3/4] And some final work to complete the coding style upgrade, missed by the previous commit Peter Portante
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Peter Portante @ 2012-03-21 21:02 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Peter Portante
Signed-off-by: Peter Portante <pportant@redhat.com>
---
slirp/slirp.c | 381 +++++++++++++++++++++++++++++++--------------------------
1 files changed, 205 insertions(+), 176 deletions(-)
diff --git a/slirp/slirp.c b/slirp/slirp.c
index ca0ff94..40f7523 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -295,15 +295,17 @@ void slirp_select_fill(int *pnfds,
/*
* See if we need a tcp_fasttimo
*/
- if (time_fasttimo == 0 && so->so_tcpcb->t_flags & TF_DELACK)
- time_fasttimo = curtime; /* Flag when we want a fasttimo */
+ if (time_fasttimo == 0 && so->so_tcpcb->t_flags & TF_DELACK) {
+ time_fasttimo = curtime; /* Flag when we want a fasttimo */
+ }
/*
* NOFDREF can include still connecting to local-host,
* newly socreated() sockets etc. Don't want to select these.
*/
- if (so->so_state & SS_NOFDREF || so->s == -1)
- continue;
+ if (so->so_state & SS_NOFDREF || so->s == -1) {
+ continue;
+ }
/*
* Set for reading sockets which are accepting
@@ -336,7 +338,8 @@ void slirp_select_fill(int *pnfds,
* Set for reading (and urgent data) if we are connected, can
* receive more, and we have room for it XXX /2 ?
*/
- if (CONN_CANFRCV(so) && (so->so_snd.sb_cc < (so->so_snd.sb_datalen/2))) {
+ if (CONN_CANFRCV(so)
+ && (so->so_snd.sb_cc < (so->so_snd.sb_datalen/2))) {
FD_SET(so->s, readfds);
FD_SET(so->s, xfds);
UPD_NFDS(so->s);
@@ -357,8 +360,9 @@ void slirp_select_fill(int *pnfds,
if (so->so_expire <= curtime) {
udp_detach(so);
continue;
- } else
+ } else {
do_slowtimo = 1; /* Let socket expire */
+ }
}
/*
@@ -377,33 +381,33 @@ void slirp_select_fill(int *pnfds,
}
}
- /*
- * ICMP sockets
- */
- for (so = slirp->icmp.so_next; so != &slirp->icmp;
- so = so_next) {
- so_next = so->so_next;
-
- /*
- * See if it's timed out
- */
- if (so->so_expire) {
- if (so->so_expire <= curtime) {
- icmp_detach(so);
- continue;
- } else {
- do_slowtimo = 1; /* Let socket expire */
- }
- }
+ /*
+ * ICMP sockets
+ */
+ for (so = slirp->icmp.so_next; so != &slirp->icmp;
+ so = so_next) {
+ so_next = so->so_next;
- if (so->so_state & SS_ISFCONNECTED) {
- FD_SET(so->s, readfds);
- UPD_NFDS(so->s);
- }
+ /*
+ * See if it's timed out
+ */
+ if (so->so_expire) {
+ if (so->so_expire <= curtime) {
+ icmp_detach(so);
+ continue;
+ } else {
+ do_slowtimo = 1; /* Let socket expire */
}
+ }
+
+ if (so->so_state & SS_ISFCONNECTED) {
+ FD_SET(so->s, readfds);
+ UPD_NFDS(so->s);
+ }
+ }
}
- *pnfds = nfds;
+ *pnfds = nfds;
}
void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
@@ -424,9 +428,9 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
curtime = qemu_get_clock_ms(rt_clock);
QTAILQ_FOREACH(slirp, &slirp_instances, entry) {
- /*
- * See if anything has timed out
- */
+ /*
+ * See if anything has timed out
+ */
if (time_fasttimo && ((curtime - time_fasttimo) >= 2)) {
tcp_fasttimo(slirp);
time_fasttimo = 0;
@@ -437,152 +441,157 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
last_slowtimo = curtime;
}
- /*
- * Check sockets
- */
- if (!select_error) {
/*
- * Check TCP sockets
+ * Check sockets
*/
- for (so = slirp->tcb.so_next; so != &slirp->tcb;
- so = so_next) {
- so_next = so->so_next;
-
+ if (!select_error) {
/*
- * FD_ISSET is meaningless on these sockets
- * (and they can crash the program)
+ * Check TCP sockets
*/
- if (so->so_state & SS_NOFDREF || so->s == -1)
- continue;
+ for (so = slirp->tcb.so_next; so != &slirp->tcb;
+ so = so_next) {
+ so_next = so->so_next;
- /*
- * Check for URG data
- * This will soread as well, so no need to
- * test for readfds below if this succeeds
- */
- if (FD_ISSET(so->s, xfds))
- sorecvoob(so);
- /*
- * Check sockets for reading
- */
- else if (FD_ISSET(so->s, readfds)) {
/*
- * Check for incoming connections
+ * FD_ISSET is meaningless on these sockets
+ * (and they can crash the program)
*/
- if (so->so_state & SS_FACCEPTCONN) {
- tcp_connect(so);
- continue;
- } /* else */
- ret = soread(so);
+ if (so->so_state & SS_NOFDREF || so->s == -1) {
+ continue;
+ }
- /* Output it if we read something */
- if (ret > 0)
- tcp_output(sototcpcb(so));
- }
+ /*
+ * Check for URG data
+ * This will soread as well, so no need to
+ * test for readfds below if this succeeds
+ */
+ if (FD_ISSET(so->s, xfds)) {
+ sorecvoob(so);
+ } else {
+ /*
+ * Check sockets for reading
+ */
+ if (FD_ISSET(so->s, readfds)) {
+ /*
+ * Check for incoming connections
+ */
+ if (so->so_state & SS_FACCEPTCONN) {
+ tcp_connect(so);
+ continue;
+ } /* else */
+ ret = soread(so);
- /*
- * Check sockets for writing
- */
- if (FD_ISSET(so->s, writefds)) {
- /*
- * Check for non-blocking, still-connecting sockets
- */
- if (so->so_state & SS_ISFCONNECTING) {
- /* Connected */
- so->so_state &= ~SS_ISFCONNECTING;
-
- ret = send(so->s, (const void *) &ret, 0, 0);
- if (ret < 0) {
- /* XXXXX Must fix, zero bytes is a NOP */
- if (errno == EAGAIN || errno == EWOULDBLOCK ||
- errno == EINPROGRESS || errno == ENOTCONN)
- continue;
+ /* Output it if we read something */
+ if (ret > 0) {
+ tcp_output(sototcpcb(so));
+ }
+ }
+ }
- /* else failed */
- so->so_state &= SS_PERSISTENT_MASK;
- so->so_state |= SS_NOFDREF;
+ /*
+ * Check sockets for writing
+ */
+ if (FD_ISSET(so->s, writefds)) {
+ /*
+ * Check for non-blocking, still-connecting sockets
+ */
+ if (so->so_state & SS_ISFCONNECTING) {
+ /* Connected */
+ so->so_state &= ~SS_ISFCONNECTING;
+
+ ret = send(so->s, (const void *) &ret, 0, 0);
+ if (ret < 0) {
+ /* XXXXX Must fix, zero bytes is a NOP */
+ if (errno == EAGAIN || errno == EWOULDBLOCK ||
+ errno == EINPROGRESS || errno == ENOTCONN) {
+ continue;
+ }
+
+ /* else failed */
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF;
+ }
+ /* else so->so_state &= ~SS_ISFCONNECTING; */
+
+ /*
+ * Continue tcp_input
+ */
+ tcp_input((struct mbuf *)NULL, sizeof(struct ip), so);
+ /* continue; */
+ } else {
+ ret = sowrite(so);
+ }
+ /*
+ * XXXXX If we wrote something (a lot), there
+ * could be a need for a window update.
+ * In the worst case, the remote will send
+ * a window probe to get things going again
+ */
}
- /* else so->so_state &= ~SS_ISFCONNECTING; */
/*
- * Continue tcp_input
+ * Probe a still-connecting, non-blocking socket
+ * to check if it's still alive
*/
- tcp_input((struct mbuf *)NULL, sizeof(struct ip), so);
- /* continue; */
- } else
- ret = sowrite(so);
- /*
- * XXXXX If we wrote something (a lot), there
- * could be a need for a window update.
- * In the worst case, the remote will send
- * a window probe to get things going again
- */
+#ifdef PROBE_CONN
+ if (so->so_state & SS_ISFCONNECTING) {
+ ret = qemu_recv(so->s, &ret, 0,0);
+
+ if (ret < 0) {
+ /* XXX */
+ if (errno == EAGAIN || errno == EWOULDBLOCK ||
+ errno == EINPROGRESS || errno == ENOTCONN) {
+ continue; /* Still connecting, continue */
+ }
+ /* else failed */
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF;
+
+ /* tcp_input will take care of it */
+ } else {
+ ret = send(so->s, &ret, 0,0);
+ if (ret < 0) {
+ /* XXX */
+ if (errno == EAGAIN || errno == EWOULDBLOCK ||
+ errno == EINPROGRESS || errno == ENOTCONN) {
+ continue;
+ }
+ /* else failed */
+ so->so_state &= SS_PERSISTENT_MASK;
+ so->so_state |= SS_NOFDREF;
+ } else {
+ so->so_state &= ~SS_ISFCONNECTING;
+ }
+ }
+ tcp_input((struct mbuf *)NULL, sizeof(struct ip),so);
+ } /* SS_ISFCONNECTING */
+#endif
}
/*
- * Probe a still-connecting, non-blocking socket
- * to check if it's still alive
+ * Now UDP sockets.
+ * Incoming packets are sent straight away, they're not buffered.
+ * Incoming UDP data isn't buffered either.
*/
-#ifdef PROBE_CONN
- if (so->so_state & SS_ISFCONNECTING) {
- ret = qemu_recv(so->s, &ret, 0,0);
-
- if (ret < 0) {
- /* XXX */
- if (errno == EAGAIN || errno == EWOULDBLOCK ||
- errno == EINPROGRESS || errno == ENOTCONN)
- continue; /* Still connecting, continue */
-
- /* else failed */
- so->so_state &= SS_PERSISTENT_MASK;
- so->so_state |= SS_NOFDREF;
-
- /* tcp_input will take care of it */
- } else {
- ret = send(so->s, &ret, 0,0);
- if (ret < 0) {
- /* XXX */
- if (errno == EAGAIN || errno == EWOULDBLOCK ||
- errno == EINPROGRESS || errno == ENOTCONN)
- continue;
- /* else failed */
- so->so_state &= SS_PERSISTENT_MASK;
- so->so_state |= SS_NOFDREF;
- } else
- so->so_state &= ~SS_ISFCONNECTING;
-
- }
- tcp_input((struct mbuf *)NULL, sizeof(struct ip),so);
- } /* SS_ISFCONNECTING */
-#endif
- }
-
- /*
- * Now UDP sockets.
- * Incoming packets are sent straight away, they're not buffered.
- * Incoming UDP data isn't buffered either.
- */
- for (so = slirp->udb.so_next; so != &slirp->udb;
- so = so_next) {
- so_next = so->so_next;
+ for (so = slirp->udb.so_next; so != &slirp->udb; so = so_next) {
+ so_next = so->so_next;
- if (so->s != -1 && FD_ISSET(so->s, readfds)) {
- sorecvfrom(so);
- }
- }
+ if (so->s != -1 && FD_ISSET(so->s, readfds)) {
+ sorecvfrom(so);
+ }
+ }
- /*
- * Check incoming ICMP relies.
- */
- for (so = slirp->icmp.so_next; so != &slirp->icmp;
- so = so_next) {
- so_next = so->so_next;
+ /*
+ * Check incoming ICMP relies.
+ */
+ for (so = slirp->icmp.so_next; so != &slirp->icmp; so = so_next) {
+ so_next = so->so_next;
- if (so->s != -1 && FD_ISSET(so->s, readfds)) {
- icmp_receive(so);
- }
+ if (so->s != -1 && FD_ISSET(so->s, readfds)) {
+ icmp_receive(so);
}
- }
+ }
+ }
if_start(slirp);
}
@@ -618,11 +627,13 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
if ((ah->ar_tip & slirp->vnetwork_mask.s_addr) ==
slirp->vnetwork_addr.s_addr) {
if (ah->ar_tip == slirp->vnameserver_addr.s_addr ||
- ah->ar_tip == slirp->vhost_addr.s_addr)
+ ah->ar_tip == slirp->vhost_addr.s_addr) {
goto arp_ok;
+ }
for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
- if (ex_ptr->ex_addr.s_addr == ah->ar_tip)
+ if (ex_ptr->ex_addr.s_addr == ah->ar_tip) {
goto arp_ok;
+ }
}
return;
arp_ok:
@@ -661,8 +672,9 @@ void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
struct mbuf *m;
int proto;
- if (pkt_len < ETH_HLEN)
+ if (pkt_len < ETH_HLEN) {
return;
+ }
proto = ntohs(*(uint16_t *)(pkt + 12));
switch(proto) {
@@ -671,8 +683,9 @@ void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
break;
case ETH_P_IP:
m = m_get(slirp);
- if (!m)
+ if (!m) {
return;
+ }
/* Note: we add to align the IP header */
if (M_FREEROOM(m) < pkt_len + 2) {
m_inc(m, pkt_len + 2);
@@ -786,12 +799,14 @@ int slirp_add_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr,
}
if (is_udp) {
if (!udp_listen(slirp, host_addr.s_addr, htons(host_port),
- guest_addr.s_addr, htons(guest_port), SS_HOSTFWD))
+ guest_addr.s_addr, htons(guest_port), SS_HOSTFWD)) {
return -1;
+ }
} else {
if (!tcp_listen(slirp, host_addr.s_addr, htons(host_port),
- guest_addr.s_addr, htons(guest_port), SS_HOSTFWD))
+ guest_addr.s_addr, htons(guest_port), SS_HOSTFWD)) {
return -1;
+ }
}
return 0;
}
@@ -845,11 +860,13 @@ size_t slirp_socket_can_recv(Slirp *slirp, struct in_addr guest_addr,
so = slirp_find_ctl_socket(slirp, guest_addr, guest_port);
- if (!so || so->so_state & SS_NOFDREF)
+ if (!so || so->so_state & SS_NOFDREF) {
return 0;
+ }
- if (!CONN_CANFRCV(so) || so->so_snd.sb_cc >= (so->so_snd.sb_datalen/2))
+ if (!CONN_CANFRCV(so) || so->so_snd.sb_cc >= (so->so_snd.sb_datalen/2)) {
return 0;
+ }
return sopreprbuf(so, iov, NULL);
}
@@ -860,13 +877,15 @@ void slirp_socket_recv(Slirp *slirp, struct in_addr guest_addr, int guest_port,
int ret;
struct socket *so = slirp_find_ctl_socket(slirp, guest_addr, guest_port);
- if (!so)
+ if (!so) {
return;
+ }
ret = soreadbuf(so, (const char *)buf, size);
- if (ret > 0)
+ if (ret > 0) {
tcp_output(sototcpcb(so));
+ }
}
static void slirp_tcp_save(QEMUFile *f, struct tcpcb *tp)
@@ -960,17 +979,19 @@ static void slirp_state_save(QEMUFile *f, void *opaque)
Slirp *slirp = opaque;
struct ex_list *ex_ptr;
- for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next)
+ for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
if (ex_ptr->ex_pty == 3) {
struct socket *so;
so = slirp_find_ctl_socket(slirp, ex_ptr->ex_addr,
ntohs(ex_ptr->ex_fport));
- if (!so)
+ if (!so) {
continue;
+ }
qemu_put_byte(f, 42);
slirp_socket_save(f, so);
}
+ }
qemu_put_byte(f, 0);
qemu_put_be16(f, slirp->ip_id);
@@ -983,8 +1004,9 @@ static void slirp_tcp_load(QEMUFile *f, struct tcpcb *tp)
int i;
tp->t_state = qemu_get_sbe16(f);
- for (i = 0; i < TCPT_NTIMERS; i++)
+ for (i = 0; i < TCPT_NTIMERS; i++) {
tp->t_timer[i] = qemu_get_sbe16(f);
+ }
tp->t_rxtshift = qemu_get_sbe16(f);
tp->t_rxtcur = qemu_get_sbe16(f);
tp->t_dupacks = qemu_get_sbe16(f);
@@ -1035,8 +1057,9 @@ static int slirp_sbuf_load(QEMUFile *f, struct sbuf *sbuf)
sbreserve(sbuf, sb_datalen);
- if (sbuf->sb_datalen != sb_datalen)
+ if (sbuf->sb_datalen != sb_datalen) {
return -ENOMEM;
+ }
sbuf->sb_cc = sb_cc;
@@ -1051,8 +1074,9 @@ static int slirp_sbuf_load(QEMUFile *f, struct sbuf *sbuf)
static int slirp_socket_load(QEMUFile *f, struct socket *so)
{
- if (tcp_attach(so) < 0)
+ if (tcp_attach(so) < 0) {
return -ENOMEM;
+ }
so->so_urgc = qemu_get_be32(f);
so->so_faddr.s_addr = qemu_get_be32(f);
@@ -1063,10 +1087,12 @@ static int slirp_socket_load(QEMUFile *f, struct socket *so)
so->so_emu = qemu_get_byte(f);
so->so_type = qemu_get_byte(f);
so->so_state = qemu_get_be32(f);
- if (slirp_sbuf_load(f, &so->so_rcv) < 0)
+ if (slirp_sbuf_load(f, &so->so_rcv) < 0) {
return -ENOMEM;
- if (slirp_sbuf_load(f, &so->so_snd) < 0)
+ }
+ if (slirp_sbuf_load(f, &so->so_snd) < 0) {
return -ENOMEM;
+ }
slirp_tcp_load(f, so->so_tcpcb);
return 0;
@@ -1091,13 +1117,15 @@ static int slirp_state_load(QEMUFile *f, void *opaque, int version_id)
int ret;
struct socket *so = socreate(slirp);
- if (!so)
+ if (!so) {
return -ENOMEM;
+ }
ret = slirp_socket_load(f, so);
- if (ret < 0)
+ if (ret < 0) {
return ret;
+ }
if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) !=
slirp->vnetwork_addr.s_addr) {
@@ -1110,8 +1138,9 @@ static int slirp_state_load(QEMUFile *f, void *opaque, int version_id)
break;
}
}
- if (!ex_ptr)
+ if (!ex_ptr) {
return -EINVAL;
+ }
so->extra = (void *)ex_ptr->ex_exec;
}
--
1.7.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH 3/4] And some final work to complete the coding style upgrade, missed by the previous commit.
2012-03-21 21:02 [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes Peter Portante
2012-03-21 21:02 ` [Qemu-devel] [PATCH 1/4] More whitespace cleanup in preparation for future commits Peter Portante
2012-03-21 21:02 ` [Qemu-devel] [PATCH 2/4] More work to fix up the formatting and the whitespace of this module to conform to the coding standard Peter Portante
@ 2012-03-21 21:02 ` Peter Portante
2012-03-21 21:02 ` [Qemu-devel] [PATCH 4/4] Yet another missed use of tabs Peter Portante
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Peter Portante @ 2012-03-21 21:02 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Peter Portante
Signed-off-by: Peter Portante <pportant@redhat.com>
---
slirp/slirp.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 40f7523..fd28f17 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -457,7 +457,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
* (and they can crash the program)
*/
if (so->so_state & SS_NOFDREF || so->s == -1) {
- continue;
+ continue;
}
/*
@@ -535,7 +535,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
*/
#ifdef PROBE_CONN
if (so->so_state & SS_ISFCONNECTING) {
- ret = qemu_recv(so->s, &ret, 0,0);
+ ret = qemu_recv(so->s, &ret, 0, 0);
if (ret < 0) {
/* XXX */
@@ -549,7 +549,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
/* tcp_input will take care of it */
} else {
- ret = send(so->s, &ret, 0,0);
+ ret = send(so->s, &ret, 0, 0);
if (ret < 0) {
/* XXX */
if (errno == EAGAIN || errno == EWOULDBLOCK ||
@@ -563,7 +563,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
so->so_state &= ~SS_ISFCONNECTING;
}
}
- tcp_input((struct mbuf *)NULL, sizeof(struct ip),so);
+ tcp_input((struct mbuf *)NULL, sizeof(struct ip), so);
} /* SS_ISFCONNECTING */
#endif
}
--
1.7.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH 4/4] Yet another missed use of tabs.
2012-03-21 21:02 [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes Peter Portante
` (2 preceding siblings ...)
2012-03-21 21:02 ` [Qemu-devel] [PATCH 3/4] And some final work to complete the coding style upgrade, missed by the previous commit Peter Portante
@ 2012-03-21 21:02 ` Peter Portante
2012-03-22 0:05 ` [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes Paolo Bonzini
2012-03-22 10:57 ` Peter Maydell
5 siblings, 0 replies; 9+ messages in thread
From: Peter Portante @ 2012-03-21 21:02 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Peter Portante
Signed-off-by: Peter Portante <pportant@redhat.com>
---
slirp/slirp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/slirp/slirp.c b/slirp/slirp.c
index fd28f17..45a8de2 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -457,7 +457,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
* (and they can crash the program)
*/
if (so->so_state & SS_NOFDREF || so->s == -1) {
- continue;
+ continue;
}
/*
--
1.7.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes
2012-03-21 21:02 [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes Peter Portante
` (3 preceding siblings ...)
2012-03-21 21:02 ` [Qemu-devel] [PATCH 4/4] Yet another missed use of tabs Peter Portante
@ 2012-03-22 0:05 ` Paolo Bonzini
2012-03-22 10:27 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2012-03-22 13:28 ` [Qemu-devel] " Jan Kiszka
2012-03-22 10:57 ` Peter Maydell
5 siblings, 2 replies; 9+ messages in thread
From: Paolo Bonzini @ 2012-03-22 0:05 UTC (permalink / raw)
To: qemu-trivial, qemu-devel, peter.portante
Il 21/03/2012 22:02, Peter Portante ha scritto:
> Hi Folks,
>
> Please forgive me if you find these changes are annoying, as I am trying to
> learn the ropes of patch submission with git ahead of making a real patch.
>
> While working on the code, I found that scripts/checkpatch.pl will flag lines
> that I am changing as not adhereing to the codeing standard due to
> pre-existing coding violations. So I figured I could learn a bit about how to
> submit patches by fixing these files I will be touching before submitting the
> code changes.
I think slirp is a mess and it's not worth doing this kind of sweeping
change. Just ignore checkpatch output for slirp.
For the others, the changes are pretty small so they could be doable.
If you want to change them then please also add braces around if statements.
In any case, your patch submission workflow seems to be fine. :P
Paolo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes
2012-03-22 0:05 ` [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes Paolo Bonzini
@ 2012-03-22 10:27 ` Stefan Hajnoczi
2012-03-22 13:28 ` [Qemu-devel] " Jan Kiszka
1 sibling, 0 replies; 9+ messages in thread
From: Stefan Hajnoczi @ 2012-03-22 10:27 UTC (permalink / raw)
To: peter.portante; +Cc: qemu-trivial, Paolo Bonzini, qemu-devel
On Thu, Mar 22, 2012 at 12:05 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Il 21/03/2012 22:02, Peter Portante ha scritto:
>> Hi Folks,
>>
>> Please forgive me if you find these changes are annoying, as I am trying to
>> learn the ropes of patch submission with git ahead of making a real patch.
>>
>> While working on the code, I found that scripts/checkpatch.pl will flag lines
>> that I am changing as not adhereing to the codeing standard due to
>> pre-existing coding violations. So I figured I could learn a bit about how to
>> submit patches by fixing these files I will be touching before submitting the
>> code changes.
>
> I think slirp is a mess and it's not worth doing this kind of sweeping
> change. Just ignore checkpatch output for slirp.
Please resend without slirp changes. I suggest including the
individual block/raw-posix.c patch you sent in the new series too.
> For the others, the changes are pretty small so they could be doable.
> If you want to change them then please also add braces around if statements.
If you're doing a whitespace patch please include the 3-space
indentation issues that checkpatch.pl reports in block/raw-posix.c.
> In any case, your patch submission workflow seems to be fine. :P
Please use a prefix in your commit messages, for example "raw-posix:
whitespace cleanup". This gives each commit a unique, useful message
which communicates more than "Yet another whitespace cleanup"-style
messages.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes
2012-03-22 0:05 ` [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes Paolo Bonzini
2012-03-22 10:27 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
@ 2012-03-22 13:28 ` Jan Kiszka
1 sibling, 0 replies; 9+ messages in thread
From: Jan Kiszka @ 2012-03-22 13:28 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-trivial, peter.portante, qemu-devel
On 2012-03-22 01:05, Paolo Bonzini wrote:
> Il 21/03/2012 22:02, Peter Portante ha scritto:
>> Hi Folks,
>>
>> Please forgive me if you find these changes are annoying, as I am trying to
>> learn the ropes of patch submission with git ahead of making a real patch.
>>
>> While working on the code, I found that scripts/checkpatch.pl will flag lines
>> that I am changing as not adhereing to the codeing standard due to
>> pre-existing coding violations. So I figured I could learn a bit about how to
>> submit patches by fixing these files I will be touching before submitting the
>> code changes.
>
> I think slirp is a mess and it's not worth doing this kind of sweeping
> change. Just ignore checkpatch output for slirp.
In fact, I could imagine accepting slirp cleanups provided they come in
palatable pieces and validate that the binary output is unchanged. It's
really a pain changing something in slirp having to use a totally
inconsistent style just to keep the code slightly readable.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes
2012-03-21 21:02 [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes Peter Portante
` (4 preceding siblings ...)
2012-03-22 0:05 ` [Qemu-devel] [PATCH 0/4] More whitespace and coding style clean ups ahead of future changes Paolo Bonzini
@ 2012-03-22 10:57 ` Peter Maydell
5 siblings, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2012-03-22 10:57 UTC (permalink / raw)
To: Peter Portante; +Cc: qemu-trivial, qemu-devel
On 21 March 2012 21:02, Peter Portante <peter.portante@redhat.com> wrote:
> Please forgive me if you find these changes are annoying, as I am trying to
> learn the ropes of patch submission with git ahead of making a real patch.
I'd recommend using git format-patch's --cover-letter option to create your
'cover letter' patch, as this will include a diffstat and summary of
all the patches in the patchset.
> While working on the code, I found that scripts/checkpatch.pl will flag lines
> that I am changing as not adhereing to the codeing standard due to
> pre-existing coding violations. So I figured I could learn a bit about how to
> submit patches by fixing these files I will be touching before submitting the
> code changes.
Whitespace-fixes and other coding-style-only changes are a bit of
a touchy issue here; they've caused long mailing list arguments in
the past. Mostly the line we seem to take is "fix issues in new
code submitted; when patching old code you can fix problems complained
about in the immediately surrounding few lines". The idea is that
gradually the codebase moves into line with the style guide without
having massive style-only changes that break tools like 'git blame'.
Small changes (like the qemu-timers one) are more likely to be
accepted than massive ones (like the slirp patches).
Also, it would be helpful if you could split your patches more
logically into smaller ones which touch the different subsystems:
any patch which touches all of block_int.h, qemu-timer.c and slirp
is going to struggle to be reviewed and committed because it is
trying to modify three different bits of the codebase and so it
needs agreement from more people. Sometimes a patch really does have
to touch several different areas, but in this case you're only
putting roadblocks in your own path...
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread