callback function arguments.
/*
- * $Id: access_log.cc,v 1.50 1999/04/23 02:57:16 wessels Exp $
+ * $Id: access_log.cc,v 1.51 1999/05/26 17:07:56 wessels Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
{
assert(fname);
xstrncpy(LogfileName, fname, SQUID_MAXPATHLEN);
- LogfileFD = file_open(LogfileName, O_WRONLY | O_CREAT, NULL, NULL, NULL);
+ LogfileFD = file_open(LogfileName, O_WRONLY | O_CREAT);
if (LogfileFD == DISK_ERROR) {
debug(50, 0) ("%s: %s\n", LogfileName, xstrerror());
fatalf("Cannot open %s: %s", LogfileName, xstrerror());
rename(fname, to);
}
/* Reopen the log. It may have been renamed "manually" */
- LogfileFD = file_open(fname, O_WRONLY | O_CREAT, NULL, NULL, NULL);
+ LogfileFD = file_open(fname, O_WRONLY | O_CREAT);
if (LogfileFD == DISK_ERROR) {
debug(46, 0) ("accessLogRotate: Cannot open logfile: %s\n", fname);
LogfileStatus = LOG_DISABLE;
/*
- * $Id: disk.cc,v 1.145 1999/05/04 19:22:24 wessels Exp $
+ * $Id: disk.cc,v 1.146 1999/05/26 17:07:57 wessels Exp $
*
* DEBUG: section 6 Disk I/O Routines
* AUTHOR: Harvest Derived
#include "squid.h"
-#define DISK_LINE_LEN 1024
-
-typedef struct open_ctrl_t {
- FOCB *callback;
- void *callback_data;
- char *path;
-} open_ctrl_t;
-
static PF diskHandleRead;
static PF diskHandleWrite;
+#if defined(_SQUID_MSWIN_) || defined(_SQUID_OS2_)
+static int
+diskWriteIsComplete(int fd)
+{
+ return fd_table[fd].disk.write_q ? 0 : 1;
+}
+#endif
+
void
disk_init(void)
{
(void) 0;
}
-/* Open a disk file. Return a file descriptor */
+/*
+ * opens a disk file specified by 'path'. This function always
+ * blocks! There is no callback.
+ */
int
-file_open(const char *path, int mode, FOCB * callback, void *callback_data, void *tag)
+file_open(const char *path, int mode)
{
int fd;
if (mode & O_WRONLY)
mode |= O_APPEND;
mode |= SQUID_NONBLOCK;
- /* Open file */
errno = 0;
fd = open(path, mode, 0644);
Counter.syscalls.disk.opens++;
commSetCloseOnExec(fd);
fd_open(fd, FD_FILE, path);
}
- if (callback)
- callback(callback_data, fd, errno);
return fd;
}
cbdataLock(client_data);
diskHandleRead(fd, ctrl_dat);
}
-
-int
-diskWriteIsComplete(int fd)
-{
- return fd_table[fd].disk.write_q ? 0 : 1;
-}
/*
- * $Id: errorpage.cc,v 1.149 1999/04/23 02:57:21 wessels Exp $
+ * $Id: errorpage.cc,v 1.150 1999/05/26 17:07:58 wessels Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
char *text;
snprintf(path, sizeof(path), "%s/%s", dir, page_name);
- fd = file_open(path, O_RDONLY, NULL, NULL, NULL);
+ fd = file_open(path, O_RDONLY);
if (fd < 0 || fstat(fd, &sb) < 0) {
debug(4, 0) ("errorTryLoadText: '%s': %s\n", path, xstrerror());
if (fd >= 0)
/*
- * $Id: mime.cc,v 1.88 1999/05/26 04:57:46 wessels Exp $
+ * $Id: mime.cc,v 1.89 1999/05/26 17:07:59 wessels Exp $
*
* DEBUG: section 25 MIME Parsing
* AUTHOR: Harvest Derived
if (storeGetPublic(url, METHOD_GET))
return;
snprintf(path, MAXPATHLEN, "%s/%s", Config.icons.directory, icon);
- fd = file_open(path, O_RDONLY, NULL, NULL, NULL);
+ fd = file_open(path, O_RDONLY);
if (fd < 0) {
debug(25, 0) ("mimeLoadIconFile: %s: %s\n", path, xstrerror());
return;
/*
- * $Id: protos.h,v 1.334 1999/05/26 06:48:06 wessels Exp $
+ * $Id: protos.h,v 1.335 1999/05/26 17:08:00 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm);
-extern int file_open(const char *path, int mode, FOCB *, void *callback_data, void *tag);
+extern int file_open(const char *path, int mode);
extern void file_close(int fd);
extern void file_write(int, off_t, void *, int len, DWCB *, void *, FREE *);
extern void file_write_mbuf(int fd, off_t, MemBuf mb, DWCB * handler, void *handler_data);
extern void file_read(int, char *, int, off_t, DRCB *, void *);
extern void disk_init(void);
-extern int diskWriteIsComplete(int);
extern void dnsShutdown(void);
extern void dnsInit(void);
/*
- * $Id: send-announce.cc,v 1.55 1998/12/05 00:54:38 wessels Exp $
+ * $Id: send-announce.cc,v 1.56 1999/05/26 17:08:02 wessels Exp $
*
* DEBUG: section 27 Cache Announcer
* AUTHOR: Duane Wessels
strcat(sndbuf, tbuf);
l = strlen(sndbuf);
if ((file = Config.Announce.file) != NULL) {
- fd = file_open(file, O_RDONLY, NULL, NULL, NULL);
+ fd = file_open(file, O_RDONLY);
if (fd > -1 && (n = read(fd, sndbuf + l, BUFSIZ - l - 1)) > 0) {
fd_bytes(fd, n, FD_READ);
l += n;
/*
- * $Id: store_log.cc,v 1.6 1998/07/22 20:54:02 wessels Exp $
+ * $Id: store_log.cc,v 1.7 1999/05/26 17:08:04 wessels Exp $
*
* DEBUG: section 20 Storage Manager Logging Functions
* AUTHOR: Duane Wessels
snprintf(to, MAXPATHLEN, "%s.%d", fname, 0);
rename(fname, to);
}
- storelog_fd = file_open(fname, O_WRONLY | O_CREAT, NULL, NULL, NULL);
+ storelog_fd = file_open(fname, O_WRONLY | O_CREAT);
if (storelog_fd < 0) {
debug(50, 0) ("storeLogRotate: %s: %s\n", fname, xstrerror());
debug(20, 1) ("Store logging disabled\n");
if (strcmp(Config.Log.store, "none") == 0)
storelog_fd = -1;
else
- storelog_fd = file_open(Config.Log.store,
- O_WRONLY | O_CREAT,
- NULL,
- NULL,
- NULL);
+ storelog_fd = file_open(Config.Log.store, O_WRONLY | O_CREAT);
if (storelog_fd < 0)
debug(20, 1) ("Store logging disabled\n");
}
/*
- * $Id: tools.cc,v 1.180 1999/05/25 06:53:53 wessels Exp $
+ * $Id: tools.cc,v 1.181 1999/05/26 17:08:05 wessels Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
return;
enter_suid();
old_umask = umask(022);
- fd = file_open(f, O_WRONLY | O_CREAT | O_TRUNC, NULL, NULL, NULL);
+ fd = file_open(f, O_WRONLY | O_CREAT | O_TRUNC);
umask(old_umask);
leave_suid();
if (fd < 0) {
/*
- * $Id: useragent.cc,v 1.16 1999/01/29 18:31:18 wessels Exp $
+ * $Id: useragent.cc,v 1.17 1999/05/26 17:08:06 wessels Exp $
*
* DEBUG: section 40 User-Agent logging
* AUTHOR: Joe Ramey <ramey@csc.ti.com>
cache_useragent_log = NULL;
}
if (fname && strcmp(fname, "none") != 0) {
- log_fd = file_open(fname, O_WRONLY | O_CREAT | O_APPEND, NULL, NULL, NULL);
+ log_fd = file_open(fname, O_WRONLY | O_CREAT | O_APPEND);
if (log_fd < 0) {
debug(50, 0) ("useragentOpenLog: %s: %s\n", fname, xstrerror());
} else if ((cache_useragent_log = fdopen(log_fd, "a")) == NULL) {