--------------------- PatchSet 10367 Date: 2008/01/05 10:24:22 Author: adri Branch: s27_adri Tag: (none) Log: Fix merging issues. disk clients are still busted. Members: src/store_client.c:1.25.10.5.4.5->1.25.10.5.4.6 Index: squid/src/store_client.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_client.c,v retrieving revision 1.25.10.5.4.5 retrieving revision 1.25.10.5.4.6 diff -u -r1.25.10.5.4.5 -r1.25.10.5.4.6 --- squid/src/store_client.c 5 Jan 2008 09:42:42 -0000 1.25.10.5.4.5 +++ squid/src/store_client.c 5 Jan 2008 10:24:22 -0000 1.25.10.5.4.6 @@ -1,6 +1,6 @@ /* - * $Id: store_client.c,v 1.25.10.5.4.5 2008/01/05 09:42:42 adri Exp $ + * $Id: store_client.c,v 1.25.10.5.4.6 2008/01/05 10:24:22 adri Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -190,53 +190,6 @@ sc->new_callback = callback; sc->callback_data = data; cbdataLock(sc->callback_data); -<<<<<<< store_client.c - sc->copy_buf = NULL; - sc->copy_size = size; - sc->copy_offset = copy_offset; - /* If the read is being deferred, run swapout in case this client has the - * lowest seen_offset. storeSwapOut() frees the memory and clears the - * ENTRY_DEFER_READ bit if necessary */ - if (EBIT_TEST(e->flags, ENTRY_DEFER_READ)) { - storeSwapOut(e); - } - storeClientCopy2(e, sc); -} - -void -storeClientCopy(store_client * sc, - StoreEntry * e, - squid_off_t seen_offset, - squid_off_t copy_offset, - size_t size, - char *buf, - STCB * callback, - void *data) -{ - assert(1==0); - assert(!EBIT_TEST(e->flags, ENTRY_ABORTED)); - debug(20, 3) ("storeClientCopy: %s, seen %" PRINTF_OFF_T ", want %" PRINTF_OFF_T ", size %d, cb %p, cbdata %p\n", - storeKeyText(e->hash.key), - seen_offset, - copy_offset, - (int) size, - callback, - data); - assert(sc != NULL); -#if STORE_CLIENT_LIST_DEBUG - assert(sc == storeClientListSearch(e->mem_obj, data)); -#endif - assert(sc->callback == NULL); - assert(sc->new_callback == NULL); - assert(sc->entry == e); - sc->new_callback = NULL; - sc->seen_offset = seen_offset; - sc->callback = callback; - sc->callback_data = data; - cbdataLock(sc->callback_data); - sc->copy_buf = buf; -======= ->>>>>>> 1.25.10.8 sc->copy_size = size; sc->copy_offset = copy_offset; /* If the read is being deferred, run swapout in case this client has the @@ -384,21 +337,7 @@ storeClientFileRead(store_client * sc) { MemObject *mem = sc->entry->mem_obj; -<<<<<<< store_client.c - if ((!sc->callback) && (!sc->new_callback)) { - fatal("storeClientFileRead: missing a callback!\n"); - } - assert(1==0); - - /* - * XXX We need to read into a buffer and then hand that buffer to storeClientReadHeader. - * XXX We shouldn't be reading into a reference like this. Thats such a hacky way of doing it. - * XXX This will have to be rethought! */ - - -======= assert(sc->new_callback); ->>>>>>> 1.25.10.8 assert(!sc->flags.disk_io_pending); sc->flags.disk_io_pending = 1; assert(sc->node_ref.node == NULL); /* We should never, ever have a node here; or we'd leak! */ @@ -426,38 +365,16 @@ static void storeClientReadBody(void *data, const char *buf_unused, ssize_t len) { - char *cbuf = NULL; store_client *sc = data; MemObject *mem = sc->entry->mem_obj; assert(sc->flags.disk_io_pending); sc->flags.disk_io_pending = 0; -<<<<<<< store_client.c - if ((!sc->callback) && (!sc->new_callback)) { - fatal("storeClientReadBody: missing a callback!\n"); - } - if (sc->new_callback) { - assert(sc->node_ref.node); - cbuf = MEMREF_BUF(sc->node_ref); - } else { - cbuf = sc->copy_buf; - } -======= assert(sc->new_callback); assert(sc->node_ref.node); - cbuf = sc->node_ref.node->data; ->>>>>>> 1.25.10.8 - /* XXX update how much data in that mem page is active; argh this should be done in a storage layer */ -<<<<<<< store_client.c - if (sc->new_callback) { - assert(! MEMREF_ISNULL(sc->node_ref)); - } -======= - sc->node_ref.node->len = len; ->>>>>>> 1.25.10.8 - debug(20, 3) ("storeClientReadBody: len %d\n", (int) len); + debug(20, 3) ("storeClientReadBody: len %d\n", (int) MEMREF_LEN(sc->node_ref)); if (sc->copy_offset == 0 && len > 0 && memHaveHeaders(mem) == 0) - httpReplyParse(mem->reply, cbuf, headersEnd(cbuf, len)); + httpReplyParse(mem->reply, MEMREF_BUF(sc->node_ref), headersEnd(MEMREF_BUF(sc->node_ref), MEMREF_LEN(sc->node_ref))); storeClientCallback(sc, len); } @@ -473,43 +390,26 @@ size_t copy_sz; tlv *tlv_list; tlv *t; - char *cbuf; int swap_object_ok = 1; char *new_url = NULL; char *new_store_url = NULL; assert(sc->flags.disk_io_pending); sc->flags.disk_io_pending = 0; -<<<<<<< store_client.c - if ((!sc->callback) && (!sc->new_callback)) { - fatal("storeClientReadHeader: missing a callback!\n"); - } - if (sc->new_callback) { - assert(sc->node_ref.node); - cbuf = MEMREF_BUF(sc->node_ref); - } else { - cbuf = sc->copy_buf; - } -======= assert(sc->new_callback); assert(sc->node_ref.node); - cbuf = sc->node_ref.node->data; ->>>>>>> 1.25.10.8 debug(20, 3) ("storeClientReadHeader: len %d\n", (int) len); /* XXX update how much data in that mem page is active; argh this should be done in a storage layer */ -<<<<<<< store_client.c - if (sc->new_callback) { - assert(! MEMREF_ISNULL(sc->node_ref)); - } -======= - sc->node_ref.node->len = len; ->>>>>>> 1.25.10.8 + + /* XXX this code needs to be rewritten already! */ + fatal("ARGH THIS STUFF NEEDS REWRITING\n"); + if (len < 0) { debug(20, 3) ("storeClientReadHeader: %s\n", xstrerror()); storeClientCallback(sc, len); return; } assert(len <= SM_PAGE_SIZE); - tlv_list = storeSwapMetaUnpack(cbuf, &swap_hdr_sz); + tlv_list = storeSwapMetaUnpack(MEMREF_BUF(sc->node_ref), &swap_hdr_sz); if (swap_hdr_sz > len) { /* oops, bad disk file? */ debug(20, 1) ("WARNING: swapfile header too small\n"); @@ -626,10 +526,12 @@ (int) copy_sz); debug(20, 8) ("sc %p; node_ref->node %p; buf %p; copy size %d; data size %d\n", sc, sc->node_ref.node, MEMREF_BUF(sc->node_ref), (int) copy_sz, (int) len); - xmemmove(cbuf, cbuf + swap_hdr_sz, copy_sz); +#if 0 + xmemmove(MEMREF_BUF(sc->node_ref), MEMREF_BUF(sc->node_ref) + swap_hdr_sz, copy_sz); if (sc->copy_offset == 0 && len > 0 && memHaveHeaders(mem) == 0) httpReplyParse(mem->reply, cbuf, headersEnd(cbuf, copy_sz)); +#endif storeClientCallback(sc, copy_sz); return; }