fd-io-styleify pass

Change-Id: If2d57a213fc2fec996db26df332910c3d2105f97
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/vlib/vlib/unix/cj.c b/vlib/vlib/unix/cj.c
index 782ddce..553b450 100644
--- a/vlib/vlib/unix/cj.c
+++ b/vlib/vlib/unix/cj.c
@@ -1,4 +1,4 @@
-/* 
+/*
  *------------------------------------------------------------------
  * cj.c
  *
@@ -25,65 +25,68 @@
 cj_main_t cj_main;
 
 void
-cj_log (u32 type, void * data0, void * data1)
+cj_log (u32 type, void *data0, void *data1)
 {
   u64 new_tail;
-  cj_main_t * cjm = &cj_main;
-  cj_record_t * r;
+  cj_main_t *cjm = &cj_main;
+  cj_record_t *r;
 
   if (cjm->enable == 0)
     return;
 
   new_tail = __sync_add_and_fetch (&cjm->tail, 1);
 
-  r = (cj_record_t *) &(cjm->records[new_tail & (cjm->num_records - 1)]);
+  r = (cj_record_t *) & (cjm->records[new_tail & (cjm->num_records - 1)]);
   r->time = vlib_time_now (cjm->vlib_main);
-  r->cpu = os_get_cpu_number();
+  r->cpu = os_get_cpu_number ();
   r->type = type;
-  r->data[0] = pointer_to_uword(data0);
-  r->data[1] = pointer_to_uword(data1);
+  r->data[0] = pointer_to_uword (data0);
+  r->data[1] = pointer_to_uword (data1);
 }
 
-void cj_stop(void)
+void
+cj_stop (void)
 {
-  cj_main_t * cjm = &cj_main;
+  cj_main_t *cjm = &cj_main;
 
   cjm->enable = 0;
 }
 
 
-clib_error_t * cj_init (vlib_main_t * vm)
+clib_error_t *
+cj_init (vlib_main_t * vm)
 {
-  cj_main_t * cjm = &cj_main;
+  cj_main_t *cjm = &cj_main;
 
   cjm->vlib_main = vm;
   return 0;
 }
+
 VLIB_INIT_FUNCTION (cj_init);
 
 static clib_error_t *
 cj_config (vlib_main_t * vm, unformat_input_t * input)
 {
-  cj_main_t * cjm = &cj_main;
+  cj_main_t *cjm = &cj_main;
   int matched = 0;
   int enable = 0;
 
-  while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
+  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (input, "records %d", &cjm->num_records))
-        matched = 1;
+	matched = 1;
       else if (unformat (input, "on"))
-        enable = 1;
+	enable = 1;
       else
-        return clib_error_return (0, "cj_config: unknown input '%U'",
-                                  format_unformat_error, input);
+	return clib_error_return (0, "cj_config: unknown input '%U'",
+				  format_unformat_error, input);
     }
 
   if (matched == 0)
     return 0;
 
   cjm->num_records = max_pow2 (cjm->num_records);
-  vec_validate (cjm->records, cjm->num_records-1);
+  vec_validate (cjm->records, cjm->num_records - 1);
   memset (cjm->records, 0xff, cjm->num_records * sizeof (cj_record_t));
   cjm->tail = ~0;
   cjm->enable = enable;
@@ -93,112 +96,119 @@
 
 VLIB_CONFIG_FUNCTION (cj_config, "cj");
 
-void cj_enable_disable (int is_enable)
+void
+cj_enable_disable (int is_enable)
 {
-  cj_main_t * cjm = &cj_main;
-  
+  cj_main_t *cjm = &cj_main;
+
   if (cjm->num_records)
     cjm->enable = is_enable;
   else
     vlib_cli_output (cjm->vlib_main, "CJ not configured...");
 }
 
-static inline void cj_dump_one_record (cj_record_t * r)
+static inline void
+cj_dump_one_record (cj_record_t * r)
 {
   fprintf (stderr, "[%d]: %10.6f T%02d %llx %llx\n",
-           r->cpu, r->time, r->type, (long long unsigned int) r->data[0], 
-           (long long unsigned int) r->data[1]);
+	   r->cpu, r->time, r->type, (long long unsigned int) r->data[0],
+	   (long long unsigned int) r->data[1]);
 }
 
-static void cj_dump_internal (u8 filter0_enable, u64 filter0, 
-                              u8 filter1_enable, u64 filter1)
+static void
+cj_dump_internal (u8 filter0_enable, u64 filter0,
+		  u8 filter1_enable, u64 filter1)
 {
-  cj_main_t * cjm = &cj_main;
-  cj_record_t * r;
+  cj_main_t *cjm = &cj_main;
+  cj_record_t *r;
   u32 i, index;
-  
+
   if (cjm->num_records == 0)
     {
       fprintf (stderr, "CJ not configured...\n");
       return;
     }
 
-  if (cjm->tail == (u64)~0)
+  if (cjm->tail == (u64) ~ 0)
     {
       fprintf (stderr, "No data collected...\n");
       return;
     }
 
   /* Has the trace wrapped? */
-  index = (cjm->tail+1) & (cjm->num_records - 1);
+  index = (cjm->tail + 1) & (cjm->num_records - 1);
   r = &(cjm->records[index]);
 
-  if (r->cpu != (u32)~0)
+  if (r->cpu != (u32) ~ 0)
     {
-        /* Yes, dump from tail + 1 to the end */
+      /* Yes, dump from tail + 1 to the end */
       for (i = index; i < cjm->num_records; i++)
-        {
-          if (filter0_enable && (r->data[0] != filter0))
-            goto skip;
-          if (filter1_enable && (r->data[1] != filter1))
-            goto skip;
-          cj_dump_one_record (r);
-        skip:
-          r++;
-        }
+	{
+	  if (filter0_enable && (r->data[0] != filter0))
+	    goto skip;
+	  if (filter1_enable && (r->data[1] != filter1))
+	    goto skip;
+	  cj_dump_one_record (r);
+	skip:
+	  r++;
+	}
     }
   /* dump from the beginning through the final tail */
   r = cjm->records;
   for (i = 0; i <= cjm->tail; i++)
     {
       if (filter0_enable && (r->data[0] != filter0))
-        goto skip2;
+	goto skip2;
       if (filter1_enable && (r->data[1] != filter1))
-        goto skip2;
+	goto skip2;
       cj_dump_one_record (r);
     skip2:
       r++;
     }
 }
 
-void cj_dump (void)
+void
+cj_dump (void)
 {
   cj_dump_internal (0, 0, 0, 0);
 }
 
-void cj_dump_filter_data0 (u64 filter0)
+void
+cj_dump_filter_data0 (u64 filter0)
 {
-  cj_dump_internal (1/* enable f0 */, filter0, 0, 0);
+  cj_dump_internal (1 /* enable f0 */ , filter0, 0, 0);
 }
 
-void cj_dump_filter_data1 (u64 filter1)
+void
+cj_dump_filter_data1 (u64 filter1)
 {
-  cj_dump_internal (0, 0, 1 /* enable f1 */, filter1);
+  cj_dump_internal (0, 0, 1 /* enable f1 */ , filter1);
 }
 
-void cj_dump_filter_data12 (u64 filter0, u64 filter1)
+void
+cj_dump_filter_data12 (u64 filter0, u64 filter1)
 {
   cj_dump_internal (1, filter0, 1, filter1);
 }
 
 static clib_error_t *
 cj_command_fn (vlib_main_t * vm,
-               unformat_input_t * input,
-               vlib_cli_command_t * cmd)
+	       unformat_input_t * input, vlib_cli_command_t * cmd)
 {
   int is_enable = -1;
   int is_dump = -1;
 
-  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
-    if (unformat (input, "enable") || unformat (input, "on"))
-      is_enable = 1;
-    else if (unformat (input, "disable") || unformat (input, "off"))
-      is_enable = 0;
-    else if (unformat (input, "dump"))
-      is_dump = 1;
-    else
-      return clib_error_return (0, "unknown input `%U'",
-                                format_unformat_error, input);
+  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (input, "enable") || unformat (input, "on"))
+	is_enable = 1;
+      else if (unformat (input, "disable") || unformat (input, "off"))
+	is_enable = 0;
+      else if (unformat (input, "dump"))
+	is_dump = 1;
+      else
+	return clib_error_return (0, "unknown input `%U'",
+				  format_unformat_error, input);
     }
 
   if (is_enable >= 0)
@@ -210,9 +220,19 @@
   return 0;
 }
 
+/* *INDENT-OFF* */
 VLIB_CLI_COMMAND (cj_command,static) = {
   .path = "cj",
   .short_help = "cj",
   .function = cj_command_fn,
 };
+/* *INDENT-ON* */
 
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */