/*
- * $Id: client_side.cc,v 1.393 1998/09/14 02:33:01 wessels Exp $
+ * $Id: client_side.cc,v 1.394 1998/09/14 21:28:00 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
int
checkNegativeHit(StoreEntry * e)
{
- if (!EBIT_TEST(e->flag, ENTRY_NEGCACHED))
+ if (!e->flags.entry_negcached)
return 0;
if (e->expires <= squid_curtime)
return 0;
} else if (!done) {
debug(33, 5) ("clientWriteComplete: closing, !done\n");
comm_close(fd);
- } else if (EBIT_TEST(entry->flag, ENTRY_BAD_LENGTH)) {
+ } else if (entry->flags.entry_bad_length) {
debug(33, 5) ("clientWriteComplete: closing, ENTRY_BAD_LENGTH\n");
comm_close(fd);
} else if (http->request->flags.proxy_keepalive) {
} else if (!storeEntryValidToSend(e)) {
http->entry = NULL;
return LOG_TCP_MISS;
- } else if (EBIT_TEST(e->flag, ENTRY_SPECIAL)) {
+ } else if (e->flags.entry_special) {
/* Special entries are always hits, no matter what the client says */
http->entry = e;
return LOG_TCP_HIT;
* or IMS request.
*/
if (http->entry) {
- if (EBIT_TEST(http->entry->flag, ENTRY_SPECIAL))
+ if (http->entry->flags.entry_special)
debug(33, 0) ("clientProcessMiss: miss on a special object (%s).\n", url);
storeUnregister(http->entry, http);
storeUnlockObject(http->entry);
if (!http->request->flags.cachable)
return 1;
- if (EBIT_TEST(http->entry->flag, KEY_PRIVATE))
+ if (http->entry->flags.key_private)
return 1;
if (http->entry->mem_obj == NULL)
return 1;
/*
- * $Id: enums.h,v 1.126 1998/08/30 05:21:40 wessels Exp $
+ * $Id: enums.h,v 1.127 1998/09/14 21:28:01 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
PD_INIT_PENDING
} peer_cd_t;
-/*
- * These are for StoreEntry->flag, which is defined as a SHORT
- *
- * NOTE: These flags are written to swap.state, so think very carefully
- * about deleting or re-assigning!
- */
-enum {
- ENTRY_SPECIAL,
- ENTRY_REVALIDATE,
- DELAY_SENDING,
- RELEASE_REQUEST,
- REFRESH_REQUEST,
- ENTRY_CACHABLE,
- ENTRY_DISPATCHED,
- KEY_PRIVATE,
-#ifndef PPNR_WIP
- ENTRY_UNUSED_08,
-#else
- ENTRY_FWD_HDR_WAIT,
-#endif /* PPNR_WIP */
- ENTRY_NEGCACHED,
- ENTRY_VALIDATED,
- ENTRY_BAD_LENGTH
-};
-
enum {
HTTP_PROXYING,
HTTP_KEEPALIVE
/*
- * $Id: forward.cc,v 1.26 1998/09/01 23:31:23 wessels Exp $
+ * $Id: forward.cc,v 1.27 1998/09/14 21:28:02 wessels Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
fwdState->client_fd,
RequestMethodStr[request->method],
storeUrl(entry));
- /*assert(!EBIT_TEST(entry->flag, ENTRY_DISPATCHED)); */
+ /*assert(!entry->flags.entry_dispatched); */
assert(entry->ping_status != PING_WAITING);
assert(entry->lock_count);
- EBIT_SET(entry->flag, ENTRY_DISPATCHED);
+ entry->flags.entry_dispatched = 1;
netdbPingSite(request->host);
/*
* Assert that server_fd is set. This is to guarantee that fwdState
fwdFail(FwdState * fwdState, int err_code, http_status http_code, int xerrno)
{
#ifdef PPNR_WIP
- assert(EBIT_TEST(fwdState->entry->flag, ENTRY_FWD_HDR_WAIT));
+ assert(fwdState->entry->flags.entry_fwd_hdr_wait);
#endif /* PPNR_WIP */
debug(17, 3) ("fwdFail: %s \"%s\"\n\t%s\n",
err_type_str[err_code],
/*
- * $Id: ftp.cc,v 1.250 1998/09/04 23:04:46 wessels Exp $
+ * $Id: ftp.cc,v 1.251 1998/09/14 21:28:03 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
storeBufferFlush(e);
reply->hdr_sz = e->mem_obj->inmem_hi;
storeTimestampsSet(e);
- if (EBIT_TEST(e->flag, ENTRY_CACHABLE))
+ if (e->flags.entry_cachable)
storeSetPublicKey(e);
}
/*
- * $Id: gopher.cc,v 1.137 1998/09/04 23:04:47 wessels Exp $
+ * $Id: gopher.cc,v 1.138 1998/09/14 21:28:04 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
gopherSendComplete,
data,
memFree4K);
- if (EBIT_TEST(gopherState->entry->flag, ENTRY_CACHABLE))
+ if (gopherState->entry->flags.entry_cachable)
storeSetPublicKey(gopherState->entry); /* Make it public */
}
/*
- * $Id: http.cc,v 1.316 1998/09/10 19:48:55 wessels Exp $
+ * $Id: http.cc,v 1.317 1998/09/14 21:28:05 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
static void
httpMakePublic(StoreEntry * entry)
{
- if (EBIT_TEST(entry->flag, ENTRY_CACHABLE))
+ if (entry->flags.entry_cachable)
storeSetPublicKey(entry);
}
httpCacheNegatively(StoreEntry * entry)
{
storeNegativeCache(entry);
- if (EBIT_TEST(entry->flag, ENTRY_CACHABLE))
+ if (entry->flags.entry_cachable)
storeSetPublicKey(entry);
}
int remove = 0;
const cache_key *key;
StoreEntry *pe;
- if (!EBIT_TEST(e->flag, KEY_PRIVATE))
+ if (!e->flags.key_private)
return;
switch (status) {
case HTTP_OK:
}
if (reply->cache_control) {
if (EBIT_TEST(reply->cache_control->mask, CC_PROXY_REVALIDATE))
- EBIT_SET(entry->flag, ENTRY_REVALIDATE);
+ entry->flags.entry_revalidate = 1;
else if (EBIT_TEST(reply->cache_control->mask, CC_MUST_REVALIDATE))
- EBIT_SET(entry->flag, ENTRY_REVALIDATE);
+ entry->flags.entry_revalidate = 1;
}
if (EBIT_TEST(httpState->flags, HTTP_KEEPALIVE))
if (httpState->peer)
/*
- * $Id: mime.cc,v 1.78 1998/08/21 03:15:18 wessels Exp $
+ * $Id: mime.cc,v 1.79 1998/09/14 21:28:05 wessels Exp $
*
* DEBUG: section 25 MIME Parsing
* AUTHOR: Harvest Derived
storeSetPublicKey(e);
storeComplete(e);
storeTimestampsSet(e);
- EBIT_SET(e->flag, ENTRY_SPECIAL);
+ e->flags.entry_special = 1;
debug(25, 3) ("Loaded icon %s\n", url);
storeUnlockObject(e);
memFree(MEM_4K_BUF, buf);
/*
- * $Id: neighbors.cc,v 1.245 1998/09/14 20:29:30 wessels Exp $
+ * $Id: neighbors.cc,v 1.246 1998/09/14 21:28:06 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
return;
}
/* check if someone is already fetching it */
- if (EBIT_TEST(entry->flag, ENTRY_DISPATCHED)) {
+ if (entry->flags.entry_dispatched) {
debug(15, 3) ("neighborsUdpAck: '%s' already being fetched.\n",
storeKeyText(key));
neighborCountIgnored(p);
return;
}
/* check if someone is already fetching it */
- if (EBIT_TEST(e->flag, ENTRY_DISPATCHED)) {
+ if (e->flags.entry_dispatched) {
debug(15, 3) ("neighborsUdpAck: '%s' already being fetched.\n",
storeKeyText(key));
neighborCountIgnored(p);
/*
- * $Id: peer_digest.cc,v 1.47 1998/09/14 15:46:48 wessels Exp $
+ * $Id: peer_digest.cc,v 1.48 1998/09/14 21:28:07 wessels Exp $
*
* DEBUG: section 72 Peer Digest Routines
* AUTHOR: Alex Rousskov
}
e = fetch->entry = storeCreateEntry(url, url, req->flags, req->method);
debug(72, 5) ("peerDigestRequest: new entry is private: %d\n",
- (int) EBIT_TEST(e->flag, KEY_PRIVATE));
+ (int) e->flags.key_private);
storeClientListAdd(e, fetch);
/* set lastmod to trigger IMS request if possible */
if (old_e)
/*
- * $Id: peer_select.cc,v 1.79 1998/08/27 06:28:28 wessels Exp $
+ * $Id: peer_select.cc,v 1.80 1998/09/14 21:28:08 wessels Exp $
*
* DEBUG: section 44 Peer Selection Algorithm
* AUTHOR: Duane Wessels
assert(direct != DIRECT_YES);
if (!request->flags.hierarchical && direct != DIRECT_NO)
return 0;
- if (EBIT_TEST(entry->flag, KEY_PRIVATE) && !neighbors_do_private_keys)
+ if (entry->flags.key_private && !neighbors_do_private_keys)
if (direct != DIRECT_NO)
return 0;
n = neighborsCount(request);
/*
- * $Id: protos.h,v 1.262 1998/09/11 17:07:46 wessels Exp $
+ * $Id: protos.h,v 1.263 1998/09/14 21:28:09 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern int stat5minClientRequests(void);
extern double stat5minCPUUsage(void);
extern double statMedianSvc(int, int);
+extern const char *storeEntryFlags(const StoreEntry *);
/* StatHist */
/*
- * $Id: refresh.cc,v 1.34 1998/08/21 04:03:48 wessels Exp $
+ * $Id: refresh.cc,v 1.35 1998/09/14 21:28:10 wessels Exp $
*
* DEBUG: section 22 Refresh Calculation
* AUTHOR: Harvest Derived
uri = urlCanonical(request);
debug(22, 3) ("refreshCheck: '%s'\n", uri);
refreshCounts.total++;
- if (EBIT_TEST(entry->flag, ENTRY_REVALIDATE)) {
+ if (entry->flags.entry_revalidate) {
debug(22, 3) ("refreshCheck: YES: Required Authorization\n");
refreshCounts.revalidate_stale++;
return 1;
assert(entry->mem_obj->url);
debug(22, 3) ("refreshWhen: key '%s'\n", storeKeyText(entry->key));
debug(22, 3) ("refreshWhen: url '%s'\n", entry->mem_obj->url);
- if (EBIT_TEST(entry->flag, ENTRY_REVALIDATE)) {
+ if (entry->flags.entry_revalidate) {
debug(22, 3) ("refreshWhen: NOW: Required Authorization\n");
return refresh_time;
}
/*
- * $Id: stat.cc,v 1.286 1998/09/10 16:03:25 wessels Exp $
+ * $Id: stat.cc,v 1.287 1998/09/14 21:28:10 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
/* LOCALS */
static const char *describeStatuses(const StoreEntry *);
-static const char *describeFlags(const StoreEntry *);
static const char *describeTimestamps(const StoreEntry *);
static void statAvgTick(void *notused);
static void statAvgDump(StoreEntry *, int minutes, int hours);
return buf;
}
-static const char *
-describeFlags(const StoreEntry * entry)
+const char *
+storeEntryFlags(const StoreEntry * entry)
{
LOCAL_ARRAY(char, buf, 256);
- int flags = (int) entry->flag;
char *t;
buf[0] = '\0';
- if (EBIT_TEST(flags, ENTRY_SPECIAL))
+ if (entry->flags.entry_special)
strcat(buf, "SPECIAL,");
- if (EBIT_TEST(flags, ENTRY_REVALIDATE))
+ if (entry->flags.entry_revalidate)
strcat(buf, "REVALIDATE,");
- if (EBIT_TEST(flags, DELAY_SENDING))
+ if (entry->flags.delay_sending)
strcat(buf, "DELAY_SENDING,");
- if (EBIT_TEST(flags, RELEASE_REQUEST))
+ if (entry->flags.release_request)
strcat(buf, "RELEASE_REQUEST,");
- if (EBIT_TEST(flags, REFRESH_REQUEST))
+ if (entry->flags.refresh_request)
strcat(buf, "REFRESH_REQUEST,");
- if (EBIT_TEST(flags, ENTRY_CACHABLE))
+ if (entry->flags.entry_cachable)
strcat(buf, "CACHABLE,");
- if (EBIT_TEST(flags, ENTRY_DISPATCHED))
+ if (entry->flags.entry_dispatched)
strcat(buf, "DISPATCHED,");
- if (EBIT_TEST(flags, KEY_PRIVATE))
+ if (entry->flags.key_private)
strcat(buf, "PRIVATE,");
- if (EBIT_TEST(flags, ENTRY_NEGCACHED))
+ if (entry->flags.entry_negcached)
strcat(buf, "NEGCACHED,");
- if (EBIT_TEST(flags, ENTRY_VALIDATED))
+ if (entry->flags.entry_validated)
strcat(buf, "VALIDATED,");
- if (EBIT_TEST(flags, ENTRY_BAD_LENGTH))
+ if (entry->flags.entry_bad_length)
strcat(buf, "BAD_LENGTH,");
if ((t = strrchr(buf, ',')))
*t = '\0';
storeAppendPrintf(s, "\t%s %s\n",
RequestMethodStr[mem->method], mem->log_url);
storeAppendPrintf(s, "\t%s\n", describeStatuses(e));
- storeAppendPrintf(s, "\t%s\n", describeFlags(e));
+ storeAppendPrintf(s, "\t%s\n", storeEntryFlags(e));
storeAppendPrintf(s, "\t%s\n", describeTimestamps(e));
storeAppendPrintf(s, "\t%d locks, %d clients, %d refs\n",
(int) e->lock_count,
/*
- * $Id: store.cc,v 1.457 1998/09/11 17:07:48 wessels Exp $
+ * $Id: store.cc,v 1.458 1998/09/14 21:28:12 wessels Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
void
storeReleaseRequest(StoreEntry * e)
{
- if (EBIT_TEST(e->flag, RELEASE_REQUEST))
+ if (e->flags.release_request)
return;
assert(storeEntryLocked(e));
debug(20, 3) ("storeReleaseRequest: '%s'\n", storeKeyText(e->key));
- EBIT_SET(e->flag, RELEASE_REQUEST);
+ e->flags.release_request = 1;
/*
* Clear cachable flag here because we might get called before
* anyone else even looks at the cachability flag. Also, this
* prevents httpMakePublic from really setting a public key.
*/
- EBIT_CLR(e->flag, ENTRY_CACHABLE);
+ e->flags.entry_cachable = 0;
storeSetPrivateKey(e);
}
if (e->lock_count)
return (int) e->lock_count;
if (e->store_status == STORE_PENDING) {
- assert(!EBIT_TEST(e->flag, ENTRY_DISPATCHED));
- EBIT_SET(e->flag, RELEASE_REQUEST);
+ assert(!e->flags.entry_dispatched);
+ e->flags.release_request = 1;
}
assert(storePendingNClients(e) == 0);
- if (EBIT_TEST(e->flag, RELEASE_REQUEST))
+ if (e->flags.release_request)
storeRelease(e);
else if (storeKeepInMemory(e)) {
storeSetMemStatus(e, IN_MEMORY);
e->mem_obj->request = NULL;
} else {
storePurgeMem(e);
- if (EBIT_TEST(e->flag, KEY_PRIVATE)) {
+ if (e->flags.key_private) {
dlinkDelete(&e->lru, &store_list);
dlinkAddTail(e, &e->lru, &store_list);
}
{
const cache_key *newkey;
MemObject *mem = e->mem_obj;
- if (e->key && EBIT_TEST(e->flag, KEY_PRIVATE))
+ if (e->key && e->flags.key_private)
return; /* is already private */
if (e->key) {
if (e->swap_file_number > -1)
newkey = storeKeyPrivate("JUNK", METHOD_NONE, getKeyCounter());
}
assert(hash_lookup(store_table, newkey) == NULL);
- EBIT_SET(e->flag, KEY_PRIVATE);
+ e->flags.key_private = 1;
storeHashInsert(e, newkey);
}
StoreEntry *e2 = NULL;
const cache_key *newkey;
MemObject *mem = e->mem_obj;
- if (e->key && !EBIT_TEST(e->flag, KEY_PRIVATE))
+ if (e->key && !e->flags.key_private)
return; /* is already public */
assert(mem);
/*
* store clients won't be able to access object data which has
* been freed from memory.
*/
- assert(!EBIT_TEST(e->flag, RELEASE_REQUEST));
+ assert(!e->flags.release_request);
newkey = storeKeyPublic(mem->url, mem->method);
if ((e2 = (StoreEntry *) hash_lookup(store_table, newkey))) {
debug(20, 3) ("storeSetPublicKey: Making old '%s' private.\n", mem->url);
}
if (e->key)
storeHashDelete(e);
- EBIT_CLR(e->flag, KEY_PRIVATE);
+ e->flags.key_private = 0;
storeHashInsert(e, newkey);
if (e->swap_file_number > -1)
storeDirSwapLog(e, SWAP_LOG_ADD);
else
storeSetPublicKey(e);
if (flags.cachable) {
- EBIT_SET(e->flag, ENTRY_CACHABLE);
- EBIT_CLR(e->flag, RELEASE_REQUEST);
+ e->flags.entry_cachable = 1;
+ e->flags.release_request = 0;
} else {
- EBIT_CLR(e->flag, ENTRY_CACHABLE);
+ e->flags.entry_cachable = 0;
storeReleaseRequest(e);
}
e->store_status = STORE_PENDING;
e->lastref = squid_curtime;
e->timestamp = 0; /* set in storeTimestampsSet() */
e->ping_status = PING_NONE;
- EBIT_SET(e->flag, ENTRY_VALIDATED);
+ e->flags.entry_validated = 1;
#ifdef PPNR_WIP
- EBIT_SET(e->flag, ENTRY_FWD_HDR_WAIT);
+ e->flags.entry_fwd_hdr_wait = 1;
#endif /* PPNR_WIP */
return e;
}
stmemAppend(&mem->data_hdr, buf, len);
mem->inmem_hi += len;
}
- if (EBIT_TEST(e->flag, DELAY_SENDING))
+ if (e->flags.delay_sending)
return;
#ifdef OPTIMISTIC_IO
storeLockObject(e);
store_check_cachable_hist.no.non_get++;
} else
#endif
- if (!EBIT_TEST(e->flag, ENTRY_CACHABLE)) {
+ if (!e->flags.entry_cachable) {
debug(20, 2) ("storeCheckCachable: NO: not cachable\n");
store_check_cachable_hist.no.not_entry_cachable++;
- } else if (EBIT_TEST(e->flag, RELEASE_REQUEST)) {
+ } else if (e->flags.release_request) {
debug(20, 2) ("storeCheckCachable: NO: release requested\n");
store_check_cachable_hist.no.release_request++;
- } else if (e->store_status == STORE_OK && EBIT_TEST(e->flag, ENTRY_BAD_LENGTH)) {
+ } else if (e->store_status == STORE_OK && e->flags.entry_bad_length) {
debug(20, 2) ("storeCheckCachable: NO: wrong content-length\n");
store_check_cachable_hist.no.wrong_content_length++;
- } else if (EBIT_TEST(e->flag, ENTRY_NEGCACHED)) {
+ } else if (e->flags.entry_negcached) {
debug(20, 3) ("storeCheckCachable: NO: negative cached\n");
store_check_cachable_hist.no.negative_cached++;
return 0; /* avoid release call below */
} else if (e->mem_obj->inmem_hi > Config.Store.maxObjectSize) {
debug(20, 2) ("storeCheckCachable: NO: too big\n");
store_check_cachable_hist.no.too_big++;
- } else if (EBIT_TEST(e->flag, KEY_PRIVATE)) {
+ } else if (e->flags.key_private) {
debug(20, 3) ("storeCheckCachable: NO: private key\n");
store_check_cachable_hist.no.private_key++;
} else if (storeTooManyDiskFilesOpen()) {
return 1;
}
storeReleaseRequest(e);
- EBIT_CLR(e->flag, ENTRY_CACHABLE);
+ e->flags.entry_cachable = 0;
return 0;
}
e->store_status = STORE_OK;
assert(e->mem_status == NOT_IN_MEMORY);
if (!storeEntryValidLength(e))
- EBIT_SET(e->flag, ENTRY_BAD_LENGTH);
+ e->flags.entry_bad_length = 1;
#if USE_CACHE_DIGESTS
if (e->mem_obj->request)
e->mem_obj->request->hier.store_complete_stop = current_time;
void
storePPNR(StoreEntry * e)
{
- assert(EBIT_TEST(e->flag, ENTRY_FWD_HDR_WAIT));
- EBIT_CLR(e->flag, ENTRY_FWD_HDR_WAIT);
+ assert(e->flags.entry_fwd_hdr_wait);
+ e->flags.entry_fwd_hdr_wait = 0;
}
#endif /* PPNR_WIP */
storeUrl(e));
storeExpireNow(e);
storeSetPrivateKey(e);
- EBIT_SET(e->flag, RELEASE_REQUEST);
+ e->flags.release_request = 1;
return;
}
#endif
storeUnlinkFileno(e->swap_file_number);
storeDirMapBitReset(e->swap_file_number);
if (e->swap_status == SWAPOUT_DONE)
- if (EBIT_TEST(e->flag, ENTRY_VALIDATED))
+ if (e->flags.entry_validated)
storeDirUpdateSwapSize(e->swap_file_number, e->swap_file_sz, -1);
- if (!EBIT_TEST(e->flag, KEY_PRIVATE))
+ if (!e->flags.key_private)
storeDirSwapLog(e, SWAP_LOG_DEL);
}
storeSetMemStatus(e, NOT_IN_MEMORY);
return 1;
if (e->store_status == STORE_PENDING)
return 1;
- if (EBIT_TEST(e->flag, ENTRY_SPECIAL))
+ if (e->flags.entry_special)
return 1;
return 0;
}
{
if (storeEntryLocked(e))
return 0;
- if (EBIT_TEST(e->flag, RELEASE_REQUEST))
+ if (e->flags.release_request)
return 1;
- if (EBIT_TEST(e->flag, ENTRY_NEGCACHED) && squid_curtime >= e->expires)
+ if (e->flags.entry_negcached && squid_curtime >= e->expires)
return 1;
if (squid_curtime - e->lastref > storeExpiredReferenceAge())
return 1;
storeNegativeCache(StoreEntry * e)
{
e->expires = squid_curtime + Config.negativeTtl;
- EBIT_SET(e->flag, ENTRY_NEGCACHED);
+ e->flags.entry_negcached = 1;
}
void
int
storeEntryValidToSend(StoreEntry * e)
{
- if (EBIT_TEST(e->flag, RELEASE_REQUEST))
+ if (e->flags.release_request)
return 0;
- if (EBIT_TEST(e->flag, ENTRY_NEGCACHED))
+ if (e->flags.entry_negcached)
if (e->expires <= squid_curtime)
return 0;
if (e->store_status == STORE_ABORTED)
debug(20, l) ("StoreEntry->lastmod: %d\n", (int) e->lastmod);
debug(20, l) ("StoreEntry->swap_file_sz: %d\n", (int) e->swap_file_sz);
debug(20, l) ("StoreEntry->refcount: %d\n", e->refcount);
- debug(20, l) ("StoreEntry->flag: %X\n", e->flag);
+ debug(20, l) ("StoreEntry->flags: %s\n", storeEntryFlags(e));
debug(20, l) ("StoreEntry->swap_file_number: %d\n", (int) e->swap_file_number);
debug(20, l) ("StoreEntry->lock_count: %d\n", (int) e->lock_count);
debug(20, l) ("StoreEntry->mem_status: %d\n", (int) e->mem_status);
void
storeBuffer(StoreEntry * e)
{
- EBIT_SET(e->flag, DELAY_SENDING);
+ e->flags.delay_sending = 1;
}
/* this just clears DELAY_SENDING and Invokes the handlers */
void
storeBufferFlush(StoreEntry * e)
{
- EBIT_CLR(e->flag, DELAY_SENDING);
+ e->flags.delay_sending = 0;
InvokeHandlers(e);
storeCheckSwapOut(e);
}
/*
- * $Id: store_client.cc,v 1.40 1998/08/24 21:07:51 wessels Exp $
+ * $Id: store_client.cc,v 1.41 1998/09/14 21:28:13 wessels Exp $
*
* DEBUG: section 20 Storage Manager Client-Side Interface
* AUTHOR: Duane Wessels
if (sc->flags.copy_event_pending)
return;
#ifdef PPNR_WIP
- if (EBIT_TEST(e->flag, ENTRY_FWD_HDR_WAIT))
+ if (e->flags.entry_fwd_hdr_wait)
return;
#endif /* PPNR_WIP */
if (sc->flags.store_copying) {
/*
- * $Id: store_digest.cc,v 1.26 1998/08/21 03:15:25 wessels Exp $
+ * $Id: store_digest.cc,v 1.27 1998/09/14 21:28:13 wessels Exp $
*
* DEBUG: section 71 Store Digest Manager
* AUTHOR: Alex Rousskov
assert(entry && store_digest);
debug(71, 6) ("storeDigestDel: checking entry, key: %s\n",
storeKeyText(entry->key));
- if (!EBIT_TEST(entry->flag, KEY_PRIVATE)) {
+ if (!entry->flags.key_private) {
if (!cacheDigestTest(store_digest, entry->key)) {
sd_stats.del_lost_count++;
debug(71, 6) ("storeDigestDel: lost entry, key: %s url: %s\n",
debug(71, 6) ("storeDigestAdd: checking entry, key: %s\n",
storeKeyText(entry->key));
/* only public entries are digested */
- if (!EBIT_TEST(entry->flag, KEY_PRIVATE)) {
+ if (!entry->flags.key_private) {
const time_t refresh = refreshWhen(entry);
debug(71, 6) ("storeDigestAdd: entry expires in %d secs\n",
(int) (refresh - squid_curtime));
assert(sd_state.rewrite_lock);
assert(!sd_state.rebuild_lock);
sd_state.rewrite_offset = 0;
- EBIT_SET(e->flag, ENTRY_SPECIAL);
+ e->flags.entry_special = 1;
/* setting public key will purge old digest entry if any */
storeSetPublicKey(e);
/* fake reply */
/*
- * $Id: store_dir.cc,v 1.75 1998/08/20 02:49:12 wessels Exp $
+ * $Id: store_dir.cc,v 1.76 1998/09/14 21:28:14 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
int dirn;
dirn = e->swap_file_number >> SWAP_DIR_SHIFT;
assert(dirn < Config.cacheSwap.n_configured);
- assert(!EBIT_TEST(e->flag, KEY_PRIVATE));
+ assert(!e->flags.key_private);
assert(e->swap_file_number >= 0);
/*
* icons and such; don't write them to the swap log
*/
- if (EBIT_TEST(e->flag, ENTRY_SPECIAL))
+ if (e->flags.entry_special)
return;
assert(op > SWAP_LOG_NOP && op < SWAP_LOG_MAX);
debug(20, 3) ("storeDirSwapLog: %s %s %08X\n",
s->lastmod = e->lastmod;
s->swap_file_sz = e->swap_file_sz;
s->refcount = e->refcount;
- s->flags = e->flag;
+ s->flags = e->flags;
xmemcpy(s->key, e->key, MD5_DIGEST_CHARS);
file_write(Config.cacheSwap.swapDirs[dirn].swaplog_fd,
-1,
continue;
if (e->swap_file_sz <= 0)
continue;
- if (EBIT_TEST(e->flag, RELEASE_REQUEST))
+ if (e->flags.release_request)
continue;
- if (EBIT_TEST(e->flag, KEY_PRIVATE))
+ if (e->flags.key_private)
continue;
- if (EBIT_TEST(e->flag, ENTRY_SPECIAL))
+ if (e->flags.entry_special)
continue;
dirn = storeDirNumber(e->swap_file_number);
assert(dirn < N);
s.lastmod = e->lastmod;
s.swap_file_sz = e->swap_file_sz;
s.refcount = e->refcount;
- s.flags = e->flag;
+ s.flags = e->flags;
xmemcpy(&s.key, e->key, MD5_DIGEST_CHARS);
xmemcpy(outbuf[dirn] + outbufoffset[dirn], &s, ss);
outbufoffset[dirn] += ss;
/*
- * $Id: store_rebuild.cc,v 1.47 1998/09/04 23:05:03 wessels Exp $
+ * $Id: store_rebuild.cc,v 1.48 1998/09/14 21:28:15 wessels Exp $
*
* DEBUG: section 20 Store Rebuild Routines
* AUTHOR: Duane Wessels
time_t lastref,
time_t lastmod,
u_num32 refcount,
- u_num32 flags,
+ store_flags flags,
int clean);
static AIOCB storeValidateComplete;
storeUnlinkFileno(sfileno);
continue;
}
- if (EBIT_TEST(tmpe.flag, KEY_PRIVATE)) {
+ if (tmpe.flags.key_private) {
storeUnlinkFileno(sfileno);
RebuildState.badflags++;
continue;
tmpe.lastref,
tmpe.lastmod,
tmpe.refcount, /* refcount */
- tmpe.flag, /* flags */
+ tmpe.flags, /* flags */
d->clean);
}
return count;
*/
storeExpireNow(e);
storeSetPrivateKey(e);
- EBIT_SET(e->flag, RELEASE_REQUEST);
+ e->flags.release_request = 1;
if (e->swap_file_number > -1) {
storeDirMapBitReset(e->swap_file_number);
e->swap_file_number = -1;
RebuildState.invalid++;
continue;
}
- if (EBIT_TEST(s.flags, KEY_PRIVATE)) {
+ if (s.flags.key_private) {
RebuildState.badflags++;
continue;
}
continue;
} else if (used && e && e->swap_file_number == s.swap_file_number) {
/* swapfile taken, same URL, newer, update meta */
- /* XXX what if e->store_status != STORE_OK? */
- e->lastref = s.timestamp;
- e->timestamp = s.timestamp;
- e->expires = s.expires;
- e->lastmod = s.lastmod;
- e->flag |= s.flags;
- e->refcount += s.refcount;
+ if (e->store_status == STORE_OK) {
+ e->lastref = s.timestamp;
+ e->timestamp = s.timestamp;
+ e->expires = s.expires;
+ e->lastmod = s.lastmod;
+ e->flags = s.flags;
+ e->refcount += s.refcount;
+ } else {
+ debug_trap("storeRebuildFromSwapLog: bad condition");
+ debug(20,1)("\tSee %s:%d\n", __FILE__, __LINE__);
+ }
continue;
} else if (used) {
/* swapfile in use, not by this URL, log entry is newer */
/* junk old, load new */
storeExpireNow(e);
storeSetPrivateKey(e);
- EBIT_SET(e->flag, RELEASE_REQUEST);
+ e->flags.release_request = 1;
if (e->swap_file_number > -1) {
storeDirMapBitReset(e->swap_file_number);
e->swap_file_number = -1;
time_t lastref,
time_t lastmod,
u_num32 refcount,
- u_num32 flags,
+ store_flags flags,
int clean)
{
StoreEntry *e = NULL;
e->expires = expires;
e->lastmod = lastmod;
e->refcount = refcount;
- e->flag = flags;
- EBIT_SET(e->flag, ENTRY_CACHABLE);
- EBIT_CLR(e->flag, RELEASE_REQUEST);
- EBIT_CLR(e->flag, KEY_PRIVATE);
+ e->flags = flags;
+ e->flags.entry_cachable = 1;
+ e->flags.release_request = 0;
+ e->flags.key_private = 0;
e->ping_status = PING_NONE;
- EBIT_CLR(e->flag, ENTRY_VALIDATED);
+ e->flags.entry_validated = 0;
storeDirMapBitSet(e->swap_file_number);
storeHashInsert(e, key); /* do it after we clear KEY_PRIVATE */
return e;
while (NULL != (link_ptr = link_next)) {
link_next = link_ptr->next;
e = (StoreEntry *) link_ptr;
- if (EBIT_TEST(e->flag, ENTRY_VALIDATED))
+ if (e->flags.entry_validated)
continue;
/*
* Calling storeRelease() has no effect because we're
continue;
}
}
- EBIT_SET(e->flag, ENTRY_VALIDATED);
+ e->flags.entry_validated = 1;
/* Only set the file bit if we know its a valid entry */
/* otherwise, set it in the validation procedure */
storeDirUpdateSwapSize(e->swap_file_number, e->swap_file_sz, 1);
#if !USE_ASYNC_IO
int x;
#endif
- assert(!EBIT_TEST(e->flag, ENTRY_VALIDATED));
+ assert(!e->flags.entry_validated);
if (e->swap_file_number < 0) {
- EBIT_CLR(e->flag, ENTRY_VALIDATED);
+ e->flags.entry_validated = 0;
callback(callback_data, 0, 0);
return;
}
retcode = stat(path, sb);
}
if (retcode < 0 || sb->st_size == 0 || sb->st_size != e->swap_file_sz) {
- EBIT_CLR(e->flag, ENTRY_VALIDATED);
+ e->flags.entry_validated = 0;
} else {
- EBIT_SET(e->flag, ENTRY_VALIDATED);
+ e->flags.entry_validated = 1;
storeDirUpdateSwapSize(e->swap_file_number, e->swap_file_sz, 1);
}
errno = errcode;
/*
- * $Id: store_swapin.cc,v 1.12 1998/08/10 19:37:50 wessels Exp $
+ * $Id: store_swapin.cc,v 1.13 1998/09/14 21:28:16 wessels Exp $
*
* DEBUG: section 20 Storage Manager Swapin Functions
* AUTHOR: Duane Wessels
{
swapin_ctrl_t *ctrlp;
assert(e->mem_status == NOT_IN_MEMORY);
- if (!EBIT_TEST(e->flag, ENTRY_VALIDATED)) {
+ if (!e->flags.entry_validated) {
/* We're still reloading and haven't validated this entry yet */
callback(-1, callback_data);
return;
ctrlp->e = e;
ctrlp->callback = callback;
ctrlp->callback_data = callback_data;
- if (EBIT_TEST(e->flag, ENTRY_VALIDATED))
+ if (e->flags.entry_validated)
storeSwapInValidateComplete(ctrlp, 0, 0);
else
storeValidate(e, storeSwapInValidateComplete, ctrlp, callback_data);
}
e = ctrlp->e;
assert(e->mem_status == NOT_IN_MEMORY);
- if (!EBIT_TEST(e->flag, ENTRY_VALIDATED)) {
+ if (!e->flags.entry_validated) {
/* Invoke a store abort that should free the memory object */
(ctrlp->callback) (-1, ctrlp->callback_data);
xfree(ctrlp);
/*
- * $Id: store_swapout.cc,v 1.30 1998/09/10 19:50:58 wessels Exp $
+ * $Id: store_swapout.cc,v 1.31 1998/09/14 21:28:16 wessels Exp $
*
* DEBUG: section 20 Storage Manager Swapout Functions
* AUTHOR: Duane Wessels
debug(20, 3) ("storeCheckSwapOut: store_status = %s\n",
storeStatusStr[e->store_status]);
if (e->store_status == STORE_ABORTED) {
- assert(EBIT_TEST(e->flag, RELEASE_REQUEST));
+ assert(e->flags.release_request);
storeSwapOutFileClose(e);
return;
}
#if USE_ASYNC_IO
if (mem->inmem_hi < mem->swapout.queue_offset) {
storeAbort(e, 0);
- assert(EBIT_TEST(e->flag, RELEASE_REQUEST));
+ assert(e->flags.release_request);
storeSwapOutFileClose(e);
return;
}
if (e->mem_obj->inmem_lo > 0)
return 0;
/* swapout.fd == -1 && inmem_lo == 0 */
- return EBIT_TEST(e->flag, ENTRY_CACHABLE);
+ return e->flags.entry_cachable;
}
/*
- * $Id: structs.h,v 1.220 1998/09/11 17:07:50 wessels Exp $
+ * $Id: structs.h,v 1.221 1998/09/14 21:28:17 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
size_t swap_hdr_sz;
};
+struct _store_flags {
+ /*
+ * These are for StoreEntry->flag, which is defined as a SHORT
+ *
+ * NOTE: These flags are written to swap.state, so think very carefully
+ * about deleting or re-assigning!
+ */
+ int entry_special:1;
+ int entry_revalidate:1;
+ int delay_sending:1;
+ int release_request:1;
+ int refresh_request:1;
+ int entry_cachable:1;
+ int entry_dispatched:1;
+ int key_private:1;
+#ifndef PPNR_WIP
+ int entry_unused_08:1;
+#else
+ int entry_fwd_hdr_wait:1;
+#endif /* PPNR_WIP */
+ int entry_negcached:1;
+ int entry_validated:1;
+ int entry_bad_length:1;
+};
+
struct _StoreEntry {
/* first two items must be same as hash_link */
const cache_key *key;
time_t lastmod;
size_t swap_file_sz;
u_short refcount;
- u_short flag;
+ store_flags flags;
int swap_file_number;
dlink_node lru;
u_short lock_count; /* Assume < 65536! */
time_t lastmod;
size_t swap_file_sz;
u_short refcount;
- u_short flags;
+ store_flags flags;
unsigned char key[MD5_DIGEST_CHARS];
};
/*
- * $Id: typedefs.h,v 1.73 1998/08/27 06:28:59 wessels Exp $
+ * $Id: typedefs.h,v 1.74 1998/09/14 21:28:18 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
typedef struct _StoreEntry StoreEntry;
typedef struct _SwapDir SwapDir;
typedef struct _request_flags request_flags;
+typedef struct _store_flags store_flags;
typedef struct _request_t request_t;
typedef struct _AccessLogEntry AccessLogEntry;
typedef struct _cachemgr_passwd cachemgr_passwd;
/*
- * $Id: wais.cc,v 1.118 1998/09/04 23:05:06 wessels Exp $
+ * $Id: wais.cc,v 1.119 1998/09/14 21:28:19 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
waisReadReply, waisState, 0);
} else {
ErrorState *err;
- EBIT_CLR(entry->flag, ENTRY_CACHABLE);
+ entry->flags.entry_cachable = 0;
storeReleaseRequest(entry);
err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR);
err->xerrno = errno;
memBufPrintf(&mb, "\r\n");
debug(24, 6) ("waisSendRequest: buf: %s\n", mb.buf);
comm_write_mbuf(fd, mb, waisSendComplete, waisState);
- if (EBIT_TEST(waisState->entry->flag, ENTRY_CACHABLE))
+ if (waisState->entry->flags.entry_cachable)
storeSetPublicKey(waisState->entry); /* Make it public */
}