trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jplev...@apache.org
Subject svn commit: r897010 [1/2] - in /incubator/trafficserver/traffic/branches/dev: iocore/cache/ iocore/cluster/ iocore/eventsystem/ iocore/net/ proxy/ proxy/http2/
Date Thu, 07 Jan 2010 20:49:38 GMT
Author: jplevyak
Date: Thu Jan  7 20:48:43 2010
New Revision: 897010

URL: http://svn.apache.org/viewvc?rev=897010&view=rev
Log:
TS-92: VIO and VConnection interfaces now use ink64 instead of int for all
sizes related to buffers or objects.  Counts remain int.
This checkin fixes type warnings in the modules which uses these interfaces.

Modified:
    incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc
    incubator/trafficserver/traffic/branches/dev/iocore/cache/CachePagesInternal.cc
    incubator/trafficserver/traffic/branches/dev/iocore/cache/CacheRead.cc
    incubator/trafficserver/traffic/branches/dev/iocore/cache/CacheWrite.cc
    incubator/trafficserver/traffic/branches/dev/iocore/cache/I_Cache.h
    incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.cc
    incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.h
    incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CacheDir.h
    incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CacheInternal.h
    incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CachePart.h
    incubator/trafficserver/traffic/branches/dev/iocore/cache/RamCache.cc
    incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterHandlerBase.cc
    incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterVConnection.cc
    incubator/trafficserver/traffic/branches/dev/iocore/cluster/P_ClusterCache.h
    incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/IOBuffer.cc
    incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_IOBuffer.h
    incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_VConnection.h
    incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_VIO.h
    incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/P_IOBuffer.h
    incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/P_VConnection.h
    incubator/trafficserver/traffic/branches/dev/iocore/net/I_NetVConnection.h
    incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixNetVConnection.h
    incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetVConnection.cc
    incubator/trafficserver/traffic/branches/dev/proxy/CoreUtils.cc
    incubator/trafficserver/traffic/branches/dev/proxy/PluginVC.cc
    incubator/trafficserver/traffic/branches/dev/proxy/PluginVC.h
    incubator/trafficserver/traffic/branches/dev/proxy/Transform.cc
    incubator/trafficserver/traffic/branches/dev/proxy/TransformInternal.h
    incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpClientSession.cc
    incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpClientSession.h
    incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpServerSession.cc
    incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpServerSession.h

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc Thu Jan  7 20:48:43 2010
@@ -125,9 +125,9 @@
 void cplist_init();
 static void cplist_update();
 int cplist_reconfigure();
-static int create_partition(int partition_number, int size_in_blocks, int scheme, CachePart * cp);
-static void rebuild_host_table(Cache * cache);
-void register_cache_stats(RecRawStatBlock * rsb, const char *prefix);
+static int create_partition(int partition_number, int size_in_blocks, int scheme, CachePart *cp);
+static void rebuild_host_table(Cache *cache);
+void register_cache_stats(RecRawStatBlock *rsb, const char *prefix);
 
 Queue<CachePart> cp_list;
 int cp_list_len = 0;
@@ -160,7 +160,7 @@
 
 int
 cache_stats_bytes_used_cb(const char *name,
-                          RecDataT data_type, RecData * data, RecRawStatBlock * rsb, int id, void *cookie)
+                          RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id, void *cookie)
 {
   if (cacheProcessor.initialized == CACHE_INITIALIZED) {
     RecSetGlobalRawStatSum(rsb, id, cache_bytes_used());
@@ -202,7 +202,7 @@
 }
 
 VIO *
-CacheVC::do_io_read(Continuation * c, int nbytes, MIOBuffer * abuf)
+CacheVC::do_io_read(Continuation *c, ink64 nbytes, MIOBuffer *abuf)
 {
   ink_assert(vio.op == VIO::READ);
   vio.buffer.writer_for(abuf);
@@ -217,15 +217,15 @@
 }
 
 VIO *
-CacheVC::do_io_pread(Continuation * c, ink64 nbytes, MIOBuffer * abuf, ink_off_t off)
+CacheVC::do_io_pread(Continuation *c, ink64 nbytes, MIOBuffer *abuf, ink64 offset)
 {
   ink_assert(vio.op == VIO::READ);
   vio.buffer.writer_for(abuf);
   vio.set_continuation(c);
-  vio.ndone = off;
+  vio.ndone = offset;
   vio.nbytes = 0;
   vio.vc_server = this;
-  seek_to = off;
+  seek_to = offset;
   ink_assert(c->mutex->thread_holding);
   if (!trigger)
     trigger = c->mutex->thread_holding->schedule_imm_local(this);
@@ -233,7 +233,7 @@
 }
 
 VIO *
-CacheVC::do_io_write(Continuation * c, int nbytes, IOBufferReader * abuf, bool owner)
+CacheVC::do_io_write(Continuation *c, ink64 nbytes, IOBufferReader *abuf, bool owner)
 {
   ink_assert(vio.op == VIO::WRITE);
   ink_assert(!owner);
@@ -258,7 +258,7 @@
 }
 
 void
-CacheVC::reenable(VIO * avio)
+CacheVC::reenable(VIO *avio)
 {
   Debug("cache_reenable", "reenable %lX", (long) this);
   (void) avio;
@@ -276,7 +276,7 @@
 }
 
 void
-CacheVC::reenable_re(VIO * avio)
+CacheVC::reenable_re(VIO *avio)
 {
   Debug("cache_reenable", "reenable_re %lX", (long) this);
   (void) avio;
@@ -335,7 +335,7 @@
 // calling set_http_info(), but it guarantees that the info will
 // be set before transferring any bytes
 void
-CacheVC::set_http_info(CacheHTTPInfo * ainfo)
+CacheVC::set_http_info(CacheHTTPInfo *ainfo)
 {
 
   ink_assert(!total_len);
@@ -386,31 +386,31 @@
 }
 
 int
-Part::begin_read(CacheVC * cont)
+Part::begin_read(CacheVC *cont)
 {
-  // no need for evacuation as the entire document is already in memory
   ink_debug_assert(cont->mutex->thread_holding == this_ethread());
   ink_debug_assert(mutex->thread_holding == this_ethread());
 #ifdef CACHE_STAT_PAGES
   ink_assert(!cont->stat_link.next && !cont->stat_link.prev);
   stat_cache_vcs.enqueue(cont, cont->stat_link);
 #endif
+  // no need for evacuation as the entire document is already in memory
   if (cont->f.single_fragment)
     return 0;
-  EThread *t = cont->mutex->thread_holding;
   int i = dir_evac_bucket(&cont->earliest_dir);
   EvacuationBlock *b;
   for (b = evacuate[i].head; b; b = b->link.next) {
     if (dir_offset(&b->dir) != dir_offset(&cont->earliest_dir))
       continue;
-    if (b->f.readers)
-      b->f.readers = b->f.readers + 1;
+    if (b->readers)
+      b->readers = b->readers + 1;
     return 0;
   }
   // we don't actually need to preserve this block as it is already in
   // memory, but this is easier, and evacuations are rare
+  EThread *t = cont->mutex->thread_holding;
   b = new_EvacuationBlock(t);
-  b->f.readers = 1;
+  b->readers = 1;
   b->dir = cont->earliest_dir;
   b->evac_frags.key = cont->earliest_key;
   evacuate[i].push(b);
@@ -418,10 +418,11 @@
 }
 
 int
-Part::close_read(CacheVC * cont)
+Part::close_read(CacheVC *cont)
 {
   EThread *t = cont->mutex->thread_holding;
   ink_debug_assert(t == this_ethread());
+  ink_debug_assert(t == mutex->thread_holding);
   if (dir_is_empty(&cont->earliest_dir))
     return 1;
   int i = dir_evac_bucket(&cont->earliest_dir);
@@ -432,9 +433,10 @@
       b = next;
       continue;
     }
-    if (b->f.readers && !--b->f.readers) {
+    if (b->readers && !--b->readers) {
       evacuate[i].remove(b);
       free_EvacuationBlock(b, t);
+      break;
     }
     b = next;
   }
@@ -882,16 +884,16 @@
 }
 
 static void
-part_init_data_internal(Part * d)
+part_init_data_internal(Part *d)
 {
   d->buckets = ((d->len - (d->start - d->skip)) / cache_config_min_average_object_size) / DIR_DEPTH;
   d->segments = (d->buckets + (((1<<16)-1)/DIR_DEPTH)) / ((1<<16)/DIR_DEPTH);
   d->buckets = (d->buckets + d->segments - 1) / d->segments;
-  d->start = d->skip + 2 * part_dirlen(d);
+  d->start = d->skip + 2 *part_dirlen(d);
 }
 
 static void
-part_init_data(Part * d) {
+part_init_data(Part *d) {
   // iteratively calculate start + buckets
   part_init_data_internal(d);
   part_init_data_internal(d);
@@ -899,7 +901,7 @@
 }
 
 void
-part_init_dir(Part * d)
+part_init_dir(Part *d)
 {
   int b, s, l;
 
@@ -916,7 +918,7 @@
 }
 
 void
-part_clear_init(Part * d)
+part_clear_init(Part *d)
 {
   int dir_len = part_dirlen(d);
   memset(d->raw_dir, 0, dir_len);
@@ -934,7 +936,7 @@
 }
 
 int
-part_dir_clear(Part * d)
+part_dir_clear(Part *d)
 {
   int dir_len = part_dirlen(d);
   part_clear_init(d);
@@ -1491,7 +1493,7 @@
 }
 
 void
-build_part_hash_table(CacheHostRecord * cp)
+build_part_hash_table(CacheHostRecord *cp)
 {
   int num_parts = cp->num_part;
   unsigned int *mapping = (unsigned int *) xmalloc(sizeof(unsigned int) * num_parts);
@@ -1688,7 +1690,7 @@
 {
 #ifdef NON_MODULAR
   Action *register_ShowCache(Continuation * c, HTTPHdr * h);
-  Action *register_ShowCacheInternal(Continuation * c, HTTPHdr * h);
+  Action *register_ShowCacheInternal(Continuation *c, HTTPHdr *h);
   statPagesManager.register_http("cache", register_ShowCache);
   statPagesManager.register_http("cache-internal", register_ShowCacheInternal);
 #endif
@@ -1767,7 +1769,7 @@
 }
 
 int
-CacheVC::dead(int event, Event * e)
+CacheVC::dead(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
@@ -1778,7 +1780,7 @@
 #define STORE_COLLISION 1
 
 int
-CacheVC::handleReadDone(int event, Event * e)
+CacheVC::handleReadDone(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   cancel_trigger();
@@ -1884,7 +1886,7 @@
 
 
 int
-CacheVC::handleRead(int event, Event * e)
+CacheVC::handleRead(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   cancel_trigger();
@@ -1936,7 +1938,7 @@
 }
 
 Action *
-Cache::lookup(Continuation * cont, CacheKey * key, CacheFragType type, char *hostname, int host_len)
+Cache::lookup(Continuation *cont, CacheKey *key, CacheFragType type, char *hostname, int host_len)
 {
 
   if (!(CacheProcessor::cache_ready & type)) {
@@ -1965,7 +1967,7 @@
 
 #ifdef HTTP_CACHE
 Action *
-Cache::lookup(Continuation * cont, CacheURL * url, CacheFragType type)
+Cache::lookup(Continuation *cont, CacheURL *url, CacheFragType type)
 {
   INK_MD5 md5;
 
@@ -1987,7 +1989,7 @@
 // open_write
 
 int
-CacheVC::removeAbortWriter(int event, Event * e)
+CacheVC::removeAbortWriter(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
@@ -2021,7 +2023,7 @@
 // remove code
 
 int
-CacheVC::removeReadDone(int event, Event * e)
+CacheVC::removeReadDone(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
@@ -2083,7 +2085,7 @@
 }
 
 Action *
-Cache::remove(Continuation * cont, CacheKey * key, bool user_agents,
+Cache::remove(Continuation *cont, CacheKey *key, bool user_agents,
               bool link, CacheFragType type, char *hostname, int host_len)
 {
   NOWARN_UNUSED(user_agents);
@@ -2130,7 +2132,7 @@
 
 #ifdef HTTP_CACHE
 Action *
-Cache::remove(Continuation * cont, CacheURL * url, CacheFragType type)
+Cache::remove(Continuation *cont, CacheURL *url, CacheFragType type)
 {
   INK_MD5 md5;
   url->MD5_get(&md5);
@@ -2443,7 +2445,7 @@
 }
 
 int
-create_partition(int partition_number, int size_in_blocks, int scheme, CachePart * cp)
+create_partition(int partition_number, int size_in_blocks, int scheme, CachePart *cp)
 {
   static int curr_part = 0;
   int to_create = size_in_blocks;
@@ -2501,7 +2503,7 @@
 }
 
 void
-rebuild_host_table(Cache * cache)
+rebuild_host_table(Cache *cache)
 {
   build_part_hash_table(&cache->hosttable->gen_host_rec);
   if (cache->hosttable->m_numEntries != 0) {
@@ -2517,7 +2519,7 @@
 
 // if generic_host_rec.parts == NULL, what do we do??? 
 Part *
-Cache::key_to_part(CacheKey * key, char *hostname, int host_len)
+Cache::key_to_part(CacheKey *key, char *hostname, int host_len)
 {
   inku32 h = (key->word(2) >> DIR_TAG_WIDTH) % PART_HASH_TABLE_SIZE;
   unsigned short *hash_table = hosttable->gen_host_rec.part_hash_table;
@@ -2547,7 +2549,7 @@
 
 // Register Stats
 void
-register_cache_stats(RecRawStatBlock * rsb, const char *prefix)
+register_cache_stats(RecRawStatBlock *rsb, const char *prefix)
 {
 
   char stat_str[256];
@@ -2911,8 +2913,8 @@
 
 //----------------------------------------------------------------------------
 Action *
-CacheProcessor::open_read(Continuation * cont, URL * url, CacheHTTPHdr * request,
-                          CacheLookupHttpConfig * params, time_t pin_in_cache, CacheFragType type)
+CacheProcessor::open_read(Continuation *cont, URL *url, CacheHTTPHdr *request,
+                          CacheLookupHttpConfig *params, time_t pin_in_cache, CacheFragType type)
 {
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0) {
@@ -2957,8 +2959,8 @@
 
 //----------------------------------------------------------------------------
 Action *
-CacheProcessor::open_write(Continuation * cont, int expected_size, URL * url,
-                           CacheHTTPHdr * request, CacheHTTPInfo * old_info, time_t pin_in_cache, CacheFragType type)
+CacheProcessor::open_write(Continuation *cont, int expected_size, URL *url,
+                           CacheHTTPHdr *request, CacheHTTPInfo *old_info, time_t pin_in_cache, CacheFragType type)
 {
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0) {
@@ -3005,7 +3007,7 @@
 
 //----------------------------------------------------------------------------
 Action *
-CacheProcessor::remove(Continuation * cont, URL * url, CacheFragType frag_type)
+CacheProcessor::remove(Continuation *cont, URL *url, CacheFragType frag_type)
 {
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0) {

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/CachePagesInternal.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/CachePagesInternal.cc?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/CachePagesInternal.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/CachePagesInternal.cc Thu Jan  7 20:48:43 2010
@@ -174,7 +174,7 @@
                     vc->part->hash_id,
                     url,
                     vc->vio.ndone,
-                    vc->vio.nbytes == INT_MAX ? "all" : nbytes, vc->vio.nbytes == INT_MAX ? "all" : todo));
+                    vc->vio.nbytes == INK64_MAX ? "all" : nbytes, vc->vio.nbytes == INK64_MAX ? "all" : todo));
   }
   part_index++;
   if (part_index < gnpart)
@@ -220,7 +220,7 @@
                       "<td>%d</td>"     // estimated size
                       "<td>%d</td>"     // reader count
                       "<td>%s</td>"     // done
-                      "</tr>\n", offset, (int) dir_approx_size(&b->dir), b->f.readers, b->f.done ? "yes" : "no"));
+                      "</tr>\n", offset, (int) dir_approx_size(&b->dir), b->readers, b->f.done ? "yes" : "no"));
     }
   }
   part_index++;

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/CacheRead.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/CacheRead.cc?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/CacheRead.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/CacheRead.cc Thu Jan  7 20:48:43 2010
@@ -380,7 +380,7 @@
         ink_assert(doc_len == doc->data_len());
         length = doc_len;
         f.single_fragment = 1;
-        docpos = 0;
+        doc_pos = 0;
         earliest_key = key;
         dir_clean(&first_dir);
         dir_clean(&earliest_dir);
@@ -419,7 +419,7 @@
   length = write_vc->length;
   // copy the vector
   f.single_fragment = !write_vc->fragment;        // single fragment doc
-  docpos = 0;
+  doc_pos = 0;
   earliest_key = write_vc->earliest_key;
   ink_assert(earliest_key == key);
   doc_len = write_vc->total_len;
@@ -449,7 +449,7 @@
   ink64 ntodo = vio.ntodo();
   if (ntodo <= 0)
     return EVENT_CONT;
-  if (length < (doc_len - vio.ndone)) {
+  if (length < ((ink64)doc_len) - vio.ndone) {
     Debug("cache_read_agg", "truncation %X", earliest_key.word(0));
     if (is_action_tag_set("cache")) {
       ink_release_assert(false);
@@ -460,9 +460,9 @@
   }
   /* its possible that the user did a do_io_close before 
      openWriteWriteDone was called. */
-  if (length > (doc_len - vio.ndone)) {
+  if (length > ((ink64)doc_len) - vio.ndone) {
     ink64 skip_bytes = length - (doc_len - vio.ndone);
-    iobufferblock_skip(writer_buf, &writer_offset, (int*)&length, skip_bytes);
+    iobufferblock_skip(writer_buf, &writer_offset, &length, skip_bytes);
   }
   ink64 bytes = length;
   if (bytes > vio.ntodo())
@@ -474,7 +474,7 @@
     return EVENT_DONE;
   }
   b = iobufferblock_clone(writer_buf, writer_offset, bytes);
-  writer_buf = iobufferblock_skip(writer_buf, &writer_offset, (int*)&length, bytes);
+  writer_buf = iobufferblock_skip(writer_buf, &writer_offset, &length, bytes);
   vio.buffer.mbuf->append_block(b);
   vio.ndone += bytes;
   if (vio.ntodo() <= 0) {
@@ -526,32 +526,29 @@
   if (event == EVENT_IMMEDIATE)
     return EVENT_CONT;
   set_io_not_in_progress();
-  if (event == AIO_EVENT_DONE && !io.ok())
-    goto Lerror;
-  if (last_collision &&         // no missed lock
-      dir_valid(part, &dir))    // object still valid
-  {
-    doc = (Doc *) buf->data();
-    if (doc->magic != DOC_MAGIC) {
-      char tmpstring[100];
-      if (doc->magic == DOC_CORRUPT)
-        Warning("Middle: Doc checksum does not match for %s", key.string(tmpstring));
-      else
-        Warning("Middle: Doc magic does not match for %s", key.string(tmpstring));
-      goto Lerror;
-    }
-    if (doc->key == key) {
-      fragment++;
-      docpos = doc->prefix_len();
-      next_CacheKey(&key, &key);
-      SET_HANDLER(&CacheVC::openReadMain);
-      return openReadMain(event, e);
-    }
-  }
   {
     CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
     if (!lock)
       VC_SCHED_LOCK_RETRY();
+    if (event == AIO_EVENT_DONE && !io.ok()) {
+      dir_delete(&earliest_key, part, &earliest_dir);
+      goto Lerror;
+    }
+    if (last_collision &&         // no missed lock
+        dir_valid(part, &dir))    // object still valid
+    {
+      doc = (Doc *) buf->data();
+      if (doc->magic != DOC_MAGIC) {
+        char tmpstring[100];
+        if (doc->magic == DOC_CORRUPT)
+          Warning("Middle: Doc checksum does not match for %s", key.string(tmpstring));
+        else
+          Warning("Middle: Doc magic does not match for %s", key.string(tmpstring));
+        goto Lerror;
+      }
+      if (doc->key == key)
+        goto LreadMain;
+    }
     if (last_collision && dir_offset(&dir) != dir_offset(last_collision))
       last_collision = 0;       // object has been/is being overwritten
     if (dir_probe(&key, part, &dir, &last_collision)) {
@@ -567,33 +564,35 @@
             Debug("cache_read_agg", "%x: key: %X ReadRead complete: %d", 
                   this, first_key.word(1), (int)vio.ndone);
             doc_len = vio.ndone;
-            MUTEX_RELEASE(lock);
-            calluser(VC_EVENT_EOS);
-            return EVENT_DONE;
+            goto Ldone;
           }
         }
         Debug("cache_read_agg", "%x: key: %X ReadRead writer aborted: %d", 
               this, first_key.word(1), (int)vio.ndone);
-        MUTEX_RELEASE(lock);
-        calluser(VC_EVENT_ERROR);
-        return EVENT_DONE;
+        goto Lerror;
       }
       Debug("cache_read_agg", "%x: key: %X ReadRead retrying: %d", this, first_key.word(1), (int)vio.ndone);
-      VC_SCHED_WRITER_RETRY();
+      VC_SCHED_WRITER_RETRY(); // wait for writer
     }
+    // fall through for truncated documents
   }
 Lerror:
-  if (is_action_tag_set("cache"))
-    ink_release_assert(false);
-  // remove the directory entry
-  dir_delete_lock(&earliest_key, part, mutex, &earliest_dir);
   char tmpstring[100];
   Warning("Document truncated for %s", earliest_key.string(tmpstring));
   calluser(VC_EVENT_ERROR);
   return EVENT_CONT;
+Ldone:
+  calluser(VC_EVENT_EOS);
+  return EVENT_DONE;
 Lcallreturn:
   handleEvent(AIO_EVENT_DONE, 0);
   return EVENT_CONT;
+LreadMain:
+  fragment++;
+  doc_pos = doc->prefix_len();
+  next_CacheKey(&key, &key);
+  SET_HANDLER(&CacheVC::openReadMain);
+  return openReadMain(event, e);
 }
 
 int
@@ -605,10 +604,10 @@
   cancel_trigger();
   Doc *doc = (Doc *) buf->data();
   ink64 ntodo = vio.ntodo();
-  ink64 bytes = doc->len - docpos;
+  ink64 bytes = doc->len - doc_pos;
   IOBufferBlock *b = NULL;
   if (seek_to) { // handle do_io_pread
-    if (seek_to >= doc_len) {
+    if (seek_to >= (int)doc_len) {
       vio.ndone = doc_len;
       calluser(VC_EVENT_EOS);
       return EVENT_DONE;
@@ -624,7 +623,7 @@
         Frag *frag = doc->frags();
         // skip to correct key, key is already set to next fragment
         for (inku32 i = 1; i <= doc->nfrags(); i++) {
-          if (seek_to < frag[i].offset) break;
+          if (seek_to < (int)frag[i].offset) break;
           next_CacheKey(&key, &key);
         }
         seek_to = 0;
@@ -641,11 +640,11 @@
     goto Lread;
   if (bytes > vio.ntodo())
     bytes = vio.ntodo();
-  b = new_IOBufferBlock(buf, bytes, docpos);
+  b = new_IOBufferBlock(buf, bytes, doc_pos);
   b->_buf_end = b->_end;
   vio.buffer.mbuf->append_block(b);
   vio.ndone += bytes;
-  docpos += bytes;
+  doc_pos += bytes;
   if (vio.ntodo() <= 0) {
     calluser(VC_EVENT_READ_COMPLETE);
     return EVENT_DONE;
@@ -673,7 +672,7 @@
     cancel_trigger();
     CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
     if (!lock) {
-      SET_HANDLER(&CacheVC::openReadReadDone);
+      SET_HANDLER(&CacheVC::openReadMain);
       VC_SCHED_LOCK_RETRY();
     }
     if (dir_probe(&key, part, &dir, &last_collision)) {
@@ -690,9 +689,7 @@
             Debug("cache_read_agg", "%x: key: %X ReadMain complete: %d", 
                   this, first_key.word(1), (int)vio.ndone);
             doc_len = vio.ndone;
-            MUTEX_RELEASE(lock);
-            calluser(VC_EVENT_EOS);
-            return EVENT_DONE;
+            goto Leos;
           }
         }
         Debug("cache_read_agg", "%x: key: %X ReadMain writer aborted: %d", 
@@ -700,10 +697,9 @@
         goto Lerror;
       }
       Debug("cache_read_agg", "%x: key: %X ReadMain retrying: %d", this, first_key.word(1), (int)vio.ndone);
-      SET_HANDLER(&CacheVC::openReadReadDone);
+      SET_HANDLER(&CacheVC::openReadMain);
       VC_SCHED_WRITER_RETRY();
     }
-    Debug("cache_evac", "truncation %X", key.word(0));
     if (is_action_tag_set("cache"))
       ink_release_assert(false);
     Warning("Document for %X truncated", earliest_key.word(0));
@@ -713,11 +709,18 @@
 Lerror:
   calluser(VC_EVENT_ERROR);
   return EVENT_DONE;
+Leos:
+  calluser(VC_EVENT_EOS);
+  return EVENT_DONE;
 Lcallreturn:
   handleEvent(AIO_EVENT_DONE, 0);
   return EVENT_CONT;
 }
 
+/*
+  This code follows CacheVC::openReadStartHead closely,
+  if you change this you might have to change that.
+*/
 int
 CacheVC::openReadStartEarliest(int event, Event * e)
 {
@@ -730,65 +733,61 @@
   set_io_not_in_progress();
   if (_action.cancelled)
     return free_CacheVC(this);
-  if (!buf)
-    goto Lcollision;
-  if (!io.ok())
-    goto Ldone;
-  // an object needs to be outside the aggregation window in order to be
-  // be evacuated as it is read
-  if (!dir_agg_valid(part, &dir)) {
-    // a directory entry which is nolonger valid may have been overwritten
-    if (!dir_valid(part, &dir))
+  {
+    CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+    if (!lock)
+      VC_SCHED_LOCK_RETRY();
+    if (!buf)
+      goto Lread;
+    if (!io.ok())
+      goto Ldone;
+    // an object needs to be outside the aggregation window in order to be
+    // be evacuated as it is read
+    if (!dir_agg_valid(part, &dir)) {
+      // a directory entry which is nolonger valid may have been overwritten
+      if (!dir_valid(part, &dir))
+        last_collision = NULL;
+      goto Lread;
+    }
+    doc = (Doc *) buf->data();
+    if (doc->magic != DOC_MAGIC) {
+      char tmpstring[100];
+      if (is_action_tag_set("cache")) {
+        ink_release_assert(false);
+      }
+      if (doc->magic == DOC_CORRUPT)
+        Warning("Earliest: Doc checksum does not match for %s", key.string(tmpstring));
+      else
+        Warning("Earliest : Doc magic does not match for %s", key.string(tmpstring));
+      // remove the dir entry
+      dir_delete(&key, part, &dir);
+      // try going through the directory entries again
+      // in case the dir entry we deleted doesnt correspond
+      // to the key we are looking for. This is possible 
+      // because of directory collisions
       last_collision = NULL;
-    goto Lcollision;
-  }
-  doc = (Doc *) buf->data();
-  if (doc->magic != DOC_MAGIC) {
-    char tmpstring[100];
-    //action_tag_assert("cache", false);
-    if (is_action_tag_set("cache")) {
-      ink_release_assert(false);
+      goto Lread;
     }
-    if (doc->magic == DOC_CORRUPT)
-      Warning("Earliest: Doc checksum does not match for %s", key.string(tmpstring));
-    else
-      Warning("Earliest : Doc magic does not match for %s", key.string(tmpstring));
-    // remove the dir entry
-    dir_delete(&key, part, &dir);
-    // try going through the directory entries again
-    // in case the dir entry we deleted doesnt correspond
-    // to the key we are looking for. This is possible 
-    // because of directory collisions
-    last_collision = NULL;
-    goto Lcollision;
-  }
-  if (!(doc->key == key))
-    goto Lcollision;
-  if (part->begin_read_lock(this) < 0)
-    VC_SCHED_LOCK_RETRY();
-  // success
-  earliest_key = key;
-  docpos = doc->prefix_len();
-  next_CacheKey(&key, &doc->key);
+    if (!(doc->key == key)) // collisiion
+      goto Lread;
+    // success
+    earliest_key = key;
+    doc_pos = doc->prefix_len();
+    next_CacheKey(&key, &doc->key);
+    part->begin_read(this);
 #ifdef HIT_EVACUATE
-  if (part->within_hit_evacuate_window(&earliest_dir) &&
-      (!cache_config_hit_evacuate_size_limit || doc_len <= cache_config_hit_evacuate_size_limit)) {
-    Debug("cache_hit_evac", "dir: %d, write: %d, phase: %d",
-          dir_offset(&earliest_dir), offset_to_part_offset(part, part->header->write_pos), part->header->phase);
-    f.hit_evacuate = 1;
-  }
+    if (part->within_hit_evacuate_window(&earliest_dir) &&
+        (!cache_config_hit_evacuate_size_limit || doc_len <= cache_config_hit_evacuate_size_limit)) {
+      Debug("cache_hit_evac", "dir: %d, write: %d, phase: %d",
+            dir_offset(&earliest_dir), offset_to_part_offset(part, part->header->write_pos), part->header->phase);
+      f.hit_evacuate = 1;
+    }
 #endif
-  if (write_vc)
-    CACHE_INCREMENT_DYN_STAT(cache_read_busy_success_stat);
-  SET_HANDLER(&CacheVC::openReadMain);
-  _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ, (void *) this);
-  return EVENT_DONE;
-
-Lcollision: {
-    CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
-    if (!lock)
-      VC_SCHED_LOCK_RETRY();
-    if (dir_probe(&key, part, &earliest_dir, &last_collision) || dir_lookaside_probe(&key, part, &earliest_dir, NULL)) {
+    goto Lsuccess;
+Lread: 
+    if (dir_probe(&key, part, &earliest_dir, &last_collision) ||
+        dir_lookaside_probe(&key, part, &earliest_dir, NULL)) 
+    {
       dir = earliest_dir;
       if ((ret = do_read_call(&key)) == EVENT_RETURN)
         goto Lcallreturn;
@@ -849,15 +848,21 @@
     }
 #endif
     // open write failure - another writer, so don't modify the vector
+  Ldone:
+    if (od)
+      part->close_write(this);
   }
-Ldone:
-  if (od)
-    part->close_write_lock(this);
   CACHE_INCREMENT_DYN_STAT(cache_read_failure_stat);
   _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_NO_DOC);
   return free_CacheVC(this);
 Lcallreturn:
   return handleEvent(AIO_EVENT_DONE, 0); // hopefully a tail call
+Lsuccess:
+  if (write_vc)
+    CACHE_INCREMENT_DYN_STAT(cache_read_busy_success_stat);
+  SET_HANDLER(&CacheVC::openReadMain);
+  _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ, (void *) this);
+  return EVENT_DONE;
 }
 
 // create the directory entry after the vector has been evacuated
@@ -918,6 +923,10 @@
 }
 #endif
 
+/*
+  This code follows CacheVC::openReadStartEarliest closely,
+  if you change this you might have to change that.
+*/
 int
 CacheVC::openReadStartHead(int event, Event * e)
 {
@@ -930,138 +939,127 @@
   set_io_not_in_progress();
   if (_action.cancelled)
     return free_CacheVC(this);
-  if (!buf)
-    goto Lcollision;
-  if (!io.ok())
-    goto Ldone;
-  // an object needs to be outside the aggregation window in order to be
-  // be evacuated as it is read
-  if (!dir_agg_valid(part, &dir)) {
-    // a directory entry which is nolonger valid may have been overwritten
-    if (!dir_valid(part, &dir))
+  {
+    CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+    if (!lock)
+      VC_SCHED_LOCK_RETRY();
+    if (!buf)
+      goto Lread;
+    if (!io.ok())
+      goto Ldone;
+    // an object needs to be outside the aggregation window in order to be
+    // be evacuated as it is read
+    if (!dir_agg_valid(part, &dir)) {
+      // a directory entry which is nolonger valid may have been overwritten
+      if (!dir_valid(part, &dir))
+        last_collision = NULL;
+      goto Lread;
+    }
+    doc = (Doc *) buf->data();
+    if (doc->magic != DOC_MAGIC) {
+      char tmpstring[100];
+      if (is_action_tag_set("cache")) {
+        ink_release_assert(false);
+      }
+      if (doc->magic == DOC_CORRUPT)
+        Warning("Head: Doc checksum does not match for %s", key.string(tmpstring));
+      else
+        Warning("Head : Doc magic does not match for %s", key.string(tmpstring));
+      // remove the dir entry
+      dir_delete(&key, part, &dir);
+      // try going through the directory entries again
+      // in case the dir entry we deleted doesnt correspond
+      // to the key we are looking for. This is possible 
+      // because of directory collisions
       last_collision = NULL;
-    goto Lcollision;
-  }
-  doc = (Doc *) buf->data();
-  if (doc->magic != DOC_MAGIC) {
-    char tmpstring[100];
-    //action_tag_assert("cache", false);
-    if (is_action_tag_set("cache")) {
-      ink_release_assert(false);
+      goto Lread;
     }
-    if (doc->magic == DOC_CORRUPT)
-      Warning("Head: Doc checksum does not match for %s", key.string(tmpstring));
-    else
-      Warning("Head : Doc magic does not match for %s", key.string(tmpstring));
-    // remove the dir entry
-    dir_delete(&key, part, &dir);
-    // try going through the directory entries again
-    // in case the dir entry we deleted doesnt correspond
-    // to the key we are looking for. This is possible 
-    // because of directory collisions
-    last_collision = NULL;
-    goto Lcollision;
-  }
-  if (!(doc->first_key == key))
-    goto Lcollision;
-  if (f.lookup) {
-    CACHE_INCREMENT_DYN_STAT(cache_lookup_success_stat);
-    _action.continuation->handleEvent(CACHE_EVENT_LOOKUP, 0);
-    return free_CacheVC(this);
-  }
-  earliest_dir = dir;
+    if (!(doc->first_key == key))
+      goto Lread;
+    if (f.lookup)
+      goto Lookup;
+    earliest_dir = dir;
 #ifdef HTTP_CACHE
-  CacheHTTPInfo *alternate_tmp;
-  if (frag_type == CACHE_FRAG_TYPE_HTTP) {
-    ink_assert(doc->hlen);
-    if (!doc->hlen)
-      goto Ldone;
-    if (vector.get_handles(doc->hdr(), doc->hlen) != doc->hlen) {
-      if (buf) {
-        Note("OpenReadHead failed for cachekey %X : vector inconsistency with %d", key.word(0), doc->hlen);
-        dir_delete(&key, part, &dir);
+    CacheHTTPInfo *alternate_tmp;
+    if (frag_type == CACHE_FRAG_TYPE_HTTP) {
+      ink_assert(doc->hlen);
+      if (!doc->hlen)
+        goto Ldone;
+      if (vector.get_handles(doc->hdr(), doc->hlen) != doc->hlen) {
+        if (buf) {
+          Note("OpenReadHead failed for cachekey %X : vector inconsistency with %d", key.word(0), doc->hlen);
+          dir_delete(&key, part, &dir);
+        }
+        err = ECACHE_BAD_META_DATA;
+        goto Ldone;
       }
-      err = ECACHE_BAD_META_DATA;
-      goto Ldone;
-    }
-    if (cache_config_select_alternate) {
+      if (cache_config_select_alternate) {
 #ifdef FIXME_NONMODULAR
-      alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, params);
+        alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, params);
 #else
-      alternate_index = 0;
+        alternate_index = 0;
 #endif
-      if (alternate_index < 0) {
-        err = ECACHE_ALT_MISS;
+        if (alternate_index < 0) {
+          err = ECACHE_ALT_MISS;
+          goto Ldone;
+        }
+      } else
+        alternate_index = 0;
+      alternate_tmp = vector.get(alternate_index);
+      if (!alternate_tmp->valid()) {
+        if (buf) {
+          Note("OpenReadHead failed for cachekey %X : alternate inconsistency", key.word(0));
+          dir_delete(&key, part, &dir);
+        }
         goto Ldone;
       }
+
+      alternate.copy_shallow(alternate_tmp);
+      alternate.object_key_get(&key);
+      doc_len = alternate.object_size_get();
+      if (key == doc->key) {      // is this my data?
+        f.single_fragment = doc->single_fragment();
+        ink_assert(f.single_fragment);     // otherwise need to read earliest
+        ink_assert(doc->hlen);
+        doc_pos = doc->prefix_len();
+        next_CacheKey(&key, &doc->key);
+      } else {
+        f.single_fragment = false;
+      }
     } else
-      alternate_index = 0;
-    alternate_tmp = vector.get(alternate_index);
-    if (!alternate_tmp->valid()) {
-      if (buf) {
-        Note("OpenReadHead failed for cachekey %X : alternate inconsistency", key.word(0));
-        dir_delete(&key, part, &dir);
+#endif
+    {
+      // non-http docs have the total len set in the first fragment
+      if (doc->hlen) {
+        ink_debug_assert(!"Cache::openReadStartHead non-http request" " for http doc");
+        err = -ECACHE_BAD_READ_REQUEST;
+        goto Ldone;
       }
-      goto Ldone;
-    }
-
-    alternate.copy_shallow(alternate_tmp);
-    alternate.object_key_get(&key);
-    doc_len = alternate.object_size_get();
-    if (key == doc->key) {      // is this my data?
-      f.single_fragment = doc->single_fragment();
-      ink_assert(f.single_fragment);     // otherwise need to read earliest
-      ink_assert(doc->hlen);
-      docpos = doc->prefix_len();
       next_CacheKey(&key, &doc->key);
-    } else {
-      f.single_fragment = false;
-    }
-  } else
-#endif
-  {
-    // non-http docs have the total len set in the first fragment
-    if (doc->hlen) {
-      ink_debug_assert(!"Cache::openReadStartHead non-http request" " for http doc");
-      err = -ECACHE_BAD_READ_REQUEST;
-      goto Ldone;
+      f.single_fragment = doc->single_fragment();
+      doc_pos = doc->prefix_len();
+      doc_len = doc->total_len;
     }
-    next_CacheKey(&key, &doc->key);
-    f.single_fragment = doc->single_fragment();
-    docpos = doc->prefix_len();
-    doc_len = doc->total_len;
-  }
-  // the first fragment might have been gc'ed. Make sure the first
-  // fragment is there before returning CACHE_EVENT_OPEN_READ
-  if (!f.single_fragment) {
-    first_buf = buf;
-    buf = NULL;
-    earliest_key = key;
-    last_collision = NULL;
-    SET_HANDLER(&CacheVC::openReadStartEarliest);
-    return openReadStartEarliest(event, e);
-  }
+    // the first fragment might have been gc'ed. Make sure the first
+    // fragment is there before returning CACHE_EVENT_OPEN_READ
+    if (!f.single_fragment)
+      goto Learliest;
+
 #ifdef HIT_EVACUATE
-  if (part->within_hit_evacuate_window(&dir) &&
-      (!cache_config_hit_evacuate_size_limit || doc_len <= cache_config_hit_evacuate_size_limit)) {
-    Debug("cache_hit_evac", "dir: %d, write: %d, phase: %d",
-          dir_offset(&dir), offset_to_part_offset(part, part->header->write_pos), part->header->phase);
-    f.hit_evacuate = 1;
-  }
+    if (part->within_hit_evacuate_window(&dir) &&
+        (!cache_config_hit_evacuate_size_limit || doc_len <= cache_config_hit_evacuate_size_limit)) {
+      Debug("cache_hit_evac", "dir: %d, write: %d, phase: %d",
+            dir_offset(&dir), offset_to_part_offset(part, part->header->write_pos), part->header->phase);
+      f.hit_evacuate = 1;
+    }
 #endif
 
-  first_buf = buf;
-  if (part->begin_read_lock(this) < 0)
-    VC_SCHED_LOCK_RETRY();
+    first_buf = buf;
+    part->begin_read(this);
 
-  SET_HANDLER(&CacheVC::openReadMain);
-  _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ, (void *) this);
-  return EVENT_DONE;
+    goto Lsuccess;
 
-Lcollision:{
-    CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
-    if (!lock)
-      VC_SCHED_LOCK_RETRY();
+  Lread:
     // check for collision
     // INKqa07684 - Cache::lookup returns CACHE_EVENT_OPEN_READ_FAILED.
     // don't want to go through this BS of reading from a writer if
@@ -1097,4 +1095,19 @@
   return free_CacheVC(this);
 Lcallreturn:
   return handleEvent(AIO_EVENT_DONE, 0); // hopefully a tail call
+Lsuccess:
+  SET_HANDLER(&CacheVC::openReadMain);
+  _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ, (void *) this);
+  return EVENT_DONE;
+Lookup:
+  CACHE_INCREMENT_DYN_STAT(cache_lookup_success_stat);
+  _action.continuation->handleEvent(CACHE_EVENT_LOOKUP, 0);
+  return free_CacheVC(this);
+Learliest:
+  first_buf = buf;
+  buf = NULL;
+  earliest_key = key;
+  last_collision = NULL;
+  SET_HANDLER(&CacheVC::openReadStartEarliest);
+  return openReadStartEarliest(event, e);
 }

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/CacheWrite.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/CacheWrite.cc?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/CacheWrite.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/CacheWrite.cc Thu Jan  7 20:48:43 2010
@@ -46,7 +46,7 @@
 // used to get the alternate which is actually present in the document
 #ifdef HTTP_CACHE
 int
-get_alternate_index(CacheHTTPInfoVector * cache_vector, CacheKey key)
+get_alternate_index(CacheHTTPInfoVector *cache_vector, CacheKey key)
 {
   int alt_count = cache_vector->count();
   CacheHTTPInfo *obj;
@@ -69,7 +69,7 @@
 // of writing the vector even if the http state machine aborts.  This
 // makes it easier to handle situations where writers abort.
 int
-CacheVC::updateVector(int event, Event * e)
+CacheVC::updateVector(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
@@ -184,7 +184,7 @@
    */
 
 int
-CacheVC::handleWrite(int event, Event * e)
+CacheVC::handleWrite(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
@@ -217,13 +217,15 @@
 #endif
   bool max_doc_error = (cache_config_max_doc_size &&
                         (cache_config_max_doc_size < vio.ndone ||
-                         (vio.nbytes != MAXINT && (cache_config_max_doc_size < vio.nbytes))));
+                         (vio.nbytes != INK64_MAX && (cache_config_max_doc_size < vio.nbytes))));
 
   if (agg_error || max_doc_error) {
     CACHE_INCREMENT_DYN_STAT(cache_write_backlog_failure_stat);
     CACHE_INCREMENT_DYN_STAT(base_stat + CACHE_STAT_FAILURE);
     part->agg_todo_size -= agg_len;
     io.aio_result = AIO_SOFT_FAILURE;
+    if (event == EVENT_CALL)
+      return EVENT_RETURN;
     return handleEvent(AIO_EVENT_DONE, 0);
   }
   if (f.evac_vector)
@@ -236,7 +238,7 @@
 }
 
 static char *
-iobufferblock_memcpy(char *p, int len, IOBufferBlock * ab, int offset)
+iobufferblock_memcpy(char *p, int len, IOBufferBlock *ab, int offset)
 {
   IOBufferBlock *b = ab;
   while (b && len >= 0) {
@@ -262,7 +264,7 @@
 }
 
 EvacuationBlock *
-Part::force_evacuate_head(Dir * evac_dir, int pinned)
+Part::force_evacuate_head(Dir *evac_dir, int pinned)
 {
   // build an evacuation block for the object
   EvacuationBlock *b = evacuation_block_exists(evac_dir, this);
@@ -281,7 +283,7 @@
   b->f.evacuate_head = 1;
   b->evac_frags.key.set(0, 0);  // ensure that the block gets
   // evacuated no matter what
-  b->f.readers = 0;             // ensure that the block does not disappear
+  b->readers = 0;             // ensure that the block does not disappear
   return b;
 }
 
@@ -367,7 +369,6 @@
     agg_buf_pos = 0;
   }
   set_io_not_in_progress();
-  SET_HANDLER(&Part::aggWrite);
   if (dir_sync_waiting) {
     dir_sync_waiting = 0;
     cacheDirSync->handleEvent(EVENT_IMMEDIATE, 0);
@@ -378,7 +379,7 @@
 }
 
 CacheVC *
-new_DocEvacuator(int nbytes, Part * part)
+new_DocEvacuator(int nbytes, Part *part)
 {
   CacheVC *c = new_CacheVC(part);
   ProxyMutex *mutex = part->mutex;
@@ -393,7 +394,7 @@
 }
 
 int
-CacheVC::evacuateReadHead(int event, Event * e)
+CacheVC::evacuateReadHead(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
@@ -461,7 +462,7 @@
 }
 
 int
-CacheVC::evacuateDocDone(int event, Event * e)
+CacheVC::evacuateDocDone(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
@@ -557,8 +558,8 @@
   return free_CacheVC(this);
 }
 
-int
-evacuate_fragments(CacheKey * key, CacheKey * earliest_key, int force, Part * part)
+static int
+evacuate_fragments(CacheKey *key, CacheKey *earliest_key, int force, Part *part)
 {
   Dir dir, *last_collision = 0;
   int i = 0;
@@ -585,7 +586,7 @@
       b->evac_frags.link.next = evac_frag;
     }
     if (force)
-      b->f.readers = 0;
+      b->readers = 0;
     Debug("cache_evac",
           "next fragment %X Earliest: %X offset %d phase %d force %d",
           (int) key->word(0), (int) earliest_key->word(0), (int) dir_offset(&dir), (int) dir_phase(&dir), force);
@@ -594,7 +595,7 @@
 }
 
 int
-Part::evacuateWrite(CacheVC * evacuator, int event, Event * e)
+Part::evacuateWrite(CacheVC *evacuator, int event, Event *e)
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
@@ -614,7 +615,7 @@
 }
 
 int
-Part::evacuateDocReadDone(int event, Event * e)
+Part::evacuateDocReadDone(int event, Event *e)
 {
   NOWARN_UNUSED(e);
 
@@ -644,7 +645,7 @@
   }
   if (!b)
     goto Ldone;
-  if ((b->f.pinned && !b->f.readers) && doc->pinned < (inku32) (ink_get_based_hrtime() / HRTIME_SECOND))
+  if ((b->f.pinned && !b->readers) && doc->pinned < (inku32) (ink_get_based_hrtime() / HRTIME_SECOND))
     goto Ldone;
 
   if (dir_head(&b->dir) && b->f.evacuate_head) {
@@ -656,6 +657,7 @@
       b->evac_frags.key = doc->first_key;
       Debug("cache_evac", "evacuating vector %X offset %d",
             (int) doc->first_key.word(0), (int) dir_offset(&doc_evacuator->overwrite_dir));
+      b->f.unused = 57;
     } else {
       // if its an earliest fragment (alternate) evacuation, things get
       // a little tricky. We have to propagate the earliest key to the next
@@ -669,17 +671,21 @@
       Debug("cache_evac", "evacuating earliest %X %X evac: %X offset: %d",
             (int) b->evac_frags.key.word(0), (int) doc->key.word(0),
             doc_evacuator, (int) dir_offset(&doc_evacuator->overwrite_dir));
+      b->f.unused = 67;
     }
   } else {
     // find which key matches the document
     EvacuationKey *ek = &b->evac_frags;
     for (; ek && !(ek->key == doc->key); ek = ek->link.next);
-    if (!ek)
+    if (!ek) {
+      b->f.unused = 77;
       goto Ldone;
+    }
     doc_evacuator->key = ek->key;
     doc_evacuator->earliest_key = ek->earliest_key;
     Debug("cache_evac", "evacuateDocReadDone key: %X earliest: %X",
           (int) ek->key.word(0), (int) ek->earliest_key.word(0));
+    b->f.unused = 87;
   }
   // if the tag in the c->dir does match the first_key in the
   // document, then it has to be the earliest fragment. We gaurantee that
@@ -687,7 +693,7 @@
   // Cache::open_write).
   if (!dir_head(&b->dir) || !dir_compare_tag(&b->dir, &doc->first_key)) {
     next_CacheKey(&next_key, &doc->key);
-    evacuate_fragments(&next_key, &doc_evacuator->earliest_key, !b->f.readers, this);
+    evacuate_fragments(&next_key, &doc_evacuator->earliest_key, !b->readers, this);
   }
   return evacuateWrite(doc_evacuator, event, e);
 Ldone:
@@ -709,7 +715,7 @@
     EvacuationBlock *first = 0;
     int first_offset = INT_MAX;
     for (; b; b = b->link.next) {
-      int offset = dir_offset(&b->dir);
+      ink64 offset = dir_offset(&b->dir);
       int phase = dir_phase(&b->dir);
       if (offset >= s && offset < e && !b->f.done && phase == evac_phase)
         if (offset < first_offset) {
@@ -730,7 +736,7 @@
       io.aiocb.aio_buf = doc_evacuator->buf->data();
       io.action = this;
       io.thread = AIO_CALLBACK_THREAD_ANY;
-      Debug("cache_evac", "evac_range evacuating %X %d", (int) dir_tag(&first->dir), (int) dir_offset(&first->dir));
+      Debug("cache_evac", "evac_range evacuating %X %d", (int)dir_tag(&first->dir), (int)dir_offset(&first->dir));
       SET_HANDLER(&Part::evacuateDocReadDone);
       ink_assert(ink_aio_read(&io) >= 0);
       return -1;
@@ -741,7 +747,7 @@
 
 
 static int
-agg_copy(char *p, CacheVC * vc)
+agg_copy(char *p, CacheVC *vc)
 {
   Part *part = vc->part;
   ink_off_t o = part->header->write_pos + part->agg_buf_pos;
@@ -911,10 +917,10 @@
 void
 Part::evacuate_cleanup()
 {
-  int eo = ((header->write_pos - start) / INK_BLOCK_SIZE) + 1;
-  int e = dir_offset_evac_bucket(eo);
-  int sx = e - (evacuate_size / PIN_SCAN_EVERY) - 1;
-  int s = sx;
+  ink64 eo = ((header->write_pos - start) / INK_BLOCK_SIZE) + 1;
+  ink64 e = dir_offset_evac_bucket(eo);
+  ink64 sx = e - (evacuate_size / PIN_SCAN_EVERY) - 1;
+  ink64 s = sx;
   int i;
 
   if (e > evacuate_size)
@@ -969,13 +975,13 @@
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
+  ink_assert(!is_io_in_progress());
 
   Que(CacheVC, link) tocall;
   CacheVC *c;
 
   cancel_trigger();
 
-  ink_assert(!is_io_in_progress());
 Lagain:
   // calculate length of aggregated write
   for (c = (CacheVC *) agg.head; c;) {
@@ -1019,9 +1025,6 @@
     goto Lagain;
   }
 
-  // set write limit
-  header->agg_pos = header->write_pos + agg_buf_pos;
-
   // evacuate space
   ink_off_t end = header->write_pos + agg_buf_pos + EVACUATION_SIZE;
   if (evac_range(header->write_pos, end, !header->phase) < 0)
@@ -1035,6 +1038,9 @@
   if (agg_buf_pos < AGG_HIGH_WATER && !agg.head && !dir_sync_waiting)
     goto Lwait;
 
+  // set write limit
+  header->agg_pos = header->write_pos + agg_buf_pos;
+
   io.aiocb.aio_fildes = fd;
   io.aiocb.aio_offset = header->write_pos;
   io.aiocb.aio_buf = agg_buffer;
@@ -1061,7 +1067,7 @@
 }
 
 int
-CacheVC::openWriteCloseDir(int event, Event * e)
+CacheVC::openWriteCloseDir(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
@@ -1110,7 +1116,7 @@
 }
 
 int
-CacheVC::openWriteCloseHeadDone(int event, Event * e)
+CacheVC::openWriteCloseHeadDone(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   {
@@ -1155,14 +1161,14 @@
 }
 
 int
-CacheVC::openWriteCloseHead(int event, Event * e)
+CacheVC::openWriteCloseHead(int event, Event *e)
 {
   NOWARN_UNUSED(e);
 
   cancel_trigger();
   f.use_first_key = 1;
   if (io.ok())
-    ink_assert(fragment || (length == total_len));
+    ink_assert(fragment || (length == (ink64)total_len));
   else
     return openWriteCloseDir(event, e);
   if (f.data_done)
@@ -1183,7 +1189,7 @@
 }
 
 int
-CacheVC::openWriteCloseDataDone(int event, Event * e)
+CacheVC::openWriteCloseDataDone(int event, Event *e)
 {
   NOWARN_UNUSED(e);
 
@@ -1207,7 +1213,7 @@
 }
 
 int
-CacheVC::openWriteClose(int event, Event * e)
+CacheVC::openWriteClose(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   cancel_trigger();
@@ -1244,7 +1250,7 @@
 }
 
 int
-CacheVC::openWriteWriteDone(int event, Event * e)
+CacheVC::openWriteWriteDone(int event, Event *e)
 {
   NOWARN_UNUSED(e);
 
@@ -1291,7 +1297,7 @@
     write_pos += write_len;
     dir_insert(&key, part, &dir);
     Debug("cache_insert", "WriteDone: %X, %X, %d", key.word(0), first_key.word(0), write_len);
-    blocks = iobufferblock_skip(blocks, &offset, (int*)&length, write_len);
+    blocks = iobufferblock_skip(blocks, &offset, &length, write_len);
     next_CacheKey(&key, &key);
   }
   if (closed)
@@ -1301,7 +1307,7 @@
 }
 
 int
-CacheVC::openWriteMain(int event, Event * e)
+CacheVC::openWriteMain(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
@@ -1367,7 +1373,7 @@
 
 // begin overwrite
 int
-CacheVC::openWriteOverwrite(int event, Event * e)
+CacheVC::openWriteOverwrite(int event, Event *e)
 {
   NOWARN_UNUSED(e);
 
@@ -1414,7 +1420,7 @@
 // openWriteStartDone handles vector read (addition of alternates)
 // and lock misses
 int
-CacheVC::openWriteStartDone(int event, Event * e)
+CacheVC::openWriteStartDone(int event, Event *e)
 {
   NOWARN_UNUSED(e);
 
@@ -1532,7 +1538,7 @@
 #endif
 // handle lock failures from main Cache::open_write entry points below
 int
-CacheVC::openWriteStartBegin(int event, Event * e)
+CacheVC::openWriteStartBegin(int event, Event *e)
 {
   NOWARN_UNUSED(e);
   NOWARN_UNUSED(event);
@@ -1565,7 +1571,7 @@
 
 // main entry point for writing of of non-http documents
 Action *
-Cache::open_write(Continuation * cont, CacheKey * key, CacheFragType frag_type,
+Cache::open_write(Continuation *cont, CacheKey *key, CacheFragType frag_type,
                   bool overwrite, time_t apin_in_cache, char *hostname, int host_len)
 {
 
@@ -1631,8 +1637,8 @@
 #ifdef HTTP_CACHE
 // main entry point for writing of http documents
 Action *
-Cache::open_write(Continuation * cont, CacheKey * key, CacheHTTPInfo * info, time_t apin_in_cache,
-                  CacheKey * key1, CacheFragType type, char *hostname, int host_len)
+Cache::open_write(Continuation *cont, CacheKey *key, CacheHTTPInfo *info, time_t apin_in_cache,
+                  CacheKey *key1, CacheFragType type, char *hostname, int host_len)
 {
   NOWARN_UNUSED(key1);
 

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/I_Cache.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/I_Cache.h?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/I_Cache.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/I_Cache.h Thu Jan  7 20:48:43 2010
@@ -124,8 +124,9 @@
 
 struct CacheVConnection:public VConnection
 {
-  VIO *do_io_read(Continuation * c, int nbytes, MIOBuffer * buf) = 0;
-  VIO *do_io_write(Continuation * c, int nbytes, IOBufferReader * buf, bool owner = false) = 0;
+  VIO *do_io_read(Continuation * c, ink64 nbytes, MIOBuffer * buf) = 0;
+  virtual VIO *do_io_pread(Continuation *c, ink64 nbytes, MIOBuffer *buf, ink64 offset) = 0;
+  VIO *do_io_write(Continuation * c, ink64 nbytes, IOBufferReader * buf, bool owner = false) = 0;
   void do_io_close(int lerrno = -1) = 0;
   void reenable(VIO * avio) = 0;
   void reenable_re(VIO * avio) = 0;
@@ -137,8 +138,6 @@
 
   virtual int get_header(void **ptr, int *len) = 0;
   virtual int set_header(void *ptr, int len) = 0;
-  // do_io_pread() may only be issued once in response to CACHE_EVENT_OPEN_READ
-  virtual VIO *do_io_pread(Continuation *c, ink64 nbytes, MIOBuffer *buf, ink_off_t off) = 0;
 
 #ifdef HTTP_CACHE
   virtual void set_http_info(CacheHTTPInfo * info) = 0;

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.cc?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.cc Thu Jan  7 20:48:43 2010
@@ -122,7 +122,7 @@
 
 //----------------------------------------------------------------------------
 VIO *
-NewCacheVC::do_io_read(Continuation * c, int nbytes, MIOBuffer * buf)
+NewCacheVC::do_io_read(Continuation * c, ink64 nbytes, MIOBuffer * buf)
 {
   Debug("cache_plugin", "[NewCacheVC::do_io_read] this=%lX c=%lX nbytes=%d", (long) this, (long) c, nbytes);
   switch (_state) {
@@ -176,7 +176,7 @@
 
 //----------------------------------------------------------------------------
 VIO *
-NewCacheVC::do_io_write(Continuation * c, int nbytes, IOBufferReader * buf, bool owner)
+NewCacheVC::do_io_write(Continuation * c, ink64 nbytes, IOBufferReader * buf, bool owner)
 {
   Debug("cache_plugin", "[NewCacheVC::do_io_write] this=%lX c=%lX", (long) this, (long) c);
 

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.h?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.h Thu Jan  7 20:48:43 2010
@@ -69,8 +69,8 @@
   // static method to allocate a new cache vc
   static NewCacheVC *alloc(Continuation * cont, URL * url, HttpCacheSM * sm);
   void setWriteVC(CacheHTTPInfo * old_info);
-  VIO *do_io_read(Continuation * c, int nbytes, MIOBuffer * buf);
-  VIO *do_io_write(Continuation * c, int nbytes, IOBufferReader * buf, bool owner = false);
+  VIO *do_io_read(Continuation * c, ink64 nbytes, MIOBuffer * buf);
+  VIO *do_io_write(Continuation * c, ink64 nbytes, IOBufferReader * buf, bool owner = false);
   void do_io_close(int lerrno = -1);
 
   void reenable(VIO * vio);
@@ -126,7 +126,7 @@
     ink_assert(!"implemented");
     return -1;
   }
-  VIO *do_io_pread(Continuation *c, ink64 nbytes, MIOBuffer *buf, ink_off_t off) {
+  VIO *do_io_pread(Continuation *c, ink64 nbytes, MIOBuffer *buf, ink64 offset) {
     ink_assert(!"implemented");
     return 0;
   }

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CacheDir.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CacheDir.h?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CacheDir.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CacheDir.h Thu Jan  7 20:48:43 2010
@@ -161,7 +161,7 @@
 
 #define dir_bit(_e, _w, _b) (((_e)->w[_w] >> (_b)) & 1)
 #define dir_set_bit(_e, _w, _b, _v) (_e)->w[_w] = (inku16)(((_e)->w[_w] & ~(1<<(_b))) | (((_v)?1:0)<<(_b)))
-#define dir_offset(_e) ((ink_off_t)                                     \
+#define dir_offset(_e) ((ink64)                                         \
                          (((inku64)(_e)->w[0]) |                        \
                           (((inku64)((_e)->w[1] & 0xFF)) << 16) |       \
                           (((inku64)(_e)->w[4]) << 24)))

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CacheInternal.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CacheInternal.h?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CacheInternal.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CacheInternal.h Thu Jan  7 20:48:43 2010
@@ -33,6 +33,8 @@
 #include "inktomi++.h"
 #include "api/include/InkAPI.h"
 
+class EvacuationBlock;
+
 // Compilation Options
 
 //#define HIT_EVACUATE                    1
@@ -220,9 +222,9 @@
 {
   CacheVC();
 
-  VIO *do_io_read(Continuation * c, int nbytes, MIOBuffer * buf);
-  VIO *do_io_pread(Continuation *c, ink64 nbytes, MIOBuffer *buf, ink_off_t off);
-  VIO *do_io_write(Continuation * c, int nbytes, IOBufferReader * buf, bool owner = false);
+  VIO *do_io_read(Continuation * c, ink64 nbytes, MIOBuffer * buf);
+  VIO *do_io_pread(Continuation *c, ink64 nbytes, MIOBuffer *buf, ink64 offset);
+  VIO *do_io_write(Continuation * c, ink64 nbytes, IOBufferReader * buf, bool owner = false);
   void do_io_close(int lerrno = -1);
   void reenable(VIO * avio);
   void reenable_re(VIO * avio);
@@ -406,23 +408,24 @@
   int base_stat;
   int recursive;
   int closed;
-  inku32 docpos;                // read position in 'buf'
-  int offset;                   // offset into 'blocks' of data to write
-  inku64 length;                // length of data available to write
+  ink64 seek_to;                // pread offset
+  ink64 offset;                 // offset into 'blocks' of data to write
+  ink64 writer_offset;          // offset of the writer for reading from a writer
+  ink64 length;                 // length of data available to write
+  ink64 doc_pos;                // read position in 'buf'
   inku64 write_pos;             // length written
   inku64 total_len;             // total length written and available to write
-  inku64 doc_len;
+  inku64 doc_len;               // total_length (of the selected alternate for HTTP)
   inku64 update_len;
-  inku64 seek_to;
   int fragment;
   int scan_msec_delay;
-  int writer_offset;
   CacheVC *write_vc;
   char *hostname;
   int host_len;
   int header_to_write_len;  
   void *header_to_write;
   short writer_lock_retry;
+
   union
   {
     inku32 flags;
@@ -579,7 +582,7 @@
 inline int
 CacheVC::do_read_call(CacheKey * akey)
 {
-  docpos = 0;
+  doc_pos = 0;
   read_key = akey;
   io.aiocb.aio_nbytes = dir_approx_size(&dir);
   PUSH_HANDLER(&CacheVC::handleRead);

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CachePart.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CachePart.h?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CachePart.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/P_CachePart.h Thu Jan  7 20:48:43 2010
@@ -110,19 +110,19 @@
     unsigned int init;
     struct
     {
-      unsigned int readers:16;  // normal readers
-      unsigned int done:1;      // has been evacuated
-      unsigned int pinned:1;    // check pinning timeout
+      unsigned int done:1;              // has been evacuated
+      unsigned int pinned:1;            // check pinning timeout
       unsigned int evacuate_head:1;     // check pinning timeout
-      unsigned int unused:13;
+      unsigned int unused:29;
     } f;
   };
+  int readers;
   Dir dir;
   Dir new_dir;
   // we need to have a list of evacuationkeys because of collision.
   EvacuationKey evac_frags;
   CacheVC *earliest_evacuator;
-    Link<EvacuationBlock> link;
+  Link<EvacuationBlock> link;
 };
 
 struct Part:public Continuation
@@ -451,6 +451,7 @@
 {
   EvacuationBlock *b = THREAD_ALLOC(evacuationBlockAllocator, t);
   b->init = 0;
+  b->readers = 0;
   b->earliest_evacuator = 0;
   b->evac_frags.link.next = 0;
   return b;

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/RamCache.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/RamCache.cc?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/RamCache.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/RamCache.cc Thu Jan  7 20:48:43 2010
@@ -247,7 +247,7 @@
       for (int j = 0; j < partition_size; j++) {
         RamCacheEntry *e = partition[i].bucket[j].head;
         while (e) {
-          printf("\t\t%9d %9d\n", e->data->_size_index, e->data->block_size());
+          printf("\t\t%9d %9d\n", (int)e->data->_size_index, (int)e->data->block_size());
           total += e->data->block_size();
           n++;
           e = e->hash_link.next;
@@ -260,7 +260,7 @@
       {
         RamCacheEntry *e = partition[i].lru.head;
         while (e) {
-          printf("\t\t%9d %9d\n", e->data->_size_index, e->data->block_size());
+          printf("\t\t%9d %9d\n", (int)e->data->_size_index, (int)e->data->block_size());
           total += e->data->block_size();
           n++;
           e = e->lru_link.next;

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterHandlerBase.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterHandlerBase.cc?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterHandlerBase.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterHandlerBase.cc Thu Jan  7 20:48:43 2010
@@ -1316,8 +1316,8 @@
         printf("ch[%d] vc=0x%p remote_free=%d last_local_free=%d\n", i, vc,
                vc->remote_free, vc->last_local_free);
         printf("  r_bytes=%d r_done=%d w_bytes=%d w_done=%d\n",
-               vc->read.vio.nbytes, vc->read.vio.ndone,
-               vc->write.vio.nbytes, vc->write.vio.ndone);
+               (int)vc->read.vio.nbytes, (int)vc->read.vio.ndone,
+               (int)vc->write.vio.nbytes, (int)vc->write.vio.ndone);
       }
     }
   }

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterVConnection.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterVConnection.cc?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterVConnection.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterVConnection.cc Thu Jan  7 20:48:43 2010
@@ -70,7 +70,7 @@
 #endif
 
 VIO *
-ClusterVConnectionBase::do_io_read(Continuation * acont, int anbytes, MIOBuffer * abuffer)
+ClusterVConnectionBase::do_io_read(Continuation * acont, ink64 anbytes, MIOBuffer * abuffer)
 {
   ink_assert(!closed);
   read.vio.buffer.writer_for(abuffer);
@@ -87,7 +87,7 @@
 }
 
 VIO *
-ClusterVConnectionBase::do_io_pread(Continuation * acont, ink64 anbytes, MIOBuffer * abuffer, ink_off_t off)
+ClusterVConnectionBase::do_io_pread(Continuation * acont, ink64 anbytes, MIOBuffer * abuffer, ink64 off)
 {
   ink_assert(!"implemented");
   return 0;
@@ -108,7 +108,7 @@
 }
 
 VIO *
-ClusterVConnectionBase::do_io_write(Continuation * acont, int anbytes, IOBufferReader * abuffer, bool owner)
+ClusterVConnectionBase::do_io_write(Continuation * acont, ink64 anbytes, IOBufferReader * abuffer, bool owner)
 {
   ink_assert(!closed);
   ink_assert(!owner);

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cluster/P_ClusterCache.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cluster/P_ClusterCache.h?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cluster/P_ClusterCache.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cluster/P_ClusterCache.h Thu Jan  7 20:48:43 2010
@@ -371,15 +371,15 @@
   //                creation callback.
   //
 
-  virtual VIO *do_io_read(Continuation * c, int nbytes, MIOBuffer * buf);
-  virtual VIO *do_io_write(Continuation * c, int nbytes, IOBufferReader * buf, bool owner = false);
+  virtual VIO *do_io_read(Continuation * c, ink64 nbytes, MIOBuffer * buf);
+  virtual VIO *do_io_write(Continuation * c, ink64 nbytes, IOBufferReader * buf, bool owner = false);
   virtual void do_io_shutdown(ShutdownHowTo_t howto)
   {
     (void) howto;
     ink_assert(!"shutdown of cluster connection");
   }
   virtual void do_io_close(int lerrno = -1);
-  virtual VIO* do_io_pread(Continuation*, ink64, MIOBuffer*, ink_off_t);
+  virtual VIO* do_io_pread(Continuation*, ink64, MIOBuffer*, ink64);
 
   // Set the timeouts associated with this connection.
   // active_timeout is for the total elasped time of the connection.

Modified: incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/IOBuffer.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/IOBuffer.cc?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/IOBuffer.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/IOBuffer.cc Thu Jan  7 20:48:43 2010
@@ -36,9 +36,9 @@
 inkcoreapi ClassAllocator<MIOBuffer> ioAllocator("ioAllocator", DEFAULT_BUFFER_NUMBER);
 inkcoreapi ClassAllocator<IOBufferData> ioDataAllocator("ioDataAllocator", DEFAULT_BUFFER_NUMBER);
 inkcoreapi ClassAllocator<IOBufferBlock> ioBlockAllocator("ioBlockAllocator", DEFAULT_BUFFER_NUMBER);
-int default_large_iobuffer_size = DEFAULT_LARGE_BUFFER_SIZE;
-int default_small_iobuffer_size = DEFAULT_SMALL_BUFFER_SIZE;
-int max_iobuffer_size = DEFAULT_BUFFER_SIZES - 1;
+ink64 default_large_iobuffer_size = DEFAULT_LARGE_BUFFER_SIZE;
+ink64 default_small_iobuffer_size = DEFAULT_SMALL_BUFFER_SIZE;
+ink64 max_iobuffer_size = DEFAULT_BUFFER_SIZES - 1;
 
 //
 // Initialization
@@ -49,8 +49,8 @@
   char *name;
 
   for (int i = 0; i < DEFAULT_BUFFER_SIZES; i++) {
-    int s = DEFAULT_BUFFER_BASE_SIZE * (1 << i);
-    int a = DEFAULT_BUFFER_ALIGNMENT;
+    ink64 s = DEFAULT_BUFFER_BASE_SIZE * (((ink64)1) << i);
+    ink64 a = DEFAULT_BUFFER_ALIGNMENT;
     int n = i <= default_large_iobuffer_size ? DEFAULT_BUFFER_NUMBER : DEFAULT_HUGE_BUFFER_NUMBER;
     if (s < a)
       a = s;
@@ -61,10 +61,10 @@
   }
 }
 
-int
+ink64
 MIOBuffer::remove_append(IOBufferReader * r)
 {
-  int l = 0;
+  ink64 l = 0;
   while (r->block) {
     Ptr<IOBufferBlock> b = r->block;
     r->block = r->block->next;
@@ -81,15 +81,15 @@
   return l;
 }
 
-int
-MIOBuffer::write(const void *abuf, int alen)
+ink64
+MIOBuffer::write(const void *abuf, ink64 alen)
 {
   const char *buf = (const char*)abuf;
-  int len = alen;
+  ink64 len = alen;
   while (len) {
     if (!_writer)
       add_block();
-    int f = _writer->write_avail();
+    ink64 f = _writer->write_avail();
     f = f < len ? f : len;
     if (f > 0) {
       ::memcpy(_writer->end(), buf, f);
@@ -115,10 +115,10 @@
    * and this space becomes available to the copy.
    *
    */
-int
-MIOBuffer::write_and_transfer_left_over_space(IOBufferReader * r, int alen, int offset)
+ink64
+MIOBuffer::write_and_transfer_left_over_space(IOBufferReader * r, ink64 alen, ink64 offset)
 {
-  int rval = write(r, alen, offset);
+  ink64 rval = write(r, alen, offset);
   // reset the end markers of the original so that it cannot
   // make use of the space in the current block
   if (r->mbuf->_writer)
@@ -134,22 +134,22 @@
 #endif
 
 
-int
-MIOBuffer::write(IOBufferReader * r, int alen, int offset)
+ink64
+MIOBuffer::write(IOBufferReader * r, ink64 alen, ink64 offset)
 {
-  int len = alen;
+  ink64 len = alen;
   IOBufferBlock *b = r->block;
   offset += r->start_offset;
 
   while (b && len > 0) {
-    int max_bytes = b->read_avail();
+    ink64 max_bytes = b->read_avail();
     max_bytes -= offset;
     if (max_bytes <= 0) {
       offset = -max_bytes;
       b = b->next;
       continue;
     }
-    int bytes;
+    ink64 bytes;
     if (len<0 || len>= max_bytes)
       bytes = max_bytes;
     else
@@ -165,8 +165,8 @@
   return alen - len;
 }
 
-int
-MIOBuffer::puts(char *s, int len)
+ink64
+MIOBuffer::puts(char *s, ink64 len)
 {
   char *pc = end();
   char *pb = s;
@@ -174,7 +174,7 @@
     if (len-- <= 0)
       return -1;
     if (!*pb || *pb == '\n') {
-      int n = (int) (pb - s);
+      ink64 n = (ink64) (pb - s);
       memcpy(end(), s, n + 1);  // Upto and including '\n'
       end()[n + 1] = 0;
       fill(n + 1);
@@ -186,16 +186,16 @@
   return 0;
 }
 
-int
-IOBufferReader::read(void *ab, int len)
+ink64
+IOBufferReader::read(void *ab, ink64 len)
 {
   char *b = (char*)ab;
-  int max_bytes = read_avail();
-  int bytes = len <= max_bytes ? len : max_bytes;
-  int n = bytes;
+  ink64 max_bytes = read_avail();
+  ink64 bytes = len <= max_bytes ? len : max_bytes;
+  ink64 n = bytes;
 
   while (n) {
-    int l = block_read_avail();
+    ink64 l = block_read_avail();
     if (n < l)
       l = n;
     ::memcpy(b, start(), l);
@@ -206,22 +206,22 @@
   return bytes;
 }
 
-int
-IOBufferReader::memchr(char c, int len, int offset)
+ink64
+IOBufferReader::memchr(char c, ink64 len, ink64 offset)
 {
   IOBufferBlock *b = block;
   offset += start_offset;
-  int o = offset;
+  ink64 o = offset;
 
   while (b && len) {
-    int max_bytes = b->read_avail();
+    ink64 max_bytes = b->read_avail();
     max_bytes -= offset;
     if (max_bytes <= 0) {
       offset = -max_bytes;
       b = b->next;
       continue;
     }
-    int bytes;
+    ink64 bytes;
     if (len<0 || len>= max_bytes)
       bytes = max_bytes;
     else
@@ -229,7 +229,7 @@
     char *s = b->start() + offset;
     char *p = (char *) ink_memchr(s, c, bytes);
     if (p)
-      return (int) (o - start_offset + p - s);
+      return (ink64) (o - start_offset + p - s);
     o += bytes;
     len -= bytes;
     b = b->next;
@@ -240,21 +240,21 @@
 }
 
 char *
-IOBufferReader::memcpy(void *ap, int len, int offset)
+IOBufferReader::memcpy(void *ap, ink64 len, ink64 offset)
 {
   char *p = (char*)ap;
   IOBufferBlock *b = block;
   offset += start_offset;
 
   while (b && len) {
-    int max_bytes = b->read_avail();
+    ink64 max_bytes = b->read_avail();
     max_bytes -= offset;
     if (max_bytes <= 0) {
       offset = -max_bytes;
       b = b->next;
       continue;
     }
-    int bytes;
+    ink64 bytes;
     if (len<0 || len>= max_bytes)
       bytes = max_bytes;
     else

Modified: incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_IOBuffer.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_IOBuffer.h?rev=897010&r1=897009&r2=897010&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_IOBuffer.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_IOBuffer.h Thu Jan  7 20:48:43 2010
@@ -50,9 +50,9 @@
 // Removing this optimization since this is breaking WMT over HTTP
 //#define WRITE_AND_TRANSFER 
 
-inkcoreapi extern int max_iobuffer_size;
-extern int default_small_iobuffer_size;
-extern int default_large_iobuffer_size; // matched to size of OS buffers
+inkcoreapi extern ink64 max_iobuffer_size;
+extern ink64 default_small_iobuffer_size;
+extern ink64 default_large_iobuffer_size; // matched to size of OS buffers
 
 #if !defined(PURIFY)
 // Define this macro to enable buffer usage tracking.
@@ -112,9 +112,9 @@
 #define BUFFER_SIZE_NOT_ALLOCATED    DEFAULT_BUFFER_SIZES
 #define BUFFER_SIZE_INDEX_IS_XMALLOCED(_size_index) (_size_index < 0)
 #define BUFFER_SIZE_INDEX_IS_FAST_ALLOCATED(_size_index) \
-  ((unsigned int)_size_index  < DEFAULT_BUFFER_SIZES)
+  (((inku64)_size_index) < DEFAULT_BUFFER_SIZES)
 #define BUFFER_SIZE_INDEX_IS_CONSTANT(_size_index) \
-  ((unsigned int)_size_index >= DEFAULT_BUFFER_SIZES)
+  (_size_index >= DEFAULT_BUFFER_SIZES)
 
 #define BUFFER_SIZE_FOR_XMALLOC(_size) (-(_size))
 #define BUFFER_SIZE_INDEX_FOR_XMALLOC_SIZE(_size) (-(_size))
@@ -179,7 +179,7 @@
     @return number of bytes allocated for the '_data' member.
 
   */
-  int block_size();
+  ink64 block_size();
 
   /**
     Frees the memory managed by this IOBufferData.  Deallocates the
@@ -199,7 +199,7 @@
     @param size_index
     @param type of allocation to use; see remarks section.
   */
-  void alloc(int size_index, AllocType type = DEFAULT_ALLOC);
+  void alloc(ink64 size_index, AllocType type = DEFAULT_ALLOC);
 
   /**
     Provides access to the allocated memory. Returns the address of the
@@ -233,7 +233,7 @@
   */
   virtual void free();
 
-  int _size_index;
+  ink64 _size_index;
 
   /**
     Type of allocation used for the managed memory. Stores the type of
@@ -340,9 +340,9 @@
     @return bytes occupied by the inuse area.
 
   */
-  int size()
+  ink64 size()
   {
-    return (int) (_end - _start);
+    return (ink64) (_end - _start);
   }
 
   /**
@@ -352,9 +352,9 @@
     @return bytes available for reading from the inuse area.
 
   */
-  int read_avail()
+  ink64 read_avail()
   {
-    return (int) (_end - _start);
+    return (ink64) (_end - _start);
   }
 
   /**
@@ -363,9 +363,9 @@
 
     @return space available for writing in this IOBufferBlock.
   */
-  int write_avail()
+  ink64 write_avail()
   {
-    return (int) (_buf_end - _end);
+    return (ink64) (_buf_end - _end);
   }
 
   /**
@@ -378,7 +378,7 @@
       IOBufferBlock.
 
   */
-  int block_size()
+  ink64 block_size()
   {
     return data->block_size();
   }
@@ -392,7 +392,7 @@
       the inuse area.
 
   */
-  void consume(int len);
+  void consume(ink64 len);
 
   /**
     Increase the inuse area of the block. Adds 'len' bytes to the inuse
@@ -404,7 +404,7 @@
       or equal to the value of write_avail().
 
   */
-  void fill(int len);
+  void fill(ink64 len);
 
   /**
     Reset the inuse area. The start and end of the inuse area are reset
@@ -443,7 +443,7 @@
     section in MIOBuffer.
 
   */
-  void alloc(int i = default_large_iobuffer_size);
+  void alloc(ink64 i = default_large_iobuffer_size);
 
   /**
     Clear the IOBufferData this IOBufferBlock handles. Clears this
@@ -465,13 +465,13 @@
       and to mark its start.
 
   */
-  void set(IOBufferData * d, int len = 0, int offset = 0);
-  void set_internal(void *b, int len, int asize_index);
-  void realloc_set_internal(void *b, int buf_size, int asize_index);
-  void realloc(void *b, int buf_size);
-  void realloc(int i);
-  void realloc_xmalloc(void *b, int buf_size);
-  void realloc_xmalloc(int buf_size);
+  void set(IOBufferData * d, ink64 len = 0, ink64 offset = 0);
+  void set_internal(void *b, ink64 len, ink64 asize_index);
+  void realloc_set_internal(void *b, ink64 buf_size, ink64 asize_index);
+  void realloc(void *b, ink64 buf_size);
+  void realloc(ink64 i);
+  void realloc_xmalloc(void *b, ink64 buf_size);
+  void realloc_xmalloc(ink64 buf_size);
 
   /**
     Frees the IOBufferBlock object and its underlying memory.
@@ -564,7 +564,7 @@
     @return bytes of data available across all the buffers.
 
   */
-  int read_avail();
+  ink64 read_avail();
 
   /**
     Number of IOBufferBlocks with data in the block list. Returns the
@@ -585,7 +585,7 @@
       buffer.
 
   */
-  int block_read_avail();
+  ink64 block_read_avail();
 
   void skip_empty_blocks();
 
@@ -616,7 +616,7 @@
       to read_avail().
 
   */
-  void consume(int n);
+  void consume(ink64 n);
 
   /**
     Create another reader with access to the same data as this
@@ -690,7 +690,7 @@
 
     @param c character to look for.
     @param len number of characters to check. If len exceeds the number
-      of bytes available on the buffer or INT_MAX is passed in, the
+      of bytes available on the buffer or INK64_MAX is passed in, the
       number of bytes available to the reader is used. It is independent
       of the offset value.
     @param offset number of the bytes to skip over before beginning
@@ -699,7 +699,7 @@
       ocurrence.
 
   */
-  inkcoreapi int memchr(char c, int len = INT_MAX, int offset = 0);
+  inkcoreapi ink64 memchr(char c, ink64 len = INK64_MAX, ink64 offset = 0);
 
   /**
     Copies and consumes data. Copies len bytes of data from the buffer
@@ -715,7 +715,7 @@
     @return number of bytes copied and consumed.
 
   */
-  inkcoreapi int read(void *buf, int len);
+  inkcoreapi ink64 read(void *buf, ink64 len);
 
   /**
     Copy data but do not consume it. Copies 'len' bytes of data from
@@ -726,7 +726,7 @@
     @param buf in which to place the data. The pointer is modified after
       the call and points one position after the end of the data copied.
     @param len bytes to copy. If len exceeds the bytes available to the
-      reader or INT_MAX is passed in, the number of bytes available is
+      reader or INK64_MAX is passed in, the number of bytes available is
       used instead. No data is consumed from the reader in this operation.
     @param offset bytes to skip from the current position. The parameter
       is modified after the call.
@@ -734,7 +734,7 @@
       parameter buf is set to this value also.
 
   */
-  inkcoreapi char *memcpy(void *buf, int len = INT_MAX, int offset = 0);
+  inkcoreapi char *memcpy(void *buf, ink64 len = INK64_MAX, ink64 offset = 0);
 
   /**
     Subscript operator. Returns a reference to the character at the
@@ -747,7 +747,7 @@
     @return reference to the character in that position.
 
   */
-  char &operator[] (int i);
+  char &operator[] (ink64 i);
 
   MIOBuffer *writer()
   {
@@ -774,10 +774,10 @@
     of the available data.
 
   */
-  int start_offset;
-  int size_limit;
+  ink64 start_offset;
+  ink64 size_limit;
 
-IOBufferReader():accessor(NULL), mbuf(NULL), start_offset(0), size_limit(MAXINT) {
+  IOBufferReader():accessor(NULL), mbuf(NULL), start_offset(0), size_limit(INK64_MAX) {
   }
 };
 
@@ -809,7 +809,7 @@
     @param len number of bytes to add to the inuse area of the block.
 
   */
-  void fill(int len);
+  void fill(ink64 len);
 
   /**
     Adds a block to the end of the block list. The block added to list
@@ -825,7 +825,7 @@
     buffer block sizes.
 
   */
-  void append_block(int asize_index);
+  void append_block(ink64 asize_index);
 
   /**
     Adds new block to the end of block list using the block size for
@@ -841,7 +841,7 @@
     by the buffer once all readers on the buffer have consumed it.
 
   */
-  void append_xmalloced(void *b, int len);
+  void append_xmalloced(void *b, ink64 len);
 
   /**
     Adds by reference len bytes of data pointed to by b to the end of the
@@ -851,7 +851,7 @@
     have consumed it.
 
   */
-  void append_fast_allocated(void *b, int len, int fast_size_index);
+  void append_fast_allocated(void *b, ink64 len, ink64 fast_size_index);
 
   /**
     Adds the nbytes worth of data pointed by rbuf to the buffer. The
@@ -860,7 +860,7 @@
     control. Returns the number of bytes added.
 
   */
-  inkcoreapi int write(const void *rbuf, int nbytes);
+  inkcoreapi ink64 write(const void *rbuf, ink64 nbytes);
 
 #ifdef WRITE_AND_TRANSFER
   /**
@@ -869,7 +869,7 @@
     this space becomes available to the copy.
 
   */
-  inkcoreapi int write_and_transfer_left_over_space(IOBufferReader * r, int len = MAXINT, int offset = 0);
+  inkcoreapi ink64 write_and_transfer_left_over_space(IOBufferReader * r, ink64 len = INK64_MAX, ink64 offset = 0);
 #endif
 
   /**
@@ -897,9 +897,9 @@
     rather than sharing blocks to prevent a build of blocks on the buffer.
 
   */
-  inkcoreapi int write(IOBufferReader * r, int len = MAXINT, int offset = 0);
+  inkcoreapi ink64 write(IOBufferReader * r, ink64 len = INK64_MAX, ink64 offset = 0);
 
-  int remove_append(IOBufferReader *);
+  ink64 remove_append(IOBufferReader *);
 
   /**
     Returns a pointer to the first writable block on the block chain.
@@ -943,7 +943,7 @@
     by first_write_block()).
 
   */
-  int block_write_avail();
+  ink64 block_write_avail();
 
   /**
     Returns the amount of space of available for writing on all writable
@@ -951,7 +951,7 @@
     block chain.
 
   */
-  int current_write_avail();
+  ink64 current_write_avail();
 
   /**
     Adds blocks for writing if the watermark criteria are met. Returns
@@ -959,19 +959,19 @@
     on the block chain after a block due to the watermark criteria.
 
   */
-  int write_avail();
+  ink64 write_avail();
 
   /**
     Returns the default data block size for this buffer.
 
   */
-  int block_size();
+  ink64 block_size();
 
   /**
     Returns the default data block size for this buffer.
 
   */
-  int total_size()
+  ink64 total_size()
   {
     return block_size();
   }
@@ -1006,7 +1006,7 @@
   {
     return current_write_avail() <= water_mark;
   }
-  void set_size_index(int size);
+  void set_size_index(ink64 size);
 
   /**
     Allocates a new IOBuffer reader and sets it's its 'accessor' field
@@ -1050,12 +1050,12 @@
   */
   void dealloc_all_readers();
 
-  void set(void *b, int len);
-  void set_xmalloced(void *b, int len);
-  void alloc(int i = default_large_iobuffer_size);
-  void alloc_xmalloc(int buf_size);
+  void set(void *b, ink64 len);
+  void set_xmalloced(void *b, ink64 len);
+  void alloc(ink64 i = default_large_iobuffer_size);
+  void alloc_xmalloc(ink64 buf_size);
   void append_block_internal(IOBufferBlock * b);
-  int puts(char *buf, int len);
+  ink64 puts(char *buf, ink64 len);
 
   // internal interface
 
@@ -1063,7 +1063,7 @@
   {
     return !_writer;
   }
-  int max_read_avail();
+  ink64 max_read_avail();
   int max_block_count();
   void check_add_block();
 
@@ -1100,24 +1100,24 @@
     water_mark = 0;
   }
 
-  void realloc(int i)
+  void realloc(ink64 i)
   {
     _writer->realloc(i);
   }
-  void realloc(void *b, int buf_size)
+  void realloc(void *b, ink64 buf_size)
   {
     _writer->realloc(b, buf_size);
   }
-  void realloc_xmalloc(void *b, int buf_size)
+  void realloc_xmalloc(void *b, ink64 buf_size)
   {
     _writer->realloc_xmalloc(b, buf_size);
   }
-  void realloc_xmalloc(int buf_size)
+  void realloc_xmalloc(ink64 buf_size)
   {
     _writer->realloc_xmalloc(buf_size);
   }
 
-  int size_index;
+  ink64 size_index;
 
   /**
     Determines when to stop writing or reading. The watermark is the
@@ -1127,7 +1127,7 @@
     no matter how small.
 
   */
-  int water_mark;
+  ink64 water_mark;
 
   // DEPRECATED
   Link<MIOBuffer> link;
@@ -1139,8 +1139,8 @@
   const char *_location;
 #endif
 
-  MIOBuffer(void *b, int bufsize, int aWater_mark);
-  MIOBuffer(int default_size_index);
+  MIOBuffer(void *b, ink64 bufsize, ink64 aWater_mark);
+  MIOBuffer(ink64 default_size_index);
   MIOBuffer();
   ~MIOBuffer();
 };
@@ -1160,11 +1160,11 @@
     return mbuf;
   }
 
-  int block_size()
+  ink64 block_size()
   {
     return mbuf->block_size();
   }
-  int total_size()
+  ink64 total_size()
   {
     return block_size();
   }
@@ -1206,7 +1206,7 @@
 #ifdef TRACK_BUFFER_USER
                                                const char *loc,
 #endif
-                                               int size_index = default_large_iobuffer_size);
+                                               ink64 size_index = default_large_iobuffer_size);
 
 #ifdef TRACK_BUFFER_USER
 class MIOBuffer_tracker
@@ -1217,7 +1217,7 @@
     MIOBuffer_tracker(const char *_loc):loc(_loc)
   {
   }
-  MIOBuffer *operator() (int size_index = default_large_iobuffer_size) {
+  MIOBuffer *operator() (ink64 size_index = default_large_iobuffer_size) {
     return new_MIOBuffer_internal(loc, size_index);
   }
 
@@ -1228,7 +1228,7 @@
 #ifdef TRACK_BUFFER_USER
                                                      const char *loc,
 #endif
-                                                     int size_index = default_large_iobuffer_size);
+                                                     ink64 size_index = default_large_iobuffer_size);
 
 #ifdef TRACK_BUFFER_USER
 class Empty_MIOBuffer_tracker
@@ -1239,7 +1239,7 @@
     Empty_MIOBuffer_tracker(const char *_loc):loc(_loc)
   {
   }
-  MIOBuffer *operator() (int size_index = default_large_iobuffer_size) {
+  MIOBuffer *operator() (ink64 size_index = default_large_iobuffer_size) {
     return new_empty_MIOBuffer_internal(loc, size_index);
   }
 };
@@ -1265,7 +1265,7 @@
 #ifdef TRACK_BUFFER_USER
                                                        const char *loc,
 #endif
-                                                       IOBufferData * d, int len = 0, int offset = 0);
+                                                       IOBufferData * d, ink64 len = 0, ink64 offset = 0);
 
 #ifdef TRACK_BUFFER_USER
 class IOBufferBlock_tracker
@@ -1280,7 +1280,7 @@
   {
     return new_IOBufferBlock_internal(loc);
   }
-  IOBufferBlock *operator() (IOBufferData * d, int len = 0, int offset = 0) {
+  IOBufferBlock *operator() (IOBufferData * d, ink64 len = 0, ink64 offset = 0) {
     return new_IOBufferBlock_internal(loc, d, len, offset);
   }
 
@@ -1299,20 +1299,20 @@
 #ifdef TRACK_BUFFER_USER
                                                     const char *location,
 #endif
-                                                    int size_index = default_large_iobuffer_size,
+                                                    ink64 size_index = default_large_iobuffer_size,
                                                     AllocType type = DEFAULT_ALLOC);
 
 inline IOBufferData *new_xmalloc_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
                                                             const char *location,
 #endif
-                                                            void *b, int size);
+                                                            void *b, ink64 size);
 
 inline IOBufferData *new_constant_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
                                                              const char *loc,
 #endif
-                                                             void *b, int size);
+                                                             void *b, ink64 size);
 
 
 #ifdef TRACK_BUFFER_USER
@@ -1324,7 +1324,7 @@
     IOBufferData_tracker(const char *_loc):loc(_loc)
   {
   }
-  IOBufferData *operator() (int size_index = default_large_iobuffer_size, AllocType type = DEFAULT_ALLOC) {
+  IOBufferData *operator() (ink64 size_index = default_large_iobuffer_size, AllocType type = DEFAULT_ALLOC) {
     return new_IOBufferData_internal(loc, size_index, type);
   }
 
@@ -1345,8 +1345,8 @@
 #define  new_constant_IOBufferData new_constant_IOBufferData_internal
 #endif
 
-inline int iobuffer_size_to_index(unsigned int size, int max = max_iobuffer_size);
-inline int index_to_buffer_size(int idx);
+inline ink64 iobuffer_size_to_index(ink64 size, ink64 max = max_iobuffer_size);
+inline ink64 index_to_buffer_size(ink64 idx);
 /**
   Clone a IOBufferBlock chain. Used to snarf a IOBufferBlock chain
   w/o copy.
@@ -1357,7 +1357,7 @@
   @return ptr to head of new IOBufferBlock chain.
 
 */
-inline IOBufferBlock *iobufferblock_clone(IOBufferBlock * b, int offset, int len);
+inline IOBufferBlock *iobufferblock_clone(IOBufferBlock * b, ink64 offset, ink64 len);
 /**
   Skip over specified bytes in chain. Used for dropping references.
 
@@ -1369,5 +1369,5 @@
   @return ptr to head of new IOBufferBlock chain.
 
 */
-inline IOBufferBlock *iobufferblock_skip(IOBufferBlock * b, int *poffset, int *plen, int write);
+inline IOBufferBlock *iobufferblock_skip(IOBufferBlock * b, ink64 *poffset, ink64 *plen, ink64 write);
 #endif



Mime
View raw message