qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, samuel.thibault@gnu.org, jan.kiszka@siemens.com
Cc: quintela@redhat.com
Subject: [Qemu-devel] [PATCH v5 3/5] slirp: Common lhost/fhost union
Date: Mon,  3 Apr 2017 18:18:41 +0100	[thread overview]
Message-ID: <20170403171843.3363-4-dgilbert@redhat.com> (raw)
In-Reply-To: <20170403171843.3363-1-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

The socket structure has a pair of unions for lhost and fhost
addresses; the unions are identical so split them out into
a separate union declaration.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 slirp/socket.h | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/slirp/socket.h b/slirp/socket.h
index 8feed2a..c1be77e 100644
--- a/slirp/socket.h
+++ b/slirp/socket.h
@@ -15,6 +15,12 @@
  * Our socket structure
  */
 
+union slirp_sockaddr {
+    struct sockaddr_storage ss;
+    struct sockaddr_in sin;
+    struct sockaddr_in6 sin6;
+};
+
 struct socket {
   struct socket *so_next,*so_prev;      /* For a linked list of sockets */
 
@@ -31,22 +37,14 @@ struct socket {
   struct tcpiphdr *so_ti;	   /* Pointer to the original ti within
 				    * so_mconn, for non-blocking connections */
   int so_urgc;
-  union {   /* foreign host */
-      struct sockaddr_storage ss;
-      struct sockaddr_in sin;
-      struct sockaddr_in6 sin6;
-  } fhost;
+  union slirp_sockaddr fhost;      /* Foreign host */
 #define so_faddr fhost.sin.sin_addr
 #define so_fport fhost.sin.sin_port
 #define so_faddr6 fhost.sin6.sin6_addr
 #define so_fport6 fhost.sin6.sin6_port
 #define so_ffamily fhost.ss.ss_family
 
-  union {   /* local host */
-      struct sockaddr_storage ss;
-      struct sockaddr_in sin;
-      struct sockaddr_in6 sin6;
-  } lhost;
+  union slirp_sockaddr lhost;      /* Local host */
 #define so_laddr lhost.sin.sin_addr
 #define so_lport lhost.sin.sin_port
 #define so_laddr6 lhost.sin6.sin6_addr
-- 
2.9.3

  parent reply	other threads:[~2017-04-03 17:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 17:18 [Qemu-devel] [PATCH v5 0/5 for 2.10] SLIRP VMStatification Dr. David Alan Gilbert (git)
2017-04-03 17:18 ` [Qemu-devel] [PATCH v5 1/5] slirp: VMState conversion; tcpcb Dr. David Alan Gilbert (git)
2017-04-03 17:18 ` [Qemu-devel] [PATCH v5 2/5] slirp: VMStatify sbuf Dr. David Alan Gilbert (git)
2017-04-03 17:18 ` Dr. David Alan Gilbert (git) [this message]
2017-04-03 18:41   ` [Qemu-devel] [PATCH v5 3/5] slirp: Common lhost/fhost union Philippe Mathieu-Daudé
2017-04-21 10:16   ` Juan Quintela
2017-04-03 17:18 ` [Qemu-devel] [PATCH v5 4/5] slirp: VMStatify socket level Dr. David Alan Gilbert (git)
2017-04-03 17:18 ` [Qemu-devel] [PATCH v5 5/5] slirp: VMStatify remaining except for loop Dr. David Alan Gilbert (git)
2017-04-21 10:24   ` Juan Quintela
2017-04-03 17:44 ` [Qemu-devel] [PATCH v5 0/5 for 2.10] SLIRP VMStatification no-reply

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=20170403171843.3363-4-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=samuel.thibault@gnu.org \
    /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).