All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0 of 3] tools/xenpaging: remove typedefs
@ 2012-01-09 16:09 Olaf Hering
  2012-01-09 16:09 ` [PATCH 1 of 3] xenpaging: convert xenpaging_victim_t to struct victim Olaf Hering
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Olaf Hering @ 2012-01-09 16:09 UTC (permalink / raw)
  To: xen-devel


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(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1 of 3] xenpaging: convert xenpaging_victim_t to struct victim
  2012-01-09 16:09 [PATCH 0 of 3] tools/xenpaging: remove typedefs Olaf Hering
@ 2012-01-09 16:09 ` Olaf Hering
  2012-01-09 16:09 ` [PATCH 2 of 3] xenpaging: convert xenpaging_t to struct xenpaging Olaf Hering
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Olaf Hering @ 2012-01-09 16:09 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1326125241 -3600
# Node ID dfcef53aa44f76b0dc13fa2acb012f4158da5c7b
# Parent  3a22ed3ec534799b3cab55b0dc0a7380e701ecbe
xenpaging: convert xenpaging_victim_t to struct victim

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r 3a22ed3ec534 -r dfcef53aa44f tools/xenpaging/policy.h
--- a/tools/xenpaging/policy.h
+++ b/tools/xenpaging/policy.h
@@ -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);
diff -r 3a22ed3ec534 -r dfcef53aa44f tools/xenpaging/policy_default.c
--- a/tools/xenpaging/policy_default.c
+++ b/tools/xenpaging/policy_default.c
@@ -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;
diff -r 3a22ed3ec534 -r dfcef53aa44f tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c
+++ b/tools/xenpaging/xenpaging.c
@@ -562,8 +562,7 @@ static void put_response(mem_event_t *me
     RING_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 *pa
         page_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;
 
diff -r 3a22ed3ec534 -r dfcef53aa44f tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h
+++ b/tools/xenpaging/xenpaging.h
@@ -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);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2 of 3] xenpaging: convert xenpaging_t to struct xenpaging
  2012-01-09 16:09 [PATCH 0 of 3] tools/xenpaging: remove typedefs Olaf Hering
  2012-01-09 16:09 ` [PATCH 1 of 3] xenpaging: convert xenpaging_victim_t to struct victim Olaf Hering
@ 2012-01-09 16:09 ` Olaf Hering
  2012-01-09 16:09 ` [PATCH 3 of 3] xenpaging: convert mem_event_t to struct mem_event Olaf Hering
  2012-01-10 17:02 ` [PATCH 0 of 3] tools/xenpaging: remove typedefs Ian Jackson
  3 siblings, 0 replies; 5+ messages in thread
From: Olaf Hering @ 2012-01-09 16:09 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1326125246 -3600
# Node ID de41b885dd70757c8a3a283e895d813c2f5e6744
# Parent  dfcef53aa44f76b0dc13fa2acb012f4158da5c7b
xenpaging: convert xenpaging_t to struct xenpaging

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r dfcef53aa44f -r de41b885dd70 tools/xenpaging/pagein.c
--- a/tools/xenpaging/pagein.c
+++ b/tools/xenpaging/pagein.c
@@ -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;
diff -r dfcef53aa44f -r de41b885dd70 tools/xenpaging/policy.h
--- a/tools/xenpaging/policy.h
+++ b/tools/xenpaging/policy.h
@@ -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);
diff -r dfcef53aa44f -r de41b885dd70 tools/xenpaging/policy_default.c
--- a/tools/xenpaging/policy_default.c
+++ b/tools/xenpaging/policy_default.c
@@ -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;
diff -r dfcef53aa44f -r de41b885dd70 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c
+++ b/tools/xenpaging/xenpaging.c
@@ -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_io
     return 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_t
     return 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 a
     int 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 a
     return 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 *me
     RING_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(xenpagin
     return 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(xenpagi
     return 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 *pa
         page_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 *pagi
 int 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;
diff -r dfcef53aa44f -r de41b885dd70 tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h
+++ b/tools/xenpaging/xenpaging.h
@@ -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__

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3 of 3] xenpaging: convert mem_event_t to struct mem_event
  2012-01-09 16:09 [PATCH 0 of 3] tools/xenpaging: remove typedefs Olaf Hering
  2012-01-09 16:09 ` [PATCH 1 of 3] xenpaging: convert xenpaging_victim_t to struct victim Olaf Hering
  2012-01-09 16:09 ` [PATCH 2 of 3] xenpaging: convert xenpaging_t to struct xenpaging Olaf Hering
@ 2012-01-09 16:09 ` Olaf Hering
  2012-01-10 17:02 ` [PATCH 0 of 3] tools/xenpaging: remove typedefs Ian Jackson
  3 siblings, 0 replies; 5+ messages in thread
From: Olaf Hering @ 2012-01-09 16:09 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1326125252 -3600
# Node ID 283e6ed3e1de572c9f974dd9083dc95e8cf60b15
# Parent  de41b885dd70757c8a3a283e895d813c2f5e6744
xenpaging: convert mem_event_t to struct mem_event

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r de41b885dd70 -r 283e6ed3e1de tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c
+++ b/tools/xenpaging/xenpaging.c
@@ -528,7 +528,7 @@ static int xenpaging_teardown(struct xen
     return -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;
diff -r de41b885dd70 -r 283e6ed3e1de tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h
+++ b/tools/xenpaging/xenpaging.h
@@ -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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0 of 3] tools/xenpaging: remove typedefs
  2012-01-09 16:09 [PATCH 0 of 3] tools/xenpaging: remove typedefs Olaf Hering
                   ` (2 preceding siblings ...)
  2012-01-09 16:09 ` [PATCH 3 of 3] xenpaging: convert mem_event_t to struct mem_event Olaf Hering
@ 2012-01-10 17:02 ` Ian Jackson
  3 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2012-01-10 17:02 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel

Olaf Hering writes ("[Xen-devel] [PATCH 0 of 3] 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.

Thanks, I have applied this style change.

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-10 17:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-09 16:09 [PATCH 0 of 3] tools/xenpaging: remove typedefs Olaf Hering
2012-01-09 16:09 ` [PATCH 1 of 3] xenpaging: convert xenpaging_victim_t to struct victim Olaf Hering
2012-01-09 16:09 ` [PATCH 2 of 3] xenpaging: convert xenpaging_t to struct xenpaging Olaf Hering
2012-01-09 16:09 ` [PATCH 3 of 3] xenpaging: convert mem_event_t to struct mem_event Olaf Hering
2012-01-10 17:02 ` [PATCH 0 of 3] tools/xenpaging: remove typedefs Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.