<article>
<title>Squid Programmers Guide</title>
<author>Duane Wessels, Squid Developers
-<date>$Id: prog-guide.sgml,v 1.39 2001/04/27 23:42:05 wessels Exp $</date>
+<date>$Id: prog-guide.sgml,v 1.40 2001/05/08 15:24:34 hno Exp $</date>
<abstract>
Squid is a WWW Cache application developed by the National Laboratory
<P>
<verb>
typedef void
- STDUMP(StoreEntry *e, const char *path, SwapDir *SD);
+ STDUMP(StoreEntry *e, SwapDir *SD);
</verb>
<P>
- Dump the configuration of the current <em/SwapDir/ to the given
- <em/StoreEntry/. Used to grab a configuration file dump from th
- <em/cachemgr/ interface. 'const char *' refers to the path of the
- given <em/Swapdir/, and is redundant.
+ Dump the FS specific configuration data of the current <em/SwapDir/
+ to the given <em/StoreEntry/. Used to grab a configuration file dump
+ from th <em/cachemgr/ interface.
+ Note: The printed options should start with a space character to
+ separate them from the cache_dir path.
<sect2>freefs
/*
- * $Id: cache_cf.cc,v 1.380 2001/05/04 13:37:41 hno Exp $
+ * $Id: cache_cf.cc,v 1.381 2001/05/08 15:24:35 hno Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
static const char *const B_GBYTES_STR = "GB";
static const char *const list_sep = ", \t\n\r";
+static struct cache_dir_option common_cachedir_options[];
static void update_maxobjsize(void);
static void configDoConfigure(void);
}
}
+void
+dump_cachedir_options(StoreEntry * entry, struct cache_dir_option *options, SwapDir * sd)
+{
+ struct cache_dir_option *option;
+ if (!options)
+ return;
+ for (option = options; option->name; option++)
+ option->dump(entry, option->name, sd);
+}
+
static void
dump_cachedir(StoreEntry * entry, const char *name, cacheSwap swap)
{
int i;
for (i = 0; i < swap.n_configured; i++) {
s = swap.swapDirs + i;
- s->dump(entry, name, s);
+ storeAppendPrintf(entry, "%s %s %s", name, s->type, s->path);
+ if (s->dump)
+ s->dump(entry, s);
+ dump_cachedir_options(entry, common_cachedir_options, s);
+ storeAppendPrintf(entry, "\n");
}
}
sd->flags.read_only = read_only;
}
+static void
+dump_cachedir_option_readonly(StoreEntry * e, const char *option, SwapDir * sd)
+{
+ if (sd->flags.read_only)
+ storeAppendPrintf(e, " %s", option);
+}
+
static void
parse_cachedir_option_maxsize(SwapDir * sd, const char *option, const char *value, int reconfiguring)
{
sd->max_objsize = size;
}
+static void
+dump_cachedir_option_maxsize(StoreEntry * e, const char *option, SwapDir * sd)
+{
+ if (sd->max_objsize != -1)
+ storeAppendPrintf(e, " %s=%d", option, sd->max_objsize);
+}
+
static struct cache_dir_option common_cachedir_options[] =
{
- {"read-only", parse_cachedir_option_readonly},
- {"max-size", parse_cachedir_option_maxsize},
+ {"read-only", parse_cachedir_option_readonly, dump_cachedir_option_readonly},
+ {"max-size", parse_cachedir_option_maxsize, dump_cachedir_option_maxsize},
{NULL, NULL}
};
/*
- * $Id: store_dir_aufs.cc,v 1.34 2001/03/17 13:31:16 hno Exp $
+ * $Id: store_dir_aufs.cc,v 1.35 2001/05/08 15:24:36 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
static struct cache_dir_option options[] =
{
#if NOT_YET_DONE
- {"L1", storeAufsDirParseL1},
- {"L2", storeAufsDirParseL2},
+ {"L1", storeAufsDirParseL1, storeAufsDirDumpL1},
+ {"L2", storeAufsDirParseL2, storeAufsDirDumpL2},
#endif
{NULL, NULL}
};
}
void
-storeAufsDirDump(StoreEntry * entry, const char *name, SwapDir * s)
+storeAufsDirDump(StoreEntry * entry, SwapDir * s)
{
aioinfo_t *aioinfo = (aioinfo_t *) s->fsdata;
- storeAppendPrintf(entry, "%s %s %s %d %d %d\n",
- name,
- "aufs",
- s->path,
+ storeAppendPrintf(entry, " %d %d %d",
s->max_size >> 10,
aioinfo->l1,
aioinfo->l2);
+ dump_cachedir_options(entry, options, s);
}
/*
/*
- * $Id: store_dir_coss.cc,v 1.20 2001/03/03 10:39:37 hno Exp $
+ * $Id: store_dir_coss.cc,v 1.21 2001/05/08 15:24:36 hno Exp $
*
* DEBUG: section 81 Store COSS Directory Routines
* AUTHOR: Eric Stern
}
void
-storeCossDirDump(StoreEntry * entry, const char *name, SwapDir * s)
+storeCossDirDump(StoreEntry * entry, SwapDir * s)
{
- storeAppendPrintf(entry, "%s %s %s %d\n",
- name,
- s->type,
- s->path,
+ storeAppendPrintf(entry, " %d",
s->max_size >> 20);
+ dump_cachedir_options(entry, NULL, sd);
}
#if OLD_UNUSED_CODE
/*
- * $Id: store_dir_diskd.cc,v 1.48 2001/04/03 20:22:11 adrian Exp $
+ * $Id: store_dir_diskd.cc,v 1.49 2001/05/08 15:24:36 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
debug(3, 1) ("cache_dir '%s' new Q1 value '%d'\n", diskdinfo->magic1);
}
+static void
+storeDiskdDirDumpQ1(StoreEntry * e, const char *option, SwapDir *sd)
+{
+ diskdinfo_t *diskdinfo = sd->fsdata;
+ storeAppendPrintf(e, " Q1=%d", diskdinfo->magic1);
+}
+
static void
storeDiskdDirParseQ2(SwapDir * sd, const char *name, const char *value, int reconfiguring)
{
debug(3, 1) ("cache_dir '%s' new Q2 value '%d'\n", diskdinfo->magic2);
}
+static void
+storeDiskdDirDumpQ2(StoreEntry * e, const char *option, SwapDir *sd)
+{
+ diskdinfo_t *diskdinfo = sd->fsdata;
+ storeAppendPrintf(e, " Q2=%d", diskdinfo->magic2);
+}
+
struct cache_dir_option options[] =
{
#if NOT_YET
- {"L1", storeDiskdDirParseL1},
- {"L2", storeDiskdDirParseL2},
+ {"L1", storeDiskdDirParseL1, storeDiskdDirDumpL1},
+ {"L2", storeDiskdDirParseL2, storeDiskdDirDumpL2},
#endif
- {"Q1", storeDiskdDirParseQ1},
- {"Q2", storeDiskdDirParseQ2},
+ {"Q1", storeDiskdDirParseQ1, storeDiskdDirDumpQ1},
+ {"Q2", storeDiskdDirParseQ2, storeDiskdDirDumpQ2},
{NULL, NULL}
};
}
void
-storeDiskdDirDump(StoreEntry * entry, const char *name, SwapDir * s)
+storeDiskdDirDump(StoreEntry * entry, SwapDir * s)
{
diskdinfo_t *diskdinfo = s->fsdata;
- storeAppendPrintf(entry, "%s %s %s %d %d %d\n",
- name,
- "diskd",
- s->path,
+ storeAppendPrintf(entry, " %d %d %d",
s->max_size >> 10,
diskdinfo->l1,
diskdinfo->l2);
+ dump_cachedir_options(entry, options, s);
}
/*
/*
- * $Id: store_dir_ufs.cc,v 1.33 2001/03/14 22:28:41 wessels Exp $
+ * $Id: store_dir_ufs.cc,v 1.34 2001/05/08 15:24:37 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
static struct cache_dir_option options[] =
{
#if NOT_YET_DONE
- {"L1", storeAufsDirParseL1},
- {"L2", storeAufsDirParseL2},
+ {"L1", storeUfsDirParseL1, storeUfsDirDumpL1},
+ {"L2", storeUfsDirParseL2, storeUfsDirDumpL2},
#endif
{NULL, NULL}
};
}
void
-storeUfsDirDump(StoreEntry * entry, const char *name, SwapDir * s)
+storeUfsDirDump(StoreEntry * entry, SwapDir * s)
{
ufsinfo_t *ufsinfo = (ufsinfo_t *) s->fsdata;
- storeAppendPrintf(entry, "%s %s %s %d %d %d\n",
- name,
- "ufs",
- s->path,
+ storeAppendPrintf(entry, " %d %d %d",
s->max_size >> 10,
ufsinfo->l1,
ufsinfo->l2);
+ dump_cachedir_options(entry, options, s);
}
/*
/*
- * $Id: protos.h,v 1.404 2001/05/05 17:49:55 hno Exp $
+ * $Id: protos.h,v 1.405 2001/05/08 15:24:35 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
extern void requirePathnameExists(const char *name, const char *path);
extern void parse_time_t(time_t * var);
extern void parse_cachedir_options(SwapDir * sd, struct cache_dir_option *options, int reconfiguring);
+extern void dump_cachedir_options(StoreEntry * e, struct cache_dir_option *options, SwapDir * sd);
/*
/*
- * $Id: structs.h,v 1.389 2001/05/04 13:37:42 hno Exp $
+ * $Id: structs.h,v 1.390 2001/05/08 15:24:35 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
struct cache_dir_option {
char *name;
void (*parse) (SwapDir * sd, const char *option, const char *value, int reconfiguring);
+ void (*dump) (StoreEntry * e, const char *option, SwapDir * sd);
};
/*
- * $Id: typedefs.h,v 1.127 2001/05/04 13:37:42 hno Exp $
+ * $Id: typedefs.h,v 1.128 2001/05/08 15:24:35 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
typedef void STINIT(SwapDir *);
typedef void STNEWFS(SwapDir *);
-typedef void STDUMP(StoreEntry *, const char *, SwapDir *);
+typedef void STDUMP(StoreEntry *, SwapDir *);
typedef void STFREE(SwapDir *);
typedef int STDBLCHECK(SwapDir *, StoreEntry *);
typedef void STSTATFS(SwapDir *, StoreEntry *);