include/qemu/iov.h: Don't include qemu-common.h
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>
This commit is contained in:
		
							parent
							
								
									6f061ea10f
								
							
						
					
					
						commit
						daf015ef5a
					
				@ -15,6 +15,8 @@
 | 
				
			|||||||
#ifndef QEMU_RAW_AIO_H
 | 
					#ifndef QEMU_RAW_AIO_H
 | 
				
			||||||
#define QEMU_RAW_AIO_H
 | 
					#define QEMU_RAW_AIO_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "qemu/iov.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* AIO request types */
 | 
					/* AIO request types */
 | 
				
			||||||
#define QEMU_AIO_READ         0x0001
 | 
					#define QEMU_AIO_READ         0x0001
 | 
				
			||||||
#define QEMU_AIO_WRITE        0x0002
 | 
					#define QEMU_AIO_WRITE        0x0002
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@
 | 
				
			|||||||
#define BLOCK_H
 | 
					#define BLOCK_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "block/aio.h"
 | 
					#include "block/aio.h"
 | 
				
			||||||
#include "qemu-common.h"
 | 
					#include "qemu/iov.h"
 | 
				
			||||||
#include "qemu/option.h"
 | 
					#include "qemu/option.h"
 | 
				
			||||||
#include "qemu/coroutine.h"
 | 
					#include "qemu/coroutine.h"
 | 
				
			||||||
#include "block/accounting.h"
 | 
					#include "block/accounting.h"
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,7 @@
 | 
				
			|||||||
#define HW_MAC_DBDMA_H 1
 | 
					#define HW_MAC_DBDMA_H 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "exec/memory.h"
 | 
					#include "exec/memory.h"
 | 
				
			||||||
 | 
					#include "qemu/iov.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct DBDMA_io DBDMA_io;
 | 
					typedef struct DBDMA_io DBDMA_io;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -26,6 +26,7 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "hw/qdev.h"
 | 
					#include "hw/qdev.h"
 | 
				
			||||||
 | 
					#include "qemu/iov.h"
 | 
				
			||||||
#include "qemu/queue.h"
 | 
					#include "qemu/queue.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Constants related to the USB / PCI interaction */
 | 
					/* Constants related to the USB / PCI interaction */
 | 
				
			||||||
 | 
				
			|||||||
@ -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) \
 | 
					#define qemu_co_send(sockfd, buf, bytes) \
 | 
				
			||||||
  qemu_co_send_recv(sockfd, buf, bytes, true)
 | 
					  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);
 | 
					bool buffer_is_zero(const void *buf, size_t len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qemu_progress_init(int enabled, float min_skip);
 | 
					void qemu_progress_init(int enabled, float min_skip);
 | 
				
			||||||
 | 
				
			|||||||
@ -14,8 +14,6 @@
 | 
				
			|||||||
#ifndef IOV_H
 | 
					#ifndef IOV_H
 | 
				
			||||||
#define IOV_H
 | 
					#define IOV_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "qemu-common.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * count and return data size, in bytes, of an iovec
 | 
					 * count and return data size, in bytes, of an iovec
 | 
				
			||||||
 * starting at `iov' of `iov_cnt' number of elements.
 | 
					 * 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 iov_discard_back(struct iovec *iov, unsigned int *iov_cnt,
 | 
				
			||||||
                        size_t bytes);
 | 
					                        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
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -13,6 +13,8 @@
 | 
				
			|||||||
#ifndef BLOCK_BACKEND_H
 | 
					#ifndef BLOCK_BACKEND_H
 | 
				
			||||||
#define BLOCK_BACKEND_H
 | 
					#define BLOCK_BACKEND_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "qemu/iov.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * TODO Have to include block/block.h for a bunch of block layer
 | 
					 * TODO Have to include block/block.h for a bunch of block layer
 | 
				
			||||||
 * types.  Unfortunately, this pulls in the whole BlockDriverState
 | 
					 * types.  Unfortunately, this pulls in the whole BlockDriverState
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,7 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "qemu/osdep.h"
 | 
					#include "qemu/osdep.h"
 | 
				
			||||||
 | 
					#include "qemu-common.h"
 | 
				
			||||||
#include "qemu/iov.h"
 | 
					#include "qemu/iov.h"
 | 
				
			||||||
#include "qemu/sockets.h"
 | 
					#include "qemu/sockets.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user