mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-29 14:37:36 +00:00
treewide: remove unnecessary unnamed structs/unions
According to the syntax defined in C99, each struct/union field must have an identifier. This patch removes unnamed struct/union fields that can be easily expressed in a C99-compatible way. Here is a summary of structs/unions removed. struct vhm_request: union { uint32_t type; uint32_t type; int32_t reserved0[16]; => int32_t reserved0[15]; }; struct vhm_request_buffer: struct vhm_request_buffer { union { union vhm_request_buffer { struct vhm_request ...; => struct vhm_request ...; int8_t reserved[4096]; int8_t reserved[4096]; } } } Signed-off-by: Junjie Mao <junjie.mao@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
parent
b9660eb9d6
commit
ef3cb5ba1c
@ -157,11 +157,9 @@ struct vhm_request {
|
||||
int32_t processed;
|
||||
} __aligned(256);
|
||||
|
||||
struct vhm_request_buffer {
|
||||
union {
|
||||
struct vhm_request req_queue[VHM_REQUEST_MAX];
|
||||
int8_t reserved[4096];
|
||||
};
|
||||
union vhm_request_buffer {
|
||||
struct vhm_request req_queue[VHM_REQUEST_MAX];
|
||||
int8_t reserved[4096];
|
||||
} __aligned(4096);
|
||||
|
||||
/**
|
||||
|
@ -291,9 +291,9 @@ int dm_emulate_mmio_post(struct vcpu *vcpu)
|
||||
{
|
||||
int ret = 0;
|
||||
int cur = vcpu->vcpu_id;
|
||||
struct vhm_request_buffer *req_buf;
|
||||
union vhm_request_buffer *req_buf;
|
||||
|
||||
req_buf = (struct vhm_request_buffer *)(vcpu->vm->sw.io_shared_page);
|
||||
req_buf = (union vhm_request_buffer *)(vcpu->vm->sw.io_shared_page);
|
||||
|
||||
vcpu->req.reqs.mmio_request.value =
|
||||
req_buf->req_queue[cur].reqs.mmio_request.value;
|
||||
|
@ -34,12 +34,12 @@ int dm_emulate_pio_post(struct vcpu *vcpu)
|
||||
{
|
||||
int cur = vcpu->vcpu_id;
|
||||
int cur_context = vcpu->arch_vcpu.cur_context;
|
||||
struct vhm_request_buffer *req_buf = NULL;
|
||||
union vhm_request_buffer *req_buf = NULL;
|
||||
uint32_t mask =
|
||||
0xFFFFFFFFul >> (32 - 8 * vcpu->req.reqs.pio_request.size);
|
||||
uint64_t *rax;
|
||||
|
||||
req_buf = (struct vhm_request_buffer *)(vcpu->vm->sw.io_shared_page);
|
||||
req_buf = (union vhm_request_buffer *)(vcpu->vm->sw.io_shared_page);
|
||||
|
||||
rax = &vcpu->arch_vcpu.contexts[cur_context].guest_cpu_regs.regs.rax;
|
||||
vcpu->req.reqs.pio_request.value =
|
||||
|
@ -353,9 +353,9 @@ static void complete_request(struct vcpu *vcpu)
|
||||
* mark ioreq done and don't resume vcpu.
|
||||
*/
|
||||
if (vcpu->state == VCPU_ZOMBIE) {
|
||||
struct vhm_request_buffer *req_buf;
|
||||
union vhm_request_buffer *req_buf;
|
||||
|
||||
req_buf = (struct vhm_request_buffer *)
|
||||
req_buf = (union vhm_request_buffer *)
|
||||
vcpu->vm->sw.io_shared_page;
|
||||
req_buf->req_queue[vcpu->vcpu_id].valid = false;
|
||||
atomic_store(&vcpu->ioreq_pending, 0);
|
||||
@ -382,7 +382,7 @@ static void complete_request(struct vcpu *vcpu)
|
||||
int64_t hcall_notify_req_finish(uint64_t vmid, uint64_t vcpu_id)
|
||||
{
|
||||
int64_t ret = 0;
|
||||
struct vhm_request_buffer *req_buf;
|
||||
union vhm_request_buffer *req_buf;
|
||||
struct vhm_request *req;
|
||||
struct vcpu *vcpu;
|
||||
struct vm *target_vm = get_vm_from_vmid(vmid);
|
||||
@ -397,7 +397,7 @@ int64_t hcall_notify_req_finish(uint64_t vmid, uint64_t vcpu_id)
|
||||
vcpu = vcpu_from_vid(target_vm, vcpu_id);
|
||||
ASSERT(vcpu != NULL, "Failed to get VCPU context.");
|
||||
|
||||
req_buf = (struct vhm_request_buffer *)target_vm->sw.io_shared_page;
|
||||
req_buf = (union vhm_request_buffer *)target_vm->sw.io_shared_page;
|
||||
req = req_buf->req_queue + vcpu_id;
|
||||
|
||||
if (req->valid &&
|
||||
|
@ -57,7 +57,7 @@ static void acrn_print_request(int vcpu_id, struct vhm_request *req)
|
||||
|
||||
int acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req)
|
||||
{
|
||||
struct vhm_request_buffer *req_buf = NULL;
|
||||
union vhm_request_buffer *req_buf = NULL;
|
||||
long cur;
|
||||
|
||||
ASSERT(sizeof(*req) == (4096/VHM_REQUEST_MAX),
|
||||
@ -67,7 +67,7 @@ int acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req)
|
||||
if (!vcpu || !req || vcpu->vm->sw.io_shared_page == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
req_buf = (struct vhm_request_buffer *)(vcpu->vm->sw.io_shared_page);
|
||||
req_buf = (union vhm_request_buffer *)(vcpu->vm->sw.io_shared_page);
|
||||
|
||||
/* ACRN insert request to VHM and inject upcall */
|
||||
cur = vcpu->vcpu_id;
|
||||
@ -146,7 +146,7 @@ static void _get_req_info_(struct vhm_request *req, int *id, char *type,
|
||||
int get_req_info(char *str, int str_max)
|
||||
{
|
||||
int i, len, size = str_max, client_id;
|
||||
struct vhm_request_buffer *req_buf;
|
||||
union vhm_request_buffer *req_buf;
|
||||
struct vhm_request *req;
|
||||
char type[16], state[16], dir[16];
|
||||
long addr, val;
|
||||
@ -161,7 +161,7 @@ int get_req_info(char *str, int str_max)
|
||||
spinlock_obtain(&vm_list_lock);
|
||||
list_for_each(pos, &vm_list) {
|
||||
vm = list_entry(pos, struct vm, list);
|
||||
req_buf = (struct vhm_request_buffer *)vm->sw.io_shared_page;
|
||||
req_buf = (union vhm_request_buffer *)vm->sw.io_shared_page;
|
||||
if (req_buf) {
|
||||
for (i = 0; i < VHM_REQUEST_MAX; i++) {
|
||||
req = req_buf->req_queue + i;
|
||||
|
@ -110,10 +110,9 @@ struct pci_request {
|
||||
/* vhm_request are 256Bytes aligned */
|
||||
struct vhm_request {
|
||||
/* offset: 0bytes - 63bytes */
|
||||
union {
|
||||
uint32_t type;
|
||||
int32_t reserved0[16];
|
||||
};
|
||||
uint32_t type;
|
||||
int32_t reserved0[15];
|
||||
|
||||
/* offset: 64bytes-127bytes */
|
||||
union {
|
||||
struct pio_request pio_request;
|
||||
@ -138,11 +137,9 @@ struct vhm_request {
|
||||
int32_t processed;
|
||||
} __aligned(256);
|
||||
|
||||
struct vhm_request_buffer {
|
||||
union {
|
||||
struct vhm_request req_queue[VHM_REQUEST_MAX];
|
||||
int8_t reserved[4096];
|
||||
};
|
||||
union vhm_request_buffer {
|
||||
struct vhm_request req_queue[VHM_REQUEST_MAX];
|
||||
int8_t reserved[4096];
|
||||
} __aligned(4096);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user