From patchwork Thu Feb 7 14:02:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 10801313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE8F36C2 for ; Thu, 7 Feb 2019 14:11:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD7D62D976 for ; Thu, 7 Feb 2019 14:11:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9E682D979; Thu, 7 Feb 2019 14:11:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 043EE2D963 for ; Thu, 7 Feb 2019 14:11:35 +0000 (UTC) Received: from localhost ([127.0.0.1]:40699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grkOt-0008Ld-5X for patchwork-qemu-devel@patchwork.kernel.org; Thu, 07 Feb 2019 09:11:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grkHS-00024g-FN for qemu-devel@nongnu.org; Thu, 07 Feb 2019 09:03:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grkHN-0000v8-Kg for qemu-devel@nongnu.org; Thu, 07 Feb 2019 09:03:53 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:49780) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1grkHL-0000ra-Ly for qemu-devel@nongnu.org; Thu, 07 Feb 2019 09:03:48 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id CAC48CD42; Thu, 7 Feb 2019 15:03:28 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZCxMvUAfhCwB; Thu, 7 Feb 2019 15:03:27 +0100 (CET) Received: from function (unknown [160.40.205.85]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 8D805CD25; Thu, 7 Feb 2019 15:03:19 +0100 (CET) Received: from samy by function with local (Exim 4.92-RC4) (envelope-from ) id 1grkGr-0004DI-7i; Thu, 07 Feb 2019 15:03:17 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Thu, 7 Feb 2019 16:02:54 +0200 Message-Id: <20190207140316.16103-11-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190207140316.16103-1-samuel.thibault@ens-lyon.org> References: <20190207140316.16103-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULLv4 10/32] slirp: replace QEMU_PACKED with SLIRP_PACKED X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau Signed-off-by: Marc-André Lureau Signed-off-by: Samuel Thibault --- 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