/*
- * $Id: cache_cf.cc,v 1.350 2000/06/08 18:05:34 hno Exp $
+ * $Id: cache_cf.cc,v 1.351 2000/06/25 22:28:42 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
}
static void
-free_removalpolicy(RemovalPolicySettings **settings)
+free_removalpolicy(RemovalPolicySettings ** settings)
{
if (!*settings)
return;
}
static void
-parse_removalpolicy(RemovalPolicySettings **settings)
+parse_removalpolicy(RemovalPolicySettings ** settings)
{
if (*settings)
free_removalpolicy(settings);
}
static void
-dump_removalpolicy(StoreEntry * entry, const char *name, RemovalPolicySettings *settings)
+dump_removalpolicy(StoreEntry * entry, const char *name, RemovalPolicySettings * settings)
{
wordlist *args;
storeAppendPrintf(entry, "%s %s", name, settings->type);
args = args->next;
}
}
-
+
#include "cf_parser.c"
if (stat(path, &sb) < 0)
fatalf("%s: %s", path, xstrerror());
}
-
-
/*
- * $Id: ftp.cc,v 1.294 2000/05/31 10:00:24 hno Exp $
+ * $Id: ftp.cc,v 1.295 2000/06/25 22:28:42 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
comm_close(ftpState->ctrl.fd);
return;
}
-
fd = comm_accept(fd, &my_peer, &me);
if (fd < 0) {
debug(9, 1) ("ftpHandleDataAccept: comm_accept(%d): %s", fd, xstrerror());
/*
- * $Id: globals.h,v 1.92 2000/06/08 18:05:35 hno Exp $
+ * $Id: globals.h,v 1.93 2000/06/25 22:28:42 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern int store_swap_low; /* 0 */
extern int store_swap_high; /* 0 */
extern int store_pages_max; /* 0 */
-extern ssize_t store_maxobjsize; /* -1 */
+extern ssize_t store_maxobjsize; /* -1 */
extern RemovalPolicy *mem_policy;
/*
- * $Id: protos.h,v 1.371 2000/06/25 21:27:57 wessels Exp $
+ * $Id: protos.h,v 1.372 2000/06/25 22:28:43 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern void logfilePrintf(va_alist);
#endif
-/* Removal Policies */
-RemovalPolicy *
-createRemovalPolicy(RemovalPolicySettings *settings);
+/*
+ * Removal Policies
+ */
+extern RemovalPolicy *createRemovalPolicy(RemovalPolicySettings * settings);
/*
* prototypes for system functions missing from system includes
/*
- * $Id: store.cc,v 1.525 2000/06/08 18:05:36 hno Exp $
+ * $Id: store.cc,v 1.526 2000/06/25 22:28:43 wessels Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
}
static void
-storeEntryReferenced(StoreEntry *e)
+storeEntryReferenced(StoreEntry * e)
{
SwapDir *SD;
SD->refobj(SD, e);
}
/* Notify the memory cache that we're referencing this object again */
- if(e->mem_obj) {
+ if (e->mem_obj) {
if (mem_policy->Referenced)
mem_policy->Referenced(mem_policy, e, &e->mem_obj->repl);
}
}
static void
-storeEntryDereferenced(StoreEntry *e)
+storeEntryDereferenced(StoreEntry * e)
{
SwapDir *SD;
/* Notify the fs that we're not referencing this object any more */
if (e->swap_filen > -1) {
- SD = INDEXSD(e->swap_dirn);
+ SD = INDEXSD(e->swap_dirn);
if (SD->unrefobj != NULL)
SD->unrefobj(SD, e);
}
/* Notify the memory cache that we're not referencing this object any more */
- if(e->mem_obj) {
+ if (e->mem_obj) {
if (mem_policy->Dereferenced)
mem_policy->Dereferenced(mem_policy, e, &e->mem_obj->repl);
}
debug(20, 2) ("storeGetMemSpace: Starting, need %d pages\n", pages_needed);
/* XXX what to set as max_scan here? */
walker = mem_policy->PurgeInit(mem_policy, 100000);
- while((e = walker->Next(walker))) {
+ while ((e = walker->Next(walker))) {
storePurgeMem(e);
released++;
if (memInUse(MEM_STMEM_BUF) + pages_needed < store_pages_max)
/* walk each fs */
for (i = 0; i < Config.cacheSwap.n_configured; i++) {
/* call the maintain function .. */
- SD = INDEXSD(i);
+ SD = INDEXSD(i);
/* XXX FixMe: This should be done "in parallell" on the different
* cache_dirs, not one at a time.
*/
- if (SD->maintainfs != NULL)
+ if (SD->maintainfs != NULL)
SD->maintainfs(SD);
}
if (store_swap_size > Config.Swap.maxSize) {
hot_obj_count++;
} else {
if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) {
- debug(20, 4) ("storeSetMemStatus: special entry %s\n",
- mem->url);
+ debug(20, 4) ("storeSetMemStatus: special entry %s\n",
+ mem->url);
} else {
mem_policy->Remove(mem_policy, e, &mem->repl);
debug(20, 4) ("storeSetMemStatus: removed mem node %s\n",
/*
- * $Id: store_dir.cc,v 1.111 2000/06/08 18:05:36 hno Exp $
+ * $Id: store_dir.cc,v 1.112 2000/06/25 22:28:43 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
continue;
}
}
- while(notdone) {
+ while (notdone) {
notdone = 0;
for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) {
sd = &Config.cacheSwap.swapDirs[dirn];
/* Flush */
for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) {
sd = &Config.cacheSwap.swapDirs[dirn];
- sd->log.clean.done(sd);
+ sd->log.clean.done(sd);
}
if (reopen)
storeDirOpenSwapLogs();
SwapDir *SD;
static int ndir = 0;
do {
- j = 0;
- for (i = 0; i < Config.cacheSwap.n_configured; i++) {
- if (ndir >= Config.cacheSwap.n_configured)
- ndir = ndir % Config.cacheSwap.n_configured;
- SD = &Config.cacheSwap.swapDirs[ndir++];
- if (NULL == SD->callback)
- continue;
- j += SD->callback(SD);
- }
+ j = 0;
+ for (i = 0; i < Config.cacheSwap.n_configured; i++) {
+ if (ndir >= Config.cacheSwap.n_configured)
+ ndir = ndir % Config.cacheSwap.n_configured;
+ SD = &Config.cacheSwap.swapDirs[ndir++];
+ if (NULL == SD->callback)
+ continue;
+ j += SD->callback(SD);
+ }
} while (j > 0);
ndir++;
}
-
/*
- * $Id: store_log.cc,v 1.16 2000/06/08 18:05:36 hno Exp $
+ * $Id: store_log.cc,v 1.17 2000/06/25 22:28:43 wessels Exp $
*
* DEBUG: section 20 Storage Manager Logging Functions
* AUTHOR: Duane Wessels
if (EBIT_TEST(e->flags, ENTRY_DONT_LOG))
return;
if (mem != NULL) {
- if (mem->log_url == NULL) {
- debug(20, 1) ("storeLog: NULL log_url for %s\n", mem->url);
- storeMemObjectDump(mem);
- mem->log_url = xstrdup(mem->url);
- }
- reply = mem->reply;
- /*
- * XXX Ok, where should we print the dir number here?
- * Because if we print it before the swap file number, it'll break
- * the existing log format.
- */
- logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d %s %d/%d %s %s\n",
- (int) current_time.tv_sec,
- (int) current_time.tv_usec / 1000,
- storeLogTags[tag],
- e->swap_dirn,
- e->swap_filen,
- storeKeyText(e->key),
- reply->sline.status,
- (int) reply->date,
- (int) reply->last_modified,
- (int) reply->expires,
- strLen(reply->content_type) ? strBuf(reply->content_type) : "unknown",
- reply->content_length,
- (int) (mem->inmem_hi - mem->reply->hdr_sz),
- RequestMethodStr[mem->method],
- mem->log_url);
+ if (mem->log_url == NULL) {
+ debug(20, 1) ("storeLog: NULL log_url for %s\n", mem->url);
+ storeMemObjectDump(mem);
+ mem->log_url = xstrdup(mem->url);
+ }
+ reply = mem->reply;
+ /*
+ * XXX Ok, where should we print the dir number here?
+ * Because if we print it before the swap file number, it'll break
+ * the existing log format.
+ */
+ logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d %s %d/%d %s %s\n",
+ (int) current_time.tv_sec,
+ (int) current_time.tv_usec / 1000,
+ storeLogTags[tag],
+ e->swap_dirn,
+ e->swap_filen,
+ storeKeyText(e->key),
+ reply->sline.status,
+ (int) reply->date,
+ (int) reply->last_modified,
+ (int) reply->expires,
+ strLen(reply->content_type) ? strBuf(reply->content_type) : "unknown",
+ reply->content_length,
+ (int) (mem->inmem_hi - mem->reply->hdr_sz),
+ RequestMethodStr[mem->method],
+ mem->log_url);
} else {
/* no mem object. Most RELEASE cases */
logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s ? ? ? ? ?/? ?/? ? ?\n",
/*
- * $Id: store_swapout.cc,v 1.70 2000/06/02 17:30:48 wessels Exp $
+ * $Id: store_swapout.cc,v 1.71 2000/06/25 22:28:43 wessels Exp $
*
* DEBUG: section 20 Storage Manager Swapout Functions
* AUTHOR: Duane Wessels
*/
if ((on_disk = storeSwapOutObjectBytesOnDisk(mem)) - 1 < new_mem_lo)
new_mem_lo = on_disk - 1;
- if ( new_mem_lo == -1 )
- new_mem_lo = 0; /* the above might become -1 */
+ if (new_mem_lo == -1)
+ new_mem_lo = 0; /* the above might become -1 */
} else if (new_mem_lo > 0) {
/*
* Its not swap-able, and we're about to delete a chunk,
/*
- * $Id: structs.h,v 1.339 2000/06/08 18:05:36 hno Exp $
+ * $Id: structs.h,v 1.340 2000/06/25 22:28:43 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
struct _RemovalPolicy {
char *_type;
void *_data;
- void (*Free)(RemovalPolicy *policy);
- void (*Add)(RemovalPolicy *policy, StoreEntry *entry, RemovalPolicyNode *node);
- void (*Remove)(RemovalPolicy *policy, StoreEntry *entry, RemovalPolicyNode *node);
- void (*Referenced)(RemovalPolicy *policy, const StoreEntry *entry, RemovalPolicyNode *node);
- void (*Dereferenced)(RemovalPolicy *policy, const StoreEntry *entry, RemovalPolicyNode *node);
- RemovalPolicyWalker *(*WalkInit)(RemovalPolicy *policy);
- RemovalPurgeWalker *(*PurgeInit)(RemovalPolicy *policy, int max_scan);
+ void (*Free) (RemovalPolicy * policy);
+ void (*Add) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
+ void (*Remove) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
+ void (*Referenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
+ void (*Dereferenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
+ RemovalPolicyWalker *(*WalkInit) (RemovalPolicy * policy);
+ RemovalPurgeWalker *(*PurgeInit) (RemovalPolicy * policy, int max_scan);
};
struct _RemovalPolicyWalker {
RemovalPolicy *_policy;
void *_data;
- const StoreEntry *(*Next)(RemovalPolicyWalker *walker);
- void (*Done)(RemovalPolicyWalker *walker);
+ const StoreEntry *(*Next) (RemovalPolicyWalker * walker);
+ void (*Done) (RemovalPolicyWalker * walker);
};
struct _RemovalPurgeWalker {
RemovalPolicy *_policy;
void *_data;
int scanned, max_scan, locked;
- StoreEntry *(*Next)(RemovalPurgeWalker *walker);
- void (*Done)(RemovalPurgeWalker *walker);
+ StoreEntry *(*Next) (RemovalPurgeWalker * walker);
+ void (*Done) (RemovalPurgeWalker * walker);
};
/* This structure can be freed while object is purged out from memory */
size_t bufsz;
off_t offset;
};
-
/*
- * $Id: typedefs.h,v 1.104 2000/06/08 18:05:37 hno Exp $
+ * $Id: typedefs.h,v 1.105 2000/06/25 22:28:43 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
typedef struct _htcpReplyData htcpReplyData;
#endif
-typedef RemovalPolicy *REMOVALPOLICYCREATE(wordlist *args);
+typedef RemovalPolicy *REMOVALPOLICYCREATE(wordlist * args);
#endif /* _TYPEDEFS_H_ */