All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	stefanha@redhat.com, jan.kiszka@siemens.com,
	"Samuel Thibault" <samuel.thibault@ens-lyon.org>
Subject: [Qemu-devel] [PULLv3 10/32] slirp: replace QEMU_PACKED with SLIRP_PACKED
Date: Tue,  5 Feb 2019 20:28:26 +0200	[thread overview]
Message-ID: <20190205182848.29887-11-samuel.thibault@ens-lyon.org> (raw)
In-Reply-To: <20190205182848.29887-1-samuel.thibault@ens-lyon.org>

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 slirp/ip.h       | 10 +++++-----
 slirp/ip6_icmp.h |  6 +++---
 slirp/slirp.h    |  5 +++--
 slirp/util.h     | 32 ++++++++++++++++++++++++++++++++
 4 files changed, 43 insertions(+), 10 deletions(-)
 create mode 100644 slirp/util.h

diff --git a/slirp/ip.h b/slirp/ip.h
index 20614f3b53..2baeeb9a3a 100644
--- a/slirp/ip.h
+++ b/slirp/ip.h
@@ -89,7 +89,7 @@ struct ip {
 	uint8_t ip_p;			/* protocol */
 	uint16_t	ip_sum;			/* checksum */
 	struct	in_addr ip_src,ip_dst;	/* source and dest address */
-} QEMU_PACKED;
+} SLIRP_PACKED;
 
 #define	IP_MAXPACKET	65535		/* maximum packet size */
 
@@ -151,7 +151,7 @@ struct	ip_timestamp {
 			n_long ipt_time;
 		} ipt_ta[1];
 	} ipt_timestamp;
-} QEMU_PACKED;
+} SLIRP_PACKED;
 
 /* flag bits for ipt_flg */
 #define	IPOPT_TS_TSONLY		0		/* timestamps only */
@@ -181,11 +181,11 @@ struct	ip_timestamp {
 struct mbuf_ptr {
 	struct mbuf *mptr;
 	uint32_t dummy;
-} QEMU_PACKED;
+} SLIRP_PACKED;
 #else
 struct mbuf_ptr {
 	struct mbuf *mptr;
-} QEMU_PACKED;
+} SLIRP_PACKED;
 #endif
 struct qlink {
 	void *next, *prev;
@@ -201,7 +201,7 @@ struct ipovly {
 	uint16_t	ih_len;			/* protocol length */
 	struct	in_addr ih_src;		/* source internet address */
 	struct	in_addr ih_dst;		/* destination internet address */
-} QEMU_PACKED;
+} SLIRP_PACKED;
 
 /*
  * Ip reassembly queue structure.  Each fragment
diff --git a/slirp/ip6_icmp.h b/slirp/ip6_icmp.h
index 2ad2b75e67..3f44ed2f49 100644
--- a/slirp/ip6_icmp.h
+++ b/slirp/ip6_icmp.h
@@ -144,16 +144,16 @@ struct ndpopt {
             uint32_t    pref_lt;                /* Preferred Lifetime */
             uint32_t    reserved2;
             struct in6_addr prefix;
-        } QEMU_PACKED prefixinfo;
+        } SLIRP_PACKED prefixinfo;
 #define ndpopt_prefixinfo ndpopt_body.prefixinfo
         struct rdnss {
             uint16_t reserved;
             uint32_t lifetime;
             struct in6_addr addr;
-        } QEMU_PACKED rdnss;
+        } SLIRP_PACKED rdnss;
 #define ndpopt_rdnss ndpopt_body.rdnss
     } ndpopt_body;
-} QEMU_PACKED;
+} SLIRP_PACKED;
 
 /* NDP options type */
 #define NDPOPT_LINKLAYER_SOURCE     1   /* Source Link-Layer Address */
diff --git a/slirp/slirp.h b/slirp/slirp.h
index 17056f4b83..67ff4d610c 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -45,6 +45,7 @@ typedef char *caddr_t;
 #define quehead slirp_quehead
 
 #include "debug.h"
+#include "util.h"
 
 #include "qemu/queue.h"
 #include "qemu/sockets.h"
@@ -93,7 +94,7 @@ struct slirp_arphdr {
     uint32_t      ar_sip;           /* sender IP address       */
     unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
     uint32_t      ar_tip;           /* target IP address       */
-} QEMU_PACKED;
+} SLIRP_PACKED;
 
 #define ARP_TABLE_SIZE 16
 
@@ -110,7 +111,7 @@ bool arp_table_search(Slirp *slirp, uint32_t ip_addr,
 struct ndpentry {
     unsigned char   eth_addr[ETH_ALEN];     /* sender hardware address */
     struct in6_addr ip_addr;                /* sender IP address       */
-} QEMU_PACKED;
+} SLIRP_PACKED;
 
 #define NDP_TABLE_SIZE 16
 
diff --git a/slirp/util.h b/slirp/util.h
new file mode 100644
index 0000000000..00291c30a6
--- /dev/null
+++ b/slirp/util.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ * Copyright (c) 2010-2019 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef UTIL_H_
+#define UTIL_H_
+
+#if defined(_WIN32)
+# define SLIRP_PACKED __attribute__((gcc_struct, packed))
+#else
+# define SLIRP_PACKED __attribute__((packed))
+#endif
+
+#endif
-- 
2.20.1

  parent reply	other threads:[~2019-02-05 18:29 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05 18:28 [Qemu-devel] [PULLv3 00/32] More work towards libslirp Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 01/32] slirp: Avoid unaligned 16bit memory access Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 02/32] slirp: Avoid marking naturally packed structs as QEMU_PACKED Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 03/32] slirp: Don't mark struct ipq or struct ipasfrag as packed Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 04/32] slirp: generalize guestfwd with a callback based approach Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 05/32] net/slirp: simplify checking for cmd: prefix Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 06/32] net/slirp: free forwarding rules on cleanup Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 07/32] net/slirp: fix leaks on forwarding rule registration error Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 08/32] slirp: add callbacks for timer Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 09/32] slirp: replace trace functions with DEBUG calls Samuel Thibault
2019-02-05 18:28 ` Samuel Thibault [this message]
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 11/32] slirp: replace most qemu socket utilities with slirp own version Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 12/32] slirp: replace qemu_set_nonblock() Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 13/32] slirp: add unregister_poll_fd() callback Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 14/32] slirp: replace qemu_notify_event() with a callback Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 15/32] slirp: move QEMU state saving to a separate unit Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 16/32] slirp: do not include qemu headers in libslirp.h public API header Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 17/32] slirp: improve windows headers inclusion Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 18/32] slirp: add slirp own version of pstrcpy Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 19/32] slirp: remove qemu timer.h dependency Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 20/32] slirp: remove now useless QEMU headers inclusions Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 21/32] slirp: replace net/eth.h inclusion with own defines Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 22/32] slirp: replace qemu qtailq with slirp own copy Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 23/32] slirp: replace QEMU_BUILD_BUG_ON with G_STATIC_ASSERT Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 24/32] slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/ Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 25/32] slirp: replace remaining qemu headers dependency Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 26/32] slirp: prefer c99 types over BSD kind Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 27/32] slirp: improve send_packet() callback Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 28/32] slirp: replace global polling with per-instance & notifier Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 29/32] slirp: remove slirp_instances list Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 30/32] slirp: use polling callbacks, drop glib requirement Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 31/32] slirp: pass opaque to all callbacks Samuel Thibault
2019-02-05 18:28 ` [Qemu-devel] [PULLv3 32/32] slirp: API is extern C Samuel Thibault
2019-02-05 20:15 ` [Qemu-devel] [PULLv3 00/32] More work towards libslirp no-reply
2019-02-05 20:19 ` no-reply
2019-02-07 11:46 ` Peter Maydell
2019-02-07 11:53   ` Daniel P. Berrangé
2019-02-07 13:29   ` Samuel Thibault
2019-02-07 13:52     ` Marc-André Lureau
2019-02-07 13:53       ` Peter Maydell
2019-02-07 14:42     ` Daniel P. Berrangé

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=20190205182848.29887-11-samuel.thibault@ens-lyon.org \
    --to=samuel.thibault@ens-lyon.org \
    --cc=jan.kiszka@siemens.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.