tools/xenpaging: remove typedefs
PATCH 1/1 tools/xenpaging: remove typedefs
As noted by Ian Jackson, use of types with names ending in _t is reserved to the C implementation (compiler and runtime). This series removes all typedefs from xenpaging code.
Changes:
xenpaging: convert xenpaging_victim_t to struct victim
xenpaging: convert xenpaging_t to struct xenpaging
xenpaging: convert mem_event_t to struct mem_event
tools/xenpaging/pagein.c | 2 - tools/xenpaging/policy.h | 4 +-- tools/xenpaging/policy_default.c | 4 +-- tools/xenpaging/xenpaging.c | 40 ++++++++++++++++++--------------------- tools/xenpaging/xenpaging.h | 16 +++++++-------- 5 files changed, 32 insertions(+), 34 deletions(-)
PATCH 1/1 xenpaging: convert xenpaging_victim_t to struct victim
# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1326125241 -3600
# Node ID dfcef53aa44f76b0dc13fa2acb012f4158da5c7b # Parent 3a22ed3ec534799b3cab55b0dc0a7380e701ecbe
xenpaging: convert xenpaging_victim_t to struct victim
tools/xenpaging/policy.h +1 -1
@@ -29,7 +29,7 @@int policy_init (xenpaging_t *paging); -int policy_choose_victim (xenpaging_t *paging,xenpaging_victim_t *victim); +int policy_choose_victim (xenpaging_t *paging,struct victim *victim);void policy_notify_paged_out (unsigned long gfn);void policy_notify_paged_in (unsigned long gfn);void policy_notify_paged_in_nomru (unsigned long gfn);
tools/xenpaging/policy_default.c +1 -1
@@ -77,7 +77,7 @@ int policy_init(xenpaging_t *paging)return rc; } -int policy_choose_victim (xenpaging_t *paging,xenpaging_victim_t *victim) +int policy_choose_victim (xenpaging_t *paging,struct victim *victim) {xc_interface *xch = paging->xc_handle;unsigned long wrap = current_gfn;
tools/xenpaging/xenpaging.c +5 -7
@@ -562,8 +562,7 @@ static void put_response(mem_event_t *meRING_PUSH_RESPONSES (back_ring); } -static int xenpaging_evict_page (xenpaging_t *paging, -xenpaging_victim_t *victim,int fd,int i) +static int xenpaging_evict_page (xenpaging_t *paging,struct victim *victim,int fd,int i) {xc_interface *xch = paging->xc_handle;void *page;
@@ -712,8 +711,7 @@ static void resume_pages(xenpaging_t *papage_in_trigger (); } -static int evict_victim (xenpaging_t *paging, -xenpaging_victim_t *victim,int fd,int i) +static int evict_victim (xenpaging_t *paging,struct victim *victim,int fd,int i) {xc_interface *xch = paging->xc_handle;int j =0 ;
@@ -756,7 +754,7 @@ static int evict_victim(xenpaging_t *pag }/* Evict a batch of pages and write them to a free slot in the paging file */ -static int evict_pages (xenpaging_t *paging,int fd,xenpaging_victim_t *victims,int num_pages) +static int evict_pages (xenpaging_t *paging,int fd,struct victim *victims,int num_pages) {xc_interface *xch = paging->xc_handle;int rc, slot, num =0 ;
@@ -783,7 +781,7 @@ int main(int argc, char *argv[]) {struct sigaction act;xenpaging_t *paging; -xenpaging_victim_t *victims; +struct victim *victims;mem_event_request_t req;mem_event_response_t rsp;int num, prev_num =0 ;
@@ -817,7 +815,7 @@ int main(int argc, char *argv[]) }/* Allocate upper limit of pages to allow growing and shrinking */ - victims =calloc (paging->max_pages,sizeof (xenpaging_victim_t)); + victims =calloc (paging->max_pages,sizeof (struct victim ));if ( !victims ) goto out;
tools/xenpaging/xenpaging.h +2 -2
@@ -57,10 +57,10 @@ typedef struct xenpaging { } xenpaging_t; -typedef struct xenpaging_victim { +struct victim {/* the gfn of the page to evict */ unsigned long gfn; -}xenpaging_victim_t ; +};extern void create_page_in_thread (xenpaging_t *paging);
PATCH 1/1 xenpaging: convert xenpaging_t to struct xenpaging
In reply to Olaf Hering# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1326125246 -3600
# Node ID de41b885dd70757c8a3a283e895d813c2f5e6744 # Parent dfcef53aa44f76b0dc13fa2acb012f4158da5c7b
xenpaging: convert xenpaging_t to struct xenpaging
tools/xenpaging/pagein.c +1 -1
@@ -61,7 +61,7 @@ void page_in_trigger(void)pthread_cond_signal (&page_in_cond); } -void create_page_in_thread (xenpaging_t *paging) +void create_page_in_thread (struct xenpaging *paging) { page_in_args.dom = paging->mem_event.domain_id; page_in_args.pagein_queue = paging->pagein_queue;
tools/xenpaging/policy.h +2 -2
@@ -28,8 +28,8 @@#include "xenpaging.h" -int policy_init (xenpaging_t *paging); -int policy_choose_victim (xenpaging_t *paging,struct victim *victim); +int policy_init (struct xenpaging *paging); +int policy_choose_victim (struct xenpaging *paging,struct victim *victim);void policy_notify_paged_out (unsigned long gfn);void policy_notify_paged_in (unsigned long gfn);void policy_notify_paged_in_nomru (unsigned long gfn);
tools/xenpaging/policy_default.c +2 -2
@@ -37,7 +37,7 @@ static unsigned long current_gfn;static unsigned long max_pages; -int policy_init (xenpaging_t *paging) +int policy_init (struct xenpaging *paging) {int i;int rc = -ENOMEM ;
@@ -77,7 +77,7 @@ int policy_init(xenpaging_t *paging)return rc; } -int policy_choose_victim (xenpaging_t *paging,struct victim *victim) +int policy_choose_victim (struct xenpaging *paging,struct victim *victim) {xc_interface *xch = paging->xc_handle;unsigned long wrap = current_gfn;
tools/xenpaging/xenpaging.c +15 -15
@@ -62,7 +62,7 @@ static void close_handler(int sig)unlink_pagefile (); } -static int xenpaging_mem_paging_flush_ioemu_cache (xenpaging_t *paging) +static int xenpaging_mem_paging_flush_ioemu_cache (struct xenpaging *paging) {struct xs_handle *xsh = paging->xs_handle;domid_t domain_id = paging->mem_event.domain_id;
@@ -76,7 +76,7 @@ static int xenpaging_mem_paging_flush_ioreturn rc == true ?0 :-1 ; } -static int xenpaging_wait_for_event_or_timeout (xenpaging_t *paging) +static int xenpaging_wait_for_event_or_timeout (struct xenpaging *paging) {xc_interface *xch = paging->xc_handle;xc_evtchn *xce = paging->mem_event.xce_handle;
@@ -164,7 +164,7 @@ err:return rc; } -static int xenpaging_get_tot_pages (xenpaging_t *paging) +static int xenpaging_get_tot_pages (struct xenpaging *paging) {xc_interface *xch = paging->xc_handle;xc_domaininfo_t domain_info;
@@ -219,7 +219,7 @@ static void usage(void)printf (" -h --help this output.\n" ); } -static int xenpaging_getopts (xenpaging_t *paging,int argc,char *argv[]) +static int xenpaging_getopts (struct xenpaging *paging,int argc,char *argv[]) {int ch;static const char sopts[] ="hvd:f:m:r:" ;
@@ -278,9 +278,9 @@ static int xenpaging_getopts(xenpaging_treturn 0 ; } -static xenpaging_t *xenpaging_init (int argc,char *argv[]) +static struct xenpaging *xenpaging_init (int argc,char *argv[]) { -xenpaging_t *paging; +struct xenpaging *paging;xc_domaininfo_t domain_info;xc_interface *xch =NULL ;xentoollog_logger *dbg =NULL ;
@@ -288,7 +288,7 @@ static xenpaging_t *xenpaging_init(int aint rc;/* Allocate memory */ - paging =calloc (1 ,sizeof (xenpaging_t)); + paging =calloc (1 ,sizeof (struct xenpaging ));if ( !paging ) goto err;
@@ -476,7 +476,7 @@ static xenpaging_t *xenpaging_init(int areturn NULL ; } -static int xenpaging_teardown (xenpaging_t *paging) +static int xenpaging_teardown (struct xenpaging *paging) {int rc;xc_interface *xch;
@@ -562,7 +562,7 @@ static void put_response(mem_event_t *meRING_PUSH_RESPONSES (back_ring); } -static int xenpaging_evict_page (xenpaging_t *paging,struct victim *victim,int fd,int i) +static int xenpaging_evict_page (struct xenpaging *paging,struct victim *victim,int fd,int i) {xc_interface *xch = paging->xc_handle;void *page;
@@ -613,7 +613,7 @@ static int xenpaging_evict_page(xenpaginreturn ret; } -static int xenpaging_resume_page (xenpaging_t *paging,mem_event_response_t *rsp,int notify_policy) +static int xenpaging_resume_page (struct xenpaging *paging,mem_event_response_t *rsp,int notify_policy) {int ret;
@@ -647,7 +647,7 @@ static int xenpaging_resume_page(xenpagireturn ret; } -static int xenpaging_populate_page (xenpaging_t *paging, +static int xenpaging_populate_page (struct xenpaging *paging,xen_pfn_t gfn,int fd,int i) {xc_interface *xch = paging->xc_handle;
@@ -691,7 +691,7 @@ static int xenpaging_populate_page(xenpa }/* Trigger a page-in for a batch of pages */ -static void resume_pages (xenpaging_t *paging,int num_pages) +static void resume_pages (struct xenpaging *paging,int num_pages) {xc_interface *xch = paging->xc_handle;int i, num =0 ;
@@ -711,7 +711,7 @@ static void resume_pages(xenpaging_t *papage_in_trigger (); } -static int evict_victim (xenpaging_t *paging,struct victim *victim,int fd,int i) +static int evict_victim (struct xenpaging *paging,struct victim *victim,int fd,int i) {xc_interface *xch = paging->xc_handle;int j =0 ;
@@ -754,7 +754,7 @@ static int evict_victim(xenpaging_t *pag }/* Evict a batch of pages and write them to a free slot in the paging file */ -static int evict_pages (xenpaging_t *paging,int fd,struct victim *victims,int num_pages) +static int evict_pages (struct xenpaging *paging,int fd,struct victim *victims,int num_pages) {xc_interface *xch = paging->xc_handle;int rc, slot, num =0 ;
@@ -780,7 +780,7 @@ static int evict_pages(xenpaging_t *pagiint main (int argc,char *argv[]) {struct sigaction act; -xenpaging_t *paging; +struct xenpaging *paging;struct victim *victims;mem_event_request_t req;mem_event_response_t rsp;
tools/xenpaging/xenpaging.h +3 -3
@@ -40,7 +40,7 @@ typedef struct mem_event {void *ring_page; } mem_event_t; -typedef struct xenpaging { +struct xenpaging {xc_interface *xc_handle;struct xs_handle *xs_handle;
@@ -54,7 +54,7 @@ typedef struct xenpaging {int policy_mru_size;int debug;unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE ]; -} xenpaging_t; +};struct victim {
@@ -63,7 +63,7 @@ struct victim { }; -extern void create_page_in_thread (xenpaging_t *paging); +extern void create_page_in_thread (struct xenpaging *paging);extern void page_in_trigger (void );#endif // __XEN_PAGING_H__
PATCH 1/1 xenpaging: convert mem_event_t to struct mem_event
In reply to Olaf Hering# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1326125252 -3600
# Node ID 283e6ed3e1de572c9f974dd9083dc95e8cf60b15 # Parent de41b885dd70757c8a3a283e895d813c2f5e6744
xenpaging: convert mem_event_t to struct mem_event
tools/xenpaging/xenpaging.c +2 -2
@@ -528,7 +528,7 @@ static int xenpaging_teardown(struct xenreturn -1 ; } -static void get_request (mem_event_t *mem_event,mem_event_request_t *req) +static void get_request (struct mem_event *mem_event,mem_event_request_t *req) {mem_event_back_ring_t *back_ring;RING_IDX req_cons;
@@ -545,7 +545,7 @@ static void get_request(mem_event_t *mem back_ring->sring->req_event = req_cons +1 ; } -static void put_response (mem_event_t *mem_event,mem_event_response_t *rsp) +static void put_response (struct mem_event *mem_event,mem_event_response_t *rsp) {mem_event_back_ring_t *back_ring;RING_IDX rsp_prod;
tools/xenpaging/xenpaging.h +3 -3
@@ -31,14 +31,14 @@#define XENPAGING_PAGEIN_QUEUE_SIZE 64 -typedef struct mem_event { +struct mem_event {domid_t domain_id;xc_evtchn *xce_handle;int port;mem_event_back_ring_t back_ring;mem_event_shared_page_t *shared_page;void *ring_page; -}mem_event_t ; +};struct xenpaging {xc_interface *xc_handle;
@@ -46,7 +46,7 @@ struct xenpaging {unsigned long *bitmap; -mem_event_t mem_event; +struct mem_event mem_event;/* number of pages for which data structures were allocated */ int max_pages;int num_paged_out;
Olaf Hering writes ("[Xen-devel] [PATCH 0 of 3] tools/xenpaging: remove typedefs"):
Quoted 3 lines
As noted by Ian Jackson, use of types with names ending in _t is reserved to the C implementation (compiler and runtime). This series removes all typedefs from xenpaging code.
Thanks, I have applied this style change.
Ian.