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] [PULLv4 25/32] slirp: replace remaining qemu headers dependency
Date: Thu,  7 Feb 2019 16:03:09 +0200	[thread overview]
Message-ID: <20190207140316.16103-26-samuel.thibault@ens-lyon.org> (raw)
In-Reply-To: <20190207140316.16103-1-samuel.thibault@ens-lyon.org>

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

Except for the migration code which is gated by WITH_QEMU, only
include our own headers, so libslirp can be built standalone.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 slirp/arp_table.c  |  3 ++-
 slirp/bootp.c      |  1 -
 slirp/cksum.c      |  1 -
 slirp/dhcpv6.c     |  1 -
 slirp/dnssearch.c  |  1 -
 slirp/if.c         |  1 -
 slirp/ip6.h        |  1 +
 slirp/ip6_icmp.c   |  1 -
 slirp/ip6_input.c  |  1 -
 slirp/ip6_output.c |  2 --
 slirp/ip_icmp.c    |  1 -
 slirp/ip_input.c   |  1 -
 slirp/ip_output.c  |  1 -
 slirp/mbuf.c       |  1 -
 slirp/misc.c       |  2 --
 slirp/ncsi.c       |  1 -
 slirp/ndp_table.c  |  2 --
 slirp/sbuf.c       |  1 -
 slirp/slirp.c      |  2 --
 slirp/socket.c     |  2 --
 slirp/tcp_input.c  |  1 -
 slirp/tcp_output.c |  1 -
 slirp/tcp_subr.c   |  1 -
 slirp/tcp_timer.c  |  1 -
 slirp/tftp.c       |  6 ++++--
 slirp/udp.c        |  1 -
 slirp/udp6.c       |  2 --
 slirp/util.h       | 21 +++++++++++++++++++++
 28 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/slirp/arp_table.c b/slirp/arp_table.c
index bf71b984ad..58eafdcfd8 100644
--- a/slirp/arp_table.c
+++ b/slirp/arp_table.c
@@ -22,9 +22,10 @@
  * THE SOFTWARE.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 
+#include <string.h>
+
 void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN])
 {
     const uint32_t broadcast_addr =
diff --git a/slirp/bootp.c b/slirp/bootp.c
index 4c9a77eb98..d396849a05 100644
--- a/slirp/bootp.c
+++ b/slirp/bootp.c
@@ -21,7 +21,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "qemu/osdep.h"
 #include "slirp.h"
 
 #if defined(_WIN32)
diff --git a/slirp/cksum.c b/slirp/cksum.c
index 84c858fafb..25bfa67348 100644
--- a/slirp/cksum.c
+++ b/slirp/cksum.c
@@ -30,7 +30,6 @@
  * in_cksum.c,v 1.2 1994/08/02 07:48:16 davidg Exp
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 
 /*
diff --git a/slirp/dhcpv6.c b/slirp/dhcpv6.c
index e27d9a46f8..9ffba38e8f 100644
--- a/slirp/dhcpv6.c
+++ b/slirp/dhcpv6.c
@@ -20,7 +20,6 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 #include "dhcpv6.h"
 
diff --git a/slirp/dnssearch.c b/slirp/dnssearch.c
index 8fb563321b..c459cece8d 100644
--- a/slirp/dnssearch.c
+++ b/slirp/dnssearch.c
@@ -22,7 +22,6 @@
  * THE SOFTWARE.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 
 static const uint8_t RFC3397_OPT_DOMAIN_SEARCH = 119;
diff --git a/slirp/if.c b/slirp/if.c
index 90b9078687..2ad03b8a79 100644
--- a/slirp/if.c
+++ b/slirp/if.c
@@ -5,7 +5,6 @@
  * terms and conditions of the copyright.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 
 static void
diff --git a/slirp/ip6.h b/slirp/ip6.h
index 5361bd7449..1b3364f960 100644
--- a/slirp/ip6.h
+++ b/slirp/ip6.h
@@ -7,6 +7,7 @@
 #define SLIRP_IP6_H
 
 #include <glib.h>
+#include <string.h>
 
 #define ALLNODES_MULTICAST  { .s6_addr = \
                             { 0xff, 0x02, 0x00, 0x00,\
diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c
index b3b7e50a31..2a432ebbd4 100644
--- a/slirp/ip6_icmp.c
+++ b/slirp/ip6_icmp.c
@@ -3,7 +3,6 @@
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 #include "ip6_icmp.h"
 
diff --git a/slirp/ip6_input.c b/slirp/ip6_input.c
index ab656a0a9d..1b8c003c66 100644
--- a/slirp/ip6_input.c
+++ b/slirp/ip6_input.c
@@ -3,7 +3,6 @@
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 #include "ip6_icmp.h"
 
diff --git a/slirp/ip6_output.c b/slirp/ip6_output.c
index 52c88ad691..19d1ae7748 100644
--- a/slirp/ip6_output.c
+++ b/slirp/ip6_output.c
@@ -3,8 +3,6 @@
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
  */
 
-#include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "slirp.h"
 
 /* Number of packets queued before we start sending
diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c
index 19e247f773..6b6344b776 100644
--- a/slirp/ip_icmp.c
+++ b/slirp/ip_icmp.c
@@ -30,7 +30,6 @@
  * ip_icmp.c,v 1.7 1995/05/30 08:09:42 rgrimes Exp
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 #include "ip_icmp.h"
 
diff --git a/slirp/ip_input.c b/slirp/ip_input.c
index d360620838..774ce662e6 100644
--- a/slirp/ip_input.c
+++ b/slirp/ip_input.c
@@ -38,7 +38,6 @@
  * terms and conditions of the copyright.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 #include "ip_icmp.h"
 
diff --git a/slirp/ip_output.c b/slirp/ip_output.c
index db403f04c1..f6ec141df5 100644
--- a/slirp/ip_output.c
+++ b/slirp/ip_output.c
@@ -38,7 +38,6 @@
  * terms and conditions of the copyright.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 
 /* Number of packets queued before we start sending
diff --git a/slirp/mbuf.c b/slirp/mbuf.c
index d8d275e0e7..521c02c967 100644
--- a/slirp/mbuf.c
+++ b/slirp/mbuf.c
@@ -15,7 +15,6 @@
  * the flags
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 
 #define MBUF_THRESH 30
diff --git a/slirp/misc.c b/slirp/misc.c
index ee77aff337..3c02510101 100644
--- a/slirp/misc.c
+++ b/slirp/misc.c
@@ -5,9 +5,7 @@
  * terms and conditions of the copyright.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
-#include "libslirp.h"
 
 inline void
 insque(void *a, void *b)
diff --git a/slirp/ncsi.c b/slirp/ncsi.c
index 8594382270..327f17543c 100644
--- a/slirp/ncsi.c
+++ b/slirp/ncsi.c
@@ -6,7 +6,6 @@
  * This code is licensed under the GPL version 2 or later. See the
  * COPYING file in the top-level directory.
  */
-#include "qemu/osdep.h"
 #include "slirp.h"
 
 #include "ncsi-pkt.h"
diff --git a/slirp/ndp_table.c b/slirp/ndp_table.c
index b7b73722f7..34ea4fdf1f 100644
--- a/slirp/ndp_table.c
+++ b/slirp/ndp_table.c
@@ -3,8 +3,6 @@
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
  */
 
-#include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "slirp.h"
 
 void ndp_table_add(Slirp *slirp, struct in6_addr ip_addr,
diff --git a/slirp/sbuf.c b/slirp/sbuf.c
index c83e4dd8ed..51a9f0cc7d 100644
--- a/slirp/sbuf.c
+++ b/slirp/sbuf.c
@@ -5,7 +5,6 @@
  * terms and conditions of the copyright.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 
 static void sbappendsb(struct sbuf *sb, struct mbuf *m);
diff --git a/slirp/slirp.c b/slirp/slirp.c
index ec1f606d72..730b78255c 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -21,8 +21,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "slirp.h"
 
 #ifdef WITH_QEMU
diff --git a/slirp/socket.c b/slirp/socket.c
index 2e8dc22fb6..dea201f5ce 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -5,8 +5,6 @@
  * terms and conditions of the copyright.
  */
 
-#include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "slirp.h"
 #include "ip_icmp.h"
 #ifdef __sun__
diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
index 7c1fe18fec..864da7d857 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -38,7 +38,6 @@
  * terms and conditions of the copyright.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 #include "ip_icmp.h"
 
diff --git a/slirp/tcp_output.c b/slirp/tcp_output.c
index 6dd1ecf5d9..2b4335eb34 100644
--- a/slirp/tcp_output.c
+++ b/slirp/tcp_output.c
@@ -38,7 +38,6 @@
  * terms and conditions of the copyright.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 
 static const u_char  tcp_outflags[TCP_NSTATES] = {
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index d8846a33b0..879a7dcd29 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -38,7 +38,6 @@
  * terms and conditions of the copyright.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 
 /* patchable/settable parameters for tcp */
diff --git a/slirp/tcp_timer.c b/slirp/tcp_timer.c
index a843e57a2b..703907eb37 100644
--- a/slirp/tcp_timer.c
+++ b/slirp/tcp_timer.c
@@ -30,7 +30,6 @@
  * tcp_timer.c,v 1.2 1994/08/02 07:49:10 davidg Exp
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 
 static struct tcpcb *tcp_timers(register struct tcpcb *tp, int timer);
diff --git a/slirp/tftp.c b/slirp/tftp.c
index 5c31886190..2d8f978786 100644
--- a/slirp/tftp.c
+++ b/slirp/tftp.c
@@ -22,9 +22,11 @@
  * THE SOFTWARE.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
-#include "qemu-common.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 
 static inline int tftp_session_in_use(struct tftp_session *spt)
 {
diff --git a/slirp/udp.c b/slirp/udp.c
index 3915971b50..ac42be0d8e 100644
--- a/slirp/udp.c
+++ b/slirp/udp.c
@@ -38,7 +38,6 @@
  * terms and conditions of the copyright.
  */
 
-#include "qemu/osdep.h"
 #include "slirp.h"
 #include "ip_icmp.h"
 
diff --git a/slirp/udp6.c b/slirp/udp6.c
index fa531e03c4..be5cba1f54 100644
--- a/slirp/udp6.c
+++ b/slirp/udp6.c
@@ -3,8 +3,6 @@
  * Guillaume Subiron
  */
 
-#include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "slirp.h"
 #include "udp.h"
 #include "dhcpv6.h"
diff --git a/slirp/util.h b/slirp/util.h
index ef75804560..4963747aef 100644
--- a/slirp/util.h
+++ b/slirp/util.h
@@ -48,6 +48,27 @@
 # define SLIRP_PACKED __attribute__((packed))
 #endif
 
+#ifndef DIV_ROUND_UP
+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+#endif
+
+#ifndef container_of
+#define container_of(ptr, type, member) __extension__ ({    \
+    void *__mptr = (void *)(ptr);               \
+    ((type *)(__mptr - offsetof(type, member))); })
+#endif
+
+#if defined(_WIN32) /* CONFIG_IOVEC */
+# if !defined(IOV_MAX) /* XXX: to avoid duplicate with QEMU osdep.h */
+struct iovec {
+    void *iov_base;
+    size_t iov_len;
+};
+# endif
+#else
+#include <sys/uio.h>
+#endif
+
 #define SCALE_MS 1000000
 
 #define ETH_ALEN    6
-- 
2.20.1

  parent reply	other threads:[~2019-02-07 14:04 UTC|newest]

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

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=20190207140316.16103-26-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.