Mailing List Archive

Place typedefs on their own separate lines in the Xen public headers.
# HG changeset patch
# User kaf24@firebug.cl.cam.ac.uk
# Node ID 093f8d333568cb77fb5fbb11a454b3195100b0ff
# Parent b736d3335641c0ca531d2e59695ebde4fac1bf8b
Place typedefs on their own separate lines in the Xen public headers.
Makes it easier to share with Linux tree.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
xen/include/public/arch-x86_32.h | 36 +++++++++++++++++------------
xen/include/public/arch-x86_64.h | 29 ++++++++++++++----------
xen/include/public/io/netif.h | 32 ++++++++++++++------------
xen/include/public/xen.h | 47 ++++++++++++++++++++++-----------------
4 files changed, 83 insertions(+), 61 deletions(-)

diff -r b736d3335641 -r 093f8d333568 xen/include/public/arch-x86_32.h
--- a/xen/include/public/arch-x86_32.h Fri May 19 15:35:19 2006 +0100
+++ b/xen/include/public/arch-x86_32.h Fri May 19 15:51:06 2006 +0100
@@ -95,15 +95,16 @@ DEFINE_XEN_GUEST_HANDLE(void);
#define TI_GET_IF(_ti) ((_ti)->flags & 4)
#define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
#define TI_SET_IF(_ti,_if) ((_ti)->flags |= ((!!(_if))<<2))
-typedef struct trap_info {
+struct trap_info {
uint8_t vector; /* exception vector */
uint8_t flags; /* 0-3: privilege level; 4: clear event enable? */
uint16_t cs; /* code selector */
unsigned long address; /* code offset */
-} trap_info_t;
+};
+typedef struct trap_info trap_info_t;
DEFINE_XEN_GUEST_HANDLE(trap_info_t);

-typedef struct cpu_user_regs {
+struct cpu_user_regs {
uint32_t ebx;
uint32_t ecx;
uint32_t edx;
@@ -124,7 +125,8 @@ typedef struct cpu_user_regs {
uint16_t ds, _pad3;
uint16_t fs, _pad4;
uint16_t gs, _pad5;
-} cpu_user_regs_t;
+};
+typedef struct cpu_user_regs cpu_user_regs_t;
DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);

typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
@@ -133,14 +135,14 @@ typedef uint64_t tsc_timestamp_t; /* RDT
* The following is all CPU context. Note that the fpu_ctxt block is filled
* in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
*/
-typedef struct vcpu_guest_context {
+struct vcpu_guest_context {
/* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */
struct { char x[512]; } fpu_ctxt; /* User-level FPU registers */
#define VGCF_I387_VALID (1<<0)
#define VGCF_HVM_GUEST (1<<1)
#define VGCF_IN_KERNEL (1<<2)
unsigned long flags; /* VGCF_* flags */
- cpu_user_regs_t user_regs; /* User-level CPU registers */
+ struct cpu_user_regs user_regs; /* User-level CPU registers */
struct trap_info trap_ctxt[256]; /* Virtual IDT */
unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */
unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
@@ -152,25 +154,29 @@ typedef struct vcpu_guest_context {
unsigned long failsafe_callback_cs; /* CS:EIP of failsafe callback */
unsigned long failsafe_callback_eip;
unsigned long vm_assist; /* VMASST_TYPE_* bitmap */
-} vcpu_guest_context_t;
+};
+typedef struct vcpu_guest_context vcpu_guest_context_t;
DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);

-typedef struct arch_shared_info {
+struct arch_shared_info {
unsigned long max_pfn; /* max pfn that appears in table */
/* Frame containing list of mfns containing list of mfns containing p2m. */
unsigned long pfn_to_mfn_frame_list_list;
unsigned long nmi_reason;
-} arch_shared_info_t;
-
-typedef struct {
+};
+typedef struct arch_shared_info arch_shared_info_t;
+
+struct arch_vcpu_info {
unsigned long cr2;
unsigned long pad[5]; /* sizeof(vcpu_info_t) == 64 */
-} arch_vcpu_info_t;
-
-typedef struct {
+};
+typedef struct arch_vcpu_info arch_vcpu_info_t;
+
+struct xen_callback {
unsigned long cs;
unsigned long eip;
-} xen_callback_t;
+};
+typedef struct xen_callback xen_callback_t;

#endif /* !__ASSEMBLY__ */

diff -r b736d3335641 -r 093f8d333568 xen/include/public/arch-x86_64.h
--- a/xen/include/public/arch-x86_64.h Fri May 19 15:35:19 2006 +0100
+++ b/xen/include/public/arch-x86_64.h Fri May 19 15:51:06 2006 +0100
@@ -150,12 +150,13 @@ struct iret_context {
#define TI_GET_IF(_ti) ((_ti)->flags & 4)
#define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
#define TI_SET_IF(_ti,_if) ((_ti)->flags |= ((!!(_if))<<2))
-typedef struct trap_info {
+struct trap_info {
uint8_t vector; /* exception vector */
uint8_t flags; /* 0-3: privilege level; 4: clear event enable? */
uint16_t cs; /* code selector */
unsigned long address; /* code offset */
-} trap_info_t;
+};
+typedef struct trap_info trap_info_t;
DEFINE_XEN_GUEST_HANDLE(trap_info_t);

#ifdef __GNUC__
@@ -166,7 +167,7 @@ DEFINE_XEN_GUEST_HANDLE(trap_info_t);
#define __DECL_REG(name) uint64_t r ## name
#endif

-typedef struct cpu_user_regs {
+struct cpu_user_regs {
uint64_t r15;
uint64_t r14;
uint64_t r13;
@@ -195,7 +196,8 @@ typedef struct cpu_user_regs {
uint16_t ds, _pad4[3];
uint16_t fs, _pad5[3]; /* Non-zero => takes precedence over fs_base. */
uint16_t gs, _pad6[3]; /* Non-zero => takes precedence over gs_base_usr. */
-} cpu_user_regs_t;
+};
+typedef struct cpu_user_regs cpu_user_regs_t;
DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);

#undef __DECL_REG
@@ -206,14 +208,14 @@ typedef uint64_t tsc_timestamp_t; /* RDT
* The following is all CPU context. Note that the fpu_ctxt block is filled
* in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
*/
-typedef struct vcpu_guest_context {
+struct vcpu_guest_context {
/* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */
struct { char x[512]; } fpu_ctxt; /* User-level FPU registers */
#define VGCF_I387_VALID (1<<0)
#define VGCF_HVM_GUEST (1<<1)
#define VGCF_IN_KERNEL (1<<2)
unsigned long flags; /* VGCF_* flags */
- cpu_user_regs_t user_regs; /* User-level CPU registers */
+ struct cpu_user_regs user_regs; /* User-level CPU registers */
struct trap_info trap_ctxt[256]; /* Virtual IDT */
unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */
unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
@@ -228,20 +230,23 @@ typedef struct vcpu_guest_context {
uint64_t fs_base;
uint64_t gs_base_kernel;
uint64_t gs_base_user;
-} vcpu_guest_context_t;
+};
+typedef struct vcpu_guest_context vcpu_guest_context_t;
DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);

-typedef struct arch_shared_info {
+struct arch_shared_info {
unsigned long max_pfn; /* max pfn that appears in table */
/* Frame containing list of mfns containing list of mfns containing p2m. */
unsigned long pfn_to_mfn_frame_list_list;
unsigned long nmi_reason;
-} arch_shared_info_t;
-
-typedef struct {
+};
+typedef struct arch_shared_info arch_shared_info_t;
+
+struct arch_vcpu_info {
unsigned long cr2;
unsigned long pad; /* sizeof(vcpu_info_t) == 64 */
-} arch_vcpu_info_t;
+};
+typedef struct arch_vcpu_info arch_vcpu_info_t;

typedef unsigned long xen_callback_t;

diff -r b736d3335641 -r 093f8d333568 xen/include/public/io/netif.h
--- a/xen/include/public/io/netif.h Fri May 19 15:35:19 2006 +0100
+++ b/xen/include/public/io/netif.h Fri May 19 15:51:06 2006 +0100
@@ -13,10 +13,10 @@
#include "../grant_table.h"

/*
- * Note that there is *never* any need to notify the backend when enqueuing
- * receive requests (netif_rx_request_t). Notifications after enqueuing any
- * other type of message should be conditional on the appropriate req_event
- * or rsp_event field in the shared ring.
+ * Note that there is *never* any need to notify the backend when
+ * enqueuing receive requests (struct netif_rx_request). Notifications
+ * after enqueuing any other type of message should be conditional on
+ * the appropriate req_event or rsp_event field in the shared ring.
*/

/* Protocol checksum field is blank in the packet (hardware offload)? */
@@ -27,23 +27,26 @@
#define _NETTXF_data_validated (1)
#define NETTXF_data_validated (1U<<_NETTXF_data_validated)

-typedef struct netif_tx_request {
+struct netif_tx_request {
grant_ref_t gref; /* Reference to buffer page */
uint16_t offset; /* Offset within buffer page */
uint16_t flags; /* NETTXF_* */
uint16_t id; /* Echoed in response message. */
uint16_t size; /* Packet size in bytes. */
-} netif_tx_request_t;
+};
+typedef struct netif_tx_request netif_tx_request_t;

-typedef struct netif_tx_response {
+struct netif_tx_response {
uint16_t id;
int16_t status; /* NETIF_RSP_* */
-} netif_tx_response_t;
+};
+typedef struct netif_tx_response netif_tx_response_t;

-typedef struct {
+struct netif_rx_request {
uint16_t id; /* Echoed in response message. */
grant_ref_t gref; /* Reference to incoming granted frame */
-} netif_rx_request_t;
+};
+typedef struct netif_rx_request netif_rx_request_t;

/* Packet data has been validated against protocol checksum. */
#define _NETRXF_data_validated (0)
@@ -53,19 +56,20 @@ typedef struct {
#define _NETRXF_csum_blank (1)
#define NETRXF_csum_blank (1U<<_NETRXF_csum_blank)

-typedef struct {
+struct netif_rx_response {
uint16_t id;
uint16_t offset; /* Offset in page of start of received packet */
uint16_t flags; /* NETRXF_* */
int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
-} netif_rx_response_t;
+};
+typedef struct netif_rx_response netif_rx_response_t;

/*
* Generate netif ring structures and types.
*/

-DEFINE_RING_TYPES(netif_tx, netif_tx_request_t, netif_tx_response_t);
-DEFINE_RING_TYPES(netif_rx, netif_rx_request_t, netif_rx_response_t);
+DEFINE_RING_TYPES(netif_tx, struct netif_tx_request, struct netif_tx_response);
+DEFINE_RING_TYPES(netif_rx, struct netif_rx_request, struct netif_rx_response);

#define NETIF_RSP_DROPPED -2
#define NETIF_RSP_ERROR -1
diff -r b736d3335641 -r 093f8d333568 xen/include/public/xen.h
--- a/xen/include/public/xen.h Fri May 19 15:35:19 2006 +0100
+++ b/xen/include/public/xen.h Fri May 19 15:51:06 2006 +0100
@@ -193,7 +193,7 @@
#define MMUEXT_NEW_USER_BASEPTR 15

#ifndef __ASSEMBLY__
-typedef struct mmuext_op {
+struct mmuext_op {
unsigned int cmd;
union {
/* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */
@@ -207,7 +207,8 @@ typedef struct mmuext_op {
/* TLB_FLUSH_MULTI, INVLPG_MULTI */
void *vcpumask;
} arg2;
-} mmuext_op_t;
+};
+typedef struct mmuext_op mmuext_op_t;
DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
#endif

@@ -271,20 +272,22 @@ typedef uint16_t domid_t;
* Send an array of these to HYPERVISOR_mmu_update().
* NB. The fields are natural pointer/address size for this architecture.
*/
-typedef struct mmu_update {
+struct mmu_update {
uint64_t ptr; /* Machine address of PTE. */
uint64_t val; /* New contents of PTE. */
-} mmu_update_t;
+};
+typedef struct mmu_update mmu_update_t;
DEFINE_XEN_GUEST_HANDLE(mmu_update_t);

/*
* Send an array of these to HYPERVISOR_multicall().
* NB. The fields are natural register size for this architecture.
*/
-typedef struct multicall_entry {
+struct multicall_entry {
unsigned long op, result;
unsigned long args[6];
-} multicall_entry_t;
+};
+typedef struct multicall_entry multicall_entry_t;
DEFINE_XEN_GUEST_HANDLE(multicall_entry_t);

/*
@@ -293,7 +296,7 @@ DEFINE_XEN_GUEST_HANDLE(multicall_entry_
*/
#define NR_EVENT_CHANNELS (sizeof(unsigned long) * sizeof(unsigned long) * 64)

-typedef struct vcpu_time_info {
+struct vcpu_time_info {
/*
* Updates to the following values are preceded and followed by an
* increment of 'version'. The guest can therefore detect updates by
@@ -317,9 +320,10 @@ typedef struct vcpu_time_info {
uint32_t tsc_to_system_mul;
int8_t tsc_shift;
int8_t pad1[3];
-} vcpu_time_info_t; /* 32 bytes */
-
-typedef struct vcpu_info {
+}; /* 32 bytes */
+typedef struct vcpu_time_info vcpu_time_info_t;
+
+struct vcpu_info {
/*
* 'evtchn_upcall_pending' is written non-zero by Xen to indicate
* a pending notification for a particular VCPU. It is then cleared
@@ -348,16 +352,17 @@ typedef struct vcpu_info {
uint8_t evtchn_upcall_pending;
uint8_t evtchn_upcall_mask;
unsigned long evtchn_pending_sel;
- arch_vcpu_info_t arch;
- vcpu_time_info_t time;
-} vcpu_info_t; /* 64 bytes (x86) */
+ struct arch_vcpu_info arch;
+ struct vcpu_time_info time;
+}; /* 64 bytes (x86) */
+typedef struct vcpu_info vcpu_info_t;

/*
* Xen/kernel shared data -- pointer provided in start_info.
* NB. We expect that this struct is smaller than a page.
*/
-typedef struct shared_info {
- vcpu_info_t vcpu_info[MAX_VIRT_CPUS];
+struct shared_info {
+ struct vcpu_info vcpu_info[MAX_VIRT_CPUS];

/*
* A domain can create "event channels" on which it can send and receive
@@ -401,9 +406,10 @@ typedef struct shared_info {
uint32_t wc_sec; /* Secs 00:00:00 UTC, Jan 1, 1970. */
uint32_t wc_nsec; /* Nsecs 00:00:00 UTC, Jan 1, 1970. */

- arch_shared_info_t arch;
-
-} shared_info_t;
+ struct arch_shared_info arch;
+
+};
+typedef struct shared_info shared_info_t;

/*
* Start-of-day memory layout for the initial domain (DOM0):
@@ -431,7 +437,7 @@ typedef struct shared_info {
*/

#define MAX_GUEST_CMDLINE 1024
-typedef struct start_info {
+struct start_info {
/* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */
char magic[32]; /* "xen-<version>-<platform>". */
unsigned long nr_pages; /* Total pages allocated to this domain. */
@@ -448,7 +454,8 @@ typedef struct start_info {
unsigned long mod_start; /* VIRTUAL address of pre-loaded module. */
unsigned long mod_len; /* Size (bytes) of pre-loaded module. */
int8_t cmd_line[MAX_GUEST_CMDLINE];
-} start_info_t;
+};
+typedef struct start_info start_info_t;

/* These flags are passed in the 'flags' field of start_info_t. */
#define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog