qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PULL 05/29] include/qemu/iov.h: Don't include qemu-common.h
Date: Tue, 22 Mar 2016 15:16:45 +0100	[thread overview]
Message-ID: <1458656229-32043-6-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1458656229-32043-1-git-send-email-pbonzini@redhat.com>

From: Markus Armbruster <armbru@redhat.com>

qemu-common.h should only be included by .c files.  Its file comment
explains why: "No header file should depend on qemu-common.h, as this
would easily lead to circular header dependencies."

qemu/iov.h includes qemu-common.h for QEMUIOVector stuff.  Move all
that to qemu/iov.h and drop the ill-advised include.  Include
qemu/iov.h where the QEMUIOVector stuff is now missing.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/raw-aio.h                |  2 ++
 include/block/block.h          |  2 +-
 include/hw/ppc/mac_dbdma.h     |  1 +
 include/hw/usb.h               |  1 +
 include/qemu-common.h          | 28 ----------------------------
 include/qemu/iov.h             | 30 ++++++++++++++++++++++++++++--
 include/sysemu/block-backend.h |  2 ++
 util/iov.c                     |  1 +
 8 files changed, 36 insertions(+), 31 deletions(-)

diff --git a/block/raw-aio.h b/block/raw-aio.h
index 31d791f..811e375 100644
--- a/block/raw-aio.h
+++ b/block/raw-aio.h
@@ -15,6 +15,8 @@
 #ifndef QEMU_RAW_AIO_H
 #define QEMU_RAW_AIO_H
 
+#include "qemu/iov.h"
+
 /* AIO request types */
 #define QEMU_AIO_READ         0x0001
 #define QEMU_AIO_WRITE        0x0002
diff --git a/include/block/block.h b/include/block/block.h
index 01349ef..47e80bc 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -2,7 +2,7 @@
 #define BLOCK_H
 
 #include "block/aio.h"
-#include "qemu-common.h"
+#include "qemu/iov.h"
 #include "qemu/option.h"
 #include "qemu/coroutine.h"
 #include "block/accounting.h"
diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h
index c687021..0cce4e8 100644
--- a/include/hw/ppc/mac_dbdma.h
+++ b/include/hw/ppc/mac_dbdma.h
@@ -23,6 +23,7 @@
 #define HW_MAC_DBDMA_H 1
 
 #include "exec/memory.h"
+#include "qemu/iov.h"
 
 typedef struct DBDMA_io DBDMA_io;
 
diff --git a/include/hw/usb.h b/include/hw/usb.h
index c8b6e7b..163fe04 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -26,6 +26,7 @@
  */
 
 #include "hw/qdev.h"
+#include "qemu/iov.h"
 #include "qemu/queue.h"
 
 /* Constants related to the USB / PCI interaction */
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 2de4ce2..b8fbd9e 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -364,34 +364,6 @@ ssize_t qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send);
 #define qemu_co_send(sockfd, buf, bytes) \
   qemu_co_send_recv(sockfd, buf, bytes, true)
 
-typedef struct QEMUIOVector {
-    struct iovec *iov;
-    int niov;
-    int nalloc;
-    size_t size;
-} QEMUIOVector;
-
-void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint);
-void qemu_iovec_init_external(QEMUIOVector *qiov, struct iovec *iov, int niov);
-void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len);
-void qemu_iovec_concat(QEMUIOVector *dst,
-                       QEMUIOVector *src, size_t soffset, size_t sbytes);
-size_t qemu_iovec_concat_iov(QEMUIOVector *dst,
-                             struct iovec *src_iov, unsigned int src_cnt,
-                             size_t soffset, size_t sbytes);
-bool qemu_iovec_is_zero(QEMUIOVector *qiov);
-void qemu_iovec_destroy(QEMUIOVector *qiov);
-void qemu_iovec_reset(QEMUIOVector *qiov);
-size_t qemu_iovec_to_buf(QEMUIOVector *qiov, size_t offset,
-                         void *buf, size_t bytes);
-size_t qemu_iovec_from_buf(QEMUIOVector *qiov, size_t offset,
-                           const void *buf, size_t bytes);
-size_t qemu_iovec_memset(QEMUIOVector *qiov, size_t offset,
-                         int fillc, size_t bytes);
-ssize_t qemu_iovec_compare(QEMUIOVector *a, QEMUIOVector *b);
-void qemu_iovec_clone(QEMUIOVector *dest, const QEMUIOVector *src, void *buf);
-void qemu_iovec_discard_back(QEMUIOVector *qiov, size_t bytes);
-
 bool buffer_is_zero(const void *buf, size_t len);
 
 void qemu_progress_init(int enabled, float min_skip);
diff --git a/include/qemu/iov.h b/include/qemu/iov.h
index 2847551..bd9fd55 100644
--- a/include/qemu/iov.h
+++ b/include/qemu/iov.h
@@ -14,8 +14,6 @@
 #ifndef IOV_H
 #define IOV_H
 
-#include "qemu-common.h"
-
 /**
  * count and return data size, in bytes, of an iovec
  * starting at `iov' of `iov_cnt' number of elements.
@@ -138,4 +136,32 @@ size_t iov_discard_front(struct iovec **iov, unsigned int *iov_cnt,
 size_t iov_discard_back(struct iovec *iov, unsigned int *iov_cnt,
                         size_t bytes);
 
+typedef struct QEMUIOVector {
+    struct iovec *iov;
+    int niov;
+    int nalloc;
+    size_t size;
+} QEMUIOVector;
+
+void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint);
+void qemu_iovec_init_external(QEMUIOVector *qiov, struct iovec *iov, int niov);
+void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len);
+void qemu_iovec_concat(QEMUIOVector *dst,
+                       QEMUIOVector *src, size_t soffset, size_t sbytes);
+size_t qemu_iovec_concat_iov(QEMUIOVector *dst,
+                             struct iovec *src_iov, unsigned int src_cnt,
+                             size_t soffset, size_t sbytes);
+bool qemu_iovec_is_zero(QEMUIOVector *qiov);
+void qemu_iovec_destroy(QEMUIOVector *qiov);
+void qemu_iovec_reset(QEMUIOVector *qiov);
+size_t qemu_iovec_to_buf(QEMUIOVector *qiov, size_t offset,
+                         void *buf, size_t bytes);
+size_t qemu_iovec_from_buf(QEMUIOVector *qiov, size_t offset,
+                           const void *buf, size_t bytes);
+size_t qemu_iovec_memset(QEMUIOVector *qiov, size_t offset,
+                         int fillc, size_t bytes);
+ssize_t qemu_iovec_compare(QEMUIOVector *a, QEMUIOVector *b);
+void qemu_iovec_clone(QEMUIOVector *dest, const QEMUIOVector *src, void *buf);
+void qemu_iovec_discard_back(QEMUIOVector *qiov, size_t bytes);
+
 #endif
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 70f4eaf..c62b6fe 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -13,6 +13,8 @@
 #ifndef BLOCK_BACKEND_H
 #define BLOCK_BACKEND_H
 
+#include "qemu/iov.h"
+
 /*
  * TODO Have to include block/block.h for a bunch of block layer
  * types.  Unfortunately, this pulls in the whole BlockDriverState
diff --git a/util/iov.c b/util/iov.c
index 062f4e5..b69e4b7 100644
--- a/util/iov.c
+++ b/util/iov.c
@@ -17,6 +17,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu/iov.h"
 #include "qemu/sockets.h"
 
-- 
2.5.0

  parent reply	other threads:[~2016-03-22 14:17 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22 14:16 [Qemu-devel] [PULL 00/29] Miscellaneous changes for 2016-03-22 Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 01/29] include/qemu/osdep.h: Don't include qapi/error.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 02/29] Use scripts/clean-includes to drop redundant qemu/typedefs.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 03/29] Clean up includes some more Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 04/29] fw_cfg: Split fw_cfg_keys.h off fw_cfg.h Paolo Bonzini
2016-03-22 14:16 ` Paolo Bonzini [this message]
2016-03-22 14:16 ` [Qemu-devel] [PULL 06/29] include/hw/hw.h: Don't include qemu-common.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 07/29] hw/pci/pci.h: " Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 08/29] Move HOST_LONG_BITS from qemu-common.h to qemu/osdep.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 09/29] Move QEMU_ALIGN_*() " Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 10/29] Move ParallelIOArg from qemu-common.h to sysemu/char.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 11/29] isa: Move DMA_transfer_handler from qemu-common.h to hw/isa/isa.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 12/29] include/crypto: Include qapi-types.h or qemu/bswap.h instead of qemu-common.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 13/29] hw: explicitly include qemu-common.h and cpu.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 14/29] Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 15/29] util: move declarations out of qemu-common.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 16/29] tcg: pass down TranslationBlock to tcg_code_gen Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 17/29] qemu-log: correct help text for -d cpu Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 18/29] qemu-log: Avoid function call for disabled qemu_log_mask logging Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 19/29] qemu-log: Improve the "exec" TB execution logging Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 20/29] qemu-log: new option -dfilter to limit output Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 21/29] qemu-log: dfilter-ise exec, out_asm, op and opt_op Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 22/29] target-arm: dfilter support for in_asm Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 23/29] qemu-log: support simple pid substitution for logs Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 24/29] cputlb: modernise the debug support Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 25/29] exec: fix error handling in file_ram_alloc Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 26/29] char: translate from QIOChannel error to errno Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 27/29] char: ensure all clients are in non-blocking mode Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 28/29] config.status: Pass extra parameters Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 29/29] target-i386: implement PKE for TCG Paolo Bonzini
2016-03-22 20:27 ` [Qemu-devel] [PULL 00/29] Miscellaneous changes for 2016-03-22 Peter Maydell
2016-03-22 21:26   ` Paolo Bonzini

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=1458656229-32043-6-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.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).