]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Generalized how cache_dir lines are dumped on mgr:config
authorhno <>
Tue, 8 May 2001 21:24:34 +0000 (21:24 +0000)
committerhno <>
Tue, 8 May 2001 21:24:34 +0000 (21:24 +0000)
doc/Programming-Guide/prog-guide.sgml
src/cache_cf.cc
src/fs/aufs/store_dir_aufs.cc
src/fs/coss/store_dir_coss.cc
src/fs/diskd/store_dir_diskd.cc
src/fs/ufs/store_dir_ufs.cc
src/protos.h
src/structs.h
src/typedefs.h

index d699293201a0d8cb32e5b53887f3d14d9322a282..8c5f510560bf20ee6b91876b26b3d38b215bb437 100644 (file)
@@ -2,7 +2,7 @@
 <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
@@ -990,15 +990,16 @@ Squid consists of the following major components
        <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
 
index 563d67a688d0cb9947f304b4bbc1a6a78692e0e0..22fc67b23b67b7bd7c4ae66dbf38cc4c929599d2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -55,6 +55,7 @@ static const char *const B_MBYTES_STR = "MB";
 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);
@@ -888,6 +889,16 @@ free_http_header_replace(header_mangler header[])
     }
 }
 
+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)
 {
@@ -895,7 +906,11 @@ 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");
     }
 }
 
@@ -1098,6 +1113,13 @@ parse_cachedir_option_readonly(SwapDir * sd, const char *option, const char *val
     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)
 {
@@ -1114,10 +1136,17 @@ parse_cachedir_option_maxsize(SwapDir * sd, const char *option, const char *valu
     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}
 };
 
index 09af0ea573055688bda1791af7d544ce89877b87..d542e2114bdd3f8824686e6c9c6dd41616c5b380 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -1493,8 +1493,8 @@ storeAufsDirStats(SwapDir * SD, StoreEntry * sentry)
 static struct cache_dir_option options[] =
 {
 #if NOT_YET_DONE
-    {"L1", storeAufsDirParseL1},
-    {"L2", storeAufsDirParseL2},
+    {"L1", storeAufsDirParseL1, storeAufsDirDumpL1},
+    {"L2", storeAufsDirParseL2, storeAufsDirDumpL2},
 #endif
     {NULL, NULL}
 };
@@ -1540,16 +1540,14 @@ storeAufsDirReconfigure(SwapDir * sd, int index, char *path)
 }
 
 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);
 }
 
 /*
index 7982c0c3866448d74adbdac756ff293da3fc51cb..660b2dbb3739ea1f874ce623622dc1b1503432e5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -793,13 +793,11 @@ storeCossDirReconfigure(SwapDir * sd, int index, char *path)
 }
 
 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
index 6b507c17ba27f0c0dab3ca6e451b479c08b755e8..944c3a89381b98ac1060ca66e1626037bce6f635 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -1713,6 +1713,13 @@ storeDiskdDirParseQ1(SwapDir * sd, const char *name, const char *value, int reco
        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)
 {
@@ -1723,14 +1730,21 @@ storeDiskdDirParseQ2(SwapDir * sd, const char *name, const char *value, int reco
        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}
 };
 
@@ -1772,16 +1786,14 @@ storeDiskdDirReconfigure(SwapDir * sd, int index, char *path)
 }
 
 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);
 }
 
 /*
index 8bc298457c6db5dbc24e1ac98bc5d1b8ac1d3fb1..937b4974bddbf29a29576ff9949eeb2fe1dba89d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -1475,8 +1475,8 @@ storeUfsDirStats(SwapDir * SD, StoreEntry * sentry)
 static struct cache_dir_option options[] =
 {
 #if NOT_YET_DONE
-    {"L1", storeAufsDirParseL1},
-    {"L2", storeAufsDirParseL2},
+    {"L1", storeUfsDirParseL1, storeUfsDirDumpL1},
+    {"L2", storeUfsDirParseL2, storeUfsDirDumpL2},
 #endif
     {NULL, NULL}
 };
@@ -1520,16 +1520,14 @@ storeUfsDirReconfigure(SwapDir * sd, int index, char *path)
 }
 
 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);
 }
 
 /*
index d2cf7b02a79bcded0c41b2abec05ee5b740bb483..78ad5a001b60eeb9abaf02a05b86df53cc2e996e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -94,6 +94,7 @@ extern void parse_wordlist(wordlist ** list);
 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);
 
 
 /*
index e7e073bb91b9e12853e6e7046795ccbd0c712190..aaa905eefa73425d5303926dfb7593f1ad19dcbe 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -2110,4 +2110,5 @@ struct _Logfile {
 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);
 };
index f91598b52fdef2d4a7411f9a87ef1403ab288f6d..6c5db0ee8780e82c8409a87bd4f6ddcf75368b7d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -252,7 +252,7 @@ typedef void IDNSCB(void *, rfc1035_rr *, int);
 
 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 *);