---------------------
PatchSet 4181 
Date: 2002/06/02 19:26:57
Author: serassio
Branch: nt-2_5
Tag: (none) 
Log:
Merged store changes from nt branch

Members: 
	port/win32/include/squid-mswin.h:1.1.2.9->1.1.2.10 
	src/disk.c:1.8.22.2->1.8.22.3 
	src/errorpage.c:1.15.6.1.4.2->1.15.6.1.4.3 
	src/fd.c:1.7.16.5->1.7.16.6 
	src/logfile.c:1.5.46.1->1.5.46.2 
	src/net_db.c:1.11->1.11.28.1 
	src/store_dir.c:1.19.14.4->1.19.14.5 
	src/store_io.c:1.3.14.2->1.3.14.3 
	src/structs.h:1.48.6.8->1.48.6.9 
	src/unlinkd.c:1.6.10.6->1.6.10.7 
	src/win32.c:1.5.14.7->1.5.14.8 
	src/fs/awin32/aiops.c:1.1.62.3->1.1.62.4 
	src/fs/awin32/store_dir_aufs.c:1.1.62.6->1.1.62.7 
	src/fs/awin32/store_io_aufs.c:1.1.62.5->1.1.62.6 
	src/fs/ufs/store_dir_ufs.c:1.21.6.1.4.7->1.21.6.1.4.8 
	src/fs/ufs/store_io_ufs.c:1.7->1.7.14.1 

Index: squid/port/win32/include/squid-mswin.h
===================================================================
RCS file: /cvsroot/squid-sf//squid/port/win32/include/Attic/squid-mswin.h,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -r1.1.2.9 -r1.1.2.10
--- squid/port/win32/include/squid-mswin.h	20 May 2002 18:55:30 -0000	1.1.2.9
+++ squid/port/win32/include/squid-mswin.h	2 Jun 2002 19:26:57 -0000	1.1.2.10
@@ -1,5 +1,5 @@
 /*
- * $Id: squid-mswin.h,v 1.1.2.9 2002/05/20 18:55:30 serassio Exp $
+ * $Id: squid-mswin.h,v 1.1.2.10 2002/06/02 19:26:57 serassio Exp $
  *
  * AUTHOR: Guido Serassio & Andrey Shorin
  *
@@ -71,14 +71,23 @@
 #define unlink _unlink
 #define vsnprintf _vsnprintf
 
-#define O_RDONLY _O_RDONLY
-#define O_BINARY _O_BINARY
-#define O_WRONLY _O_WRONLY
-#define O_APPEND _O_APPEND
-#define O_TRUNC _O_TRUNC
-#define O_CREAT _O_CREAT
-#define O_TEXT _O_TEXT
-#define O_RDWR _O_RDWR
+#define O_RDONLY        _O_RDONLY
+#define O_WRONLY        _O_WRONLY
+#define O_RDWR          _O_RDWR
+#define O_APPEND        _O_APPEND
+
+#define O_CREAT         _O_CREAT
+#define O_TRUNC         _O_TRUNC
+#define O_EXCL          _O_EXCL
+
+#define O_TEXT          _O_TEXT
+#define O_BINARY        _O_BINARY
+#define O_RAW           _O_BINARY
+#define O_TEMPORARY     _O_TEMPORARY
+#define O_NOINHERIT     _O_NOINHERIT
+#define O_SEQUENTIAL    _O_SEQUENTIAL
+#define O_RANDOM        _O_RANDOM
+#define O_NDELAY	0
 
 #define S_IRWXO 007
 #define	S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR)
@@ -309,7 +318,7 @@
 	(errno = WSAGetLastError()), -1 : 0)
 #endif /* !UNICODE */
 
-#if defined(UTIL_C) || defined (STORE_DIR_C) || defined (STORE_IO_C)  || defined (AIOPS_C)
+#if defined(UTIL_C)
 #define read       _read
 #define write      _write
 #else
Index: squid/src/disk.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/disk.c,v
retrieving revision 1.8.22.2
retrieving revision 1.8.22.3
diff -u -r1.8.22.2 -r1.8.22.3
--- squid/src/disk.c	7 Apr 2002 13:10:25 -0000	1.8.22.2
+++ squid/src/disk.c	2 Jun 2002 19:26:57 -0000	1.8.22.3
@@ -1,6 +1,6 @@
 
 /*
- * $Id: disk.c,v 1.8.22.2 2002/04/07 13:10:25 serassio Exp $
+ * $Id: disk.c,v 1.8.22.3 2002/06/02 19:26:57 serassio Exp $
  *
  * DEBUG: section 6     Disk I/O Routines
  * AUTHOR: Harvest Derived
@@ -60,39 +60,20 @@
 file_open(const char *path, int mode)
 {
     int fd;
-#ifdef _SQUID_MSWIN_ 
-    char fmode[4]="";
-    FILE * fbuf;
-#endif
     if (mode & O_WRONLY)
 	mode |= O_APPEND;
 #ifdef _SQUID_MSWIN_ 
     mode |= _O_BINARY;
-    errno = 0;
-    if (mode & O_WRONLY) {
-	if (mode & O_TRUNC)
-	    strcpy(fmode,"wb");
-	else
-    	    strcpy(fmode,"a+b");
-	}
-	else
-	    strcpy(fmode,"rb");
-    fbuf = fopen(path,fmode);
-    fd = (fbuf != NULL) ? fileno(fbuf) : -1;
-#else
+#endif
     mode |= SQUID_NONBLOCK;
     errno = 0;
     fd = open(path, mode, 0644);
-#endif
     statCounter.syscalls.disk.opens++;
     if (fd < 0) {
 	debug(50, 3) ("file_open: error opening file %s: %s\n", path,
 	    xstrerror());
 	fd = DISK_ERROR;
     } else {
-#ifdef _SQUID_MSWIN_ 
-	fd_table[fd].fbuf=fbuf;
-#endif
 	debug(6, 5) ("file_open: FD %d\n", fd);
 	commSetCloseOnExec(fd);
 	fd_open(fd, FD_FILE, path);
@@ -105,9 +86,6 @@
 void
 file_close(int fd)
 {
-#ifdef _SQUID_MSWIN_
-    FILE *fbuf;
-#endif
     fde *F = &fd_table[fd];
     PF *read_callback;
     assert(fd >= 0);
@@ -139,15 +117,7 @@
 #if CALL_FSYNC_BEFORE_CLOSE
     fsync(fd);
 #endif
-#ifdef _SQUID_MSWIN_
-    fbuf = fd_table[fd].fbuf;
-    if (fbuf == NULL)
-	close(fd);
-    else 
-	fclose(fbuf);
-#else
     close(fd);
-#endif
     debug(6, F->flags.close_request ? 2 : 5)
 	("file_close: FD %d, really closing\n", fd);
     fd_close(fd);
Index: squid/src/errorpage.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/errorpage.c,v
retrieving revision 1.15.6.1.4.2
retrieving revision 1.15.6.1.4.3
diff -u -r1.15.6.1.4.2 -r1.15.6.1.4.3
--- squid/src/errorpage.c	16 Apr 2002 19:40:37 -0000	1.15.6.1.4.2
+++ squid/src/errorpage.c	2 Jun 2002 19:26:57 -0000	1.15.6.1.4.3
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.c,v 1.15.6.1.4.2 2002/04/16 19:40:37 serassio Exp $
+ * $Id: errorpage.c,v 1.15.6.1.4.3 2002/06/02 19:26:57 serassio Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
@@ -176,8 +176,8 @@
 	    file_close(fd);
 	return NULL;
     }
-    text = xcalloc(sb.st_size + 2 + 1, 1);	/* 2 == space for %S */
-    if (FD_READ_METHOD(fd, text, sb.st_size) != sb.st_size) {
+    text = xcalloc((size_t) sb.st_size + 2 + 1, 1);	/* 2 == space for %S */
+    if (FD_READ_METHOD(fd, text, (size_t) sb.st_size) != sb.st_size) {
 	debug(4, 0) ("errorTryLoadText: failed to fully read: '%s': %s\n",
 	    path, xstrerror());
 	xfree(text);
Index: squid/src/fd.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/fd.c,v
retrieving revision 1.7.16.5
retrieving revision 1.7.16.6
diff -u -r1.7.16.5 -r1.7.16.6
--- squid/src/fd.c	9 Apr 2002 19:04:42 -0000	1.7.16.5
+++ squid/src/fd.c	2 Jun 2002 19:26:57 -0000	1.7.16.6
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fd.c,v 1.7.16.5 2002/04/09 19:04:42 serassio Exp $
+ * $Id: fd.c,v 1.7.16.6 2002/06/02 19:26:57 serassio Exp $
  *
  * DEBUG: section 51    Filedescriptor Functions
  * AUTHOR: Duane Wessels
@@ -109,12 +109,7 @@
 int
 file_read_method(int fd, char *buf, int len)
 {
-    FILE *fbuf = fd_table[fd].fbuf;
-
-    if (fbuf == NULL)
-	return (read(fd, buf, len));
-    else
-	return (fread(buf, 1, len, fbuf));
+    return (_read(fd, buf, len));
 }
 
 int
@@ -125,12 +120,7 @@
 
 file_write_method(int fd, const char *buf, int len)
 {
-    FILE *fbuf = fd_table[fd].fbuf;
-
-    if (fbuf == NULL)
-	return (write(fd, buf, len));
-    else
-	return (fwrite(buf, 1, len, fbuf));
+    return (_write(fd, buf, len));
 }
 #endif
 
Index: squid/src/logfile.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/logfile.c,v
retrieving revision 1.5.46.1
retrieving revision 1.5.46.2
diff -u -r1.5.46.1 -r1.5.46.2
--- squid/src/logfile.c	7 Apr 2002 13:23:40 -0000	1.5.46.1
+++ squid/src/logfile.c	2 Jun 2002 19:26:57 -0000	1.5.46.2
@@ -180,7 +180,7 @@
 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;
Index: squid/src/net_db.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/net_db.c,v
retrieving revision 1.11
retrieving revision 1.11.28.1
diff -u -r1.11 -r1.11.28.1
--- squid/src/net_db.c	13 Jun 2001 07:20:56 -0000	1.11
+++ squid/src/net_db.c	2 Jun 2002 19:26:57 -0000	1.11.28.1
@@ -1,6 +1,6 @@
 
 /*
- * $Id: net_db.c,v 1.11 2001/06/13 07:20:56 squidadm Exp $
+ * $Id: net_db.c,v 1.11.28.1 2002/06/02 19:26:57 serassio Exp $
  *
  * DEBUG: section 38    Network Measurement Database
  * AUTHOR: Duane Wessels
@@ -442,8 +442,8 @@
 	file_close(fd);
 	return;
     }
-    t = buf = xcalloc(1, sb.st_size + 1);
-    l = read(fd, buf, sb.st_size);
+    t = buf = xcalloc(1, (size_t) sb.st_size + 1);
+    l = FD_READ_METHOD(fd, buf, (size_t) sb.st_size);
     file_close(fd);
     if (l <= 0)
 	return;
Index: squid/src/store_dir.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/store_dir.c,v
retrieving revision 1.19.14.4
retrieving revision 1.19.14.5
diff -u -r1.19.14.4 -r1.19.14.5
--- squid/src/store_dir.c	8 Apr 2002 17:06:10 -0000	1.19.14.4
+++ squid/src/store_dir.c	2 Jun 2002 19:26:57 -0000	1.19.14.5
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir.c,v 1.19.14.4 2002/04/08 17:06:10 serassio Exp $
+ * $Id: store_dir.c,v 1.19.14.5 2002/06/02 19:26:57 serassio Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -33,8 +33,6 @@
  *
  */
 
-#ifndef STORE_DIR_C
-#define STORE_DIR_C
 #include "squid.h"
 
 #if HAVE_STATVFS
@@ -276,7 +274,7 @@
 	e->swap_dirn,
 	e->swap_filen);
     sd = &Config.cacheSwap.swapDirs[e->swap_dirn];
-    sd->log.write(sd, e, op);
+    (sd->log.write)(sd, e, op);
 }
 
 void
@@ -434,7 +432,7 @@
 		continue;
 	    if (EBIT_TEST(e->flags, ENTRY_SPECIAL))
 		continue;
-	    sd->log.clean.write(sd, e);
+	    (sd->log.clean.write)(sd, e);
 	    if ((++n & 0xFFFF) == 0) {
 		getCurrentTime();
 		debug(20, 1) ("  %7d entries written so far.\n", n);
@@ -553,4 +551,3 @@
 #endif
     return 0;
 }
-#endif
Index: squid/src/store_io.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/store_io.c,v
retrieving revision 1.3.14.2
retrieving revision 1.3.14.3
diff -u -r1.3.14.2 -r1.3.14.3
--- squid/src/store_io.c	27 Mar 2002 21:01:18 -0000	1.3.14.2
+++ squid/src/store_io.c	2 Jun 2002 19:26:57 -0000	1.3.14.3
@@ -1,5 +1,3 @@
-#ifndef STORE_IO_C
-#define STORE_IO_C
 #include "squid.h"
 
 static struct {
@@ -81,14 +79,14 @@
 storeRead(storeIOState * sio, char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data)
 {
     SwapDir *SD = &Config.cacheSwap.swapDirs[sio->swap_dirn];
-    SD->obj.read(SD, sio, buf, size, offset, callback, callback_data);
+    (SD->obj.read)(SD, sio, buf, size, offset, callback, callback_data);
 }
 
 void
 storeWrite(storeIOState * sio, char *buf, size_t size, off_t offset, FREE * free_func)
 {
     SwapDir *SD = &Config.cacheSwap.swapDirs[sio->swap_dirn];
-    SD->obj.write(SD, sio, buf, size, offset, free_func);
+    (SD->obj.write)(SD, sio, buf, size, offset, free_func);
 }
 
 void
@@ -117,4 +115,3 @@
     storeAppendPrintf(sentry, "create.create_fail %d\n", store_io_stats.create.create_fail);
     storeAppendPrintf(sentry, "create.success %d\n", store_io_stats.create.success);
 }
-#endif
Index: squid/src/structs.h
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/structs.h,v
retrieving revision 1.48.6.8
retrieving revision 1.48.6.9
diff -u -r1.48.6.8 -r1.48.6.9
--- squid/src/structs.h	30 Apr 2002 08:19:09 -0000	1.48.6.8
+++ squid/src/structs.h	2 Jun 2002 19:26:58 -0000	1.48.6.9
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.48.6.8 2002/04/30 08:19:09 serassio Exp $
+ * $Id: structs.h,v 1.48.6.9 2002/06/02 19:26:58 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -749,9 +749,6 @@
     unsigned int type;
     u_short local_port;
     u_short remote_port;
-#ifdef _SQUID_MSWIN_
-    FILE * fbuf;
-#endif
     struct in_addr local_addr;
     unsigned char tos;
     char ipaddr[16];		/* dotted decimal address of peer */
Index: squid/src/unlinkd.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/unlinkd.c,v
retrieving revision 1.6.10.6
retrieving revision 1.6.10.7
diff -u -r1.6.10.6 -r1.6.10.7
--- squid/src/unlinkd.c	27 Apr 2002 21:40:45 -0000	1.6.10.6
+++ squid/src/unlinkd.c	2 Jun 2002 19:26:58 -0000	1.6.10.7
@@ -1,6 +1,6 @@
 
 /*
- * $Id: unlinkd.c,v 1.6.10.6 2002/04/27 21:40:45 serassio Exp $
+ * $Id: unlinkd.c,v 1.6.10.7 2002/06/02 19:26:58 serassio Exp $
  *
  * DEBUG: section 12    Unlink Daemon
  * AUTHOR: Duane Wessels
@@ -238,6 +238,8 @@
     if (FD_PIPE == fd_table[unlinkd_wfd].type)
 	commUnsetNonBlocking(unlinkd_wfd);
     debug(12, 1) ("Unlinkd pipe opened on FD %d\n", unlinkd_wfd);
+#else
+    debug(12, 1) ("Unlinkd is disabled\n");
 #endif
 }
 
Index: squid/src/win32.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/win32.c,v
retrieving revision 1.5.14.7
retrieving revision 1.5.14.8
diff -u -r1.5.14.7 -r1.5.14.8
--- squid/src/win32.c	26 Apr 2002 20:27:50 -0000	1.5.14.7
+++ squid/src/win32.c	2 Jun 2002 19:26:58 -0000	1.5.14.8
@@ -28,7 +28,7 @@
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
Index: squid/src/fs/awin32/aiops.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/fs/awin32/Attic/aiops.c,v
retrieving revision 1.1.62.3
retrieving revision 1.1.62.4
diff -u -r1.1.62.3 -r1.1.62.4
--- squid/src/fs/awin32/aiops.c	19 May 2002 17:26:30 -0000	1.1.62.3
+++ squid/src/fs/awin32/aiops.c	2 Jun 2002 19:26:58 -0000	1.1.62.4
@@ -1,5 +1,5 @@
 /*
- * $Id: aiops.c,v 1.1.62.3 2002/05/19 17:26:30 serassio Exp $
+ * $Id: aiops.c,v 1.1.62.4 2002/06/02 19:26:58 serassio Exp $
  *
  * DEBUG: section 43    AIOPS
  * AUTHOR: Stewart Forster <slf@connect.com.au>
@@ -32,14 +32,10 @@
  *
  */
 
-#ifndef AIOPS_C
-#define AIOPS_C
-
 #include "squid.h"
 #include <windows.h>
 #include "store_asyncufs.h"
 
-
 #include	<stdio.h>
 #include	<sys/types.h>
 #include	<sys/stat.h>
@@ -151,7 +147,7 @@
 #define AIO_MICRO_BUFS	128
 
 static MemPool *squidaio_large_bufs = NULL;	/* 16K */
-static MemPool *squidaio_medium_bufs = NULL;		/* 8K */
+static MemPool *squidaio_medium_bufs = NULL;	/* 8K */
 static MemPool *squidaio_small_bufs = NULL;	/* 4K */
 static MemPool *squidaio_tiny_bufs = NULL;	/* 2K */
 static MemPool *squidaio_micro_bufs = NULL;	/* 128K */
@@ -749,7 +745,11 @@
 squidaio_do_read(squidaio_request_t * requestp)
 {
     lseek(requestp->fd, requestp->offset, requestp->whence);
+#ifdef _SQUID_MSWIN_
+    requestp->ret = _read(requestp->fd, requestp->tmpbufp, requestp->buflen);
+#else
     requestp->ret = read(requestp->fd, requestp->tmpbufp, requestp->buflen);
+#endif
     requestp->err = errno;
 }
 
@@ -780,7 +780,11 @@
 static void
 squidaio_do_write(squidaio_request_t * requestp)
 {
+#ifdef _SQUID_MSWIN_
+    requestp->ret = _write(requestp->fd, requestp->tmpbufp, requestp->buflen);
+#else
     requestp->ret = write(requestp->fd, requestp->tmpbufp, requestp->buflen);
+#endif
     requestp->err = errno;
 }
 
@@ -1032,4 +1036,3 @@
 	break;
     }
 }
-#endif /* IOPS_C */
Index: squid/src/fs/awin32/store_dir_aufs.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/fs/awin32/Attic/store_dir_aufs.c,v
retrieving revision 1.1.62.6
retrieving revision 1.1.62.7
diff -u -r1.1.62.6 -r1.1.62.7
--- squid/src/fs/awin32/store_dir_aufs.c	19 May 2002 17:26:30 -0000	1.1.62.6
+++ squid/src/fs/awin32/store_dir_aufs.c	2 Jun 2002 19:26:58 -0000	1.1.62.7
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_aufs.c,v 1.1.62.6 2002/05/19 17:26:30 serassio Exp $
+ * $Id: store_dir_aufs.c,v 1.1.62.7 2002/06/02 19:26:58 serassio Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -417,12 +417,7 @@
 		rb->sd->path, rb->counts.scancount);
 	debug(20, 9) ("file_in: fd=%d %08X\n", fd, filn);
 	statCounter.syscalls.disk.reads++;
-#ifdef _SQUID_MSWIN_
-	if (fread(hdr_buf, 1, SM_PAGE_SIZE, fd_table[fd].fbuf) == 0 
-	    && ferror(fd_table[fd].fbuf)) {
-#else
-	if (read(fd, hdr_buf, SM_PAGE_SIZE) < 0) {
-#endif
+	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);
@@ -917,14 +912,11 @@
     }
     aioinfo->swaplog_fd = fd;
     /* open a read-only stream of the old log */
-    fp = fopen(swaplog_path, "r");
+    fp = fopen(swaplog_path, "rb");
     if (fp == NULL) {
 	debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror());
 	fatal("Failed to open swap log for reading");
     }
-#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
-    setmode(fileno(fp), O_BINARY);
-#endif
     memset(&clean_sb, '\0', sizeof(struct stat));
     if (stat(clean_path, &clean_sb) < 0)
 	*clean_flag = 0;
@@ -962,7 +954,6 @@
 #if HAVE_FCHMOD
     struct stat sb;
 #endif
-
     sd->log.clean.write = NULL;
     sd->log.clean.state = NULL;
     state->new = xstrdup(storeAufsDirSwapLogFile(sd, ".clean"));
@@ -1026,11 +1017,7 @@
     state->outbuf_offset += ss;
     /* buffered write */
     if (state->outbuf_offset + ss > CLEAN_BUF_SZ) {
-#ifdef _SQUID_MSWIN_
-	if (fwrite(state->outbuf, 1, state->outbuf_offset, fd_table[state->fd].fbuf) < (size_t) state->outbuf_offset) {
-#else
-	if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) {
-#endif
+	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");
@@ -1049,9 +1036,6 @@
 static void
 storeAufsDirWriteCleanDone(SwapDir * sd)
 {
-#ifdef _SQUID_MSWIN_
-    FILE *fbuf;
-#endif
     int fd;
     struct _clean_state *state = sd->log.clean.state;
     if (NULL == state)
@@ -1059,13 +1043,7 @@
     if (state->fd < 0)
 	return;
     state->walker->Done(state->walker);
-#ifdef _SQUID_MSWIN_
-    fbuf=fd_table[state->fd].fbuf;
-    fwrite(state->outbuf, 1, state->outbuf_offset, fbuf);
-    if (ferror(fbuf) || feof(fbuf)){
-#else
-    if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) {
-#endif
+    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 "
@@ -1084,7 +1062,7 @@
     fd = state->fd;
     /* rename */
     if (state->fd >= 0) {
-#if defined(_SQUID_OS2_) || defined (_SQUID_CYGWIN_) || defined(_SQUID_MSWIN_)
+#if defined(_SQUID_OS2_) || defined(_SQUID_CYGWIN_) || defined(_SQUID_MSWIN_)
 	file_close(state->fd);
 	state->fd = -1;
 	if (unlink(state->cur) < 0)
@@ -1281,7 +1259,7 @@
 static int
 storeAufsDirIs(SwapDir * sd)
 {
-    if (strncmp(sd->type, "awin32", 3) == 0)
+    if (strncmp(sd->type, "awin32", 6) == 0)
 	return 1;
     return 0;
 }
Index: squid/src/fs/awin32/store_io_aufs.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/fs/awin32/Attic/store_io_aufs.c,v
retrieving revision 1.1.62.5
retrieving revision 1.1.62.6
diff -u -r1.1.62.5 -r1.1.62.6
--- squid/src/fs/awin32/store_io_aufs.c	20 May 2002 17:22:54 -0000	1.1.62.5
+++ squid/src/fs/awin32/store_io_aufs.c	2 Jun 2002 19:26:58 -0000	1.1.62.6
@@ -1,9 +1,9 @@
 
 /*
- * $Id: store_io_aufs.c,v 1.1.62.5 2002/05/20 17:22:54 serassio Exp $
+ * $Id: store_io_aufs.c,v 1.1.62.6 2002/06/02 19:26:58 serassio Exp $
  *
- * DEBUG: section 78    Storage Manager AUFS Interface
- * AUTHOR: Duane Wessels
+ * DEBUG: section 78    Storage Manager awin32 Interface
+ * AUTHOR: Robert Collins
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
Index: squid/src/fs/ufs/store_dir_ufs.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/fs/ufs/store_dir_ufs.c,v
retrieving revision 1.21.6.1.4.7
retrieving revision 1.21.6.1.4.8
diff -u -r1.21.6.1.4.7 -r1.21.6.1.4.8
--- squid/src/fs/ufs/store_dir_ufs.c	19 May 2002 17:26:31 -0000	1.21.6.1.4.7
+++ squid/src/fs/ufs/store_dir_ufs.c	2 Jun 2002 19:26:58 -0000	1.21.6.1.4.8
@@ -416,12 +416,7 @@
 		rb->sd->path, rb->counts.scancount);
 	debug(20, 9) ("file_in: fd=%d %08X\n", fd, filn);
 	statCounter.syscalls.disk.reads++;
-#ifdef _SQUID_MSWIN_
-	if (fread(hdr_buf, 1, SM_PAGE_SIZE, fd_table[fd].fbuf) == 0 
-	    && ferror(fd_table[fd].fbuf)) {
-#else
-	if (read(fd, hdr_buf, SM_PAGE_SIZE) < 0) {
-#endif
+	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);
@@ -471,9 +466,9 @@
 	tmpe.hash.key = key;
 	/* check sizes */
 	if (tmpe.swap_file_sz == 0) {
-	    tmpe.swap_file_sz = sb.st_size;
+	    tmpe.swap_file_sz = (size_t) sb.st_size;
 	} else if (tmpe.swap_file_sz == sb.st_size - swap_hdr_len) {
-	    tmpe.swap_file_sz = sb.st_size;
+	    tmpe.swap_file_sz = (size_t) sb.st_size;
 	} else if (tmpe.swap_file_sz != sb.st_size) {
 	    debug(20, 1) ("storeUfsDirRebuildFromDirectory: SIZE MISMATCH %ld!=%ld\n",
 		(long int) tmpe.swap_file_sz, (long int) sb.st_size);
@@ -915,14 +910,11 @@
     }
     ufsinfo->swaplog_fd = fd;
     /* open a read-only stream of the old log */
-    fp = fopen(swaplog_path, "r");
+    fp = fopen(swaplog_path, "rb");
     if (fp == NULL) {
 	debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror());
 	fatal("Failed to open swap log for reading");
     }
-#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
-    setmode(fileno(fp), O_BINARY);
-#endif
     memset(&clean_sb, '\0', sizeof(struct stat));
     if (stat(clean_path, &clean_sb) < 0)
 	*clean_flag = 0;
@@ -1023,11 +1015,7 @@
     state->outbuf_offset += ss;
     /* buffered write */
     if (state->outbuf_offset + ss > CLEAN_BUF_SZ) {
-#ifdef _SQUID_MSWIN_
-	if (fwrite(state->outbuf, 1, state->outbuf_offset, fd_table[state->fd].fbuf) < (size_t) state->outbuf_offset) {
-#else
-	if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) {
-#endif
+	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");
@@ -1046,9 +1034,6 @@
 static void
 storeUfsDirWriteCleanDone(SwapDir * sd)
 {
-#ifdef _SQUID_MSWIN_
-    FILE *fbuf;
-#endif
     int fd;
     struct _clean_state *state = sd->log.clean.state;
     if (NULL == state)
@@ -1056,13 +1041,7 @@
     if (state->fd < 0)
 	return;
     state->walker->Done(state->walker);
-#ifdef _SQUID_MSWIN_
-    fbuf=fd_table[state->fd].fbuf;
-    fwrite(state->outbuf, 1, state->outbuf_offset, fbuf);
-    if (ferror(fbuf) || feof(fbuf)){
-#else
-    if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) {
-#endif
+    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 "
@@ -1081,7 +1060,7 @@
     fd = state->fd;
     /* rename */
     if (state->fd >= 0) {
-#if defined(_SQUID_OS2_) || defined (_SQUID_CYGWIN_) || defined (_SQUID_MSWIN_)
+#if defined(_SQUID_OS2_) || defined(_SQUID_CYGWIN_) || defined(_SQUID_MSWIN_)
 	file_close(state->fd);
 	state->fd = -1;
 	if (unlink(state->cur) < 0)
Index: squid/src/fs/ufs/store_io_ufs.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/fs/ufs/store_io_ufs.c,v
retrieving revision 1.7
retrieving revision 1.7.14.1
diff -u -r1.7 -r1.7.14.1
--- squid/src/fs/ufs/store_io_ufs.c	24 Oct 2001 09:42:16 -0000	1.7
+++ squid/src/fs/ufs/store_io_ufs.c	2 Jun 2002 19:26:58 -0000	1.7.14.1
@@ -78,7 +78,7 @@
     ((ufsstate_t *) (sio->fsstate))->flags.reading = 0;
     ((ufsstate_t *) (sio->fsstate))->flags.close_request = 0;
     if (fstat(fd, &sb) == 0)
-	sio->st_size = sb.st_size;
+	sio->st_size = (size_t) sb.st_size;
     store_open_disk_fd++;
 
     /* We should update the heap/dlink position here ! */
