--------------------- PatchSet 1554 Date: 2005/08/21 07:38:48 Author: serassio Branch: nt Tag: (none) Log: Don't build any code section containing truncate() when USE_TRUNCATE is not defined Members: src/DiskIO/WinDiskThreads/WinDiskThreadsIOStrategy.cc:1.1.2.2->1.1.2.3 src/DiskIO/WinDiskThreads/aiops.cc:1.1.2.3->1.1.2.4 src/DiskIO/WinDiskThreads/async_io.cc:1.1.2.1->1.1.2.2 Index: squid3/src/DiskIO/WinDiskThreads/WinDiskThreadsIOStrategy.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/WinDiskThreads/Attic/WinDiskThreadsIOStrategy.cc,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid3/src/DiskIO/WinDiskThreads/WinDiskThreadsIOStrategy.cc 1 Jan 2005 20:02:07 -0000 1.1.2.2 +++ squid3/src/DiskIO/WinDiskThreads/WinDiskThreadsIOStrategy.cc 21 Aug 2005 07:38:48 -0000 1.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: WinDiskThreadsIOStrategy.cc,v 1.1.2.2 2005/01/01 20:02:07 serassio Exp $ + * $Id: WinDiskThreadsIOStrategy.cc,v 1.1.2.3 2005/08/21 07:38:48 serassio Exp $ * * DEBUG: section 79 Squid-side Disk I/O functions. * AUTHOR: Robert Collins @@ -93,8 +93,6 @@ case _AIO_OP_NONE: - case _AIO_OP_TRUNCATE: - case _AIO_OP_OPENDIR: break; @@ -114,6 +112,7 @@ ++squidaio_counts.close_finish; break; + case _AIO_OP_TRUNCATE: case _AIO_OP_UNLINK: ++squidaio_counts.unlink_finish; break; @@ -258,7 +257,7 @@ WinDiskThreadsIOStrategy::unlinkFile(char const *path) { statCounter.syscalls.disk.unlinks++; -#if USE_TRUNCATE_NOT_UNLINK +#if USE_TRUNCATE aioTruncate(path, NULL, NULL); #else Index: squid3/src/DiskIO/WinDiskThreads/aiops.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/WinDiskThreads/Attic/aiops.cc,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- squid3/src/DiskIO/WinDiskThreads/aiops.cc 25 Apr 2005 12:06:29 -0000 1.1.2.3 +++ squid3/src/DiskIO/WinDiskThreads/aiops.cc 21 Aug 2005 07:38:48 -0000 1.1.2.4 @@ -1,5 +1,5 @@ /* - * $Id: aiops.cc,v 1.1.2.3 2005/04/25 12:06:29 serassio Exp $ + * $Id: aiops.cc,v 1.1.2.4 2005/08/21 07:38:48 serassio Exp $ * * DEBUG: section 43 AIOPS * AUTHOR: Stewart Forster @@ -117,8 +117,11 @@ static void squidaio_do_write(squidaio_request_t *); static void squidaio_do_close(squidaio_request_t *); static void squidaio_do_stat(squidaio_request_t *); -static void squidaio_do_unlink(squidaio_request_t *); +#if USE_TRUNCATE static void squidaio_do_truncate(squidaio_request_t *); +#else +static void squidaio_do_unlink(squidaio_request_t *); +#endif #if AIO_OPENDIR static void *squidaio_do_opendir(squidaio_request_t *); #endif @@ -512,13 +515,17 @@ squidaio_do_close(request); break; +#if USE_TRUNCATE + case _AIO_OP_TRUNCATE: + squidaio_do_truncate(request); + break; +#else + case _AIO_OP_UNLINK: squidaio_do_unlink(request); break; - case _AIO_OP_TRUNCATE: - squidaio_do_truncate(request); - break; +#endif #if AIO_OPENDIR /* Opendir not implemented yet */ case _AIO_OP_OPENDIR: @@ -980,8 +987,9 @@ } +#if USE_TRUNCATE int -squidaio_unlink(const char *path, squidaio_result_t * resultp) +squidaio_truncate(const char *path, off_t length, squidaio_result_t * resultp) { squidaio_request_t *requestp; @@ -990,15 +998,17 @@ requestp = (squidaio_request_t *)squidaio_request_pool->alloc(); - requestp->path = squidaio_xstrdup(path); + requestp->path = (char *) squidaio_xstrdup(path); + + requestp->offset = length; requestp->resultp = resultp; - requestp->request_type = _AIO_OP_UNLINK; + requestp->request_type = _AIO_OP_TRUNCATE; requestp->cancelled = 0; - resultp->result_type = _AIO_OP_UNLINK; + resultp->result_type = _AIO_OP_TRUNCATE; squidaio_queue_request(requestp); @@ -1007,14 +1017,16 @@ static void -squidaio_do_unlink(squidaio_request_t * requestp) +squidaio_do_truncate(squidaio_request_t * requestp) { - requestp->ret = unlink(requestp->path); + requestp->ret = truncate(requestp->path, requestp->offset); requestp->err = errno; } +#else + int -squidaio_truncate(const char *path, off_t length, squidaio_result_t * resultp) +squidaio_unlink(const char *path, squidaio_result_t * resultp) { squidaio_request_t *requestp; @@ -1023,17 +1035,15 @@ requestp = (squidaio_request_t *)squidaio_request_pool->alloc(); - requestp->path = (char *) squidaio_xstrdup(path); - - requestp->offset = length; + requestp->path = squidaio_xstrdup(path); requestp->resultp = resultp; - requestp->request_type = _AIO_OP_TRUNCATE; + requestp->request_type = _AIO_OP_UNLINK; requestp->cancelled = 0; - resultp->result_type = _AIO_OP_TRUNCATE; + resultp->result_type = _AIO_OP_UNLINK; squidaio_queue_request(requestp); @@ -1042,11 +1052,12 @@ static void -squidaio_do_truncate(squidaio_request_t * requestp) +squidaio_do_unlink(squidaio_request_t * requestp) { - requestp->ret = truncate(requestp->path, requestp->offset); + requestp->ret = unlink(requestp->path); requestp->err = errno; } +#endif #if AIO_OPENDIR Index: squid3/src/DiskIO/WinDiskThreads/async_io.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/WinDiskThreads/Attic/async_io.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid3/src/DiskIO/WinDiskThreads/async_io.cc 1 Jan 2005 18:54:31 -0000 1.1.2.1 +++ squid3/src/DiskIO/WinDiskThreads/async_io.cc 21 Aug 2005 07:38:48 -0000 1.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: async_io.cc,v 1.1.2.1 2005/01/01 18:54:31 serassio Exp $ + * $Id: async_io.cc,v 1.1.2.2 2005/08/21 07:38:48 serassio Exp $ * * DEBUG: section 32 Asynchronous Disk I/O * AUTHOR: Pete Bentley @@ -210,8 +210,9 @@ return; } /* aioStat */ +#if USE_TRUNCATE void -aioUnlink(const char *path, AIOCB * callback, void *callback_data) +aioTruncate(const char *path, off_t length, AIOCB * callback, void *callback_data) { squidaio_ctrl_t *ctrlp; assert(WinDiskThreadsIOStrategy::Instance.initialised); @@ -220,14 +221,15 @@ ctrlp->fd = -2; ctrlp->done_handler = callback; ctrlp->done_handler_data = cbdataReference(callback_data); - ctrlp->operation = _AIO_UNLINK; + ctrlp->operation = _AIO_TRUNCATE; ctrlp->result.data = ctrlp; - squidaio_unlink(path, &ctrlp->result); + squidaio_truncate(path, length, &ctrlp->result); dlinkAdd(ctrlp, &ctrlp->node, &used_list); -} /* aioUnlink */ +} /* aioTruncate */ +#else void -aioTruncate(const char *path, off_t length, AIOCB * callback, void *callback_data) +aioUnlink(const char *path, AIOCB * callback, void *callback_data) { squidaio_ctrl_t *ctrlp; assert(WinDiskThreadsIOStrategy::Instance.initialised); @@ -236,11 +238,12 @@ ctrlp->fd = -2; ctrlp->done_handler = callback; ctrlp->done_handler_data = cbdataReference(callback_data); - ctrlp->operation = _AIO_TRUNCATE; + ctrlp->operation = _AIO_UNLINK; ctrlp->result.data = ctrlp; - squidaio_truncate(path, length, &ctrlp->result); + squidaio_unlink(path, &ctrlp->result); dlinkAdd(ctrlp, &ctrlp->node, &used_list); -} /* aioTruncate */ +} /* aioUnlink */ +#endif int aioQueueSize(void)