diff mbox

[v4,03/14] contrib/ivshmem-*: comply with QEMU coding style

Message ID 1409671532-12706-4-git-send-email-david.marchand@6wind.com
State New
Headers show

Commit Message

David Marchand Sept. 2, 2014, 3:25 p.m. UTC
Fix coding style for structures.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 contrib/ivshmem-client/ivshmem-client.c |   47 ++++++++++---------
 contrib/ivshmem-client/ivshmem-client.h |   76 +++++++++++++++----------------
 contrib/ivshmem-client/main.c           |   21 ++++-----
 contrib/ivshmem-server/ivshmem-server.c |   38 ++++++++--------
 contrib/ivshmem-server/ivshmem-server.h |   68 +++++++++++++--------------
 contrib/ivshmem-server/main.c           |   12 ++---
 6 files changed, 129 insertions(+), 133 deletions(-)
diff mbox

Patch

diff --git a/contrib/ivshmem-client/ivshmem-client.c b/contrib/ivshmem-client/ivshmem-client.c
index 2166b64..3f6ca98 100644
--- a/contrib/ivshmem-client/ivshmem-client.c
+++ b/contrib/ivshmem-client/ivshmem-client.c
@@ -31,7 +31,7 @@ 
 
 /* read message from the unix socket */
 static int
-read_one_msg(struct ivshmem_client *client, long *index, int *fd)
+read_one_msg(IvshmemClient *client, long *index, int *fd)
 {
     int ret;
     struct msghdr msg;
@@ -80,7 +80,7 @@  read_one_msg(struct ivshmem_client *client, long *index, int *fd)
 /* free a peer when the server advertise a disconnection or when the
  * client is freed */
 static void
-free_peer(struct ivshmem_client *client, struct ivshmem_client_peer *peer)
+free_peer(IvshmemClient *client, IvshmemClientPeer *peer)
 {
     unsigned vector;
 
@@ -94,9 +94,9 @@  free_peer(struct ivshmem_client *client, struct ivshmem_client_peer *peer)
 
 /* handle message coming from server (new peer, new vectors) */
 static int
-handle_server_msg(struct ivshmem_client *client)
+handle_server_msg(IvshmemClient *client)
 {
-    struct ivshmem_client_peer *peer;
+    IvshmemClientPeer *peer;
     long peer_id;
     int ret, fd;
 
@@ -146,7 +146,7 @@  handle_server_msg(struct ivshmem_client *client)
 
 /* init a new ivshmem client */
 int
-ivshmem_client_init(struct ivshmem_client *client, const char *unix_sock_path,
+ivshmem_client_init(IvshmemClient *client, const char *unix_sock_path,
                     ivshmem_client_notif_cb_t notif_cb, void *notif_arg,
                     int verbose)
 {
@@ -173,7 +173,7 @@  ivshmem_client_init(struct ivshmem_client *client, const char *unix_sock_path,
 
 /* create and connect to the unix socket */
 int
-ivshmem_client_connect(struct ivshmem_client *client)
+ivshmem_client_connect(IvshmemClient *client)
 {
     struct sockaddr_un sun;
     int fd;
@@ -223,9 +223,9 @@  ivshmem_client_connect(struct ivshmem_client *client)
 
 /* close connection to the server, and free all peer structures */
 void
-ivshmem_client_close(struct ivshmem_client *client)
+ivshmem_client_close(IvshmemClient *client)
 {
-    struct ivshmem_client_peer *peer;
+    IvshmemClientPeer *peer;
     unsigned i;
 
     debug_log(client, "close client\n");
@@ -244,8 +244,7 @@  ivshmem_client_close(struct ivshmem_client *client)
 
 /* get the fd_set according to the unix socket and peer list */
 void
-ivshmem_client_get_fds(const struct ivshmem_client *client, fd_set *fds,
-                       int *maxfd)
+ivshmem_client_get_fds(const IvshmemClient *client, fd_set *fds, int *maxfd)
 {
     int fd;
     unsigned vector;
@@ -266,9 +265,9 @@  ivshmem_client_get_fds(const struct ivshmem_client *client, fd_set *fds,
 
 /* handle events from eventfd: just print a message on notification */
 static int
-handle_event(struct ivshmem_client *client, const fd_set *cur, int maxfd)
+handle_event(IvshmemClient *client, const fd_set *cur, int maxfd)
 {
-    struct ivshmem_client_peer *peer;
+    IvshmemClientPeer *peer;
     uint64_t kick;
     unsigned i;
     int ret;
@@ -301,7 +300,7 @@  handle_event(struct ivshmem_client *client, const fd_set *cur, int maxfd)
 
 /* read and handle new messages on the given fd_set */
 int
-ivshmem_client_handle_fds(struct ivshmem_client *client, fd_set *fds, int maxfd)
+ivshmem_client_handle_fds(IvshmemClient *client, fd_set *fds, int maxfd)
 {
     if (client->sock_fd < maxfd && FD_ISSET(client->sock_fd, fds) &&
         handle_server_msg(client) < 0 && errno != EINTR) {
@@ -317,8 +316,8 @@  ivshmem_client_handle_fds(struct ivshmem_client *client, fd_set *fds, int maxfd)
 
 /* send a notification on a vector of a peer */
 int
-ivshmem_client_notify(const struct ivshmem_client *client,
-                      const struct ivshmem_client_peer *peer, unsigned vector)
+ivshmem_client_notify(const IvshmemClient *client,
+                      const IvshmemClientPeer *peer, unsigned vector)
 {
     uint64_t kick;
     int fd;
@@ -342,8 +341,8 @@  ivshmem_client_notify(const struct ivshmem_client *client,
 
 /* send a notification to all vectors of a peer */
 int
-ivshmem_client_notify_all_vects(const struct ivshmem_client *client,
-                                const struct ivshmem_client_peer *peer)
+ivshmem_client_notify_all_vects(const IvshmemClient *client,
+                                const IvshmemClientPeer *peer)
 {
     unsigned vector;
     int ret = 0;
@@ -359,9 +358,9 @@  ivshmem_client_notify_all_vects(const struct ivshmem_client *client,
 
 /* send a notification to all peers */
 int
-ivshmem_client_notify_broadcast(const struct ivshmem_client *client)
+ivshmem_client_notify_broadcast(const IvshmemClient *client)
 {
-    struct ivshmem_client_peer *peer;
+    IvshmemClientPeer *peer;
     int ret = 0;
 
     TAILQ_FOREACH(peer, &client->peer_list, next) {
@@ -374,10 +373,10 @@  ivshmem_client_notify_broadcast(const struct ivshmem_client *client)
 }
 
 /* lookup peer from its id */
-struct ivshmem_client_peer *
-ivshmem_client_search_peer(struct ivshmem_client *client, long peer_id)
+IvshmemClientPeer *
+ivshmem_client_search_peer(IvshmemClient *client, long peer_id)
 {
-    struct ivshmem_client_peer *peer;
+    IvshmemClientPeer *peer;
 
     if (peer_id == client->local.id) {
         return &client->local;
@@ -393,9 +392,9 @@  ivshmem_client_search_peer(struct ivshmem_client *client, long peer_id)
 
 /* dump our info, the list of peers their vectors on stdout */
 void
-ivshmem_client_dump(const struct ivshmem_client *client)
+ivshmem_client_dump(const IvshmemClient *client)
 {
-    const struct ivshmem_client_peer *peer;
+    const IvshmemClientPeer *peer;
     unsigned vector;
 
     /* dump local infos */
diff --git a/contrib/ivshmem-client/ivshmem-client.h b/contrib/ivshmem-client/ivshmem-client.h
index d27222b..0fe0c94 100644
--- a/contrib/ivshmem-client/ivshmem-client.h
+++ b/contrib/ivshmem-client/ivshmem-client.h
@@ -33,29 +33,30 @@ 
  *
  * Each time a client connects to an ivshmem server, it is advertised to
  * all connected clients through the unix socket. When our ivshmem
- * client receives a notification, it creates a ivshmem_client_peer
+ * client receives a notification, it creates a IvshmemClientPeer
  * structure to store the infos of this peer.
  *
  * This structure is also used to store the information of our own
- * client in (struct ivshmem_client)->local.
+ * client in (IvshmemClient)->local.
  */
-struct ivshmem_client_peer {
-    TAILQ_ENTRY(ivshmem_client_peer) next;    /**< next in list*/
-    long id;                                    /**< the id of the peer */
-    int vectors[IVSHMEM_CLIENT_MAX_VECTORS];  /**< one fd per vector */
-    unsigned vectors_count;                     /**< number of vectors */
-};
-TAILQ_HEAD(ivshmem_client_peer_list, ivshmem_client_peer);
+typedef struct IvshmemClientPeer {
+    TAILQ_ENTRY(IvshmemClientPeer) next;     /**< next in list*/
+    long id;                                 /**< the id of the peer */
+    int vectors[IVSHMEM_CLIENT_MAX_VECTORS]; /**< one fd per vector */
+    unsigned vectors_count;                  /**< number of vectors */
+} IvshmemClientPeer;
+TAILQ_HEAD(IvshmemClientPeerList, IvshmemClientPeer);
 
-struct ivshmem_client;
+typedef struct IvshmemClientPeerList IvshmemClientPeerList;
+typedef struct IvshmemClient IvshmemClient;
 
 /**
- * Typedef of callback function used when our ivshmem_client receives a
+ * Typedef of callback function used when our IvshmemClient receives a
  * notification from a peer.
  */
 typedef void (*ivshmem_client_notif_cb_t)(
-    const struct ivshmem_client *client,
-    const struct ivshmem_client_peer *peer,
+    const IvshmemClient *client,
+    const IvshmemClientPeer *peer,
     unsigned vect, void *arg);
 
 /**
@@ -66,29 +67,29 @@  typedef void (*ivshmem_client_notif_cb_t)(
  * server, our own client information, and a pointer the notification
  * callback function used when we receive a notification from a peer.
  */
-struct ivshmem_client {
-    char unix_sock_path[PATH_MAX];        /**< path to unix sock */
-    int sock_fd;                          /**< unix sock filedesc */
+struct IvshmemClient {
+    char unix_sock_path[PATH_MAX];      /**< path to unix sock */
+    int sock_fd;                        /**< unix sock filedesc */
 
-    struct ivshmem_client_peer_list peer_list;  /**< list of peers */
-    struct ivshmem_client_peer local;   /**< our own infos */
+    IvshmemClientPeerList peer_list;    /**< list of peers */
+    IvshmemClientPeer local;            /**< our own infos */
 
     ivshmem_client_notif_cb_t notif_cb; /**< notification callback */
-    void *notif_arg;                      /**< notification argument */
+    void *notif_arg;                    /**< notification argument */
 
-    int verbose;                          /**< true to enable debug */
+    int verbose;                        /**< true to enable debug */
 };
 
 /**
  * Initialize an ivshmem client
  *
  * @param client
- *   A pointer to an uninitialized ivshmem_client structure
+ *   A pointer to an uninitialized IvshmemClient structure
  * @param unix_sock_path
  *   The pointer to the unix socket file name
  * @param notif_cb
  *   If not NULL, the pointer to the function to be called when we our
- *   ivshmem_client receives a notification from a peer
+ *   IvshmemClient receives a notification from a peer
  * @param notif_arg
  *   Opaque pointer given as-is to the notification callback function
  * @param verbose
@@ -97,9 +98,9 @@  struct ivshmem_client {
  * @return
  *   0 on success, or a negative value on error
  */
-int ivshmem_client_init(struct ivshmem_client *client,
-    const char *unix_sock_path, ivshmem_client_notif_cb_t notif_cb,
-    void *notif_arg, int verbose);
+int ivshmem_client_init(IvshmemClient *client, const char *unix_sock_path,
+                        ivshmem_client_notif_cb_t notif_cb, void *notif_arg,
+                        int verbose);
 
 /**
  * Connect to the server
@@ -114,7 +115,7 @@  int ivshmem_client_init(struct ivshmem_client *client,
  * @return
  *   0 on success, or a negative value on error
  */
-int ivshmem_client_connect(struct ivshmem_client *client);
+int ivshmem_client_connect(IvshmemClient *client);
 
 /**
  * Close connection to the server and free all peer structures
@@ -122,7 +123,7 @@  int ivshmem_client_connect(struct ivshmem_client *client);
  * @param client
  *   The ivshmem client
  */
-void ivshmem_client_close(struct ivshmem_client *client);
+void ivshmem_client_close(IvshmemClient *client);
 
 /**
  * Fill a fd_set with file descriptors to be monitored
@@ -140,7 +141,7 @@  void ivshmem_client_close(struct ivshmem_client *client);
  *   Must be set to the max file descriptor + 1 in fd_set. This value is
  *   updated if this function adds a greated fd in fd_set.
  */
-void ivshmem_client_get_fds(const struct ivshmem_client *client, fd_set *fds,
+void ivshmem_client_get_fds(const IvshmemClient *client, fd_set *fds,
                             int *maxfd);
 
 /**
@@ -161,8 +162,7 @@  void ivshmem_client_get_fds(const struct ivshmem_client *client, fd_set *fds,
  * @return
  *   0 on success, negative value on failure.
  */
-int ivshmem_client_handle_fds(struct ivshmem_client *client, fd_set *fds,
-    int maxfd);
+int ivshmem_client_handle_fds(IvshmemClient *client, fd_set *fds, int maxfd);
 
 /**
  * Send a notification to a vector of a peer
@@ -177,8 +177,8 @@  int ivshmem_client_handle_fds(struct ivshmem_client *client, fd_set *fds,
  * @return
  *   0 on success, and a negative error on failure.
  */
-int ivshmem_client_notify(const struct ivshmem_client *client,
-    const struct ivshmem_client_peer *peer, unsigned vector);
+int ivshmem_client_notify(const IvshmemClient *client,
+                          const IvshmemClientPeer *peer, unsigned vector);
 
 /**
  * Send a notification to all vectors of a peer
@@ -192,8 +192,8 @@  int ivshmem_client_notify(const struct ivshmem_client *client,
  *   0 on success, and a negative error on failure (at least one
  *   notification failed).
  */
-int ivshmem_client_notify_all_vects(const struct ivshmem_client *client,
-    const struct ivshmem_client_peer *peer);
+int ivshmem_client_notify_all_vects(const IvshmemClient *client,
+                                    const IvshmemClientPeer *peer);
 
 /**
  * Broadcat a notification to all vectors of all peers
@@ -205,7 +205,7 @@  int ivshmem_client_notify_all_vects(const struct ivshmem_client *client,
  *   0 on success, and a negative error on failure (at least one
  *   notification failed).
  */
-int ivshmem_client_notify_broadcast(const struct ivshmem_client *client);
+int ivshmem_client_notify_broadcast(const IvshmemClient *client);
 
 /**
  * Search a peer from its identifier
@@ -221,8 +221,8 @@  int ivshmem_client_notify_broadcast(const struct ivshmem_client *client);
  * @return
  *   The peer structure, or NULL if not found
  */
-struct ivshmem_client_peer *
-ivshmem_client_search_peer(struct ivshmem_client *client, long peer_id);
+IvshmemClientPeer *
+ivshmem_client_search_peer(IvshmemClient *client, long peer_id);
 
 /**
  * Dump information of this ivshmem client on stdout
@@ -233,6 +233,6 @@  ivshmem_client_search_peer(struct ivshmem_client *client, long peer_id);
  * @param client
  *   The ivshmem client
  */
-void ivshmem_client_dump(const struct ivshmem_client *client);
+void ivshmem_client_dump(const IvshmemClient *client);
 
 #endif /* _IVSHMEM_CLIENT_ */
diff --git a/contrib/ivshmem-client/main.c b/contrib/ivshmem-client/main.c
index 0d53f55..778d0f2 100644
--- a/contrib/ivshmem-client/main.c
+++ b/contrib/ivshmem-client/main.c
@@ -21,10 +21,10 @@ 
 #define DEFAULT_VERBOSE        0
 #define DEFAULT_UNIX_SOCK_PATH "/tmp/ivshmem_socket"
 
-struct ivshmem_client_args {
+typedef struct IvshmemClientArgs {
     int verbose;
     char *unix_sock_path;
-};
+} IvshmemClientArgs;
 
 /* show usage and exit with given error code */
 static void
@@ -41,7 +41,7 @@  usage(const char *name, int code)
 
 /* parse the program arguments, exit on error */
 static void
-parse_args(struct ivshmem_client_args *args, int argc, char *argv[])
+parse_args(IvshmemClientArgs *args, int argc, char *argv[])
 {
     char c;
 
@@ -83,9 +83,9 @@  cmdline_help(void)
 
 /* read stdin and handle commands */
 static int
-handle_stdin_command(struct ivshmem_client *client)
+handle_stdin_command(IvshmemClient *client)
 {
-    struct ivshmem_client_peer *peer;
+    IvshmemClientPeer *peer;
     char buf[128];
     char *s, *token;
     int ret;
@@ -138,7 +138,7 @@  handle_stdin_command(struct ivshmem_client *client)
 /* listen on stdin (command line), on unix socket (notifications of new
  * and dead peers), and on eventfd (IRQ request) */
 int
-poll_events(struct ivshmem_client *client)
+poll_events(IvshmemClient *client)
 {
     fd_set fds;
     int ret, maxfd;
@@ -181,9 +181,8 @@  poll_events(struct ivshmem_client *client)
 
 /* callback when we receive a notification (just display it) */
 void
-notification_cb(const struct ivshmem_client *client,
-                const struct ivshmem_client_peer *peer, unsigned vect,
-                void *arg)
+notification_cb(const IvshmemClient *client, const IvshmemClientPeer *peer,
+                unsigned vect, void *arg)
 {
     (void)client;
     (void)arg;
@@ -194,8 +193,8 @@  int
 main(int argc, char *argv[])
 {
     struct sigaction sa;
-    struct ivshmem_client client;
-    struct ivshmem_client_args args = {
+    IvshmemClient client;
+    IvshmemClientArgs args = {
         .verbose = DEFAULT_VERBOSE,
         .unix_sock_path = DEFAULT_UNIX_SOCK_PATH,
     };
diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c
index f6497bb..20fbac0 100644
--- a/contrib/ivshmem-server/ivshmem-server.c
+++ b/contrib/ivshmem-server/ivshmem-server.c
@@ -89,10 +89,10 @@  send_one_msg(int sock_fd, long peer_id, int fd)
 /* free a peer when the server advertise a disconnection or when the
  * server is freed */
 static void
-free_peer(struct ivshmem_server *server, struct ivshmem_server_peer *peer)
+free_peer(IvshmemServer *server, IvshmemServerPeer *peer)
 {
     unsigned vector;
-    struct ivshmem_server_peer *other_peer;
+    IvshmemServerPeer *other_peer;
 
     debug_log(server, "free peer %ld\n", peer->id);
     close(peer->sock_fd);
@@ -112,8 +112,7 @@  free_peer(struct ivshmem_server *server, struct ivshmem_server_peer *peer)
 
 /* send the peer id and the shm_fd just after a new client connection */
 static int
-send_initial_info(struct ivshmem_server *server,
-                  struct ivshmem_server_peer *peer)
+send_initial_info(IvshmemServer *server, IvshmemServerPeer *peer)
 {
     int ret;
 
@@ -136,9 +135,9 @@  send_initial_info(struct ivshmem_server *server,
 
 /* handle message on listening unix socket (new client connection) */
 static int
-handle_new_conn(struct ivshmem_server *server)
+handle_new_conn(IvshmemServer *server)
 {
-    struct ivshmem_server_peer *peer, *other_peer;
+    IvshmemServerPeer *peer, *other_peer;
     struct sockaddr_un unaddr;
     socklen_t unaddr_len;
     int newfd;
@@ -252,7 +251,7 @@  ivshmem_ftruncate(int fd, unsigned shmsize)
 
 /* Init a new ivshmem server */
 int
-ivshmem_server_init(struct ivshmem_server *server, const char *unix_sock_path,
+ivshmem_server_init(IvshmemServer *server, const char *unix_sock_path,
                     const char *shm_path, size_t shm_size, unsigned n_vectors,
                     int verbose)
 {
@@ -274,7 +273,7 @@  ivshmem_server_init(struct ivshmem_server *server, const char *unix_sock_path,
 
 /* open shm, create and bind to the unix socket */
 int
-ivshmem_server_start(struct ivshmem_server *server)
+ivshmem_server_start(IvshmemServer *server)
 {
     struct sockaddr_un sun;
     int shm_fd, sock_fd;
@@ -328,9 +327,9 @@  ivshmem_server_start(struct ivshmem_server *server)
 
 /* close connections to clients, the unix socket and the shm fd */
 void
-ivshmem_server_close(struct ivshmem_server *server)
+ivshmem_server_close(IvshmemServer *server)
 {
-    struct ivshmem_server_peer *peer;
+    IvshmemServerPeer *peer;
 
     debug_log(server, "close server\n");
 
@@ -346,10 +345,9 @@  ivshmem_server_close(struct ivshmem_server *server)
 
 /* get the fd_set according to the unix socket and the peer list */
 void
-ivshmem_server_get_fds(const struct ivshmem_server *server, fd_set *fds,
-                       int *maxfd)
+ivshmem_server_get_fds(const IvshmemServer *server, fd_set *fds, int *maxfd)
 {
-    struct ivshmem_server_peer *peer;
+    IvshmemServerPeer *peer;
 
     FD_SET(server->sock_fd, fds);
     if (server->sock_fd >= *maxfd) {
@@ -366,9 +364,9 @@  ivshmem_server_get_fds(const struct ivshmem_server *server, fd_set *fds,
 
 /* process incoming messages on the sockets in fd_set */
 int
-ivshmem_server_handle_fds(struct ivshmem_server *server, fd_set *fds, int maxfd)
+ivshmem_server_handle_fds(IvshmemServer *server, fd_set *fds, int maxfd)
 {
-    struct ivshmem_server_peer *peer, *peer_next;
+    IvshmemServerPeer *peer, *peer_next;
 
     if (server->sock_fd < maxfd && FD_ISSET(server->sock_fd, fds) &&
         handle_new_conn(server) < 0 && errno != EINTR) {
@@ -388,10 +386,10 @@  ivshmem_server_handle_fds(struct ivshmem_server *server, fd_set *fds, int maxfd)
 }
 
 /* lookup peer from its id */
-struct ivshmem_server_peer *
-ivshmem_server_search_peer(struct ivshmem_server *server, long peer_id)
+IvshmemServerPeer *
+ivshmem_server_search_peer(IvshmemServer *server, long peer_id)
 {
-    struct ivshmem_server_peer *peer;
+    IvshmemServerPeer *peer;
 
     TAILQ_FOREACH(peer, &server->peer_list, next) {
         if (peer->id == peer_id) {
@@ -403,9 +401,9 @@  ivshmem_server_search_peer(struct ivshmem_server *server, long peer_id)
 
 /* dump our info, the list of peers their vectors on stdout */
 void
-ivshmem_server_dump(const struct ivshmem_server *server)
+ivshmem_server_dump(const IvshmemServer *server)
 {
-    const struct ivshmem_server_peer *peer;
+    const IvshmemServerPeer *peer;
     unsigned vector;
 
     /* dump peers */
diff --git a/contrib/ivshmem-server/ivshmem-server.h b/contrib/ivshmem-server/ivshmem-server.h
index cd74bbf..42736e4 100644
--- a/contrib/ivshmem-server/ivshmem-server.h
+++ b/contrib/ivshmem-server/ivshmem-server.h
@@ -39,18 +39,20 @@ 
  * Structure storing a peer
  *
  * Each time a client connects to an ivshmem server, a new
- * ivshmem_server_peer structure is created. This peer and all its
+ * IvshmemServerPeer structure is created. This peer and all its
  * vectors are advertised to all connected clients through the connected
  * unix sockets.
  */
-struct ivshmem_server_peer {
-    TAILQ_ENTRY(ivshmem_server_peer) next;    /**< next in list*/
-    int sock_fd;                                /**< connected unix sock */
-    long id;                                    /**< the id of the peer */
-    int vectors[IVSHMEM_SERVER_MAX_VECTORS];  /**< one fd per vector */
-    unsigned vectors_count;                     /**< number of vectors */
-};
-TAILQ_HEAD(ivshmem_server_peer_list, ivshmem_server_peer);
+typedef struct IvshmemServerPeer {
+    TAILQ_ENTRY(IvshmemServerPeer) next;     /**< next in list*/
+    int sock_fd;                             /**< connected unix sock */
+    long id;                                 /**< the id of the peer */
+    int vectors[IVSHMEM_SERVER_MAX_VECTORS]; /**< one fd per vector */
+    unsigned vectors_count;                  /**< number of vectors */
+} IvshmemServerPeer;
+TAILQ_HEAD(IvshmemServerPeerList, IvshmemServerPeer);
+
+typedef struct IvshmemServerPeerList IvshmemServerPeerList;
 
 /**
  * Structure describing an ivshmem server
@@ -58,23 +60,23 @@  TAILQ_HEAD(ivshmem_server_peer_list, ivshmem_server_peer);
  * This structure stores all information related to our server: the name
  * of the server unix socket and the list of connected peers.
  */
-struct ivshmem_server {
-    char unix_sock_path[PATH_MAX];  /**< path to unix socket */
-    int sock_fd;                    /**< unix sock file descriptor */
-    char shm_path[PATH_MAX];        /**< path to shm */
-    size_t shm_size;                /**< size of shm */
-    int shm_fd;                     /**< shm file descriptor */
-    unsigned n_vectors;             /**< number of vectors */
-    long cur_id;                    /**< id to be given to next client */
-    int verbose;                    /**< true in verbose mode */
-    struct ivshmem_server_peer_list peer_list;  /**< list of peers */
-};
+typedef struct IvshmemServer {
+    char unix_sock_path[PATH_MAX];   /**< path to unix socket */
+    int sock_fd;                     /**< unix sock file descriptor */
+    char shm_path[PATH_MAX];         /**< path to shm */
+    size_t shm_size;                 /**< size of shm */
+    int shm_fd;                      /**< shm file descriptor */
+    unsigned n_vectors;              /**< number of vectors */
+    long cur_id;                     /**< id to be given to next client */
+    int verbose;                     /**< true in verbose mode */
+    IvshmemServerPeerList peer_list; /**< list of peers */
+} IvshmemServer;
 
 /**
  * Initialize an ivshmem server
  *
  * @param server
- *   A pointer to an uninitialized ivshmem_server structure
+ *   A pointer to an uninitialized IvshmemServer structure
  * @param unix_sock_path
  *   The pointer to the unix socket file name
  * @param shm_path
@@ -92,20 +94,20 @@  struct ivshmem_server {
  *   0 on success, negative value on error
  */
 int
-ivshmem_server_init(struct ivshmem_server *server,
-    const char *unix_sock_path, const char *shm_path, size_t shm_size,
-    unsigned n_vectors, int verbose);
+ivshmem_server_init(IvshmemServer *server, const char *unix_sock_path,
+                    const char *shm_path, size_t shm_size, unsigned n_vectors,
+                    int verbose);
 
 /**
  * Open the shm, then create and bind to the unix socket
  *
  * @param server
- *   The pointer to the initialized ivshmem server structure
+ *   The pointer to the initialized IvshmemServer structure
  *
  * @return
  *   0 on success, or a negative value on error
  */
-int ivshmem_server_start(struct ivshmem_server *server);
+int ivshmem_server_start(IvshmemServer *server);
 
 /**
  * Close the server
@@ -118,7 +120,7 @@  int ivshmem_server_start(struct ivshmem_server *server);
  * @param server
  *   The ivshmem server
  */
-void ivshmem_server_close(struct ivshmem_server *server);
+void ivshmem_server_close(IvshmemServer *server);
 
 /**
  * Fill a fd_set with file descriptors to be monitored
@@ -136,8 +138,7 @@  void ivshmem_server_close(struct ivshmem_server *server);
  *   updated if this function adds a greated fd in fd_set.
  */
 void
-ivshmem_server_get_fds(const struct ivshmem_server *server,
-    fd_set *fds, int *maxfd);
+ivshmem_server_get_fds(const IvshmemServer *server, fd_set *fds, int *maxfd);
 
 /**
  * Read and handle new messages
@@ -157,8 +158,7 @@  ivshmem_server_get_fds(const struct ivshmem_server *server,
  * @return
  *   0 on success, negative value on failure.
  */
-int ivshmem_server_handle_fds(struct ivshmem_server *server, fd_set *fds,
-    int maxfd);
+int ivshmem_server_handle_fds(IvshmemServer *server, fd_set *fds, int maxfd);
 
 /**
  * Search a peer from its identifier
@@ -171,8 +171,8 @@  int ivshmem_server_handle_fds(struct ivshmem_server *server, fd_set *fds,
  * @return
  *   The peer structure, or NULL if not found
  */
-struct ivshmem_server_peer *
-ivshmem_server_search_peer(struct ivshmem_server *server, long peer_id);
+IvshmemServerPeer *
+ivshmem_server_search_peer(IvshmemServer *server, long peer_id);
 
 /**
  * Dump information of this ivshmem server and its peers on stdout
@@ -180,6 +180,6 @@  ivshmem_server_search_peer(struct ivshmem_server *server, long peer_id);
  * @param server
  *   The ivshmem server
  */
-void ivshmem_server_dump(const struct ivshmem_server *server);
+void ivshmem_server_dump(const IvshmemServer *server);
 
 #endif /* _IVSHMEM_SERVER_ */
diff --git a/contrib/ivshmem-server/main.c b/contrib/ivshmem-server/main.c
index 36b7028..a4504c3 100644
--- a/contrib/ivshmem-server/main.c
+++ b/contrib/ivshmem-server/main.c
@@ -29,7 +29,7 @@ 
 #define DEFAULT_N_VECTORS      16
 
 /* arguments given by the user */
-struct ivshmem_server_args {
+typedef struct IvshmemServerArgs {
     int verbose;
     int foreground;
     char *pid_file;
@@ -37,7 +37,7 @@  struct ivshmem_server_args {
     char *shm_path;
     size_t shm_size;
     unsigned n_vectors;
-};
+} IvshmemServerArgs;
 
 /* show usage and exit with given error code */
 static void
@@ -117,7 +117,7 @@  parse_uint(const char *val_str, unsigned *val)
 
 /* parse the program arguments, exit on error */
 static void
-parse_args(struct ivshmem_server_args *args, int argc, char *argv[])
+parse_args(IvshmemServerArgs *args, int argc, char *argv[])
 {
     char c;
 
@@ -192,7 +192,7 @@  parse_args(struct ivshmem_server_args *args, int argc, char *argv[])
 /* wait for events on listening server unix socket and connected client
  * sockets */
 int
-poll_events(struct ivshmem_server *server)
+poll_events(IvshmemServer *server)
 {
     fd_set fds;
     int ret, maxfd;
@@ -229,9 +229,9 @@  poll_events(struct ivshmem_server *server)
 int
 main(int argc, char *argv[])
 {
-    struct ivshmem_server server;
+    IvshmemServer server;
     struct sigaction sa;
-    struct ivshmem_server_args args = {
+    IvshmemServerArgs args = {
         .verbose = DEFAULT_VERBOSE,
         .foreground = DEFAULT_FOREGROUND,
         .pid_file = DEFAULT_PID_FILE,