+
/*
- * $Id: client.cc,v 1.74 1998/07/22 20:37:07 wessels Exp $
+ * $Id: client.cc,v 1.75 1998/09/19 17:05:58 wessels Exp $
*
* DEBUG: section 0 WWW Client
* AUTHOR: Harvest Derived
/*
- * $Id: client_side.cc,v 1.397 1998/09/15 22:05:10 wessels Exp $
+ * $Id: client_side.cc,v 1.398 1998/09/19 17:05:59 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
int
checkNegativeHit(StoreEntry * e)
{
- if (!e->flags.entry_negcached)
+ if (!EBIT_TEST(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 (entry->flags.entry_bad_length) {
+ } else if (EBIT_TEST(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 (e->flags.entry_special) {
+ } else if (EBIT_TEST(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 (http->entry->flags.entry_special)
+ if (EBIT_TEST(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 (http->entry->flags.key_private)
+ if (EBIT_TEST(http->entry->flags, KEY_PRIVATE))
return 1;
if (http->entry->mem_obj == NULL)
return 1;
/*
- * $Id: enums.h,v 1.129 1998/09/14 22:17:56 wessels Exp $
+ * $Id: enums.h,v 1.130 1998/09/19 17:06:00 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
HTTP_INVALID_HEADER = 600 /* Squid header parsing error */
} http_status;
+/*
+ * 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 {
- ERR_FLAG_CBDATA
+ 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
};
typedef enum {
/*
- * $Id: forward.cc,v 1.27 1998/09/14 21:28:02 wessels Exp $
+ * $Id: forward.cc,v 1.28 1998/09/19 17:06:01 wessels Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
fwdState->client_fd,
RequestMethodStr[request->method],
storeUrl(entry));
- /*assert(!entry->flags.entry_dispatched); */
+ /*assert(!EBIT_TEST(entry->flags, ENTRY_DISPATCHED)); */
assert(entry->ping_status != PING_WAITING);
assert(entry->lock_count);
- entry->flags.entry_dispatched = 1;
+ EBIT_SET(entry->flags, ENTRY_DISPATCHED);
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(fwdState->entry->flags.entry_fwd_hdr_wait);
+ assert(EBIT_TEST(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: fqdncache.cc,v 1.116 1998/09/15 22:29:30 wessels Exp $
+ * $Id: fqdncache.cc,v 1.117 1998/09/19 17:06:02 wessels Exp $
*
* DEBUG: section 35 FQDN Cache
* AUTHOR: Harvest Derived
}
return;
} else {
- debug(35,1)("fqdncache_nbgethostbyaddr: BAD status %d",
- (int) f->status);
+ debug(35, 1) ("fqdncache_nbgethostbyaddr: BAD status %d",
+ (int) f->status);
assert(0);
}
/*
- * $Id: ftp.cc,v 1.251 1998/09/14 21:28:03 wessels Exp $
+ * $Id: ftp.cc,v 1.252 1998/09/19 17:06: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 (e->flags.entry_cachable)
+ if (EBIT_TEST(e->flags, ENTRY_CACHABLE))
storeSetPublicKey(e);
}
/*
- * $Id: gopher.cc,v 1.138 1998/09/14 21:28:04 wessels Exp $
+ * $Id: gopher.cc,v 1.139 1998/09/19 17:06:04 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
gopherSendComplete,
data,
memFree4K);
- if (gopherState->entry->flags.entry_cachable)
+ if (EBIT_TEST(gopherState->entry->flags, ENTRY_CACHABLE))
storeSetPublicKey(gopherState->entry); /* Make it public */
}
/*
- * $Id: http.cc,v 1.321 1998/09/15 22:05:09 wessels Exp $
+ * $Id: http.cc,v 1.322 1998/09/19 17:06:05 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
static void
httpMakePublic(StoreEntry * entry)
{
- if (entry->flags.entry_cachable)
+ if (EBIT_TEST(entry->flags, ENTRY_CACHABLE))
storeSetPublicKey(entry);
}
httpCacheNegatively(StoreEntry * entry)
{
storeNegativeCache(entry);
- if (entry->flags.entry_cachable)
+ if (EBIT_TEST(entry->flags, ENTRY_CACHABLE))
storeSetPublicKey(entry);
}
int remove = 0;
const cache_key *key;
StoreEntry *pe;
- if (!e->flags.key_private)
+ if (!EBIT_TEST(e->flags, KEY_PRIVATE))
return;
switch (status) {
case HTTP_OK:
}
if (reply->cache_control) {
if (EBIT_TEST(reply->cache_control->mask, CC_PROXY_REVALIDATE))
- entry->flags.entry_revalidate = 1;
+ EBIT_SET(entry->flags, ENTRY_REVALIDATE);
else if (EBIT_TEST(reply->cache_control->mask, CC_MUST_REVALIDATE))
- entry->flags.entry_revalidate = 1;
+ EBIT_SET(entry->flags, ENTRY_REVALIDATE);
}
if (httpState->flags.keepalive)
if (httpState->peer)
/*
- * $Id: mime.cc,v 1.79 1998/09/14 21:28:05 wessels Exp $
+ * $Id: mime.cc,v 1.80 1998/09/19 17:06:06 wessels Exp $
*
* DEBUG: section 25 MIME Parsing
* AUTHOR: Harvest Derived
storeSetPublicKey(e);
storeComplete(e);
storeTimestampsSet(e);
- e->flags.entry_special = 1;
+ EBIT_SET(e->flags, ENTRY_SPECIAL);
debug(25, 3) ("Loaded icon %s\n", url);
storeUnlockObject(e);
memFree(MEM_4K_BUF, buf);
/*
- * $Id: neighbors.cc,v 1.250 1998/09/18 15:25:41 wessels Exp $
+ * $Id: neighbors.cc,v 1.251 1998/09/19 17:06:07 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
if (rtt < 1 || rtt > 10000)
return;
p->stats.rtt = intAverage(p->stats.rtt, rtt,
- p->stats.pings_acked, RTT_AV_FACTOR);
+ p->stats.pings_acked, RTT_AV_FACTOR);
}
#if USE_HTCP
return;
}
/* check if someone is already fetching it */
- if (entry->flags.entry_dispatched) {
+ if (EBIT_TEST(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 (e->flags.entry_dispatched) {
+ if (EBIT_TEST(e->flags, ENTRY_DISPATCHED)) {
debug(15, 3) ("neighborsUdpAck: '%s' already being fetched.\n",
storeKeyText(key));
neighborCountIgnored(p);
/*
- * $Id: peer_digest.cc,v 1.52 1998/09/15 19:37:55 wessels Exp $
+ * $Id: peer_digest.cc,v 1.53 1998/09/19 17:06:08 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) e->flags.key_private);
+ (int) EBIT_TEST(e->flags, KEY_PRIVATE));
storeClientListAdd(e, fetch);
/* set lastmod to trigger IMS request if possible */
if (old_e)
/*
- * $Id: peer_select.cc,v 1.84 1998/09/19 15:28:44 wessels Exp $
+ * $Id: peer_select.cc,v 1.85 1998/09/19 17:06: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 (entry->flags.key_private && !neighbors_do_private_keys)
+ if (EBIT_TEST(entry->flags, KEY_PRIVATE) && !neighbors_do_private_keys)
if (direct != DIRECT_NO)
return 0;
n = neighborsCount(request);
/*
- * $Id: refresh.cc,v 1.35 1998/09/14 21:28:10 wessels Exp $
+ * $Id: refresh.cc,v 1.36 1998/09/19 17:06:09 wessels Exp $
*
* DEBUG: section 22 Refresh Calculation
* AUTHOR: Harvest Derived
uri = urlCanonical(request);
debug(22, 3) ("refreshCheck: '%s'\n", uri);
refreshCounts.total++;
- if (entry->flags.entry_revalidate) {
+ if (EBIT_TEST(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 (entry->flags.entry_revalidate) {
+ if (EBIT_TEST(entry->flags, ENTRY_REVALIDATE)) {
debug(22, 3) ("refreshWhen: NOW: Required Authorization\n");
return refresh_time;
}
/*
- * $Id: stat.cc,v 1.289 1998/09/15 19:37:58 wessels Exp $
+ * $Id: stat.cc,v 1.290 1998/09/19 17:06:10 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
LOCAL_ARRAY(char, buf, 256);
char *t;
buf[0] = '\0';
- if (entry->flags.entry_special)
+ if (EBIT_TEST(entry->flags, ENTRY_SPECIAL))
strcat(buf, "SPECIAL,");
- if (entry->flags.entry_revalidate)
+ if (EBIT_TEST(entry->flags, ENTRY_REVALIDATE))
strcat(buf, "REVALIDATE,");
- if (entry->flags.delay_sending)
+ if (EBIT_TEST(entry->flags, DELAY_SENDING))
strcat(buf, "DELAY_SENDING,");
- if (entry->flags.release_request)
+ if (EBIT_TEST(entry->flags, RELEASE_REQUEST))
strcat(buf, "RELEASE_REQUEST,");
- if (entry->flags.refresh_request)
+ if (EBIT_TEST(entry->flags, REFRESH_REQUEST))
strcat(buf, "REFRESH_REQUEST,");
- if (entry->flags.entry_cachable)
+ if (EBIT_TEST(entry->flags, ENTRY_CACHABLE))
strcat(buf, "CACHABLE,");
- if (entry->flags.entry_dispatched)
+ if (EBIT_TEST(entry->flags, ENTRY_DISPATCHED))
strcat(buf, "DISPATCHED,");
- if (entry->flags.key_private)
+ if (EBIT_TEST(entry->flags, KEY_PRIVATE))
strcat(buf, "PRIVATE,");
- if (entry->flags.entry_negcached)
+ if (EBIT_TEST(entry->flags, ENTRY_NEGCACHED))
strcat(buf, "NEGCACHED,");
- if (entry->flags.entry_validated)
+ if (EBIT_TEST(entry->flags, ENTRY_VALIDATED))
strcat(buf, "VALIDATED,");
- if (entry->flags.entry_bad_length)
+ if (EBIT_TEST(entry->flags, ENTRY_BAD_LENGTH))
strcat(buf, "BAD_LENGTH,");
if ((t = strrchr(buf, ',')))
*t = '\0';
/*
- * $Id: store.cc,v 1.461 1998/09/15 20:16:22 wessels Exp $
+ * $Id: store.cc,v 1.462 1998/09/19 17:06:12 wessels Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
void
storeReleaseRequest(StoreEntry * e)
{
- if (e->flags.release_request)
+ if (EBIT_TEST(e->flags, RELEASE_REQUEST))
return;
assert(storeEntryLocked(e));
debug(20, 3) ("storeReleaseRequest: '%s'\n", storeKeyText(e->key));
- e->flags.release_request = 1;
+ EBIT_SET(e->flags, RELEASE_REQUEST);
/*
* 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.
*/
- e->flags.entry_cachable = 0;
+ EBIT_CLR(e->flags, ENTRY_CACHABLE);
storeSetPrivateKey(e);
}
if (e->lock_count)
return (int) e->lock_count;
if (e->store_status == STORE_PENDING) {
- assert(!e->flags.entry_dispatched);
- e->flags.release_request = 1;
+ assert(!EBIT_TEST(e->flags, ENTRY_DISPATCHED));
+ EBIT_SET(e->flags, RELEASE_REQUEST);
}
assert(storePendingNClients(e) == 0);
- if (e->flags.release_request)
+ if (EBIT_TEST(e->flags, RELEASE_REQUEST))
storeRelease(e);
else if (storeKeepInMemory(e)) {
storeSetMemStatus(e, IN_MEMORY);
e->mem_obj->request = NULL;
} else {
storePurgeMem(e);
- if (e->flags.key_private) {
+ if (EBIT_TEST(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 && e->flags.key_private)
+ if (e->key && EBIT_TEST(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);
- e->flags.key_private = 1;
+ EBIT_SET(e->flags, KEY_PRIVATE);
storeHashInsert(e, newkey);
}
StoreEntry *e2 = NULL;
const cache_key *newkey;
MemObject *mem = e->mem_obj;
- if (e->key && !e->flags.key_private)
+ if (e->key && !EBIT_TEST(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(!e->flags.release_request);
+ assert(!EBIT_TEST(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);
- e->flags.key_private = 0;
+ EBIT_CLR(e->flags, KEY_PRIVATE);
storeHashInsert(e, newkey);
if (e->swap_file_number > -1)
storeDirSwapLog(e, SWAP_LOG_ADD);
else
storeSetPublicKey(e);
if (flags.cachable) {
- e->flags.entry_cachable = 1;
- e->flags.release_request = 0;
+ EBIT_SET(e->flags, ENTRY_CACHABLE);
+ EBIT_CLR(e->flags, RELEASE_REQUEST);
} else {
- e->flags.entry_cachable = 0;
+ EBIT_CLR(e->flags, ENTRY_CACHABLE);
storeReleaseRequest(e);
}
e->store_status = STORE_PENDING;
e->lastref = squid_curtime;
e->timestamp = 0; /* set in storeTimestampsSet() */
e->ping_status = PING_NONE;
- e->flags.entry_validated = 1;
+ EBIT_SET(e->flags, ENTRY_VALIDATED);
#ifdef PPNR_WIP
- e->flags.entry_fwd_hdr_wait = 1;
+ EBIT_SET(e->flags, ENTRY_FWD_HDR_WAIT);
#endif /* PPNR_WIP */
return e;
}
stmemAppend(&mem->data_hdr, buf, len);
mem->inmem_hi += len;
}
- if (e->flags.delay_sending)
+ if (EBIT_TEST(e->flags, DELAY_SENDING))
return;
#ifdef OPTIMISTIC_IO
storeLockObject(e);
store_check_cachable_hist.no.non_get++;
} else
#endif
- if (!e->flags.entry_cachable) {
+ if (!EBIT_TEST(e->flags, ENTRY_CACHABLE)) {
debug(20, 2) ("storeCheckCachable: NO: not cachable\n");
store_check_cachable_hist.no.not_entry_cachable++;
- } else if (e->flags.release_request) {
+ } else if (EBIT_TEST(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 && e->flags.entry_bad_length) {
+ } else if (e->store_status == STORE_OK && EBIT_TEST(e->flags, ENTRY_BAD_LENGTH)) {
debug(20, 2) ("storeCheckCachable: NO: wrong content-length\n");
store_check_cachable_hist.no.wrong_content_length++;
- } else if (e->flags.entry_negcached) {
+ } else if (EBIT_TEST(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 (e->flags.key_private) {
+ } else if (EBIT_TEST(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);
- e->flags.entry_cachable = 0;
+ EBIT_CLR(e->flags, ENTRY_CACHABLE);
return 0;
}
e->store_status = STORE_OK;
assert(e->mem_status == NOT_IN_MEMORY);
if (!storeEntryValidLength(e))
- e->flags.entry_bad_length = 1;
+ EBIT_SET(e->flags, ENTRY_BAD_LENGTH);
#if USE_CACHE_DIGESTS
if (e->mem_obj->request)
e->mem_obj->request->hier.store_complete_stop = current_time;
void
storePPNR(StoreEntry * e)
{
- assert(e->flags.entry_fwd_hdr_wait);
- e->flags.entry_fwd_hdr_wait = 0;
+ assert(EBIT_TEST(e->flags, ENTRY_FWD_HDR_WAIT));
+ EBIT_CLR(e->flags, ENTRY_FWD_HDR_WAIT);
}
#endif /* PPNR_WIP */
storeUrl(e));
storeExpireNow(e);
storeSetPrivateKey(e);
- e->flags.release_request = 1;
+ EBIT_SET(e->flags, RELEASE_REQUEST);
return;
}
#if USE_ASYNC_IO
storeUnlinkFileno(e->swap_file_number);
storeDirMapBitReset(e->swap_file_number);
if (e->swap_status == SWAPOUT_DONE)
- if (e->flags.entry_validated)
+ if (EBIT_TEST(e->flags, ENTRY_VALIDATED))
storeDirUpdateSwapSize(e->swap_file_number, e->swap_file_sz, -1);
- if (!e->flags.key_private)
+ if (!EBIT_TEST(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 (e->flags.entry_special)
+ if (EBIT_TEST(e->flags, ENTRY_SPECIAL))
return 1;
return 0;
}
void
storeInit(void)
{
- assert(sizeof(store_flags) == sizeof(unsigned short));
storeKeyInit();
storeInitHashValues();
store_table = hash_create(storeKeyHashCmp,
{
if (storeEntryLocked(e))
return 0;
- if (e->flags.release_request)
+ if (EBIT_TEST(e->flags, RELEASE_REQUEST))
return 1;
- if (e->flags.entry_negcached && squid_curtime >= e->expires)
+ if (EBIT_TEST(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;
- e->flags.entry_negcached = 1;
+ EBIT_SET(e->flags, ENTRY_NEGCACHED);
}
void
int
storeEntryValidToSend(StoreEntry * e)
{
- if (e->flags.release_request)
+ if (EBIT_TEST(e->flags, RELEASE_REQUEST))
return 0;
- if (e->flags.entry_negcached)
+ if (EBIT_TEST(e->flags, ENTRY_NEGCACHED))
if (e->expires <= squid_curtime)
return 0;
if (e->store_status == STORE_ABORTED)
void
storeBuffer(StoreEntry * e)
{
- e->flags.delay_sending = 1;
+ EBIT_SET(e->flags, DELAY_SENDING);
}
/* this just clears DELAY_SENDING and Invokes the handlers */
void
storeBufferFlush(StoreEntry * e)
{
- e->flags.delay_sending = 0;
+ EBIT_CLR(e->flags, DELAY_SENDING);
InvokeHandlers(e);
storeCheckSwapOut(e);
}
/*
- * $Id: store_client.cc,v 1.42 1998/09/19 16:39:15 wessels Exp $
+ * $Id: store_client.cc,v 1.43 1998/09/19 17:06: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 (e->flags.entry_fwd_hdr_wait)
+ if (EBIT_TEST(e->flags, ENTRY_FWD_HDR_WAIT))
return;
#endif /* PPNR_WIP */
if (sc->flags.store_copying) {
/*
- * $Id: store_digest.cc,v 1.27 1998/09/14 21:28:13 wessels Exp $
+ * $Id: store_digest.cc,v 1.28 1998/09/19 17:06: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 (!entry->flags.key_private) {
+ if (!EBIT_TEST(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 (!entry->flags.key_private) {
+ if (!EBIT_TEST(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;
- e->flags.entry_special = 1;
+ EBIT_SET(e->flags, ENTRY_SPECIAL);
/* setting public key will purge old digest entry if any */
storeSetPublicKey(e);
/* fake reply */
/*
- * $Id: store_dir.cc,v 1.78 1998/09/18 15:14:42 wessels Exp $
+ * $Id: store_dir.cc,v 1.79 1998/09/19 17:06: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(!e->flags.key_private);
+ assert(!EBIT_TEST(e->flags, KEY_PRIVATE));
assert(e->swap_file_number >= 0);
/*
* icons and such; don't write them to the swap log
*/
- if (e->flags.entry_special)
+ if (EBIT_TEST(e->flags, ENTRY_SPECIAL))
return;
assert(op > SWAP_LOG_NOP && op < SWAP_LOG_MAX);
debug(20, 3) ("storeDirSwapLog: %s %s %08X\n",
continue;
if (e->swap_file_sz <= 0)
continue;
- if (e->flags.release_request)
+ if (EBIT_TEST(e->flags, RELEASE_REQUEST))
continue;
- if (e->flags.key_private)
+ if (EBIT_TEST(e->flags, KEY_PRIVATE))
continue;
- if (e->flags.entry_special)
+ if (EBIT_TEST(e->flags, ENTRY_SPECIAL))
continue;
dirn = storeDirNumber(e->swap_file_number);
assert(dirn < N);
/*
- * $Id: store_rebuild.cc,v 1.50 1998/09/15 19:38:03 wessels Exp $
+ * $Id: store_rebuild.cc,v 1.51 1998/09/19 17:06:15 wessels Exp $
*
* DEBUG: section 20 Store Rebuild Routines
* AUTHOR: Duane Wessels
time_t lastref,
time_t lastmod,
u_num32 refcount,
- store_flags flags,
+ u_short flags,
int clean);
static AIOCB storeValidateComplete;
storeUnlinkFileno(sfileno);
continue;
}
- if (tmpe.flags.key_private) {
+ if (EBIT_TEST(tmpe.flags, KEY_PRIVATE)) {
storeUnlinkFileno(sfileno);
RebuildState.badflags++;
continue;
*/
storeExpireNow(e);
storeSetPrivateKey(e);
- e->flags.release_request = 1;
+ EBIT_SET(e->flags, RELEASE_REQUEST);
if (e->swap_file_number > -1) {
storeDirMapBitReset(e->swap_file_number);
e->swap_file_number = -1;
RebuildState.invalid++;
continue;
}
- if (s.flags.key_private) {
+ if (EBIT_TEST(s.flags, KEY_PRIVATE)) {
RebuildState.badflags++;
continue;
}
/* junk old, load new */
storeExpireNow(e);
storeSetPrivateKey(e);
- e->flags.release_request = 1;
+ EBIT_SET(e->flags, RELEASE_REQUEST);
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,
- store_flags flags,
+ u_short flags,
int clean)
{
StoreEntry *e = NULL;
e->lastmod = lastmod;
e->refcount = refcount;
e->flags = flags;
- e->flags.entry_cachable = 1;
- e->flags.release_request = 0;
- e->flags.key_private = 0;
+ EBIT_SET(e->flags, ENTRY_CACHABLE);
+ EBIT_CLR(e->flags, RELEASE_REQUEST);
+ EBIT_CLR(e->flags, KEY_PRIVATE);
e->ping_status = PING_NONE;
- e->flags.entry_validated = 0;
+ EBIT_CLR(e->flags, ENTRY_VALIDATED);
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 (e->flags.entry_validated)
+ if (EBIT_TEST(e->flags, ENTRY_VALIDATED))
continue;
/*
* Calling storeRelease() has no effect because we're
continue;
}
}
- e->flags.entry_validated = 1;
+ EBIT_SET(e->flags, ENTRY_VALIDATED);
/* 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(!e->flags.entry_validated);
+ assert(!EBIT_TEST(e->flags, ENTRY_VALIDATED));
if (e->swap_file_number < 0) {
- e->flags.entry_validated = 0;
+ EBIT_CLR(e->flags, ENTRY_VALIDATED);
callback(callback_data, 0, 0);
return;
}
retcode = stat(path, sb);
}
if (retcode < 0 || sb->st_size == 0 || sb->st_size != e->swap_file_sz) {
- e->flags.entry_validated = 0;
+ EBIT_CLR(e->flags, ENTRY_VALIDATED);
} else {
- e->flags.entry_validated = 1;
+ EBIT_SET(e->flags, ENTRY_VALIDATED);
storeDirUpdateSwapSize(e->swap_file_number, e->swap_file_sz, 1);
}
errno = errcode;
/*
- * $Id: store_swapin.cc,v 1.13 1998/09/14 21:28:16 wessels Exp $
+ * $Id: store_swapin.cc,v 1.14 1998/09/19 17:06: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 (!e->flags.entry_validated) {
+ if (!EBIT_TEST(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 (e->flags.entry_validated)
+ if (EBIT_TEST(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 (!e->flags.entry_validated) {
+ if (!EBIT_TEST(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.32 1998/09/18 15:15:25 wessels Exp $
+ * $Id: store_swapout.cc,v 1.33 1998/09/19 17:06: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(e->flags.release_request);
+ assert(EBIT_TEST(e->flags, RELEASE_REQUEST));
storeSwapOutFileClose(e);
return;
}
#if USE_ASYNC_IO
if (mem->inmem_hi < mem->swapout.queue_offset) {
storeAbort(e, 0);
- assert(e->flags.release_request);
+ assert(EBIT_TEST(e->flags, RELEASE_REQUEST));
storeSwapOutFileClose(e);
return;
}
if (e->mem_obj->inmem_lo > 0)
return 0;
/* swapout.fd == -1 && inmem_lo == 0 */
- return e->flags.entry_cachable;
+ return EBIT_TEST(e->flags, ENTRY_CACHABLE);
}
+
/*
- * $Id: structs.h,v 1.230 1998/09/15 19:38:04 wessels Exp $
+ * $Id: structs.h,v 1.231 1998/09/19 17:06: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!
- */
-#if WORDS_BIGENDIAN
- unsigned short entry_unused_15:1;
- unsigned short entry_unused_14:1;
- unsigned short entry_unused_13:1;
- unsigned short entry_unused_12:1;
- unsigned short entry_bad_length:1;
- unsigned short entry_validated:1;
- unsigned short entry_negcached:1;
-#ifndef PPNR_WIP
- unsigned short entry_unused_08:1;
-#else
- unsigned short entry_fwd_hdr_wait:1;
-#endif /* PPNR_WIP */
- unsigned short key_private:1;
- unsigned short entry_dispatched:1;
- unsigned short entry_cachable:1;
- unsigned short refresh_request:1;
- unsigned short release_request:1;
- unsigned short delay_sending:1;
- unsigned short entry_revalidate:1;
- unsigned short entry_special:1;
-#else /* ENDIAN */
- unsigned short entry_special:1;
- unsigned short entry_revalidate:1;
- unsigned short delay_sending:1;
- unsigned short release_request:1;
- unsigned short refresh_request:1;
- unsigned short entry_cachable:1;
- unsigned short entry_dispatched:1;
- unsigned short key_private:1;
-#ifndef PPNR_WIP
- unsigned short entry_unused_08:1;
-#else
- unsigned short entry_fwd_hdr_wait:1;
-#endif /* PPNR_WIP */
- unsigned short entry_negcached:1;
- unsigned short entry_validated:1;
- unsigned short entry_bad_length:1;
-#endif /* ENDIAN */
-};
-
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;
- store_flags flags;
+ u_short 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;
- store_flags flags;
+ u_short flags;
unsigned char key[MD5_DIGEST_CHARS];
};
/*
- * $Id: typedefs.h,v 1.77 1998/09/14 22:28:00 wessels Exp $
+ * $Id: typedefs.h,v 1.78 1998/09/19 17:06: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 _helper_flags helper_flags;
typedef struct _http_state_flags http_state_flags;
typedef struct _request_t request_t;
/*
- * $Id: wais.cc,v 1.119 1998/09/14 21:28:19 wessels Exp $
+ * $Id: wais.cc,v 1.120 1998/09/19 17:06:19 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
waisReadReply, waisState, 0);
} else {
ErrorState *err;
- entry->flags.entry_cachable = 0;
+ EBIT_CLR(entry->flags, ENTRY_CACHABLE);
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 (waisState->entry->flags.entry_cachable)
+ if (EBIT_TEST(waisState->entry->flags, ENTRY_CACHABLE))
storeSetPublicKey(waisState->entry); /* Make it public */
}