qemu/queue.h: leave head structs anonymous unless necessary

Most list head structs need not be given a name.  In most cases the
name is given just in case one is going to use QTAILQ_LAST, QTAILQ_PREV
or reverse iteration, but this does not apply to lists of other kinds,
and even for QTAILQ in practice this is only rarely needed.  In addition,
we will soon reimplement those macros completely so that they do not
need a name for the head struct.  So clean up everything, not giving a
name except in the rare case where it is necessary.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini
2019-01-11 15:46:55 +01:00
parent 10ca76b4d2
commit b58deb344d
41 changed files with 59 additions and 65 deletions
+2 -2
View File
@@ -86,7 +86,7 @@ struct KVMState
int robust_singlestep; int robust_singlestep;
int debugregs; int debugregs;
#ifdef KVM_CAP_SET_GUEST_DEBUG #ifdef KVM_CAP_SET_GUEST_DEBUG
struct kvm_sw_breakpoint_head kvm_sw_breakpoints; QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;
#endif #endif
int many_ioeventfds; int many_ioeventfds;
int intx_set_mask; int intx_set_mask;
@@ -102,7 +102,7 @@ struct KVMState
int nr_allocated_irq_routes; int nr_allocated_irq_routes;
unsigned long *used_gsi_bitmap; unsigned long *used_gsi_bitmap;
unsigned int gsi_count; unsigned int gsi_count;
QTAILQ_HEAD(msi_hashtab, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE]; QTAILQ_HEAD(, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE];
#endif #endif
KVMMemoryListener memory_listener; KVMMemoryListener memory_listener;
QLIST_HEAD(, KVMParkedVcpu) kvm_parked_vcpus; QLIST_HEAD(, KVMParkedVcpu) kvm_parked_vcpus;
+1 -1
View File
@@ -72,7 +72,7 @@ typedef struct ListElement {
GlfsPreopened saved; GlfsPreopened saved;
} ListElement; } ListElement;
static QLIST_HEAD(glfs_list, ListElement) glfs_list; static QLIST_HEAD(, ListElement) glfs_list;
static QemuOptsList qemu_gluster_create_opts = { static QemuOptsList qemu_gluster_create_opts = {
.name = "qemu-gluster-create-opts", .name = "qemu-gluster-create-opts",
+1 -1
View File
@@ -72,7 +72,7 @@ typedef struct MirrorBlockJob {
unsigned long *in_flight_bitmap; unsigned long *in_flight_bitmap;
int in_flight; int in_flight;
int64_t bytes_in_flight; int64_t bytes_in_flight;
QTAILQ_HEAD(MirrorOpList, MirrorOp) ops_in_flight; QTAILQ_HEAD(, MirrorOp) ops_in_flight;
int ret; int ret;
bool unmap; bool unmap;
int target_cluster_size; int target_cluster_size;
+1 -3
View File
@@ -77,8 +77,6 @@ typedef struct Qcow2BitmapTable {
uint32_t size; /* number of 64bit entries */ uint32_t size; /* number of 64bit entries */
QSIMPLEQ_ENTRY(Qcow2BitmapTable) entry; QSIMPLEQ_ENTRY(Qcow2BitmapTable) entry;
} Qcow2BitmapTable; } Qcow2BitmapTable;
typedef QSIMPLEQ_HEAD(Qcow2BitmapTableList, Qcow2BitmapTable)
Qcow2BitmapTableList;
typedef struct Qcow2Bitmap { typedef struct Qcow2Bitmap {
Qcow2BitmapTable table; Qcow2BitmapTable table;
@@ -1316,7 +1314,7 @@ void qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, Error **errp)
int ret; int ret;
Qcow2BitmapList *bm_list; Qcow2BitmapList *bm_list;
Qcow2Bitmap *bm; Qcow2Bitmap *bm;
Qcow2BitmapTableList drop_tables; QSIMPLEQ_HEAD(, Qcow2BitmapTable) drop_tables;
Qcow2BitmapTable *tb, *tb_next; Qcow2BitmapTable *tb, *tb_next;
if (!bdrv_has_changed_persistent_bitmaps(bs)) { if (!bdrv_has_changed_persistent_bitmaps(bs)) {
+4 -1
View File
@@ -278,7 +278,10 @@ typedef struct BDRVQcow2State {
QEMUTimer *cache_clean_timer; QEMUTimer *cache_clean_timer;
unsigned cache_clean_interval; unsigned cache_clean_interval;
QLIST_HEAD(QCowClusterAlloc, QCowL2Meta) cluster_allocs; uint8_t *cluster_cache;
uint8_t *cluster_data;
uint64_t cluster_cache_offset;
QLIST_HEAD(, QCowL2Meta) cluster_allocs;
uint64_t *refcount_table; uint64_t *refcount_table;
uint64_t refcount_table_offset; uint64_t refcount_table_offset;
+3 -3
View File
@@ -391,12 +391,12 @@ struct BDRVSheepdogState {
uint32_t aioreq_seq_num; uint32_t aioreq_seq_num;
/* Every aio request must be linked to either of these queues. */ /* Every aio request must be linked to either of these queues. */
QLIST_HEAD(inflight_aio_head, AIOReq) inflight_aio_head; QLIST_HEAD(, AIOReq) inflight_aio_head;
QLIST_HEAD(failed_aio_head, AIOReq) failed_aio_head; QLIST_HEAD(, AIOReq) failed_aio_head;
CoMutex queue_lock; CoMutex queue_lock;
CoQueue overlapping_queue; CoQueue overlapping_queue;
QLIST_HEAD(inflight_aiocb_head, SheepdogAIOCB) inflight_aiocb_head; QLIST_HEAD(, SheepdogAIOCB) inflight_aiocb_head;
}; };
typedef struct BDRVSheepdogReopenState { typedef struct BDRVSheepdogReopenState {
+1 -1
View File
@@ -398,7 +398,7 @@ typedef struct BDRVVHDXState {
bool log_replayed_on_open; bool log_replayed_on_open;
QLIST_HEAD(VHDXRegionHead, VHDXRegionEntry) regions; QLIST_HEAD(, VHDXRegionEntry) regions;
} BDRVVHDXState; } BDRVVHDXState;
void vhdx_guid_generate(MSGUID *guid); void vhdx_guid_generate(MSGUID *guid);
+1 -1
View File
@@ -2266,7 +2266,7 @@ void qmp_transaction(TransactionActionList *dev_list,
BlkActionState *state, *next; BlkActionState *state, *next;
Error *local_err = NULL; Error *local_err = NULL;
QSIMPLEQ_HEAD(snap_bdrv_states, BlkActionState) snap_bdrv_states; QSIMPLEQ_HEAD(, BlkActionState) snap_bdrv_states;
QSIMPLEQ_INIT(&snap_bdrv_states); QSIMPLEQ_INIT(&snap_bdrv_states);
/* Does this transaction get canceled as a group on failure? /* Does this transaction get canceled as a group on failure?
+1 -3
View File
@@ -46,9 +46,7 @@ typedef struct IvshmemClientPeer {
int vectors[IVSHMEM_CLIENT_MAX_VECTORS]; /**< one fd per vector */ int vectors[IVSHMEM_CLIENT_MAX_VECTORS]; /**< one fd per vector */
unsigned vectors_count; /**< number of vectors */ unsigned vectors_count; /**< number of vectors */
} IvshmemClientPeer; } IvshmemClientPeer;
QTAILQ_HEAD(IvshmemClientPeerList, IvshmemClientPeer);
typedef struct IvshmemClientPeerList IvshmemClientPeerList;
typedef struct IvshmemClient IvshmemClient; typedef struct IvshmemClient IvshmemClient;
/** /**
@@ -73,7 +71,7 @@ struct IvshmemClient {
int sock_fd; /**< unix sock filedesc */ int sock_fd; /**< unix sock filedesc */
int shm_fd; /**< shm file descriptor */ int shm_fd; /**< shm file descriptor */
IvshmemClientPeerList peer_list; /**< list of peers */ QTAILQ_HEAD(, IvshmemClientPeer) peer_list; /**< list of peers */
IvshmemClientPeer local; /**< our own infos */ IvshmemClientPeer local; /**< our own infos */
IvshmemClientNotifCb notif_cb; /**< notification callback */ IvshmemClientNotifCb notif_cb; /**< notification callback */
+1 -4
View File
@@ -52,9 +52,6 @@ typedef struct IvshmemServerPeer {
EventNotifier vectors[IVSHMEM_SERVER_MAX_VECTORS]; /**< one per vector */ EventNotifier vectors[IVSHMEM_SERVER_MAX_VECTORS]; /**< one per vector */
unsigned vectors_count; /**< number of vectors */ unsigned vectors_count; /**< number of vectors */
} IvshmemServerPeer; } IvshmemServerPeer;
QTAILQ_HEAD(IvshmemServerPeerList, IvshmemServerPeer);
typedef struct IvshmemServerPeerList IvshmemServerPeerList;
/** /**
* Structure describing an ivshmem server * Structure describing an ivshmem server
@@ -72,7 +69,7 @@ typedef struct IvshmemServer {
unsigned n_vectors; /**< number of vectors */ unsigned n_vectors; /**< number of vectors */
uint16_t cur_id; /**< id to be given to next client */ uint16_t cur_id; /**< id to be given to next client */
bool verbose; /**< true in verbose mode */ bool verbose; /**< true in verbose mode */
IvshmemServerPeerList peer_list; /**< list of peers */ QTAILQ_HEAD(, IvshmemServerPeer) peer_list; /**< list of peers */
} IvshmemServer; } IvshmemServer;
/** /**
+1 -1
View File
@@ -3471,7 +3471,7 @@ typedef struct MapClient {
} MapClient; } MapClient;
QemuMutex map_client_list_lock; QemuMutex map_client_list_lock;
static QLIST_HEAD(map_client_list, MapClient) map_client_list static QLIST_HEAD(, MapClient) map_client_list
= QLIST_HEAD_INITIALIZER(map_client_list); = QLIST_HEAD_INITIALIZER(map_client_list);
static void cpu_unregister_map_client_do(MapClient *client) static void cpu_unregister_map_client_do(MapClient *client)
+1 -1
View File
@@ -18,7 +18,7 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/option.h" #include "qemu/option.h"
static QTAILQ_HEAD(FsDriverEntry_head, FsDriverListEntry) fsdriver_entries = static QTAILQ_HEAD(, FsDriverListEntry) fsdriver_entries =
QTAILQ_HEAD_INITIALIZER(fsdriver_entries); QTAILQ_HEAD_INITIALIZER(fsdriver_entries);
static FsDriverTable FsDrivers[] = { static FsDriverTable FsDrivers[] = {
+4 -4
View File
@@ -29,8 +29,8 @@ typedef struct NvmeSQueue {
uint64_t dma_addr; uint64_t dma_addr;
QEMUTimer *timer; QEMUTimer *timer;
NvmeRequest *io_req; NvmeRequest *io_req;
QTAILQ_HEAD(sq_req_list, NvmeRequest) req_list; QTAILQ_HEAD(, NvmeRequest) req_list;
QTAILQ_HEAD(out_req_list, NvmeRequest) out_req_list; QTAILQ_HEAD(, NvmeRequest) out_req_list;
QTAILQ_ENTRY(NvmeSQueue) entry; QTAILQ_ENTRY(NvmeSQueue) entry;
} NvmeSQueue; } NvmeSQueue;
@@ -45,8 +45,8 @@ typedef struct NvmeCQueue {
uint32_t size; uint32_t size;
uint64_t dma_addr; uint64_t dma_addr;
QEMUTimer *timer; QEMUTimer *timer;
QTAILQ_HEAD(sq_list, NvmeSQueue) sq_list; QTAILQ_HEAD(, NvmeSQueue) sq_list;
QTAILQ_HEAD(cq_req_list, NvmeRequest) req_list; QTAILQ_HEAD(, NvmeRequest) req_list;
} NvmeCQueue; } NvmeCQueue;
typedef struct NvmeNamespace { typedef struct NvmeNamespace {
+3 -3
View File
@@ -82,9 +82,9 @@ struct XenBlkDev {
int more_work; int more_work;
/* request lists */ /* request lists */
QLIST_HEAD(inflight_head, ioreq) inflight; QLIST_HEAD(, ioreq) inflight;
QLIST_HEAD(finished_head, ioreq) finished; QLIST_HEAD(, ioreq) finished;
QLIST_HEAD(freelist_head, ioreq) freelist; QLIST_HEAD(, ioreq) freelist;
int requests_total; int requests_total;
int requests_inflight; int requests_inflight;
int requests_finished; int requests_finished;
+1 -1
View File
@@ -35,7 +35,7 @@ typedef struct QEMUResetEntry {
void *opaque; void *opaque;
} QEMUResetEntry; } QEMUResetEntry;
static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers = static QTAILQ_HEAD(, QEMUResetEntry) reset_handlers =
QTAILQ_HEAD_INITIALIZER(reset_handlers); QTAILQ_HEAD_INITIALIZER(reset_handlers);
void qemu_register_reset(QEMUResetHandler *func, void *opaque) void qemu_register_reset(QEMUResetHandler *func, void *opaque)
+1 -1
View File
@@ -71,7 +71,7 @@ typedef struct MapCacheRev {
typedef struct MapCache { typedef struct MapCache {
MapCacheEntry *entry; MapCacheEntry *entry;
unsigned long nr_buckets; unsigned long nr_buckets;
QTAILQ_HEAD(map_cache_head, MapCacheRev) locked_entries; QTAILQ_HEAD(, MapCacheRev) locked_entries;
/* For most cases (>99.9%), the page address is the same. */ /* For most cases (>99.9%), the page address is the same. */
MapCacheEntry *last_entry; MapCacheEntry *last_entry;
+1 -1
View File
@@ -42,7 +42,7 @@ enum sPAPRTCEAccess {
#define IOMMU_PAGE_SIZE(shift) (1ULL << (shift)) #define IOMMU_PAGE_SIZE(shift) (1ULL << (shift))
#define IOMMU_PAGE_MASK(shift) (~(IOMMU_PAGE_SIZE(shift) - 1)) #define IOMMU_PAGE_MASK(shift) (~(IOMMU_PAGE_SIZE(shift) - 1))
static QLIST_HEAD(spapr_tce_tables, sPAPRTCETable) spapr_tce_tables; static QLIST_HEAD(, sPAPRTCETable) spapr_tce_tables;
sPAPRTCETable *spapr_tce_find_by_liobn(target_ulong liobn) sPAPRTCETable *spapr_tce_find_by_liobn(target_ulong liobn)
{ {
+2 -2
View File
@@ -119,11 +119,11 @@ struct EmulatedState {
char *db; char *db;
uint8_t atr[MAX_ATR_SIZE]; uint8_t atr[MAX_ATR_SIZE];
uint8_t atr_length; uint8_t atr_length;
QSIMPLEQ_HEAD(event_list, EmulEvent) event_list; QSIMPLEQ_HEAD(, EmulEvent) event_list;
QemuMutex event_list_mutex; QemuMutex event_list_mutex;
QemuThread event_thread_id; QemuThread event_thread_id;
VReader *reader; VReader *reader;
QSIMPLEQ_HEAD(guest_apdu_list, EmulEvent) guest_apdu_list; QSIMPLEQ_HEAD(, EmulEvent) guest_apdu_list;
QemuMutex vreader_mutex; /* and guest_apdu_list mutex */ QemuMutex vreader_mutex; /* and guest_apdu_list mutex */
QemuMutex handle_apdu_mutex; QemuMutex handle_apdu_mutex;
QemuCond handle_apdu_cond; QemuCond handle_apdu_cond;
+1 -1
View File
@@ -648,7 +648,7 @@ typedef struct USBNetState {
char usbstring_mac[13]; char usbstring_mac[13];
NICState *nic; NICState *nic;
NICConf conf; NICConf conf;
QTAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp; QTAILQ_HEAD(, rndis_response) rndis_resp;
} USBNetState; } USBNetState;
#define TYPE_USB_NET "usb-net" #define TYPE_USB_NET "usb-net"
+3 -3
View File
@@ -72,7 +72,7 @@ struct usbback_stub {
USBPort port; USBPort port;
unsigned int speed; unsigned int speed;
bool attached; bool attached;
QTAILQ_HEAD(submit_q_head, usbback_req) submit_q; QTAILQ_HEAD(, usbback_req) submit_q;
}; };
struct usbback_req { struct usbback_req {
@@ -108,8 +108,8 @@ struct usbback_info {
int num_ports; int num_ports;
int usb_ver; int usb_ver;
bool ring_error; bool ring_error;
QTAILQ_HEAD(req_free_q_head, usbback_req) req_free_q; QTAILQ_HEAD(, usbback_req) req_free_q;
QSIMPLEQ_HEAD(hotplug_q_head, usbback_hotplug) hotplug_q; QSIMPLEQ_HEAD(, usbback_hotplug) hotplug_q;
struct usbback_stub ports[USBBACK_MAXPORTS]; struct usbback_stub ports[USBBACK_MAXPORTS];
struct usbback_stub *addr_table[USB_DEV_ADDR_SIZE]; struct usbback_stub *addr_table[USB_DEV_ADDR_SIZE];
QEMUBH *bh; QEMUBH *bh;

Some files were not shown because too many files have changed in this diff Show More