Revision: 57163
          http://sourceforge.net/p/brlcad/code/57163
Author:   brlcad
Date:     2013-08-27 02:55:48 +0000 (Tue, 27 Aug 2013)
Log Message:
-----------
ws style cleanup

Modified Paths:
--------------
    brlcad/trunk/src/adrt/master/compnet.c
    brlcad/trunk/src/adrt/master/dispatcher.c
    brlcad/trunk/src/adrt/master/dispatcher.h
    brlcad/trunk/src/adrt/master/master.c
    brlcad/trunk/src/adrt/master/tienet_master.c

Modified: brlcad/trunk/src/adrt/master/compnet.c
===================================================================
--- brlcad/trunk/src/adrt/master/compnet.c      2013-08-27 02:51:27 UTC (rev 
57162)
+++ brlcad/trunk/src/adrt/master/compnet.c      2013-08-27 02:55:48 UTC (rev 
57163)
@@ -59,7 +59,7 @@
 #define SET_BASE_ATTS_01       7
 #define SET_BASE_ATTS_STATE    8
 #define RESET_BASE_ATTS                9
-#define        TERM                    128
+#define TERM                   128
 
 
 /*
@@ -113,6 +113,7 @@
     master_compserv_active = 1;
 }
 
+
 /*
  * Update the status of a component
  */
@@ -123,7 +124,7 @@
        return;
 
     /* format message */
-    snprintf(message, ADRT_NAME_SIZE, "%c%s,%d%c", SET_BASE_ATTS_STATE, 
string, status, TERM);
+    snprintf(message, ADRT_NAME_SIZE, "%c%s, %d%c", SET_BASE_ATTS_STATE, 
string, status, TERM);
 
     /* Send string */
     tienet_send(master_compserv_socket, message, strlen(message));
@@ -140,6 +141,7 @@
     tienet_send(master_compserv_socket, &message, 1);
 }
 
+
 /*
  * Local Variables:
  * mode: C

Modified: brlcad/trunk/src/adrt/master/dispatcher.c
===================================================================
--- brlcad/trunk/src/adrt/master/dispatcher.c   2013-08-27 02:51:27 UTC (rev 
57162)
+++ brlcad/trunk/src/adrt/master/dispatcher.c   2013-08-27 02:55:48 UTC (rev 
57163)
@@ -85,11 +85,9 @@
     tile.format = image_format;
     tile.frame = dispatcher_frame;
 
-    for (i = 0; i < image_h; i += tile.size_y)
-    {
+    for (i = 0; i < image_h; i += tile.size_y) {
        tile.orig_y = i;
-       for (n = 0; n < image_w; n += tile.size_x)
-       {
+       for (n = 0; n < image_w; n += tile.size_x) {
            tile.orig_x = n;
            TCOPY(camera_tile_t, &tile, 0, dispatcher_mesg.data, data_len);
            tienet_master_push(dispatcher_mesg.data, size);
@@ -101,6 +99,7 @@
     dispatcher_frame = (dispatcher_frame + 1) % (1<<14);
 }
 
+
 /*
  * Local Variables:
  * mode: C

Modified: brlcad/trunk/src/adrt/master/dispatcher.h
===================================================================
--- brlcad/trunk/src/adrt/master/dispatcher.h   2013-08-27 02:51:27 UTC (rev 
57162)
+++ brlcad/trunk/src/adrt/master/dispatcher.h   2013-08-27 02:55:48 UTC (rev 
57163)
@@ -24,11 +24,11 @@
 #ifndef _ISST_DISPATCHER_H
 #define _ISST_DISPATCHER_H
 
-#define DISPATCHER_TILE_NUM    8
+#define DISPATCHER_TILE_NUM 8
 
-extern void    dispatcher_init();
-extern void    dispatcher_free();
-extern void    dispatcher_generate(void *data, int data_len, int img_w, int 
img_h, int image_format);
+extern void dispatcher_init();
+extern void dispatcher_free();
+extern void dispatcher_generate(void *data, int data_len, int img_w, int 
img_h, int image_format);
 
 #endif
 

Modified: brlcad/trunk/src/adrt/master/master.c
===================================================================
--- brlcad/trunk/src/adrt/master/master.c       2013-08-27 02:51:27 UTC (rev 
57162)
+++ brlcad/trunk/src/adrt/master/master.c       2013-08-27 02:55:48 UTC (rev 
57163)
@@ -380,12 +380,12 @@
     /* listen for connections */
     observer_listener_result = listen(master.socklist->num, 3);
 
-    if(go_daemon_mode) {
+    if (go_daemon_mode) {
        /* spinlock until other socket is good */
-       while(master_listener_result == 1)
+       while (master_listener_result == 1)
            sleep(0);
        /* if both sockets are listening, background. */
-       if(master_listener_result == 0 && observer_listener_result == 0)
+       if (master_listener_result == 0 && observer_listener_result == 0)
            daemon(0, 0);
     }
 
@@ -709,11 +709,11 @@
                break;
 
            case 'v':
-               if(!(bu_debug & BU_DEBUG_UNUSED_1))
+               if (!(bu_debug & BU_DEBUG_UNUSED_1))
                    bu_debug |= BU_DEBUG_UNUSED_1;
-               else if(!(bu_debug & BU_DEBUG_UNUSED_2))
+               else if (!(bu_debug & BU_DEBUG_UNUSED_2))
                    bu_debug |= BU_DEBUG_UNUSED_2;
-               else if(!(bu_debug & BU_DEBUG_UNUSED_3))
+               else if (!(bu_debug & BU_DEBUG_UNUSED_3))
                    bu_debug |= BU_DEBUG_UNUSED_3;
                else
                    bu_log("Too verbose!\n");

Modified: brlcad/trunk/src/adrt/master/tienet_master.c
===================================================================
--- brlcad/trunk/src/adrt/master/tienet_master.c        2013-08-27 02:51:27 UTC 
(rev 57162)
+++ brlcad/trunk/src/adrt/master/tienet_master.c        2013-08-27 02:55:48 UTC 
(rev 57163)
@@ -19,8 +19,8 @@
  */
 /** @file tienet_master.c
  *
- *  Comments -
- *      TIE Networking Master
+ * Comments -
+ * TIE Networking Master
  *
  */
 
@@ -72,12 +72,14 @@
     sem->val = val;
 }
 
+
 void tienet_sem_free(tienet_sem_t *sem)
 {
     pthread_mutex_destroy(&sem->mut);
     pthread_cond_destroy(&sem->cond);
 }
 
+
 void tienet_sem_post(tienet_sem_t *sem)
 {
     pthread_mutex_lock(&sem->mut);
@@ -86,6 +88,7 @@
     pthread_mutex_unlock(&sem->mut);
 }
 
+
 void tienet_sem_wait(tienet_sem_t *sem)
 {
     pthread_mutex_lock(&sem->mut);
@@ -113,63 +116,63 @@
 } tienet_master_socket_t;
 
 
-void                           tienet_master_init(int port, void 
fcb_result(tienet_buffer_t *result), char *list, char *exec, int buffer_size, 
int ver_key, int verbose);
-void                           tienet_master_free(void);
-void                           tienet_master_push(const void *data, size_t 
size);
-void                           tienet_master_shutdown(void);
-void                           tienet_master_broadcast(const void *mesg, 
size_t mesg_len);
+void tienet_master_init(int port, void fcb_result(tienet_buffer_t *result), 
char *list, char *exec, int buffer_size, int ver_key, int verbose);
+void tienet_master_free(void);
+void tienet_master_push(const void *data, size_t size);
+void tienet_master_shutdown(void);
+void tienet_master_broadcast(const void *mesg, size_t mesg_len);
 
-void                           tienet_master_begin(void);
-void                           tienet_master_end(void);
-void                           tienet_master_wait(void);
+void tienet_master_begin(void);
+void tienet_master_end(void);
+void tienet_master_wait(void);
 
-void                           tienet_master_connect_slaves(fd_set *readfds);
-void*                          tienet_master_listener(void *ptr);
-void                           tienet_master_send_work(tienet_master_socket_t 
*sock);
-void                           tienet_master_result(tienet_master_socket_t 
*sock);
-void                           tienet_master_shutdown(void);
+void tienet_master_connect_slaves(fd_set *readfds);
+void* tienet_master_listener(void *ptr);
+void tienet_master_send_work(tienet_master_socket_t *sock);
+void tienet_master_result(tienet_master_socket_t *sock);
+void tienet_master_shutdown(void);
 
-static int                     tienet_master_ver_key;
-static int                     tienet_master_port;
-static int                     tienet_master_highest_fd;
+static int tienet_master_ver_key;
+static int tienet_master_port;
+static int tienet_master_highest_fd;
 
-int                            tienet_master_active_slaves;
-int                            tienet_master_socket_num;
-static tienet_master_socket_t  *tienet_master_socket_list;
-static tienet_master_socket_t  *tienet_master_dead_socket_list;
+int tienet_master_active_slaves;
+int tienet_master_socket_num;
+static tienet_master_socket_t *tienet_master_socket_list;
+static tienet_master_socket_t *tienet_master_dead_socket_list;
 
-int                            tienet_master_buffer_size;
-static tienet_master_data_t    *tienet_master_buffer;          /* Buffer */
-static int                     tienet_master_pos_fill;
-static int                     tienet_master_pos_read;
+int tienet_master_buffer_size;
+static tienet_master_data_t *tienet_master_buffer;             /* Buffer */
+static int tienet_master_pos_fill;
+static int tienet_master_pos_read;
 
-static tienet_sem_t            tienet_master_sem_fill; /* Fill Buffer 
Semaphore */
-static tienet_sem_t            tienet_master_sem_read; /* Read Buffer 
Semaphore */
-static tienet_sem_t            tienet_master_sem_app;  /* Application 
Semaphore */
-static tienet_sem_t            tienet_master_sem_out;  /* Outstanding 
Semaphore */
-static tienet_sem_t            tienet_master_sem_shutdown; /* Shutdown 
Semaphore */
+static tienet_sem_t tienet_master_sem_fill;    /* Fill Buffer Semaphore */
+static tienet_sem_t tienet_master_sem_read;    /* Read Buffer Semaphore */
+static tienet_sem_t tienet_master_sem_app;     /* Application Semaphore */
+static tienet_sem_t tienet_master_sem_out;     /* Outstanding Semaphore */
+static tienet_sem_t tienet_master_sem_shutdown; /* Shutdown Semaphore */
 
-uint64_t                       tienet_master_transfer;
-static char                    tienet_master_exec[64]; /* Something to run in 
order to jumpstart the slaves */
-static char                    tienet_master_list[64]; /* A list of slaves in 
daemon mode to connect to */
-int                            tienet_master_verbose;
-int                            tienet_master_endflag;
-int                            tienet_master_shutdown_state;
-int                            tienet_master_halt_networking;
+uint64_t tienet_master_transfer;
+static char tienet_master_exec[64]; /* Something to run in order to jumpstart 
the slaves */
+static char tienet_master_list[64]; /* A list of slaves in daemon mode to 
connect to */
+int tienet_master_verbose;
+int tienet_master_endflag;
+int tienet_master_shutdown_state;
+int tienet_master_halt_networking;
 
-tienet_buffer_t                        tienet_master_result_buffer;
-pthread_mutex_t                        tienet_master_send_mut;
-pthread_mutex_t                        tienet_master_push_mut;
-pthread_mutex_t                        tienet_master_broadcast_mut;
+tienet_buffer_t tienet_master_result_buffer;
+pthread_mutex_t tienet_master_send_mut;
+pthread_mutex_t tienet_master_push_mut;
+pthread_mutex_t tienet_master_broadcast_mut;
 
 
 #if TN_COMPRESSION
-tienet_buffer_t                        tienet_master_result_buffer_comp;
+tienet_buffer_t tienet_master_result_buffer_comp;
 #endif
 
 /* result data callback */
 typedef void tienet_master_fcb_result_t(tienet_buffer_t *result);
-tienet_master_fcb_result_t     *tienet_master_fcb_result;
+tienet_master_fcb_result_t *tienet_master_fcb_result;
 
 
 void tienet_master_init(int port, void fcb_result(tienet_buffer_t *result), 
char *list, char *exec, int buffer_size, int ver_key, int verbose)
@@ -383,7 +386,7 @@
                    /* Make a communications socket that will get stuffed into 
the list */
                    daemon_socket = socket(AF_INET, SOCK_STREAM, 0);
                    if (daemon_socket < 0) {
-                       fprintf(stderr, "unable to create  socket, exiting.\n");
+                       fprintf(stderr, "unable to create socket, exiting.\n");
                        exit(1);
                    }
 
@@ -449,12 +452,12 @@
 
 void* tienet_master_listener(void *ptr)
 {
-    struct     sockaddr_in     master, slave;
-    socklen_t                  addrlen;
-    fd_set                     readfds;
-    tienet_master_socket_t     *sock, *tmp;
-    int                                r, master_socket, slave_socket, 
slave_ver_key;
-    short                              op;
+    struct sockaddr_in master, slave;
+    socklen_t addrlen;
+    fd_set readfds;
+    tienet_master_socket_t *sock, *tmp;
+    int r, master_socket, slave_socket, slave_ver_key;
+    short op;
 
 
     if ((master_socket = socket(AF_INET, SOCK_STREAM, 0)) <= 0) {
@@ -552,24 +555,29 @@
                        }
 
                        /* Send some work */
-/*            tienet_master_send_work(sock); */
+                       /* tienet_master_send_work(sock); */
                    }
                } else {
                    /* Make sure socket is still active on this recv */
                    r = tienet_recv(sock->num, &op, sizeof(short));
                    /* if "r", error code returned, remove slave from pool */
                    if (r) {
-                       tienet_master_socket_t          *tmp2;
-                       /* Because master socket is always last there is no 
need to check if "next" exists.
-                        * Remove this socket from chain and link prev and next 
up to fill gap. */
+                       tienet_master_socket_t *tmp2;
+                       /* Because master socket is always last there
+                        * is no need to check if "next" exists.
+                        * Remove this socket from chain and link prev
+                        * and next up to fill gap.
+                        */
                        if (sock->prev)
                            sock->prev->next = sock->next;
                        sock->next->prev = sock->prev;
 
                        /* Store ptr to sock before we modify it */
                        tmp = sock;
-                       /* If the socket is the head then we need to not only 
modify the socket,
-                        * but the head as well. */
+                       /* If the socket is the head then we need to
+                        * not only modify the socket, but the head as
+                        * well.
+                        */
                        if (tienet_master_socket_list == sock)
                            tienet_master_socket_list = sock->next;
                        sock = sock->prev ? sock->prev : sock->next;
@@ -626,10 +634,12 @@
     short op;
 
     /*
-     * This exists to prevent a collision from tienet_master_push calling this 
function
-     * as a result of a socket being idle and then given work.  If this 
function were called
-     * and 2 threads entered the if (tienet_master_sem_read.val) block and 
waited on tienet_master_sem_read
-     * with the first one hitting the wait on a value of one the other one 
could end up waiting forever.
+     * This exists to prevent a collision from tienet_master_push
+     * calling this function as a result of a socket being idle and
+     * then given work.  If this function were called and 2 threads
+     * entered the if (tienet_master_sem_read.val) block and waited on
+     * tienet_master_sem_read with the first one hitting the wait on a
+     * value of one the other one could end up waiting forever.
      */
     pthread_mutex_lock(&tienet_master_send_mut);
 
@@ -706,7 +716,7 @@
 void tienet_master_result(tienet_master_socket_t *sock)
 {
 #if TN_COMPRESSION
-    unsigned long      dest_len;
+    unsigned long dest_len;
 #endif
 
     /* A work unit has come in, this slave is officially active */
@@ -781,10 +791,11 @@
            tienet_send(socket->num, &op, sizeof(short));
 
            /*
-            * Wait on Recv.  When slave socket closes, select will be 
triggered.
-            * At this point we know for sure the slave has disconnected.  This 
prevents
-            * the master socket from being closed before the slave socket, 
thus pushing
-            * the socket into an evil wait state
+            * Wait on Recv.  When slave socket closes, select will be
+            * triggered.  At this point we know for sure the slave
+            * has disconnected.  This prevents the master socket from
+            * being closed before the slave socket, thus pushing the
+            * socket into an evil wait state
             */
 
            tienet_recv(socket->num, &op, sizeof(short));
@@ -816,9 +827,9 @@
     pthread_mutex_unlock(&tienet_master_broadcast_mut);
 
     /*
-     * Tell any idle slaves to get back to work.
-     * This is the case where slaves have exhausted the work buffer,
-     * then new work becomes available.
+     * Tell any idle slaves to get back to work.  This is the case
+     * where slaves have exhausted the work buffer, then new work
+     * becomes available.
      */
     for (socket = tienet_master_socket_list; socket; socket = socket->next) {
        /* Only if not master socket do we send data to slave */
@@ -827,6 +838,7 @@
     }
 }
 
+
 /*
  * Local Variables:
  * mode: C

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to