http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheDir.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheDir.cc b/iocore/cache/CacheDir.cc
index dde499a..779c16b 100644
--- a/iocore/cache/CacheDir.cc
+++ b/iocore/cache/CacheDir.cc
@@ -26,24 +26,27 @@
 
 // #define LOOP_CHECK_MODE 1
 #ifdef LOOP_CHECK_MODE
-#define DIR_LOOP_THRESHOLD           1000
+#define DIR_LOOP_THRESHOLD 1000
 #endif
 #include "ink_stack_trace.h"
 
-#define CACHE_INC_DIR_USED(_m) do { \
-ProxyMutex *mutex = _m; \
-CACHE_INCREMENT_DYN_STAT(cache_direntries_used_stat); \
-} while (0) \
+#define CACHE_INC_DIR_USED(_m)                            \
+  do {                                                    \
+    ProxyMutex *mutex = _m;                               \
+    CACHE_INCREMENT_DYN_STAT(cache_direntries_used_stat); \
+  } while (0)
 
-#define CACHE_DEC_DIR_USED(_m) do { \
-ProxyMutex *mutex = _m; \
-CACHE_DECREMENT_DYN_STAT(cache_direntries_used_stat); \
-} while (0) \
+#define CACHE_DEC_DIR_USED(_m)                            \
+  do {                                                    \
+    ProxyMutex *mutex = _m;                               \
+    CACHE_DECREMENT_DYN_STAT(cache_direntries_used_stat); \
+  } while (0)
 
-#define CACHE_INC_DIR_COLLISIONS(_m) do {\
-ProxyMutex *mutex = _m; \
-CACHE_INCREMENT_DYN_STAT(cache_directory_collision_count_stat); \
-} while (0);
+#define CACHE_INC_DIR_COLLISIONS(_m)                                \
+  do {                                                              \
+    ProxyMutex *mutex = _m;                                         \
+    CACHE_INCREMENT_DYN_STAT(cache_directory_collision_count_stat); \
+  } while (0);
 
 
 // Globals
@@ -83,8 +86,7 @@ OpenDir::open_write(CacheVC *cont, int allow_if_writers, int 
max_writers)
     }
     return 0;
   }
-  OpenDirEntry *od = THREAD_ALLOC(openDirEntryAllocator,
-                                  cont->mutex->thread_holding);
+  OpenDirEntry *od = THREAD_ALLOC(openDirEntryAllocator, 
cont->mutex->thread_holding);
   od->readers.head = NULL;
   od->writers.push(cont);
   od->num_writers = 1;
@@ -193,7 +195,7 @@ dir_bucket_loop_check(Dir *start_dir, Dir *seg)
       return 1;
 
     if (p2 == p1)
-      return 0;                 // we have a loop
+      return 0; // we have a loop
   }
   return 1;
 }
@@ -272,9 +274,12 @@ check_dir(Vol *d)
     Dir *seg = dir_segment(s, d);
     for (i = 0; i < d->buckets; i++) {
       Dir *b = dir_bucket(i, seg);
-      if (!(dir_bucket_length(b, s, d) >= 0)) return 0;
-      if (!(!dir_next(b) || dir_offset(b))) return 0;
-      if (!(dir_bucket_loop_check(b, seg))) return 0;
+      if (!(dir_bucket_length(b, s, d) >= 0))
+        return 0;
+      if (!(!dir_next(b) || dir_offset(b)))
+        return 0;
+      if (!(dir_bucket_loop_check(b, seg)))
+        return 0;
     }
   }
   return 1;
@@ -341,8 +346,8 @@ dir_clean_bucket(Dir *b, int s, Vol *vol)
 #endif
     if (!dir_valid(vol, e) || !dir_offset(e)) {
       if (is_debug_tag_set("dir_clean"))
-        Debug("dir_clean", "cleaning %p tag %X boffset %" PRId64 " b %p p %p l 
%d",
-              e, dir_tag(e), dir_offset(e), b, p, dir_bucket_length(b, s, 
vol));
+        Debug("dir_clean", "cleaning %p tag %X boffset %" PRId64 " b %p p %p l 
%d", e, dir_tag(e), dir_offset(e), b, p,
+              dir_bucket_length(b, s, vol));
       if (dir_offset(e))
         CACHE_DEC_DIR_USED(vol->mutex);
       e = dir_delete_entry(e, p, s, vol);
@@ -384,7 +389,7 @@ interim_dir_clean_bucket(Dir *b, int s, Vol *vol, int 
offset)
     }
     p = e;
     e = next_dir(e, seg);
-  } while(e);
+  } while (e);
 }
 
 void
@@ -416,8 +421,8 @@ dir_clean_bucket(Dir *b, int s, InterimCacheVol *d)
 #endif
     if (!dir_valid(d, e) || !dir_offset(e)) {
       if (is_debug_tag_set("dir_clean"))
-        Debug("dir_clean", "cleaning %p tag %X boffset %" PRId64 " b %p p %p l 
%d",
-              e, dir_tag(e), dir_offset(e), b, p, dir_bucket_length(b, s, 
vol));
+        Debug("dir_clean", "cleaning %p tag %X boffset %" PRId64 " b %p p %p l 
%d", e, dir_tag(e), dir_offset(e), b, p,
+              dir_bucket_length(b, s, vol));
       if (dir_offset(e))
         CACHE_DEC_DIR_USED(vol->mutex);
       e = dir_delete_entry(e, p, s, vol);
@@ -452,10 +457,10 @@ dir_clean_range_interimvol(off_t start, off_t end, 
InterimCacheVol *svol)
 
   for (int i = 0; i < vol->buckets * DIR_DEPTH * vol->segments; i++) {
     Dir *e = dir_index(vol, i);
-    if (dir_ininterim(e) && dir_get_index(e) == offset && !dir_token(e) &&
-            dir_offset(e) >= (int64_t)start && dir_offset(e) < (int64_t)end) {
+    if (dir_ininterim(e) && dir_get_index(e) == offset && !dir_token(e) && 
dir_offset(e) >= (int64_t)start &&
+        dir_offset(e) < (int64_t)end) {
       CACHE_DEC_DIR_USED(vol->mutex);
-      dir_set_offset(e, 0);     // delete
+      dir_set_offset(e, 0); // delete
     }
   }
 
@@ -470,7 +475,7 @@ dir_clear_range(off_t start, off_t end, Vol *vol)
     Dir *e = dir_index(vol, i);
     if (!dir_token(e) && dir_offset(e) >= (int64_t)start && dir_offset(e) < 
(int64_t)end) {
       CACHE_DEC_DIR_USED(vol->mutex);
-      dir_set_offset(e, 0);     // delete
+      dir_set_offset(e, 0); // delete
     }
   }
   dir_clean_vol(vol);
@@ -503,7 +508,7 @@ freelist_clean(int s, Vol *vol)
       Dir *e = dir_bucket_row(b, l);
       if (dir_head(e) && !(n++ % 10)) {
         CACHE_DEC_DIR_USED(vol->mutex);
-        dir_set_offset(e, 0);   // delete
+        dir_set_offset(e, 0); // delete
       }
     }
   }
@@ -570,7 +575,7 @@ dir_segment_accounted(int s, Vol *d, int offby, int *f, int 
*u, int *et, int *v,
   if (av)
     *av = agg_valid;
   if (as)
-    *as = used ? (int) (agg_size / used) : 0;
+    *as = used ? (int)(agg_size / used) : 0;
   ink_assert(d->buckets * DIR_DEPTH - (free + used + empty) <= offby);
   return d->buckets * DIR_DEPTH - (free + used + empty) <= offby;
 }
@@ -588,7 +593,7 @@ dir_free_entry(Dir *e, int s, Vol *d)
 }
 
 int
-dir_probe(CacheKey *key, Vol *d, Dir *result, Dir ** last_collision)
+dir_probe(CacheKey *key, Vol *d, Dir *result, Dir **last_collision)
 {
   ink_assert(d->mutex->thread_holding == this_ethread());
   int s = key->slice32(0) % d->segments;
@@ -624,14 +629,15 @@ Lagain:
           goto Lcont;
         }
         if (dir_valid(d, e)) {
-          DDebug("dir_probe_hit", "found %X %X vol %d bucket %d boffset %" 
PRId64 "", key->slice32(0), key->slice32(1), d->fd, b, dir_offset(e));
+          DDebug("dir_probe_hit", "found %X %X vol %d bucket %d boffset %" 
PRId64 "", key->slice32(0), key->slice32(1), d->fd, b,
+                 dir_offset(e));
           dir_assign(result, e);
           *last_collision = e;
 #if !TS_USE_INTERIM_CACHE
           ink_assert(dir_offset(e) * CACHE_BLOCK_SIZE < d->len);
 #endif
           return 1;
-        } else {                // delete the invalid entry
+        } else { // delete the invalid entry
           CACHE_DEC_DIR_USED(d->mutex);
           e = dir_delete_entry(e, p, s, d);
           continue;
@@ -642,7 +648,7 @@ Lagain:
       p = e;
       e = next_dir(e, seg);
     } while (e);
-  if (collision) {              // last collision no longer in the list, retry
+  if (collision) { // last collision no longer in the list, retry
     DDebug("cache_stats", "Incrementing dir collisions");
     CACHE_INC_DIR_COLLISIONS(d->mutex);
     collision = NULL;
@@ -706,9 +712,8 @@ Lfill:
   dir_set_tag(e, key->slice32(2));
   ink_assert(vol_offset(d, e) < (d->skip + d->len));
 #endif
-  DDebug("dir_insert",
-        "insert %p %X into vol %d bucket %d at %p tag %X %X boffset %" PRId64 
"",
-         e, key->slice32(0), d->fd, bi, e, key->slice32(1), dir_tag(e), 
dir_offset(e));
+  DDebug("dir_insert", "insert %p %X into vol %d bucket %d at %p tag %X %X 
boffset %" PRId64 "", e, key->slice32(0), d->fd, bi, e,
+         key->slice32(1), dir_tag(e), dir_offset(e));
   CHECK_DIR(d);
   d->header->dirty = 1;
   CACHE_INC_DIR_USED(d->mutex);
@@ -733,7 +738,7 @@ dir_overwrite(CacheKey *key, Vol *d, Dir *dir, Dir 
*overwrite, bool must_overwri
   Vol *vol = d;
   CHECK_DIR(d);
 
-  ink_assert((unsigned int) dir_approx_size(dir) <= (unsigned int) 
(MAX_FRAG_SIZE + sizeofDoc));        // XXX - size should be unsigned
+  ink_assert((unsigned int)dir_approx_size(dir) <= (unsigned 
int)(MAX_FRAG_SIZE + sizeofDoc)); // XXX - size should be unsigned
 Lagain:
   // find entry to overwrite
   e = b;
@@ -784,9 +789,8 @@ Lfill:
   dir_assign_data(e, dir);
   dir_set_tag(e, t);
   ink_assert(vol_offset(d, e) < d->skip + d->len);
-  DDebug("dir_overwrite",
-        "overwrite %p %X into vol %d bucket %d at %p tag %X %X boffset %" 
PRId64 "",
-         e, key->slice32(0), d->fd, bi, e, t, dir_tag(e), dir_offset(e));
+  DDebug("dir_overwrite", "overwrite %p %X into vol %d bucket %d at %p tag %X 
%X boffset %" PRId64 "", e, key->slice32(0), d->fd,
+         bi, e, t, dir_tag(e), dir_offset(e));
   CHECK_DIR(d);
   d->header->dirty = 1;
   return res;
@@ -836,7 +840,7 @@ dir_delete(CacheKey *key, Vol *d, Dir *del)
 // Lookaside Cache
 
 int
-dir_lookaside_probe(CacheKey *key, Vol *d, Dir *result, EvacuationBlock ** 
eblock)
+dir_lookaside_probe(CacheKey *key, Vol *d, Dir *result, EvacuationBlock 
**eblock)
 {
   ink_assert(d->mutex->thread_holding == this_ethread());
   int i = key->slice32(3) % LOOKASIDE_SIZE;
@@ -861,7 +865,8 @@ int
 dir_lookaside_insert(EvacuationBlock *eblock, Vol *d, Dir *to)
 {
   CacheKey *key = &eblock->evac_frags.earliest_key;
-  DDebug("dir_lookaside", "insert %X %X, offset %d phase %d", key->slice32(0), 
key->slice32(1), (int) dir_offset(to), (int) dir_phase(to));
+  DDebug("dir_lookaside", "insert %X %X, offset %d phase %d", key->slice32(0), 
key->slice32(1), (int)dir_offset(to),
+         (int)dir_phase(to));
   ink_assert(d->mutex->thread_holding == this_ethread());
   int i = key->slice32(3) % LOOKASIDE_SIZE;
   EvacuationBlock *b = new_EvacuationBlock(d->mutex->thread_holding);
@@ -884,8 +889,8 @@ dir_lookaside_fixup(CacheKey *key, Vol *d)
   while (b) {
     if (b->evac_frags.key == *key) {
       int res = dir_overwrite(key, d, &b->new_dir, &b->dir, false);
-      DDebug("dir_lookaside", "fixup %X %X offset %" PRId64" phase %d %d",
-            key->slice32(0), key->slice32(1), dir_offset(&b->new_dir), 
dir_phase(&b->new_dir), res);
+      DDebug("dir_lookaside", "fixup %X %X offset %" PRId64 " phase %d %d", 
key->slice32(0), key->slice32(1),
+             dir_offset(&b->new_dir), dir_phase(&b->new_dir), res);
 #if TS_USE_INTERIM_CACHE == 1
       int64_t o = dir_get_offset(&b->dir), n = dir_get_offset(&b->new_dir);
 #else
@@ -911,8 +916,8 @@ dir_lookaside_cleanup(Vol *d)
     while (b) {
       if (!dir_valid(d, &b->new_dir)) {
         EvacuationBlock *nb = b->link.next;
-        DDebug("dir_lookaside", "cleanup %X %X cleaned up",
-              b->evac_frags.earliest_key.slice32(0), 
b->evac_frags.earliest_key.slice32(1));
+        DDebug("dir_lookaside", "cleanup %X %X cleaned up", 
b->evac_frags.earliest_key.slice32(0),
+               b->evac_frags.earliest_key.slice32(1));
         d->lookaside[i].remove(b);
         free_CacheVC(b->earliest_evacuator);
         free_EvacuationBlock(b, d->mutex->thread_holding);
@@ -920,7 +925,8 @@ dir_lookaside_cleanup(Vol *d)
         goto Lagain;
       }
       b = b->link.next;
-    Lagain:;
+    Lagain:
+      ;
     }
   }
 }
@@ -933,8 +939,8 @@ dir_lookaside_remove(CacheKey *key, Vol *d)
   EvacuationBlock *b = d->lookaside[i].head;
   while (b) {
     if (b->evac_frags.key == *key) {
-      DDebug("dir_lookaside", "remove %X %X offset %" PRId64" phase %d",
-            key->slice32(0), key->slice32(1), dir_offset(&b->new_dir), 
dir_phase(&b->new_dir));
+      DDebug("dir_lookaside", "remove %X %X offset %" PRId64 " phase %d", 
key->slice32(0), key->slice32(1), dir_offset(&b->new_dir),
+             dir_phase(&b->new_dir));
       d->lookaside[i].remove(b);
       free_EvacuationBlock(b, d->mutex->thread_holding);
       return;
@@ -1006,7 +1012,7 @@ sync_cache_dir_on_shutdown(void)
   char *buf = NULL;
   size_t buflen = 0;
 
-  EThread *t = (EThread *) 0xdeadbeef;
+  EThread *t = (EThread *)0xdeadbeef;
   for (int i = 0; i < gnvol; i++) {
     // the process is going down, do a blocking call
     // dont release the volume's lock, there could
@@ -1037,8 +1043,7 @@ sync_cache_dir_on_shutdown(void)
       // set write limit
       d->header->agg_pos = d->header->write_pos + d->agg_buf_pos;
 
-      int r = pwrite(d->fd, d->agg_buffer, d->agg_buf_pos,
-                     d->header->write_pos);
+      int r = pwrite(d->fd, d->agg_buffer, d->agg_buf_pos, 
d->header->write_pos);
       if (r != d->agg_buf_pos) {
         ink_assert(!"flusing agg buffer failed");
         continue;
@@ -1104,7 +1109,6 @@ sync_cache_dir_on_shutdown(void)
 }
 
 
-
 int
 CacheSync::mainEvent(int event, Event *e)
 {
@@ -1129,7 +1133,7 @@ Lrestart:
     return EVENT_CONT;
   }
 
-  Vol* vol = gvol[vol_idx]; // must be named "vol" to make STAT macros work.
+  Vol *vol = gvol[vol_idx]; // must be named "vol" to make STAT macros work.
 
   if (event == AIO_EVENT_DONE) {
     // AIO Thread
@@ -1150,7 +1154,8 @@ Lrestart:
       return EVENT_CONT;
     }
 
-    if (!vol->dir_sync_in_progress) start_time = ink_get_hrtime();
+    if (!vol->dir_sync_in_progress)
+      start_time = ink_get_hrtime();
 
     // recompute hit_evacuate_window
     vol->hit_evacuate_window = (vol->data_blocks * 
cache_config_hit_evacuate_percent) / 100;
@@ -1200,7 +1205,7 @@ Lrestart:
       vol->footer->sync_serial = vol->header->sync_serial;
 #if TS_USE_INTERIM_CACHE == 1
       for (int j = 0; j < vol->num_interim_vols; j++) {
-          vol->interim_vols[j].header->sync_serial = vol->header->sync_serial;
+        vol->interim_vols[j].header->sync_serial = vol->header->sync_serial;
       }
 #endif
       CHECK_DIR(d);
@@ -1247,11 +1252,10 @@ Ldone:
 //
 
 #define HIST_DEPTH 8
-int
-Vol::dir_check(bool /* fix ATS_UNUSED */) // TODO: we should eliminate this 
parameter ?
+int Vol::dir_check(bool /* fix ATS_UNUSED */) // TODO: we should eliminate 
this parameter ?
 {
-  int hist[HIST_DEPTH + 1] = { 0 };
-  int *shist = (int*)ats_malloc(segments * sizeof(int));
+  int hist[HIST_DEPTH + 1] = {0};
+  int *shist = (int *)ats_malloc(segments * sizeof(int));
   memset(shist, 0, segments * sizeof(int));
   int j;
   int stale = 0, full = 0, empty = 0;
@@ -1298,21 +1302,24 @@ Vol::dir_check(bool /* fix ATS_UNUSED */) // TODO: we 
should eliminate this para
   for (j = 0; j < HIST_DEPTH; j++) {
     printf("%8d ", hist[j]);
     if ((j % 4 == 3))
-      printf("\n" "                           ");
+      printf("\n"
+             "                           ");
   }
   printf("\n");
   printf("        Segment Fullness:  ");
   for (j = 0; j < segments; j++) {
     printf("%5d ", shist[j]);
     if ((j % 5 == 4))
-      printf("\n" "                           ");
+      printf("\n"
+             "                           ");
   }
   printf("\n");
   printf("        Freelist Fullness: ");
   for (j = 0; j < segments; j++) {
     printf("%5d ", dir_freelist_length(this, j));
     if ((j % 5 == 4))
-      printf("\n" "                           ");
+      printf("\n"
+             "                           ");
   }
   printf("\n");
   ats_free(shist);
@@ -1325,74 +1332,30 @@ Vol::dir_check(bool /* fix ATS_UNUSED */) // TODO: we 
should eliminate this para
 
 // permutation table
 uint8_t CacheKey_next_table[256] = {
-  21, 53, 167, 51, 255, 126, 241, 151,
-  115, 66, 155, 174, 226, 215, 80, 188,
-  12, 95, 8, 24, 162, 201, 46, 104,
-  79, 172, 39, 68, 56, 144, 142, 217,
-  101, 62, 14, 108, 120, 90, 61, 47,
-  132, 199, 110, 166, 83, 125, 57, 65,
-  19, 130, 148, 116, 228, 189, 170, 1,
-  71, 0, 252, 184, 168, 177, 88, 229,
-  242, 237, 183, 55, 13, 212, 240, 81,
-  211, 74, 195, 205, 147, 93, 30, 87,
-  86, 63, 135, 102, 233, 106, 118, 163,
-  107, 10, 243, 136, 160, 119, 43, 161,
-  206, 141, 203, 78, 175, 36, 37, 140,
-  224, 197, 185, 196, 248, 84, 122, 73,
-  152, 157, 18, 225, 219, 145, 45, 2,
-  171, 249, 173, 32, 143, 137, 69, 41,
-  35, 89, 33, 98, 179, 214, 114, 231,
-  251, 123, 180, 194, 29, 3, 178, 31,
-  192, 164, 15, 234, 26, 230, 91, 156,
-  5, 16, 23, 244, 58, 50, 4, 67,
-  134, 165, 60, 235, 250, 7, 138, 216,
-  49, 139, 191, 154, 11, 52, 239, 59,
-  111, 245, 9, 64, 25, 129, 247, 232,
-  190, 246, 109, 22, 112, 210, 221, 181,
-  92, 169, 48, 100, 193, 77, 103, 133,
-  70, 220, 207, 223, 176, 204, 76, 186,
-  200, 208, 158, 182, 227, 222, 131, 38,
-  187, 238, 6, 34, 253, 128, 146, 44,
-  94, 127, 105, 153, 113, 20, 27, 124,
-  159, 17, 72, 218, 96, 149, 213, 42,
-  28, 254, 202, 40, 117, 82, 97, 209,
-  54, 236, 121, 75, 85, 150, 99, 198,
+  21,  53,  167, 51,  255, 126, 241, 151, 115, 66,  155, 174, 226, 215, 80,  
188, 12,  95,  8,   24,  162, 201, 46,  104, 79,  172,
+  39,  68,  56,  144, 142, 217, 101, 62,  14,  108, 120, 90,  61,  47,  132, 
199, 110, 166, 83,  125, 57,  65,  19,  130, 148, 116,
+  228, 189, 170, 1,   71,  0,   252, 184, 168, 177, 88,  229, 242, 237, 183, 
55,  13,  212, 240, 81,  211, 74,  195, 205, 147, 93,
+  30,  87,  86,  63,  135, 102, 233, 106, 118, 163, 107, 10,  243, 136, 160, 
119, 43,  161, 206, 141, 203, 78,  175, 36,  37,  140,
+  224, 197, 185, 196, 248, 84,  122, 73,  152, 157, 18,  225, 219, 145, 45,  
2,   171, 249, 173, 32,  143, 137, 69,  41,  35,  89,
+  33,  98,  179, 214, 114, 231, 251, 123, 180, 194, 29,  3,   178, 31,  192, 
164, 15,  234, 26,  230, 91,  156, 5,   16,  23,  244,
+  58,  50,  4,   67,  134, 165, 60,  235, 250, 7,   138, 216, 49,  139, 191, 
154, 11,  52,  239, 59,  111, 245, 9,   64,  25,  129,
+  247, 232, 190, 246, 109, 22,  112, 210, 221, 181, 92,  169, 48,  100, 193, 
77,  103, 133, 70,  220, 207, 223, 176, 204, 76,  186,
+  200, 208, 158, 182, 227, 222, 131, 38,  187, 238, 6,   34,  253, 128, 146, 
44,  94,  127, 105, 153, 113, 20,  27,  124, 159, 17,
+  72,  218, 96,  149, 213, 42,  28,  254, 202, 40,  117, 82,  97,  209, 54,  
236, 121, 75,  85,  150, 99,  198,
 };
 
 // permutation table
 uint8_t CacheKey_prev_table[256] = {
-  57, 55, 119, 141, 158, 152, 218, 165,
-  18, 178, 89, 172, 16, 68, 34, 146,
-  153, 233, 114, 48, 229, 0, 187, 154,
-  19, 180, 148, 230, 240, 140, 78, 143,
-  123, 130, 219, 128, 101, 102, 215, 26,
-  243, 127, 239, 94, 223, 118, 22, 39,
-  194, 168, 157, 3, 173, 1, 248, 67,
-  28, 46, 156, 175, 162, 38, 33, 81,
-  179, 47, 9, 159, 27, 126, 200, 56,
-  234, 111, 73, 251, 206, 197, 99, 24,
-  14, 71, 245, 44, 109, 252, 80, 79,
-  62, 129, 37, 150, 192, 77, 224, 17,
-  236, 246, 131, 254, 195, 32, 83, 198,
-  23, 226, 85, 88, 35, 186, 42, 176,
-  188, 228, 134, 8, 51, 244, 86, 93,
-  36, 250, 110, 137, 231, 45, 5, 225,
-  221, 181, 49, 214, 40, 199, 160, 82,
-  91, 125, 166, 169, 103, 97, 30, 124,
-  29, 117, 222, 76, 50, 237, 253, 7,
-  112, 227, 171, 10, 151, 113, 210, 232,
-  92, 95, 20, 87, 145, 161, 43, 2,
-  60, 193, 54, 120, 25, 122, 11, 100,
-  204, 61, 142, 132, 138, 191, 211, 66,
-  59, 106, 207, 216, 15, 53, 184, 170,
-  144, 196, 139, 74, 107, 105, 255, 41,
-  208, 21, 242, 98, 205, 75, 96, 202,
-  209, 247, 189, 72, 69, 238, 133, 13,
-  167, 31, 235, 116, 201, 190, 213, 203,
-  104, 115, 12, 212, 52, 63, 149, 135,
-  183, 84, 147, 163, 249, 65, 217, 174,
-  70, 6, 64, 90, 155, 177, 185, 182,
-  108, 121, 164, 136, 58, 220, 241, 4,
+  57,  55,  119, 141, 158, 152, 218, 165, 18,  178, 89,  172, 16,  68,  34,  
146, 153, 233, 114, 48,  229, 0,   187, 154, 19,  180,
+  148, 230, 240, 140, 78,  143, 123, 130, 219, 128, 101, 102, 215, 26,  243, 
127, 239, 94,  223, 118, 22,  39,  194, 168, 157, 3,
+  173, 1,   248, 67,  28,  46,  156, 175, 162, 38,  33,  81,  179, 47,  9,   
159, 27,  126, 200, 56,  234, 111, 73,  251, 206, 197,
+  99,  24,  14,  71,  245, 44,  109, 252, 80,  79,  62,  129, 37,  150, 192, 
77,  224, 17,  236, 246, 131, 254, 195, 32,  83,  198,
+  23,  226, 85,  88,  35,  186, 42,  176, 188, 228, 134, 8,   51,  244, 86,  
93,  36,  250, 110, 137, 231, 45,  5,   225, 221, 181,
+  49,  214, 40,  199, 160, 82,  91,  125, 166, 169, 103, 97,  30,  124, 29,  
117, 222, 76,  50,  237, 253, 7,   112, 227, 171, 10,
+  151, 113, 210, 232, 92,  95,  20,  87,  145, 161, 43,  2,   60,  193, 54,  
120, 25,  122, 11,  100, 204, 61,  142, 132, 138, 191,
+  211, 66,  59,  106, 207, 216, 15,  53,  184, 170, 144, 196, 139, 74,  107, 
105, 255, 41,  208, 21,  242, 98,  205, 75,  96,  202,
+  209, 247, 189, 72,  69,  238, 133, 13,  167, 31,  235, 116, 201, 190, 213, 
203, 104, 115, 12,  212, 52,  63,  149, 135, 183, 84,
+  147, 163, 249, 65,  217, 174, 70,  6,   64,  90,  155, 177, 185, 182, 108, 
121, 164, 136, 58,  220, 241, 4,
 };
 
 //
@@ -1408,7 +1371,7 @@ regress_rand_init(unsigned int i)
 void
 regress_rand_CacheKey(CacheKey *key)
 {
-  unsigned int *x = (unsigned int *) key;
+  unsigned int *x = (unsigned int *)key;
   for (int i = 0; i < 4; i++)
     x[i] = next_rand(&regress_rand_seed);
 }
@@ -1417,7 +1380,7 @@ void
 dir_corrupt_bucket(Dir *b, int s, Vol *d)
 {
   // coverity[dont_call]
-  int l = ((int) (dir_bucket_length(b, s, d) * drand48()));
+  int l = ((int)(dir_bucket_length(b, s, d) * drand48()));
   Dir *e = b;
   Dir *seg = dir_segment(s, d);
   for (int i = 0; i < l; i++) {
@@ -1427,7 +1390,8 @@ dir_corrupt_bucket(Dir *b, int s, Vol *d)
   dir_set_next(e, dir_to_offset(e, seg));
 }
 
-EXCLUSIVE_REGRESSION_TEST(Cache_dir) (RegressionTest *t, int /* atype 
ATS_UNUSED */, int *status) {
+EXCLUSIVE_REGRESSION_TEST(Cache_dir)(RegressionTest *t, int /* atype 
ATS_UNUSED */, int *status)
+{
   ink_hrtime ttime;
   int ret = REGRESSION_TEST_PASSED;
 
@@ -1470,7 +1434,7 @@ EXCLUSIVE_REGRESSION_TEST(Cache_dir) (RegressionTest *t, 
int /* atype ATS_UNUSED
     inserted++;
   }
   rprintf(t, "inserted: %d\n", inserted);
-  if ((unsigned int) (inserted - free) > 1)
+  if ((unsigned int)(inserted - free) > 1)
     ret = REGRESSION_TEST_FAILED;
 
   // test delete
@@ -1481,7 +1445,7 @@ EXCLUSIVE_REGRESSION_TEST(Cache_dir) (RegressionTest *t, 
int /* atype ATS_UNUSED
   dir_clean_segment(s, d);
   int newfree = dir_freelist_length(d, s);
   rprintf(t, "newfree: %d\n", newfree);
-  if ((unsigned int) (newfree - free) > 1)
+  if ((unsigned int)(newfree - free) > 1)
     ret = REGRESSION_TEST_FAILED;
 
   // test insert-delete
@@ -1493,10 +1457,10 @@ EXCLUSIVE_REGRESSION_TEST(Cache_dir) (RegressionTest 
*t, int /* atype ATS_UNUSED
     dir_insert(&key, d, &dir);
   }
   uint64_t us = (ink_get_hrtime_internal() - ttime) / HRTIME_USECOND;
-  //On windows us is sometimes 0. I don't know why.
-  //printout the insert rate only if its not 0
+  // On windows us is sometimes 0. I don't know why.
+  // printout the insert rate only if its not 0
   if (us)
-    rprintf(t, "insert rate = %d / second\n", (int) ((newfree * (uint64_t) 
1000000) / us));
+    rprintf(t, "insert rate = %d / second\n", (int)((newfree * 
(uint64_t)1000000) / us));
   regress_rand_init(13);
   ttime = ink_get_hrtime_internal();
   for (i = 0; i < newfree; i++) {
@@ -1506,10 +1470,10 @@ EXCLUSIVE_REGRESSION_TEST(Cache_dir) (RegressionTest 
*t, int /* atype ATS_UNUSED
       ret = REGRESSION_TEST_FAILED;
   }
   us = (ink_get_hrtime_internal() - ttime) / HRTIME_USECOND;
-  //On windows us is sometimes 0. I don't know why.
-  //printout the probe rate only if its not 0
+  // On windows us is sometimes 0. I don't know why.
+  // printout the probe rate only if its not 0
   if (us)
-    rprintf(t, "probe rate = %d / second\n", (int) ((newfree * (uint64_t) 
1000000) / us));
+    rprintf(t, "probe rate = %d / second\n", (int)((newfree * 
(uint64_t)1000000) / us));
 
 
   for (int c = 0; c < vol_direntries(d) * 0.75; c++) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheDisk.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheDisk.cc b/iocore/cache/CacheDisk.cc
index b2ed592..0372d8d 100644
--- a/iocore/cache/CacheDisk.cc
+++ b/iocore/cache/CacheDisk.cc
@@ -63,7 +63,7 @@ CacheDisk::open(char *s, off_t blocks, off_t askip, int 
ahw_sector_size, int fil
 
   SET_HANDLER(&CacheDisk::openStart);
   io.aiocb.aio_offset = skip;
-  io.aiocb.aio_buf = (char *) header;
+  io.aiocb.aio_buf = (char *)header;
   io.aiocb.aio_nbytes = header_len;
   io.thread = AIO_CALLBACK_THREAD_ANY;
   ink_aio_read(&io);
@@ -74,7 +74,7 @@ CacheDisk::~CacheDisk()
 {
   if (path) {
     ats_free(path);
-    for (int i = 0; i < (int) header->num_volumes; i++) {
+    for (int i = 0; i < (int)header->num_volumes; i++) {
       DiskVolBlockQueue *q = NULL;
       while (disk_vols[i] && (q = (disk_vols[i]->dpb_queue.pop()))) {
         delete q;
@@ -110,11 +110,11 @@ CacheDisk::clearDone(int event, void * /* data ATS_UNUSED 
*/)
 {
   ink_assert(event == AIO_EVENT_DONE);
 
-  if ((size_t) io.aiocb.aio_nbytes != (size_t) io.aio_result) {
+  if ((size_t)io.aiocb.aio_nbytes != (size_t)io.aio_result) {
     Warning("Could not clear disk header for disk %s: declaring disk bad", 
path);
     SET_DISK_BAD(this);
   }
-//  update_header();
+  //  update_header();
 
   SET_HANDLER(&CacheDisk::openDone);
   return openDone(EVENT_IMMEDIATE, 0);
@@ -125,7 +125,7 @@ CacheDisk::openStart(int event, void * /* data ATS_UNUSED 
*/)
 {
   ink_assert(event == AIO_EVENT_DONE);
 
-  if ((size_t) io.aiocb.aio_nbytes != (size_t) io.aio_result) {
+  if ((size_t)io.aiocb.aio_nbytes != (size_t)io.aio_result) {
     Warning("could not read disk header for disk %s: declaring disk bad", 
path);
     SET_DISK_BAD(this);
     SET_HANDLER(&CacheDisk::openDone);
@@ -133,7 +133,7 @@ CacheDisk::openStart(int event, void * /* data ATS_UNUSED 
*/)
   }
 
   if (header->magic != DISK_HEADER_MAGIC || header->num_blocks != 
static_cast<uint64_t>(len)) {
-    uint64_t delta_3_2 =  skip - (skip >> STORE_BLOCK_SHIFT); // block count 
change from 3.2
+    uint64_t delta_3_2 = skip - (skip >> STORE_BLOCK_SHIFT); // block count 
change from 3.2
     if (static_cast<uint64_t>(len) == header->num_blocks + delta_3_2) {
       header->num_blocks += delta_3_2;
       // Only recover the space if there is a single stripe on this disk. The 
stripe space allocation logic can fail if
@@ -142,8 +142,8 @@ CacheDisk::openStart(int event, void * /* data ATS_UNUSED 
*/)
       // stripe isn't the short one, the split will be different this time.
       // Further - the size is encoded in to the disk hash so if the size 
changes, the data is effectively lost anyway.
       // So no space recovery.
-//      if (header->num_diskvol_blks == 1)
-//        header->vol_info[0].len += delta_3_2;
+      //      if (header->num_diskvol_blks == 1)
+      //        header->vol_info[0].len += delta_3_2;
     } else {
       Warning("disk header different for disk %s: clearing the disk", path);
       SET_HANDLER(&CacheDisk::clearDone);
@@ -189,7 +189,7 @@ CacheDisk::syncDone(int event, void * /* data ATS_UNUSED */)
 {
   ink_assert(event == AIO_EVENT_DONE);
 
-  if ((size_t) io.aiocb.aio_nbytes != (size_t) io.aio_result) {
+  if ((size_t)io.aiocb.aio_nbytes != (size_t)io.aio_result) {
     Warning("Error writing disk header for disk %s:disk bad", path);
     SET_DISK_BAD(this);
     return EVENT_DONE;
@@ -215,7 +215,7 @@ CacheDisk::create_volume(int number, off_t size_in_blocks, 
int scheme)
   size_in_blocks = (size_in_blocks <= max_blocks) ? size_in_blocks : 
max_blocks;
 
   int blocks_per_vol = VOL_BLOCK_SIZE / STORE_BLOCK_SIZE;
-//  ink_assert(!(size_in_blocks % blocks_per_vol));
+  //  ink_assert(!(size_in_blocks % blocks_per_vol));
   DiskVolBlock *p = 0;
   for (; q; q = q->link.next) {
     if ((off_t)q->b->len >= size_in_blocks) {
@@ -236,7 +236,7 @@ CacheDisk::create_volume(int number, off_t size_in_blocks, 
int scheme)
     q = closest_match;
     p = q->b;
     q->new_block = 1;
-    ink_assert(size_in_blocks > (off_t) p->len);
+    ink_assert(size_in_blocks > (off_t)p->len);
     /* allocate in 128 megabyte chunks. The Remaining space should
        be thrown away */
     size_in_blocks = (p->len - (p->len % blocks_per_vol));
@@ -253,7 +253,7 @@ CacheDisk::create_volume(int number, off_t size_in_blocks, 
int scheme)
     DiskVolBlock *dpb = &header->vol_info[header->num_diskvol_blks];
     *dpb = *p;
     dpb->len -= size_in_blocks;
-    dpb->offset += ((off_t) size_in_blocks * STORE_BLOCK_SIZE);
+    dpb->offset += ((off_t)size_in_blocks * STORE_BLOCK_SIZE);
 
     DiskVolBlockQueue *new_q = new DiskVolBlockQueue();
     new_q->b = dpb;
@@ -299,7 +299,6 @@ CacheDisk::delete_volume(int number)
   unsigned int i;
   for (i = 0; i < header->num_volumes; i++) {
     if (disk_vols[i]->vol_number == number) {
-
       DiskVolBlockQueue *q;
       for (q = disk_vols[i]->dpb_queue.head; q;) {
         DiskVolBlock *p = q->b;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheHosting.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc
index ad65061..6faa100 100644
--- a/iocore/cache/CacheHosting.cc
+++ b/iocore/cache/CacheHosting.cc
@@ -26,28 +26,21 @@
 
 extern int gndisks;
 
-matcher_tags CacheHosting_tags = {
-  "hostname", "domain"
-};
+matcher_tags CacheHosting_tags = {"hostname", "domain"};
 
 /*************************************************************
  *   Begin class HostMatcher
  *************************************************************/
 
-CacheHostMatcher::CacheHostMatcher(const char * name, CacheType typ):
-data_array(NULL),
-array_len(-1),
-num_el(-1),
-type(typ)
+CacheHostMatcher::CacheHostMatcher(const char *name, CacheType typ) : 
data_array(NULL), array_len(-1), num_el(-1), type(typ)
 {
   host_lookup = new HostLookup(name);
 }
 
 CacheHostMatcher::~CacheHostMatcher()
 {
-
   delete host_lookup;
-  delete[]data_array;
+  delete[] data_array;
 }
 
 //
@@ -59,7 +52,6 @@ CacheHostMatcher::~CacheHostMatcher()
 void
 CacheHostMatcher::Print()
 {
-
   printf("\tHost/Domain Matcher with %d elements\n", num_el);
   host_lookup->Print(PrintFunc);
 }
@@ -73,7 +65,7 @@ CacheHostMatcher::Print()
 void
 CacheHostMatcher::PrintFunc(void *opaque_data)
 {
-  CacheHostRecord *d = (CacheHostRecord *) opaque_data;
+  CacheHostRecord *d = (CacheHostRecord *)opaque_data;
   d->Print();
 }
 
@@ -101,9 +93,8 @@ CacheHostMatcher::AllocateSpace(int num_entries)
 //    arg hostname
 //
 void
-CacheHostMatcher::Match(char const* rdata, int rlen, CacheHostResult * result)
+CacheHostMatcher::Match(char const *rdata, int rlen, CacheHostResult *result)
 {
-
   void *opaque_ptr;
   CacheHostRecord *data_ptr;
   bool r;
@@ -125,7 +116,7 @@ CacheHostMatcher::Match(char const* rdata, int rlen, 
CacheHostResult * result)
 
   while (r == true) {
     ink_assert(opaque_ptr != NULL);
-    data_ptr = (CacheHostRecord *) opaque_ptr;
+    data_ptr = (CacheHostRecord *)opaque_ptr;
     data_ptr->UpdateMatch(result, data);
 
     r = host_lookup->MatchNext(&s, &opaque_ptr);
@@ -141,9 +132,8 @@ CacheHostMatcher::Match(char const* rdata, int rlen, 
CacheHostResult * result)
 //
 
 void
-CacheHostMatcher::NewEntry(matcher_line * line_info)
+CacheHostMatcher::NewEntry(matcher_line *line_info)
 {
-
   CacheHostRecord *cur_d;
   int errNo;
   char *match_data;
@@ -187,7 +177,7 @@ CacheHostMatcher::NewEntry(matcher_line * line_info)
  *   End class HostMatcher
  *************************************************************/
 
-CacheHostTable::CacheHostTable(Cache * c, CacheType typ)
+CacheHostTable::CacheHostTable(Cache *c, CacheType typ)
 {
   ats_scoped_str config_path;
 
@@ -196,7 +186,8 @@ CacheHostTable::CacheHostTable(Cache * c, CacheType typ)
 
   type = typ;
   cache = c;
-  matcher_name = "[CacheHosting]";;
+  matcher_name = "[CacheHosting]";
+  ;
   hostMatch = NULL;
 
   config_path = RecConfigReadConfigPath("proxy.config.cache.hosting_filename");
@@ -207,7 +198,6 @@ CacheHostTable::CacheHostTable(Cache * c, CacheType typ)
 
 CacheHostTable::~CacheHostTable()
 {
-
   if (hostMatch != NULL) {
     delete hostMatch;
   }
@@ -233,9 +223,8 @@ CacheHostTable::Print()
 //   Queries each table for the Result*
 //
 void
-CacheHostTable::Match(char const* rdata, int rlen, CacheHostResult * result)
+CacheHostTable::Match(char const *rdata, int rlen, CacheHostResult *result)
 {
-
   hostMatch->Match(rdata, rlen, result);
 }
 
@@ -243,7 +232,7 @@ int
 CacheHostTable::config_callback(const char * /* name ATS_UNUSED */, RecDataT 
/* data_type ATS_UNUSED */,
                                 RecData /* data ATS_UNUSED */, void *cookie)
 {
-  CacheHostTable **ppt = (CacheHostTable **) cookie;
+  CacheHostTable **ppt = (CacheHostTable **)cookie;
   eventProcessor.schedule_imm(new CacheHostTableConfig(ppt));
   return 0;
 }
@@ -256,7 +245,7 @@ int fstat_wrapper(int fd, struct stat *s);
 //      from it
 //
 int
-CacheHostTable::BuildTableFromString(const char * config_file_path, char 
*file_buf)
+CacheHostTable::BuildTableFromString(const char *config_file_path, char 
*file_buf)
 {
   // Table build locals
   Tokenizer bufTok("\n");
@@ -284,7 +273,6 @@ CacheHostTable::BuildTableFromString(const char * 
config_file_path, char *file_b
   // First get the number of entries
   tmp = bufTok.iterFirst(&i_state);
   while (tmp != NULL) {
-
     line_num++;
 
     // skip all blank spaces at beginning of line
@@ -293,16 +281,14 @@ CacheHostTable::BuildTableFromString(const char * 
config_file_path, char *file_b
     }
 
     if (*tmp != '#' && *tmp != '\0') {
-
       current = (matcher_line *)ats_malloc(sizeof(matcher_line));
-      errPtr = parseConfigLine((char *) tmp, current, config_tags);
+      errPtr = parseConfigLine((char *)tmp, current, config_tags);
 
       if (errPtr != NULL) {
-        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at 
line %d : %s",
-                 matcher_name, config_file_path, line_num, errPtr);
+        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at 
line %d : %s", matcher_name, config_file_path,
+                         line_num, errPtr);
         ats_free(current);
       } else {
-
         // Line parsed ok.  Figure out what the destination
         //  type is and link it into our list
         numEntries++;
@@ -355,7 +341,6 @@ CacheHostTable::BuildTableFromString(const char * 
config_file_path, char *file_b
   while (current != NULL) {
     second_pass++;
     if ((current->type == MATCH_DOMAIN) || (current->type == MATCH_HOST)) {
-
       char *match_data = current->line[1][current->dest_entry];
       ink_assert(match_data != NULL);
 
@@ -380,8 +365,8 @@ CacheHostTable::BuildTableFromString(const char * 
config_file_path, char *file_b
         hostMatch->NewEntry(current);
       }
     } else {
-      RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry with 
unknown type at line %d",
-               matcher_name, config_file_path, current->line_num);
+      RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry with 
unknown type at line %d", matcher_name,
+                       config_file_path, current->line_num);
     }
 
     // Deallocate the parsing structure
@@ -393,8 +378,8 @@ CacheHostTable::BuildTableFromString(const char * 
config_file_path, char *file_b
   if (!generic_rec_initd) {
     const char *cache_type = (type == CACHE_HTTP_TYPE) ? "http" : "mixt";
     RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-             "No Volumes specified for Generic Hostnames for %s documents: %s 
cache will be disabled", cache_type,
-             cache_type);
+                     "No Volumes specified for Generic Hostnames for %s 
documents: %s cache will be disabled", cache_type,
+                     cache_type);
   }
 
   ink_assert(second_pass == numEntries);
@@ -406,7 +391,7 @@ CacheHostTable::BuildTableFromString(const char * 
config_file_path, char *file_b
 }
 
 int
-CacheHostTable::BuildTable(const char * config_file_path)
+CacheHostTable::BuildTable(const char *config_file_path)
 {
   char *file_buf;
   int ret;
@@ -427,7 +412,6 @@ CacheHostTable::BuildTable(const char * config_file_path)
 int
 CacheHostRecord::Init(CacheType typ)
 {
-
   int i, j;
   extern Queue<CacheVol> cp_list;
   extern int cp_list_len;
@@ -465,7 +449,7 @@ CacheHostRecord::Init(CacheType typ)
 }
 
 int
-CacheHostRecord::Init(matcher_line * line_info, CacheType typ)
+CacheHostRecord::Init(matcher_line *line_info, CacheType typ)
 {
   int i, j;
   extern Queue<CacheVol> cp_list;
@@ -495,19 +479,17 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType 
typ)
           s++;
           if (!(*s)) {
             const char *errptr = "A volume number expected";
-            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                         "%s discarding %s entry at line %d :%s",
-                         "[CacheHosting]", config_file, line_info->line_num, 
errptr);
+            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry 
at line %d :%s", "[CacheHosting]", config_file,
+                             line_info->line_num, errptr);
             if (val != NULL) {
               ats_free(val);
             }
             return -1;
           }
         }
-        if ((*s<'0') || (*s> '9')) {
-          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                       "%s discarding %s entry at line %d : bad token [%c]",
-                       "[CacheHosting]", config_file, line_info->line_num, *s);
+        if ((*s < '0') || (*s > '9')) {
+          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at 
line %d : bad token [%c]", "[CacheHosting]",
+                           config_file, line_info->line_num, *s);
           if (val != NULL) {
             ats_free(val);
           }
@@ -531,9 +513,8 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType 
typ)
             if (cachep->vol_number == volume_number) {
               is_vol_present = 1;
               if (cachep->scheme == type) {
-                Debug("cache_hosting",
-                      "Host Record: %p, Volume: %d, size: %ld",
-                      this, volume_number, (long)(cachep->size * 
STORE_BLOCK_SIZE));
+                Debug("cache_hosting", "Host Record: %p, Volume: %d, size: 
%ld", this, volume_number,
+                      (long)(cachep->size * STORE_BLOCK_SIZE));
                 cp[num_cachevols] = cachep;
                 num_cachevols++;
                 num_vols += cachep->num_vols;
@@ -542,9 +523,8 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType 
typ)
             }
           }
           if (!is_vol_present) {
-            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                         "%s discarding %s entry at line %d : bad volume 
number [%d]",
-                         "[CacheHosting]", config_file, line_info->line_num, 
volume_number);
+            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry 
at line %d : bad volume number [%d]",
+                             "[CacheHosting]", config_file, 
line_info->line_num, volume_number);
             if (val != NULL) {
               ats_free(val);
             }
@@ -562,16 +542,14 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType 
typ)
       break;
     }
 
-    RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                 "%s discarding %s entry at line %d : bad token [%s]",
-                 "[CacheHosting]", config_file, line_info->line_num, label);
+    RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line 
%d : bad token [%s]", "[CacheHosting]", config_file,
+                     line_info->line_num, label);
     return -1;
   }
 
   if (i == MATCHER_MAX_TOKENS) {
-    RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                 "%s discarding %s entry at line %d : No volumes specified",
-                 "[CacheHosting]", config_file, line_info->line_num);
+    RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line 
%d : No volumes specified", "[CacheHosting]",
+                     config_file, line_info->line_num);
     return -1;
   }
 
@@ -593,7 +571,7 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType 
typ)
 }
 
 void
-CacheHostRecord::UpdateMatch(CacheHostResult * r, char * /* rd ATS_UNUSED */)
+CacheHostRecord::UpdateMatch(CacheHostResult *r, char * /* rd ATS_UNUSED */)
 {
   r->record = this;
 }
@@ -604,7 +582,6 @@ CacheHostRecord::Print()
 }
 
 
-
 void
 ConfigVolumes::read_config_file()
 {
@@ -628,25 +605,24 @@ ConfigVolumes::read_config_file()
 void
 ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf)
 {
-
 #define PAIR_ZERO 0
 #define PAIR_ONE 1
 #define PAIR_TWO 2
 #define DONE 3
 #define INK_ERROR -1
 
-#define INK_ERROR_VOLUME -2  //added by YTS Team, yamsat for bug id 59632
-// Table build locals
+#define INK_ERROR_VOLUME -2 // added by YTS Team, yamsat for bug id 59632
+  // Table build locals
   Tokenizer bufTok("\n");
   tok_iter_state i_state;
   const char *tmp;
   char *end;
   char *line_end = NULL;
   int line_num = 0;
-  int total = 0;                //added by YTS Team, yamsat for bug id 59632
+  int total = 0; // added by YTS Team, yamsat for bug id 59632
 
   char volume_seen[256];
-  int state = 0;                //changed by YTS Team, yamsat for bug id 59632
+  int state = 0; // changed by YTS Team, yamsat for bug id 59632
   int volume_number = 0;
   CacheType scheme = CACHE_NONE_TYPE;
   int size = 0;
@@ -695,8 +671,7 @@ ConfigVolumes::BuildListFromString(char *config_file_path, 
char *file_buf)
           num_http_volumes++;
         else
           num_stream_volumes++;
-        Debug("cache_hosting",
-              "added volume=%d, scheme=%d, size=%d percent=%d\n", 
volume_number, scheme, size, in_percent);
+        Debug("cache_hosting", "added volume=%d, scheme=%d, size=%d 
percent=%d\n", volume_number, scheme, size, in_percent);
         break;
       }
 
@@ -705,13 +680,13 @@ ConfigVolumes::BuildListFromString(char 
*config_file_path, char *file_buf)
           break;
       } else {
         if (!(*tmp)) {
-          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at 
line %d : Unexpected end of line",
-                   matcher_name, config_file_path, line_num);
+          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at 
line %d : Unexpected end of line", matcher_name,
+                           config_file_path, line_num);
           break;
         }
       }
 
-      end = (char *) tmp;
+      end = (char *)tmp;
       while (*end && !isspace(*end))
         end++;
 
@@ -723,7 +698,7 @@ ConfigVolumes::BuildListFromString(char *config_file_path, 
char *file_buf)
       }
       char *eq_sign;
 
-      eq_sign = (char *) strchr(tmp, '=');
+      eq_sign = (char *)strchr(tmp, '=');
       if (!eq_sign) {
         state = INK_ERROR;
       } else
@@ -735,20 +710,20 @@ ConfigVolumes::BuildListFromString(char 
*config_file_path, char *file_buf)
           state = INK_ERROR;
           break;
         }
-        tmp += 7;              //size of string volume including null
+        tmp += 7; // size of string volume including null
         volume_number = atoi(tmp);
 
-        if (volume_number<1 || volume_number> 255 || 
volume_seen[volume_number]) {
+        if (volume_number < 1 || volume_number > 255 || 
volume_seen[volume_number]) {
           const char *err;
 
-          if (volume_number<1 || volume_number> 255) {
+          if (volume_number < 1 || volume_number > 255) {
             err = "Bad Volume Number";
           } else {
             err = "Volume Already Specified";
           }
 
-          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at 
line %d : %s [%d]",
-                   matcher_name, config_file_path, line_num, err, 
volume_number);
+          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at 
line %d : %s [%d]", matcher_name, config_file_path,
+                           line_num, err, volume_number);
           state = INK_ERROR;
           break;
         }
@@ -764,7 +739,7 @@ ConfigVolumes::BuildListFromString(char *config_file_path, 
char *file_buf)
           state = INK_ERROR;
           break;
         }
-        tmp += 7;               //size of string scheme including null
+        tmp += 7; // size of string scheme including null
 
         if (!strcasecmp(tmp, "http")) {
           tmp += 4;
@@ -793,30 +768,28 @@ ConfigVolumes::BuildListFromString(char 
*config_file_path, char *file_buf)
           tmp++;
 
         if (*tmp == '%') {
-          //added by YTS Team, yamsat for bug id 59632
+          // added by YTS Team, yamsat for bug id 59632
           total += size;
           if (size > 100 || total > 100) {
             state = INK_ERROR_VOLUME;
-            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                             "Total volume size added upto more than 100 
percent, No volumes created");
+            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "Total volume size added 
upto more than 100 percent, No volumes created");
             break;
           }
-          //ends here
+          // ends here
           in_percent = 1;
           tmp++;
         } else
           in_percent = 0;
         state = DONE;
         break;
-
       }
 
       if (state == INK_ERROR || *tmp) {
-        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at 
line %d : Invalid token [%s]",
-                 matcher_name, config_file_path, line_num, tmp);
+        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at 
line %d : Invalid token [%s]", matcher_name,
+                         config_file_path, line_num, tmp);
         break;
       }
-      //added by YTS Team, yamsat for bug id 59632
+      // added by YTS Team, yamsat for bug id 59632
       if (state == INK_ERROR_VOLUME || *tmp) {
         RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "Total volume size added 
upto more than 100 percent,No volumes created");
         break;
@@ -832,10 +805,9 @@ ConfigVolumes::BuildListFromString(char *config_file_path, 
char *file_buf)
 }
 
 
-
 /* Test the cache volumeing with different configurations */
 #define MEGS_128 (128 * 1024 * 1024)
-#define ROUND_TO_VOL_SIZE(_x) (((_x) + (MEGS_128 - 1)) &~ (MEGS_128 - 1))
+#define ROUND_TO_VOL_SIZE(_x) (((_x) + (MEGS_128 - 1)) & ~(MEGS_128 - 1))
 extern CacheDisk **gdisks;
 extern Queue<CacheVol> cp_list;
 extern int cp_list_len;
@@ -851,14 +823,15 @@ int saved_cp_list_len;
 ConfigVolumes saved_config_volumes;
 int saved_gnvol;
 
-int ClearConfigVol(ConfigVolumes * configp);
+int ClearConfigVol(ConfigVolumes *configp);
 int ClearCacheVolList(Queue<CacheVol> *cpl, int len);
-int create_config(RegressionTest * t, int i);
-int execute_and_verify(RegressionTest * t);
+int create_config(RegressionTest *t, int i);
+int execute_and_verify(RegressionTest *t);
 void save_state();
 void restore_state();
 
-EXCLUSIVE_REGRESSION_TEST(Cache_vol) (RegressionTest * t, int /* atype 
ATS_UNUSED */, int *status) {
+EXCLUSIVE_REGRESSION_TEST(Cache_vol)(RegressionTest *t, int /* atype 
ATS_UNUSED */, int *status)
+{
   save_state();
   srand48(time(NULL));
   *status = REGRESSION_TEST_PASSED;
@@ -874,7 +847,7 @@ EXCLUSIVE_REGRESSION_TEST(Cache_vol) (RegressionTest * t, 
int /* atype ATS_UNUSE
 }
 
 int
-create_config(RegressionTest * t, int num)
+create_config(RegressionTest *t, int num)
 {
   int i = 0;
   int vol_num = 1;
@@ -903,117 +876,110 @@ create_config(RegressionTest * t, int num)
         config_volumes.num_volumes++;
         config_volumes.num_http_volumes++;
       }
-
     }
     rprintf(t, "%d 128 Megabyte Volumes\n", vol_num - 1);
     break;
 
-  case 1:
-    {
-      for (i = 0; i < gndisks; i++) {
-        gdisks[i]->delete_all_volumes();
-      }
+  case 1: {
+    for (i = 0; i < gndisks; i++) {
+      gdisks[i]->delete_all_volumes();
+    }
 
-      // calculate the total free space
-      off_t total_space = 0;
-      for (i = 0; i < gndisks; i++) {
-        off_t vol_blocks = gdisks[i]->num_usable_blocks;
-        /* round down the blocks to the nearest
-           multiple of STORE_BLOCKS_PER_VOL */
-        vol_blocks = (vol_blocks / STORE_BLOCKS_PER_VOL)
-          * STORE_BLOCKS_PER_VOL;
-        total_space += vol_blocks;
-      }
+    // calculate the total free space
+    off_t total_space = 0;
+    for (i = 0; i < gndisks; i++) {
+      off_t vol_blocks = gdisks[i]->num_usable_blocks;
+      /* round down the blocks to the nearest
+         multiple of STORE_BLOCKS_PER_VOL */
+      vol_blocks = (vol_blocks / STORE_BLOCKS_PER_VOL) * STORE_BLOCKS_PER_VOL;
+      total_space += vol_blocks;
+    }
 
-      // make sure we have atleast 1280 M bytes
-      if (total_space<(10 << 27)>> STORE_BLOCK_SHIFT) {
-        rprintf(t, "Not enough space for 10 volume\n");
-        return 0;
-      }
+    // make sure we have atleast 1280 M bytes
+    if (total_space<(10 << 27)>> STORE_BLOCK_SHIFT) {
+      rprintf(t, "Not enough space for 10 volume\n");
+      return 0;
+    }
 
-      vol_num = 1;
-      rprintf(t, "Cleared  disk\n");
-      for (i = 0; i < 10; i++) {
-        ConfigVol *cp = new ConfigVol();
-        cp->number = vol_num++;
-        cp->scheme = CACHE_HTTP_TYPE;
-        cp->size = 10;
-        cp->percent = 10;
-        cp->in_percent = 1;
-        cp->cachep = 0;
-        config_volumes.cp_queue.enqueue(cp);
-        config_volumes.num_volumes++;
-        config_volumes.num_http_volumes++;
-      }
-      rprintf(t, "10 volume, 10 percent each\n");
+    vol_num = 1;
+    rprintf(t, "Cleared  disk\n");
+    for (i = 0; i < 10; i++) {
+      ConfigVol *cp = new ConfigVol();
+      cp->number = vol_num++;
+      cp->scheme = CACHE_HTTP_TYPE;
+      cp->size = 10;
+      cp->percent = 10;
+      cp->in_percent = 1;
+      cp->cachep = 0;
+      config_volumes.cp_queue.enqueue(cp);
+      config_volumes.num_volumes++;
+      config_volumes.num_http_volumes++;
     }
-    break;
+    rprintf(t, "10 volume, 10 percent each\n");
+  } break;
 
   case 2:
   case 3:
 
-    {
-      /* calculate the total disk space */
-      InkRand *gen = &this_ethread()->generator;
-      off_t total_space = 0;
-      vol_num = 1;
+  {
+    /* calculate the total disk space */
+    InkRand *gen = &this_ethread()->generator;
+    off_t total_space = 0;
+    vol_num = 1;
+    if (num == 2) {
+      rprintf(t, "Random Volumes after clearing the disks\n");
+    } else {
+      rprintf(t, "Random Volumes without clearing the disks\n");
+    }
+
+    for (i = 0; i < gndisks; i++) {
+      off_t vol_blocks = gdisks[i]->num_usable_blocks;
+      /* round down the blocks to the nearest
+         multiple of STORE_BLOCKS_PER_VOL */
+      vol_blocks = (vol_blocks / STORE_BLOCKS_PER_VOL) * STORE_BLOCKS_PER_VOL;
+      total_space += vol_blocks;
+
       if (num == 2) {
-        rprintf(t, "Random Volumes after clearing the disks\n");
+        gdisks[i]->delete_all_volumes();
       } else {
-        rprintf(t, "Random Volumes without clearing the disks\n");
+        gdisks[i]->cleared = 0;
       }
-
-      for (i = 0; i < gndisks; i++) {
-        off_t vol_blocks = gdisks[i]->num_usable_blocks;
-        /* round down the blocks to the nearest
-           multiple of STORE_BLOCKS_PER_VOL */
-        vol_blocks = (vol_blocks / STORE_BLOCKS_PER_VOL)
-          * STORE_BLOCKS_PER_VOL;
-        total_space += vol_blocks;
-
-        if (num == 2) {
-          gdisks[i]->delete_all_volumes();
-        } else {
-          gdisks[i]->cleared = 0;
-        }
+    }
+    while (total_space > 0) {
+      if (vol_num > 255)
+        break;
+      off_t modu = MAX_VOL_SIZE;
+      if (total_space < (MAX_VOL_SIZE >> STORE_BLOCK_SHIFT)) {
+        modu = total_space * STORE_BLOCK_SIZE;
       }
-      while (total_space > 0) {
-        if (vol_num > 255)
-          break;
-        off_t modu = MAX_VOL_SIZE;
-        if (total_space<(MAX_VOL_SIZE>> STORE_BLOCK_SHIFT)) {
-          modu = total_space * STORE_BLOCK_SIZE;
-        }
 
-        off_t random_size = (gen->random() % modu) + 1;
-        /* convert to 128 megs multiple */
-        CacheType scheme = (random_size % 2) ? CACHE_HTTP_TYPE : 
CACHE_RTSP_TYPE;
-        random_size = ROUND_TO_VOL_SIZE(random_size);
-        off_t blocks = random_size / STORE_BLOCK_SIZE;
-        ink_assert(blocks <= (int) total_space);
-        total_space -= blocks;
-
-        ConfigVol *cp = new ConfigVol();
-
-        cp->number = vol_num++;
-        cp->scheme = scheme;
-        cp->size = random_size >> 20;
-        cp->percent = 0;
-        cp->in_percent = 0;
-        cp->cachep = 0;
-        config_volumes.cp_queue.enqueue(cp);
-        config_volumes.num_volumes++;
-        if (cp->scheme == CACHE_HTTP_TYPE) {
-          config_volumes.num_http_volumes++;
-          rprintf(t, "volume=%d scheme=http size=%d\n", cp->number, cp->size);
-        } else {
-          config_volumes.num_stream_volumes++;
-          rprintf(t, "volume=%d scheme=rtsp size=%d\n", cp->number, cp->size);
-
-        }
+      off_t random_size = (gen->random() % modu) + 1;
+      /* convert to 128 megs multiple */
+      CacheType scheme = (random_size % 2) ? CACHE_HTTP_TYPE : CACHE_RTSP_TYPE;
+      random_size = ROUND_TO_VOL_SIZE(random_size);
+      off_t blocks = random_size / STORE_BLOCK_SIZE;
+      ink_assert(blocks <= (int)total_space);
+      total_space -= blocks;
+
+      ConfigVol *cp = new ConfigVol();
+
+      cp->number = vol_num++;
+      cp->scheme = scheme;
+      cp->size = random_size >> 20;
+      cp->percent = 0;
+      cp->in_percent = 0;
+      cp->cachep = 0;
+      config_volumes.cp_queue.enqueue(cp);
+      config_volumes.num_volumes++;
+      if (cp->scheme == CACHE_HTTP_TYPE) {
+        config_volumes.num_http_volumes++;
+        rprintf(t, "volume=%d scheme=http size=%d\n", cp->number, cp->size);
+      } else {
+        config_volumes.num_stream_volumes++;
+        rprintf(t, "volume=%d scheme=rtsp size=%d\n", cp->number, cp->size);
       }
     }
-    break;
+  } break;
 
   default:
     return 1;
@@ -1022,7 +988,7 @@ create_config(RegressionTest * t, int num)
 }
 
 int
-execute_and_verify(RegressionTest * t)
+execute_and_verify(RegressionTest *t)
 {
   cplist_init();
   cplist_reconfigure();
@@ -1041,8 +1007,7 @@ execute_and_verify(RegressionTest * t)
     cachep = cp_list.head;
     while (cachep) {
       if (cachep->vol_number == cp->number) {
-        if ((cachep->scheme != cp->scheme) ||
-            (cachep->size != (cp->size << (20 - STORE_BLOCK_SHIFT))) || 
(cachep != cp->cachep)) {
+        if ((cachep->scheme != cp->scheme) || (cachep->size != (cp->size << 
(20 - STORE_BLOCK_SHIFT))) || (cachep != cp->cachep)) {
           rprintf(t, "Configuration and Actual volumes don't match\n");
           return REGRESSION_TEST_FAILED;
         }
@@ -1095,16 +1060,13 @@ execute_and_verify(RegressionTest * t)
   for (int i = 0; i < gndisks; i++) {
     CacheDisk *d = gdisks[i];
     if (is_debug_tag_set("cache_hosting")) {
-
-      Debug("cache_hosting", "Disk: %d: Vol Blocks: %u: Free space: %" PRIu64,
-            i, d->header->num_diskvol_blks, d->free_space);
-      for (int j = 0; j < (int) d->header->num_volumes; j++) {
-
+      Debug("cache_hosting", "Disk: %d: Vol Blocks: %u: Free space: %" PRIu64, 
i, d->header->num_diskvol_blks, d->free_space);
+      for (int j = 0; j < (int)d->header->num_volumes; j++) {
         Debug("cache_hosting", "\tVol: %d Size: %" PRIu64, 
d->disk_vols[j]->vol_number, d->disk_vols[j]->size);
       }
-      for (int j = 0; j < (int) d->header->num_diskvol_blks; j++) {
-        Debug("cache_hosting", "\tBlock No: %d Size: %" PRIu64" Free: %u",
-              d->header->vol_info[j].number, d->header->vol_info[j].len, 
d->header->vol_info[j].free);
+      for (int j = 0; j < (int)d->header->num_diskvol_blks; j++) {
+        Debug("cache_hosting", "\tBlock No: %d Size: %" PRIu64 " Free: %u", 
d->header->vol_info[j].number,
+              d->header->vol_info[j].len, d->header->vol_info[j].free);
       }
     }
   }
@@ -1112,9 +1074,8 @@ execute_and_verify(RegressionTest * t)
 }
 
 int
-ClearConfigVol(ConfigVolumes * configp)
+ClearConfigVol(ConfigVolumes *configp)
 {
-
   int i = 0;
   ConfigVol *cp = NULL;
   while ((cp = configp->cp_queue.dequeue())) {
@@ -1134,13 +1095,12 @@ ClearConfigVol(ConfigVolumes * configp)
 int
 ClearCacheVolList(Queue<CacheVol> *cpl, int len)
 {
-
   int i = 0;
   CacheVol *cp = NULL;
   while ((cp = cpl->dequeue())) {
     ats_free(cp->disk_vols);
     ats_free(cp->vols);
-    delete(cp);
+    delete (cp);
     i++;
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheHttp.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheHttp.cc b/iocore/cache/CacheHttp.cc
index 6bcc4fc..3d7dfba 100644
--- a/iocore/cache/CacheHttp.cc
+++ b/iocore/cache/CacheHttp.cc
@@ -34,8 +34,7 @@ static vec_info default_vec_info;
 #ifdef HTTP_CACHE
 static CacheHTTPInfo default_http_info;
 
-CacheHTTPInfoVector::CacheHTTPInfoVector()
-:magic(NULL), data(&default_vec_info, 4), xcount(0)
+CacheHTTPInfoVector::CacheHTTPInfoVector() : magic(NULL), 
data(&default_vec_info, 4), xcount(0)
 {
 }
 
@@ -57,7 +56,7 @@ CacheHTTPInfoVector::~CacheHTTPInfoVector()
   -------------------------------------------------------------------------*/
 
 int
-CacheHTTPInfoVector::insert(CacheHTTPInfo * info, int index)
+CacheHTTPInfoVector::insert(CacheHTTPInfo *info, int index)
 {
   if (index == CACHE_ALT_INDEX_DEFAULT)
     index = xcount++;
@@ -71,7 +70,7 @@ CacheHTTPInfoVector::insert(CacheHTTPInfo * info, int index)
 
 
 void
-CacheHTTPInfoVector::detach(int idx, CacheHTTPInfo * r)
+CacheHTTPInfoVector::detach(int idx, CacheHTTPInfo *r)
 {
   int i;
 
@@ -153,8 +152,7 @@ CacheHTTPInfoVector::print(char *buffer, size_t buf_size, 
bool temps)
       }
 
       if (temps || !(data[i].alternate.object_key_get() == zero_key)) {
-        snprintf(p, buf_size, "[%d %s]", data[i].alternate.id_get(),
-                     
CacheKey(data[i].alternate.object_key_get()).toHexStr(buf));
+        snprintf(p, buf_size, "[%d %s]", data[i].alternate.id_get(), 
CacheKey(data[i].alternate.object_key_get()).toHexStr(buf));
         tmp = strlen(p);
         p += tmp;
         buf_size -= tmp;
@@ -186,7 +184,7 @@ CacheHTTPInfoVector::marshal(char *buf, int length)
   char *start = buf;
   int count = 0;
 
-  ink_assert(!(((intptr_t) buf) & 3));      // buf must be aligned
+  ink_assert(!(((intptr_t)buf) & 3)); // buf must be aligned
 
   for (int i = 0; i < xcount; i++) {
     int tmp = data[i].alternate.marshal(buf, length);
@@ -202,37 +200,36 @@ CacheHTTPInfoVector::marshal(char *buf, int length)
 }
 
 int
-CacheHTTPInfoVector::unmarshal(const char *buf, int length, RefCountObj * 
block_ptr)
+CacheHTTPInfoVector::unmarshal(const char *buf, int length, RefCountObj 
*block_ptr)
 {
-  ink_assert(!(((intptr_t) buf) & 3));      // buf must be aligned
+  ink_assert(!(((intptr_t)buf) & 3)); // buf must be aligned
 
   const char *start = buf;
   CacheHTTPInfo info;
   xcount = 0;
 
-  while (length - (buf - start) > (int) sizeof(HTTPCacheAlt)) {
-
-    int tmp = HTTPInfo::unmarshal((char *) buf, length - (buf - start), 
block_ptr);
+  while (length - (buf - start) > (int)sizeof(HTTPCacheAlt)) {
+    int tmp = HTTPInfo::unmarshal((char *)buf, length - (buf - start), 
block_ptr);
     if (tmp < 0) {
       return -1;
     }
-    info.m_alt = (HTTPCacheAlt *) buf;
+    info.m_alt = (HTTPCacheAlt *)buf;
     buf += tmp;
 
     data(xcount).alternate = info;
     xcount++;
   }
 
-  return ((caddr_t) buf - (caddr_t) start);
+  return ((caddr_t)buf - (caddr_t)start);
 }
 
 
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 uint32_t
-CacheHTTPInfoVector::get_handles(const char *buf, int length, RefCountObj * 
block_ptr)
+CacheHTTPInfoVector::get_handles(const char *buf, int length, RefCountObj 
*block_ptr)
 {
-  ink_assert(!(((intptr_t) buf) & 3));      // buf must be aligned
+  ink_assert(!(((intptr_t)buf) & 3)); // buf must be aligned
 
   const char *start = buf;
   CacheHTTPInfo info;
@@ -240,12 +237,11 @@ CacheHTTPInfoVector::get_handles(const char *buf, int 
length, RefCountObj * bloc
 
   vector_buf = block_ptr;
 
-  while (length - (buf - start) > (int) sizeof(HTTPCacheAlt)) {
-
-    int tmp = info.get_handle((char *) buf, length - (buf - start));
+  while (length - (buf - start) > (int)sizeof(HTTPCacheAlt)) {
+    int tmp = info.get_handle((char *)buf, length - (buf - start));
     if (tmp < 0) {
       ink_assert(!"CacheHTTPInfoVector::unmarshal get_handle() failed");
-      return (uint32_t) -1;
+      return (uint32_t)-1;
     }
     buf += tmp;
 
@@ -253,13 +249,12 @@ CacheHTTPInfoVector::get_handles(const char *buf, int 
length, RefCountObj * bloc
     xcount++;
   }
 
-  return ((caddr_t) buf - (caddr_t) start);
+  return ((caddr_t)buf - (caddr_t)start);
 }
 
-#else //HTTP_CACHE
+#else // HTTP_CACHE
 
-CacheHTTPInfoVector::CacheHTTPInfoVector()
-:data(&default_vec_info, 4), xcount(0)
+CacheHTTPInfoVector::CacheHTTPInfoVector() : data(&default_vec_info, 4), 
xcount(0)
 {
 }
 
@@ -274,7 +269,7 @@ CacheHTTPInfoVector::~CacheHTTPInfoVector()
   -------------------------------------------------------------------------*/
 
 int
-CacheHTTPInfoVector::insert(CacheHTTPInfo */* info ATS_UNUSED */, int index)
+CacheHTTPInfoVector::insert(CacheHTTPInfo * /* info ATS_UNUSED */, int index)
 {
   ink_assert(0);
   return index;
@@ -285,7 +280,7 @@ CacheHTTPInfoVector::insert(CacheHTTPInfo */* info 
ATS_UNUSED */, int index)
 
 
 void
-CacheHTTPInfoVector::detach(int /* idx ATS_UNUSED */, CacheHTTPInfo */* r 
ATS_UNUSED */)
+CacheHTTPInfoVector::detach(int /* idx ATS_UNUSED */, CacheHTTPInfo * /* r 
ATS_UNUSED */)
 {
   ink_assert(0);
 }
@@ -311,7 +306,7 @@ CacheHTTPInfoVector::clear(bool /* destroy ATS_UNUSED */)
   -------------------------------------------------------------------------*/
 
 void
-CacheHTTPInfoVector::print(char */* buffer ATS_UNUSED */, size_t /* buf_size 
ATS_UNUSED */, bool /* temps ATS_UNUSED */)
+CacheHTTPInfoVector::print(char * /* buffer ATS_UNUSED */, size_t /* buf_size 
ATS_UNUSED */, bool /* temps ATS_UNUSED */)
 {
   ink_assert(0);
 }
@@ -329,14 +324,15 @@ CacheHTTPInfoVector::marshal_length()
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 int
-CacheHTTPInfoVector::marshal(char */* buf ATS_UNUSED */, int length)
+CacheHTTPInfoVector::marshal(char * /* buf ATS_UNUSED */, int length)
 {
   ink_assert(0);
   return length;
 }
 
 int
-CacheHTTPInfoVector::unmarshal(const char */* buf ATS_UNUSED */, int /* length 
ATS_UNUSED */, RefCountObj */* block_ptr ATS_UNUSED */)
+CacheHTTPInfoVector::unmarshal(const char * /* buf ATS_UNUSED */, int /* 
length ATS_UNUSED */,
+                               RefCountObj * /* block_ptr ATS_UNUSED */)
 {
   ink_assert(0);
   return 0;
@@ -346,10 +342,11 @@ CacheHTTPInfoVector::unmarshal(const char */* buf 
ATS_UNUSED */, int /* length A
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 uint32_t
-CacheHTTPInfoVector::get_handles(const char */* buf ATS_UNUSED */, int /* 
length ATS_UNUSED */, RefCountObj */* block_ptr ATS_UNUSED */)
+CacheHTTPInfoVector::get_handles(const char * /* buf ATS_UNUSED */, int /* 
length ATS_UNUSED */,
+                                 RefCountObj * /* block_ptr ATS_UNUSED */)
 {
   ink_assert(0);
   return 0;
 }
 
-#endif //HTTP_CACHE
+#endif // HTTP_CACHE

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheLink.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheLink.cc b/iocore/cache/CacheLink.cc
index cbd03ad..feb3846 100644
--- a/iocore/cache/CacheLink.cc
+++ b/iocore/cache/CacheLink.cc
@@ -24,9 +24,8 @@
 #include "P_Cache.h"
 
 Action *
-Cache::link(Continuation * cont, CacheKey * from, CacheKey * to, CacheFragType 
type, char *hostname, int host_len)
+Cache::link(Continuation *cont, CacheKey *from, CacheKey *to, CacheFragType 
type, char *hostname, int host_len)
 {
-
   if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_LINK_FAILED, 0);
     return ACTION_RESULT_DONE;
@@ -36,14 +35,14 @@ Cache::link(Continuation * cont, CacheKey * from, CacheKey 
* to, CacheFragType t
 
   CacheVC *c = new_CacheVC(cont);
   c->vol = key_to_vol(from, hostname, host_len);
-  c->write_len = sizeof(*to);   // so that the earliest_key will be used
+  c->write_len = sizeof(*to); // so that the earliest_key will be used
   c->f.use_first_key = 1;
   c->first_key = *from;
   c->earliest_key = *to;
 
   c->buf = new_IOBufferData(BUFFER_SIZE_INDEX_512);
 #ifdef DEBUG
-  Doc *doc = (Doc *) c->buf->data();
+  Doc *doc = (Doc *)c->buf->data();
   memcpy(doc->data(), to, sizeof(*to)); // doublecheck
 #endif
 
@@ -72,9 +71,8 @@ Ldone:
 }
 
 Action *
-Cache::deref(Continuation * cont, CacheKey * key, CacheFragType type, char 
*hostname, int host_len)
+Cache::deref(Continuation *cont, CacheKey *key, CacheFragType type, char 
*hostname, int host_len)
 {
-
   if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_DEREF_FAILED, 0);
     return ACTION_RESULT_DONE;
@@ -90,7 +88,7 @@ Cache::deref(Continuation * cont, CacheKey * key, 
CacheFragType type, char *host
     MUTEX_TRY_LOCK(lock, vol->mutex, cont->mutex->thread_holding);
     if (lock.is_locked()) {
       if (!dir_probe(key, vol, &result, &last_collision)) {
-        cont->handleEvent(CACHE_EVENT_DEREF_FAILED, (void *) -ECACHE_NO_DOC);
+        cont->handleEvent(CACHE_EVENT_DEREF_FAILED, (void *)-ECACHE_NO_DOC);
         return ACTION_RESULT_DONE;
       }
     }
@@ -107,9 +105,12 @@ Cache::deref(Continuation * cont, CacheKey * key, 
CacheFragType type, char *host
     }
 
     switch (c->do_read_call(&c->key)) {
-      case EVENT_DONE: return ACTION_RESULT_DONE;
-      case EVENT_RETURN: goto Lcallreturn;
-      default: return &c->_action;
+    case EVENT_DONE:
+      return ACTION_RESULT_DONE;
+    case EVENT_RETURN:
+      goto Lcallreturn;
+    default:
+      return &c->_action;
     }
   }
 Lcallreturn:
@@ -130,36 +131,36 @@ CacheVC::derefRead(int /* event ATS_UNUSED */, Event * /* 
e ATS_UNUSED */)
     return free_CacheVC(this);
   if (!buf)
     goto Lcollision;
-  if ((int) io.aio_result != (int) io.aiocb.aio_nbytes)
+  if ((int)io.aio_result != (int)io.aiocb.aio_nbytes)
     goto Ldone;
   if (!dir_agg_valid(vol, &dir)) {
     last_collision = NULL;
     goto Lcollision;
   }
-  doc = (Doc *) buf->data();
+  doc = (Doc *)buf->data();
   if (!(doc->first_key == key))
     goto Lcollision;
 #ifdef DEBUG
   ink_assert(!memcmp(doc->data(), &doc->key, sizeof(doc->key)));
 #endif
-  _action.continuation->handleEvent(CACHE_EVENT_DEREF, (void *) &doc->key);
+  _action.continuation->handleEvent(CACHE_EVENT_DEREF, (void *)&doc->key);
   return free_CacheVC(this);
 
-Lcollision:{
-    CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
-    if (!lock.is_locked()) {
-      mutex->thread_holding->schedule_in_local(this, 
HRTIME_MSECONDS(cache_config_mutex_retry_delay));
-      return EVENT_CONT;
-    }
-    if (dir_probe(&key, vol, &dir, &last_collision)) {
-      int ret = do_read_call(&first_key);
-      if (ret == EVENT_RETURN)
-        goto Lcallreturn;
-      return ret;
-    }
+Lcollision : {
+  CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
+  if (!lock.is_locked()) {
+    mutex->thread_holding->schedule_in_local(this, 
HRTIME_MSECONDS(cache_config_mutex_retry_delay));
+    return EVENT_CONT;
   }
+  if (dir_probe(&key, vol, &dir, &last_collision)) {
+    int ret = do_read_call(&first_key);
+    if (ret == EVENT_RETURN)
+      goto Lcallreturn;
+    return ret;
+  }
+}
 Ldone:
-  _action.continuation->handleEvent(CACHE_EVENT_DEREF_FAILED, (void *) 
-ECACHE_NO_DOC);
+  _action.continuation->handleEvent(CACHE_EVENT_DEREF_FAILED, (void 
*)-ECACHE_NO_DOC);
   return free_CacheVC(this);
 Lcallreturn:
   return handleEvent(AIO_EVENT_DONE, 0); // hopefully a tail call

Reply via email to