From: hno <> Date: Wed, 26 Jun 2002 15:55:56 +0000 (+0000) Subject: Patch by Guido to convert some more of the code to use FD_READ/WRITE_METHOD. X-Git-Tag: SQUID_3_0_PRE1~944 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d0ef8ea81f97ee213456b76d7c0ffae29d0cf00d;p=thirdparty%2Fsquid.git Patch by Guido to convert some more of the code to use FD_READ/WRITE_METHOD. Simplifies the WIN32 porting. --- diff --git a/src/fs/aufs/store_dir_aufs.cc b/src/fs/aufs/store_dir_aufs.cc index 0af80c1437..b2eba3b24c 100644 --- a/src/fs/aufs/store_dir_aufs.cc +++ b/src/fs/aufs/store_dir_aufs.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.45 2002/05/19 16:40:56 hno Exp $ + * $Id: store_dir_aufs.cc,v 1.46 2002/06/26 09:55:57 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -417,7 +417,7 @@ storeAufsDirRebuildFromDirectory(void *data) rb->sd->path, rb->counts.scancount); debug(20, 9) ("file_in: fd=%d %08X\n", fd, filn); statCounter.syscalls.disk.reads++; - if (read(fd, hdr_buf, SM_PAGE_SIZE) < 0) { + if (FD_READ_METHOD(fd, hdr_buf, SM_PAGE_SIZE) < 0) { debug(20, 1) ("storeAufsDirRebuildFromDirectory: read(FD %d): %s\n", fd, xstrerror()); file_close(fd); @@ -1017,7 +1017,7 @@ storeAufsDirWriteCleanEntry(SwapDir * sd, const StoreEntry * e) state->outbuf_offset += ss; /* buffered write */ if (state->outbuf_offset + ss > CLEAN_BUF_SZ) { - if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) { + if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) { debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n", state->new, xstrerror()); debug(20, 0) ("storeDirWriteCleanLogs: Current swap logfile not replaced.\n"); @@ -1043,7 +1043,7 @@ storeAufsDirWriteCleanDone(SwapDir * sd) if (state->fd < 0) return; state->walker->Done(state->walker); - if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) { + if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) { debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n", state->new, xstrerror()); debug(20, 0) ("storeDirWriteCleanLogs: Current swap logfile " diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index 15927dc462..12aae0ca56 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.34 2002/05/19 16:40:57 hno Exp $ + * $Id: store_dir_coss.cc,v 1.35 2002/06/26 09:55:57 hno Exp $ * * DEBUG: section 81 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -548,7 +548,7 @@ storeCossDirWriteCleanEntry(SwapDir * sd, const StoreEntry * e) state->outbuf_offset += ss; /* buffered write */ if (state->outbuf_offset + ss > CLEAN_BUF_SZ) { - if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) { + if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) { debug(50, 0) ("storeCossDirWriteCleanLogs: %s: write: %s\n", state->new, xstrerror()); debug(20, 0) ("storeCossDirWriteCleanLogs: Current swap logfile not replaced.\n"); @@ -573,7 +573,7 @@ storeCossDirWriteCleanDone(SwapDir * sd) return; if (state->fd < 0) return; - if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) { + if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) { debug(50, 0) ("storeCossDirWriteCleanLogs: %s: write: %s\n", state->new, xstrerror()); debug(20, 0) ("storeCossDirWriteCleanLogs: Current swap logfile " diff --git a/src/fs/coss/store_io_coss.cc b/src/fs/coss/store_io_coss.cc index 81e0d0d277..6c4c2f4176 100644 --- a/src/fs/coss/store_io_coss.cc +++ b/src/fs/coss/store_io_coss.cc @@ -1,6 +1,6 @@ /* - * $Id: store_io_coss.cc,v 1.14 2002/04/13 23:07:56 hno Exp $ + * $Id: store_io_coss.cc,v 1.15 2002/06/26 09:55:57 hno Exp $ * * DEBUG: section 81 Storage Manager COSS Interface * AUTHOR: Eric Stern @@ -465,7 +465,7 @@ storeCossSync(SwapDir * SD) sleep(5); /* XXX EEEWWW! */ lseek(cs->fd, t->diskstart, SEEK_SET); end = (t == cs->current_membuf) ? cs->current_offset : t->diskend; - write(cs->fd, t->buffer, end - t->diskstart); + FD_WRITE_METHOD(cs->fd, t->buffer, end - t->diskstart); } } diff --git a/src/fs/diskd/store_dir_diskd.cc b/src/fs/diskd/store_dir_diskd.cc index f8c29b5f67..a9f875cf89 100644 --- a/src/fs/diskd/store_dir_diskd.cc +++ b/src/fs/diskd/store_dir_diskd.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.66 2002/05/19 16:40:59 hno Exp $ + * $Id: store_dir_diskd.cc,v 1.67 2002/06/26 09:55:58 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -579,7 +579,7 @@ storeDiskdDirRebuildFromDirectory(void *data) rb->sd->path, rb->counts.scancount); debug(20, 9) ("file_in: fd=%d %08X\n", fd, filn); statCounter.syscalls.disk.reads++; - if (read(fd, hdr_buf, SM_PAGE_SIZE) < 0) { + if (FD_READ_METHOD(fd, hdr_buf, SM_PAGE_SIZE) < 0) { debug(20, 1) ("storeDiskdDirRebuildFromDirectory: read(FD %d): %s\n", fd, xstrerror()); file_close(fd); @@ -1206,7 +1206,7 @@ storeDiskdDirWriteCleanEntry(SwapDir * sd, const StoreEntry * e) state->outbuf_offset += ss; /* buffered write */ if (state->outbuf_offset + ss > CLEAN_BUF_SZ) { - if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) { + if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) { debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n", state->new, xstrerror()); debug(20, 0) ("storeDirWriteCleanLogs: Current swap logfile not replaced.\n"); @@ -1231,7 +1231,7 @@ storeDiskdDirWriteCleanDone(SwapDir * sd) if (state->fd < 0) return; state->walker->Done(state->walker); - if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) { + if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) { debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n", state->new, xstrerror()); debug(20, 0) ("storeDirWriteCleanLogs: Current swap logfile " diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index 61122f5f6d..ca884a792b 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.44 2002/05/19 16:41:01 hno Exp $ + * $Id: store_dir_ufs.cc,v 1.45 2002/06/26 09:55:59 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -416,7 +416,7 @@ storeUfsDirRebuildFromDirectory(void *data) rb->sd->path, rb->counts.scancount); debug(20, 9) ("file_in: fd=%d %08X\n", fd, filn); statCounter.syscalls.disk.reads++; - if (read(fd, hdr_buf, SM_PAGE_SIZE) < 0) { + if (FD_READ_METHOD(fd, hdr_buf, SM_PAGE_SIZE) < 0) { debug(20, 1) ("storeUfsDirRebuildFromDirectory: read(FD %d): %s\n", fd, xstrerror()); file_close(fd); @@ -1015,7 +1015,7 @@ storeUfsDirWriteCleanEntry(SwapDir * sd, const StoreEntry * e) state->outbuf_offset += ss; /* buffered write */ if (state->outbuf_offset + ss > CLEAN_BUF_SZ) { - if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) { + if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) { debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n", state->new, xstrerror()); debug(20, 0) ("storeDirWriteCleanLogs: Current swap logfile not replaced.\n"); @@ -1041,7 +1041,7 @@ storeUfsDirWriteCleanDone(SwapDir * sd) if (state->fd < 0) return; state->walker->Done(state->walker); - if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) { + if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) { debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n", state->new, xstrerror()); debug(20, 0) ("storeDirWriteCleanLogs: Current swap logfile " diff --git a/src/logfile.cc b/src/logfile.cc index 973fe7ef37..99ebc440f8 100644 --- a/src/logfile.cc +++ b/src/logfile.cc @@ -1,5 +1,5 @@ /* - * $Id: logfile.cc,v 1.10 2002/04/06 20:48:44 hno Exp $ + * $Id: logfile.cc,v 1.11 2002/06/26 09:55:56 hno Exp $ * * DEBUG: section 50 Log file handling * AUTHOR: Duane Wessels @@ -180,7 +180,7 @@ static void logfileWriteWrapper(Logfile * lf, const void *buf, size_t len) { int s; - s = write(lf->fd, buf, len); + s = FD_WRITE_METHOD(lf->fd, buf, len); fd_bytes(lf->fd, s, FD_WRITE); if (s == len) return; diff --git a/src/net_db.cc b/src/net_db.cc index 6e3a453d8b..9cf02024d8 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.161 2002/04/17 21:53:26 hno Exp $ + * $Id: net_db.cc,v 1.162 2002/06/26 09:55:56 hno Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -459,7 +459,7 @@ netdbReloadState(void) return; } t = buf = xcalloc(1, sb.st_size + 1); - l = read(fd, buf, sb.st_size); + l = FD_READ_METHOD(fd, buf, sb.st_size); file_close(fd); if (l <= 0) return;