netfron typedef cleanup
cover netfron typedef cleanup
Here's a short series to do typedef cleanup of netfront. This touches the xen public interface headers (but leaves the typedef) to facilitate easier sharing with Linux. There's more of this type of cleanup in the patchqueue, but wanted to see how these were received before spending more time on it. It doesn't deal with the guest handle yet. And as a tiny bonus, it's got the last bit of proc removal from netfront ;-)
thanks,
-chris
--
PATCH 1/5 arch-x86_32/64.h: separate typedef from structure definition
This makes sharing the file with Linux easier, as the typedefs won't be accepted.
--- xen/include/public/arch-x86_32.h | 32 +++++++++++++++++++------------- xen/include/public/arch-x86_64.h | 27 ++++++++++++++++----------- 2 files changed, 35 insertions(+), 24 deletions(-)
xen/include/public/arch-x86_32.h +19 -13
@@ -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 arch_shared_info arch_shared_info_t ; -typedef struct { +struct arch_vcpu_info {unsigned long cr2;unsigned long pad[5 ];/* sizeof(vcpu_info_t) == 64 */ -}arch_vcpu_info_t ; +}; +typedef struct arch_vcpu_info arch_vcpu_info_t ; -typedef struct { +struct xen_callback {unsigned long cs;unsigned long eip; -}xen_callback_t ; +}; +typedef struct xen_callback xen_callback_t ;#endif /* !__ASSEMBLY__ */
xen/include/public/arch-x86_64.h +16 -11
@@ -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 arch_shared_info arch_shared_info_t ; -typedef struct { +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 ;
--
Re: [patch 1/5] arch-x86_32/64.h: separate typedef from structure definition
Quoted 4 lines · Chris Wright
This makes sharing the file with Linux easier, as the typedefs won't be accepted.
Signed-off-by Chris Wright <[email protected]>
I'll take these, but I'd like a patch that makes this style change for every one of our public headers so that their overall style is self consistent.
-- Keir
Re: [patch 1/5] arch-x86_32/64.h: separate typedef from structure definition
Quoted 9 lines · * Keir Fraser ([email protected]) wrote:
Quoted 4 lines · Chris Wright
This makes sharing the file with Linux easier, as the typedefs won't be accepted.
Signed-off-by Chris Wright <[email protected]>I'll take these, but I'd like a patch that makes this style change for every one of our public headers so that their overall style is self consistent.
Certainly, just wanted to make sure you'd take the change before I did them all. Will do the rest later today.
thanks,
-chris
PATCH 1/1 separate typedef from structure definition in Xen public headers
In reply to Keir FraserThis finishes separating the typedefs from structure definitions in the Xen public header (didn't test ia64, but it's patched).
--- xen/include/public/acm_ops.h | 5 xen/include/public/arch-ia64.h | 81 ++++++++------ xen/include/public/callback.h | 10 + xen/include/public/dom0_ops.h | 203 +++++++++++++++++++++--------------- xen/include/public/event_channel.h | 99 +++++++++-------- xen/include/public/grant_table.h | 30 +++-- xen/include/public/hvm/ioreq.h | 26 ++-- xen/include/public/hvm/vmx_assist.h | 5 xen/include/public/io/blkif.h | 12 +- xen/include/public/io/tpmif.h | 19 +-- xen/include/public/memory.h | 20 ++- xen/include/public/nmi.h | 5 xen/include/public/physdev.h | 45 ++++--- xen/include/public/sched.h | 15 +- xen/include/public/vcpu.h | 10 + xen/include/public/version.h | 15 +- xen/include/public/xenoprof.h | 15 +- 17 files changed, 360 insertions(+), 255 deletions(-)
xen/include/public/acm_ops.h +3 -2
@@ -72,7 +72,7 @@ struct acm_getdecision {int acm_decision;/* out */ }; -typedef struct acm_op { +struct acm_op {uint32_t cmd;uint32_t interface_version;/* ACM_INTERFACE_VERSION */ union {
@@ -82,7 +82,8 @@ typedef struct acm_op {struct acm_getssid getssid; struct acm_getdecision getdecision; } u; -} acm_op_t; +}; +typedef struct acm_op acm_op_t ;DEFINE_XEN_GUEST_HANDLE (acm_op_t);#endif /* __XEN_PUBLIC_ACM_OPS_H__ */
xen/include/public/arch-ia64.h +46 -35
146 lines not on this page · raw message
xen/include/public/callback.h +6 -4
@@ -32,10 +32,11 @@* Register a callback. */ #define CALLBACKOP_register 0 -typedef struct callback_register { +struct callback_register {int type;xen_callback_t address; -}callback_register_t ; +}; +typedef struct callback_register callback_register_t ;DEFINE_XEN_GUEST_HANDLE (callback_register_t);/*
@@ -45,9 +46,10 @@ DEFINE_XEN_GUEST_HANDLE(callback_registe* you attempt to unregister such a callback. */ #define CALLBACKOP_unregister 1 -typedef struct callback_unregister { +struct callback_unregister {int type; -}callback_unregister_t ; +}; +typedef struct callback_unregister callback_unregister_t ;DEFINE_XEN_GUEST_HANDLE (callback_unregister_t);#endif /* __XEN_PUBLIC_CALLBACK_H__ */
xen/include/public/dom0_ops.h +122 -81
517 lines not on this page · raw message
xen/include/public/event_channel.h +55 -44
193 lines not on this page · raw message
xen/include/public/grant_table.h +18 -12
@@ -71,7 +71,7 @@* [XEN]: This field is written by Xen and read by the sharing guest. * [GST]: This field is written by the guest and read by Xen. */ -typedef struct grant_entry { +struct grant_entry {/* GTF_xxx: various type and flag information. [XEN,GST] */ uint16_t flags;/* The domain being granted foreign privileges. [GST] */
@@ -81,7 +81,8 @@ typedef struct grant_entry {* GTF_accept_transfer: Frame whose ownership transferred by @domid. [XEN] */ uint32_t frame; -} grant_entry_t; +}; +typedef struct grant_entry grant_entry_t ;/* * Type of grant entry.
@@ -156,7 +157,7 @@ typedef uint32_t grant_handle_t;* to be accounted to the correct grant reference! */ #define GNTTABOP_map_grant_ref 0 -typedef struct gnttab_map_grant_ref { +struct gnttab_map_grant_ref {/* IN parameters. */ uint64_t host_addr;uint32_t flags;/* GNTMAP_* */
@@ -166,7 +167,8 @@ typedef struct gnttab_map_grant_ref {int16_t status;/* GNTST_* */ grant_handle_t handle;uint64_t dev_bus_addr; -} gnttab_map_grant_ref_t; +}; +typedef struct gnttab_map_grant_ref gnttab_map_grant_ref_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_map_grant_ref_t);/*
@@ -181,14 +183,15 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_map_grant* mappings will remain in the device or host TLBs. */ #define GNTTABOP_unmap_grant_ref 1 -typedef struct gnttab_unmap_grant_ref { +struct gnttab_unmap_grant_ref {/* IN parameters. */ uint64_t host_addr;uint64_t dev_bus_addr;grant_handle_t handle;/* OUT parameters. */ int16_t status;/* GNTST_* */ -}gnttab_unmap_grant_ref_t ; +}; +typedef struct gnttab_unmap_grant_ref gnttab_unmap_grant_ref_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_unmap_grant_ref_t);/*
@@ -201,14 +204,15 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_gra* 3. Xen may not support more than a single grant-table page per domain. */ #define GNTTABOP_setup_table 2 -typedef struct gnttab_setup_table { +struct gnttab_setup_table {/* IN parameters. */ domid_t dom;uint32_t nr_frames;/* OUT parameters. */ int16_t status;/* GNTST_* */ XEN_GUEST_HANDLE (ulong) frame_list; -}gnttab_setup_table_t ; +}; +typedef struct gnttab_setup_table gnttab_setup_table_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_setup_table_t);/*
@@ -216,12 +220,13 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_setup_tab* xen console. Debugging use only. */ #define GNTTABOP_dump_table 3 -typedef struct gnttab_dump_table { +struct gnttab_dump_table {/* IN parameters. */ domid_t dom;/* OUT parameters. */ int16_t status;/* GNTST_* */ -}gnttab_dump_table_t ; +}; +typedef struct gnttab_dump_table gnttab_dump_table_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_dump_table_t);/*
@@ -233,14 +238,15 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_dump_tabl* to the calling domain *unless* the error is GNTST_bad_page. */ #define GNTTABOP_transfer 4 -typedef struct gnttab_transfer { +struct gnttab_transfer {/* IN parameters. */ unsigned long mfn;domid_t domid;grant_ref_t ref;/* OUT parameters. */ int16_t status; -}gnttab_transfer_t ; +}; +typedef struct gnttab_transfer gnttab_transfer_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_transfer_t);/*
xen/include/public/hvm/ioreq.h +15 -11
@@ -41,7 +41,7 @@* prepare this structure and notify service OS and DM by sending * virq */ -typedef struct { +struct ioreq {uint64_t addr;/* physical address */ uint64_t size;/* size in bytes */ uint64_t count;/* for rep prefixes */
@@ -55,31 +55,35 @@ typedef struct { uint8_t df:1;uint8_t type;/* I/O type */ uint64_t io_count; /* How many IO done on a vcpu */ -} ioreq_t; +}; +typedef struct ioreq ioreq_t ;#define MAX_VECTOR 256#define BITS_PER_BYTE 8#define INTR_LEN (MAX_VECTOR/(BITS_PER_BYTE * sizeof(uint64_t)))#define INTR_LEN_32 (MAX_VECTOR/(BITS_PER_BYTE * sizeof(uint32_t))) -typedef struct { +struct global_iodata {uint16_t pic_elcr;uint16_t pic_irr;uint16_t pic_last_irr;uint16_t pic_clear_irr; -}global_iodata_t ; +}; +typedef struct global_iodata global_iodata_t ; -typedef struct { -ioreq_t vp_ioreq; +struct vcpu_iodata { +struct ioreq vp_ioreq;/* Event channel port */ unsigned int vp_eport;/* VMX vcpu uses this to notify DM */ unsigned int dm_eport;/* DM uses this to notify VMX vcpu */ -}vcpu_iodata_t ; +}; +typedef struct vcpu_iodata vcpu_iodata_t ; -typedef struct { -global_iodata_t sp_global; -vcpu_iodata_t vcpu_iodata[1 ]; -}shared_iopage_t ; +struct shared_iopage { +struct global_iodata sp_global; +struct vcpu_iodata vcpu_iodata[1 ]; +}; +typedef struct shared_iopage shared_iopage_t ;#endif /* _IOREQ_H_ */
xen/include/public/hvm/vmx_assist.h +3 -2
@@ -37,7 +37,7 @@ union vmcs_arbytes {/* * World switch state */ -typedef struct vmx_assist_context { +struct vmx_assist_context {uint32_t eip;/* execution pointer */ uint32_t esp;/* stack pointer */ uint32_t eflags;/* flags register */
@@ -80,7 +80,8 @@ typedef struct vmx_assist_context {uint32_t ldtr_limit;uint32_t ldtr_base; union vmcs_arbytes ldtr_arbytes; -} vmx_assist_context_t; +}; +typedef struct vmx_assist_context vmx_assist_context_t ;#endif /* __ASSEMBLY__ */
xen/include/public/io/blkif.h +7 -5
@@ -39,7 +39,7 @@*/ #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 -typedef struct blkif_request { +struct blkif_request {uint8_t operation;/* BLKIF_OP_??? */ uint8_t nr_segments;/* number of segments */ blkif_vdev_t handle;/* only for read/write requests */
@@ -51,13 +51,15 @@ typedef struct blkif_request {/* @last_sect: last sector in frame to transfer (inclusive). */ uint8_t first_sect, last_sect; } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST ]; -} blkif_request_t; +}; +typedef struct blkif_request blkif_request_t ; -typedef struct blkif_response { +struct blkif_response {uint64_t id;/* copied from request */ uint8_t operation;/* copied from request */ int16_t status;/* BLKIF_RSP_??? */ -}blkif_response_t ; +}; +typedef struct blkif_response blkif_response_t ;#define BLKIF_RSP_ERROR -1/* non-specific 'error' */ #define BLKIF_RSP_OKAY 0/* non-specific 'okay' */
@@ -66,7 +68,7 @@ typedef struct blkif_response {* Generate blkif ring structures and types. */ -DEFINE_RING_TYPES (blkif, blkif_request_t, blkif_response_t); +DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);#define VDISK_CDROM 0x1#define VDISK_REMOVABLE 0x2
xen/include/public/io/tpmif.h +11 -8
@@ -18,12 +18,13 @@#include "../grant_table.h" -typedef struct { +struct tpmif_tx_request {unsigned long addr;/* Machine address of packet. */ grant_ref_t ref;/* grant table access reference */ uint16_t unused;uint16_t size;/* Packet size in bytes. */ -}tpmif_tx_request_t ; +}; +typedef struct tpmif_tx_request tpmif_tx_request_t ;/* * The TPMIF_TX_RING_SIZE defines the number of pages the
@@ -35,13 +36,15 @@ typedef uint32_t TPMIF_RING_IDX;/* This structure must fit in a memory page. */ -typedef struct { -tpmif_tx_request_t req; -}tpmif_ring_t ; +struct tpmif_ring { +struct tpmif_tx_request req; +}; +typedef struct tpmif_ring tpmif_ring_t ; -typedef struct { -tpmif_ring_t ring[TPMIF_TX_RING_SIZE ]; -}tpmif_tx_interface_t ; +struct tpmif_tx_interface { +struct tpmif_ring ring[TPMIF_TX_RING_SIZE ]; +}; +typedef struct tpmif_tx_interface tpmif_tx_interface_t ;#endif
xen/include/public/memory.h +12 -8
@@ -17,7 +17,7 @@#define XENMEM_increase_reservation 0#define XENMEM_decrease_reservation 1#define XENMEM_populate_physmap 6 -typedef struct xen_memory_reservation { +struct xen_memory_reservation {/* * XENMEM_increase_reservation:
@@ -49,7 +49,8 @@ typedef struct xen_memory_reservation {*/ domid_t domid; -} xen_memory_reservation_t; +}; +typedef struct xen_memory_reservation xen_memory_reservation_t ;DEFINE_XEN_GUEST_HANDLE (xen_memory_reservation_t);/*
@@ -74,7 +75,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_memory_reser* arg == addr of xen_machphys_mfn_list_t. */ #define XENMEM_machphys_mfn_list 5 -typedef struct xen_machphys_mfn_list { +struct xen_machphys_mfn_list {/* * Size of the 'extent_start' array. Fewer entries will be filled if the * machphys table is smaller than max_extents * 2MB.
@@ -93,7 +94,8 @@ typedef struct xen_machphys_mfn_list {* than 'max_extents' if the machphys table is smaller than max_e * 2MB. */ unsigned int nr_extents; -} xen_machphys_mfn_list_t; +}; +typedef struct xen_machphys_mfn_list xen_machphys_mfn_list_t ;DEFINE_XEN_GUEST_HANDLE (xen_machphys_mfn_list_t);/*
@@ -102,7 +104,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn* arg == addr of xen_add_to_physmap_t. */ #define XENMEM_add_to_physmap 7 -typedef struct xen_add_to_physmap { +struct xen_add_to_physmap {/* Which domain to change the mapping for. */ domid_t domid;
@@ -116,7 +118,8 @@ typedef struct xen_add_to_physmap {/* GPFN where the source mapping page should appear. */ unsigned long gpfn; -} xen_add_to_physmap_t; +}; +typedef struct xen_add_to_physmap xen_add_to_physmap_t ;DEFINE_XEN_GUEST_HANDLE (xen_add_to_physmap_t);/*
@@ -124,7 +127,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_add_to_physm* code on failure. This call only works for auto-translated guests. */ #define XENMEM_translate_gpfn_list 8 -typedef struct xen_translate_gpfn_list { +struct xen_translate_gpfn_list {/* Which domain to translate for? */ domid_t domid;
@@ -139,7 +142,8 @@ typedef struct xen_translate_gpfn_list {* list (in which case each input GPFN is overwritten with the output MFN). */ XEN_GUEST_HANDLE(ulong) mfn_list; -} xen_translate_gpfn_list_t; +}; +typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t ;DEFINE_XEN_GUEST_HANDLE (xen_translate_gpfn_list_t);#endif /* __XEN_PUBLIC_MEMORY_H__ */
xen/include/public/nmi.h +3 -2
@@ -34,10 +34,11 @@* arg == pointer to xennmi_callback structure. */ #define XENNMI_register_callback 0 -typedef struct xennmi_callback { +struct xennmi_callback {unsigned long handler_address;unsigned long pad; -}xennmi_callback_t ; +}; +typedef struct xennmi_callback xennmi_callback_t ;DEFINE_XEN_GUEST_HANDLE (xennmi_callback_t);/*
xen/include/public/physdev.h +26 -19
110 lines not on this page · raw message
xen/include/public/sched.h +9 -6
@@ -46,9 +46,10 @@* @arg == pointer to sched_shutdown structure. */ #define SCHEDOP_shutdown 2 -typedef struct sched_shutdown { +struct sched_shutdown {unsigned int reason;/* SHUTDOWN_* */ -}sched_shutdown_t ; +}; +typedef struct sched_shutdown sched_shutdown_t ;DEFINE_XEN_GUEST_HANDLE (sched_shutdown_t);/*
@@ -57,11 +58,12 @@ DEFINE_XEN_GUEST_HANDLE(sched_shutdown_t* @arg == pointer to sched_poll structure. */ #define SCHEDOP_poll 3 -typedef struct sched_poll { +struct sched_poll {XEN_GUEST_HANDLE (evtchn_port_t) ports;unsigned int nr_ports;uint64_t timeout; -}sched_poll_t ; +}; +typedef struct sched_poll sched_poll_t ;DEFINE_XEN_GUEST_HANDLE (sched_poll_t);/*
@@ -71,10 +73,11 @@ DEFINE_XEN_GUEST_HANDLE(sched_poll_t);* @arg == pointer to sched_remote_shutdown structure. */ #define SCHEDOP_remote_shutdown 4 -typedef struct sched_remote_shutdown { +struct sched_remote_shutdown {domid_t domain_id;/* Remote domain ID */ unsigned int reason;/* SHUTDOWN_xxx reason */ -}sched_remote_shutdown_t ; +}; +typedef struct sched_remote_shutdown sched_remote_shutdown_t ;DEFINE_XEN_GUEST_HANDLE (sched_remote_shutdown_t);/*
xen/include/public/vcpu.h +6 -4
@@ -56,7 +56,7 @@* @extra_arg == pointer to vcpu_runstate_info structure. */ #define VCPUOP_get_runstate_info 4 -typedef struct vcpu_runstate_info { +struct vcpu_runstate_info {/* VCPU's current state (RUNSTATE_*). */ int state;/* When was current state entered (system time, ns)? */
@@ -66,7 +66,8 @@ typedef struct vcpu_runstate_info {* guaranteed not to drift from system time. */ uint64_t time[4 ]; -} vcpu_runstate_info_t; +}; +typedef struct vcpu_runstate_info vcpu_runstate_info_t ;/* VCPU is currently running on a physical CPU. */ #define RUNSTATE_running 0
@@ -99,12 +100,13 @@ typedef struct vcpu_runstate_info {* @extra_arg == pointer to vcpu_register_runstate_memory_area structure. */ #define VCPUOP_register_runstate_memory_area 5 -typedef struct vcpu_register_runstate_memory_area { +struct vcpu_register_runstate_memory_area {union {struct vcpu_runstate_info *v;uint64_t p; } addr; -}vcpu_register_runstate_memory_area_t ; +}; +typedef struct vcpu_register_runstate_memory_area vcpu_register_runstate_memory_area_t ;#endif /* __XEN_PUBLIC_VCPU_H__ */
xen/include/public/version.h +9 -6
@@ -22,12 +22,13 @@ typedef char xen_extraversion_t[16];/* arg == xen_compile_info_t. */ #define XENVER_compile_info 2 -typedef struct xen_compile_info { +struct xen_compile_info {char compiler[64 ];char compile_by[16 ];char compile_domain[32 ];char compile_date[32 ]; -}xen_compile_info_t ; +}; +typedef struct xen_compile_info xen_compile_info_t ;#define XENVER_capabilities 3typedef char xen_capabilities_info_t [1024 ];
@@ -38,15 +39,17 @@ typedef char xen_changeset_info_t[64];#define XEN_CHANGESET_INFO_LEN (sizeof(xen_changeset_info_t))#define XENVER_platform_parameters 5 -typedef struct xen_platform_parameters { +struct xen_platform_parameters {unsigned long virt_start; -}xen_platform_parameters_t ; +}; +typedef struct xen_platform_parameters xen_platform_parameters_t ;#define XENVER_get_features 6 -typedef struct xen_feature_info { +struct xen_feature_info {unsigned int submap_idx;/* IN: which 32-bit submap to return */ uint32_t submap;/* OUT: 32-bit submap */ -}xen_feature_info_t ; +}; +typedef struct xen_feature_info xen_feature_info_t ;/* Declares the features reported by XENVER_get_features. */ #include "features.h"
xen/include/public/xenoprof.h +9 -6
@@ -41,7 +41,7 @@ struct event_log { };/* Xenoprof buffer shared between Xen and domain - 1 per VCPU */ -typedef struct xenoprof_buf { +struct xenoprof_buf {uint32_t event_head;uint32_t event_tail;uint32_t event_size;
@@ -51,10 +51,11 @@ typedef struct xenoprof_buf {uint64_t user_samples;uint64_t lost_samples;struct event_log event_log[1 ]; -} xenoprof_buf_t; +}; +typedef struct xenoprof_buf xenoprof_buf_t ;DEFINE_XEN_GUEST_HANDLE (xenoprof_buf_t); -typedef struct xenoprof_init { +struct xenoprof_init {int32_t max_samples;int32_t num_events;int32_t is_primary;
@@ -62,10 +63,11 @@ typedef struct xenoprof_init {int32_t bufsize;uint64_t buf_maddr;char cpu_type[XENOPROF_CPU_TYPE_SIZE ]; -} xenoprof_init_t; +}; +typedef struct xenoprof_init xenoprof_init_t ;DEFINE_XEN_GUEST_HANDLE (xenoprof_init_t); -typedef struct xenoprof_counter { +struct xenoprof_counter {uint32_t ind;uint64_t count;uint32_t enabled;
@@ -74,7 +76,8 @@ typedef struct xenoprof_counter {uint32_t kernel;uint32_t user;uint64_t unit_mask; -} xenoprof_counter_t; +}; +typedef struct xenoprof_counter xenoprof_counter_t ;DEFINE_XEN_GUEST_HANDLE (xenoprof_counter_t);
PATCH 2/5 public/xen.h: separate typedef from stucture definition
In reply to Chris WrightThis makes sharing the file with Linux easier, as the typedefs won't be accepted.
--- xen/include/public/xen.h | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-)
xen/include/public/xen.h +25 -18
@@ -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 */ +};/* 32 bytes */ +typedef struct vcpu_time_info vcpu_time_info_t ; -typedef struct vcpu_info { +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; +struct arch_shared_info arch; -} shared_info_t; +}; +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? */
--
PATCH 3/5 netif: separate typedef from struct definition
In reply to Chris WrightThis makes sharing the file with Linux easier, as the typedefs in things like netfront/netback code won't be accepted.
--- xen/include/public/io/netif.h | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
xen/include/public/io/netif.h +18 -14
@@ -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
--
PATCH 4/5 netfront: remove use of typedefs for structures
In reply to Chris Wrightremove use of typedefs for structures.
--- linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-)
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +15 -15
@@ -65,8 +65,8 @@#define GRANT_INVALID_REF 0 -#define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE) -#define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE) +#define NET_TX_RING_SIZE __RING_SIZE((struct netif_tx_sring *)0, PAGE_SIZE) +#define NET_RX_RING_SIZE __RING_SIZE((struct netif_rx_sring *)0, PAGE_SIZE)static inline void init_skb_shinfo (struct sk_buff *skb) {
@@ -81,8 +81,8 @@ struct netfront_info {struct net_device_stats stats; -netif_tx_front_ring_t tx; -netif_rx_front_ring_t rx; +struct netif_tx_front_ring tx; +struct netif_rx_front_ring rx;spinlock_t tx_lock;spinlock_t rx_lock;
@@ -124,8 +124,8 @@ struct netfront_info {u8 mac[ETH_ALEN ];unsigned long rx_pfn_array[NET_RX_RING_SIZE ]; -multicall_entry_t rx_mcl[NET_RX_RING_SIZE +1 ]; -mmu_update_t rx_mmu[NET_RX_RING_SIZE ]; +struct multicall_entry rx_mcl[NET_RX_RING_SIZE +1 ]; +struct mmu_update rx_mmu[NET_RX_RING_SIZE ]; };/*
@@ -318,8 +318,8 @@ again:static int setup_device (struct xenbus_device *dev,struct netfront_info *info) { -netif_tx_sring_t *txs; -netif_rx_sring_t *rxs; +struct netif_tx_sring *txs; +struct netif_rx_sring *rxs;int err;struct net_device *netdev = info->netdev;
@@ -329,13 +329,13 @@ static int setup_device(struct xenbus_de info->tx.sring =NULL ; info->irq =0 ; - txs = (netif_tx_sring_t *)__get_free_page (GFP_KERNEL ); + txs = (struct netif_tx_sring *)__get_free_page (GFP_KERNEL );if (!txs) { err = -ENOMEM ;xenbus_dev_fatal (dev, err,"allocating tx ring page" ); goto fail; } - rxs = (netif_rx_sring_t *)__get_free_page (GFP_KERNEL ); + rxs = (struct netif_rx_sring *)__get_free_page (GFP_KERNEL );if (!rxs) { err = -ENOMEM ;xenbus_dev_fatal (dev, err,"allocating rx ring page" );
@@ -639,7 +639,7 @@ static int network_start_xmit(struct sk_ {unsigned short id;struct netfront_info *np =netdev_priv (dev); -netif_tx_request_t *tx; +struct netif_tx_request *tx;RING_IDX i;grant_ref_t ref;unsigned long mfn;
@@ -737,10 +737,10 @@ static int netif_poll(struct net_device {struct netfront_info *np =netdev_priv (dev);struct sk_buff *skb, *nskb; -netif_rx_response_t *rx; +struct netif_rx_response *rx;RING_IDX i, rp; -mmu_update_t *mmu = np->rx_mmu; -multicall_entry_t *mcl = np->rx_mcl; +struct mmu_update *mmu = np->rx_mmu; +struct multicall_entry *mcl = np->rx_mcl;int work_done, budget, more_to_do =1 ;struct sk_buff_head rxq;unsigned long flags;
@@ -963,7 +963,7 @@ static void network_connect(struct net_d {struct netfront_info *np;int i, requeue_idx; -netif_tx_request_t *tx; +struct netif_tx_request *tx;struct sk_buff *skb; np =netdev_priv (dev);
--
PATCH 5/5 netfront: last bit of proc cleanup
In reply to Chris WrightRemove extra include from netfront after proc cleanup.
--- linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 1 - 1 file changed, 1 deletion(-)
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +0 -1
@@ -43,7 +43,6 @@#include <linux/skbuff.h> #include <linux/init.h> #include <linux/bitops.h> -#include <linux/proc_fs.h> #include <linux/ethtool.h> #include <linux/in.h> #include <net/sock.h>
--