From 2bd8a8a892101f0ecd86e523f911289e3aba6fbe Mon Sep 17 00:00:00 2001 From: wessels <> Date: Fri, 16 May 1997 13:43:46 +0000 Subject: [PATCH] - don't storeAddSwapDisk() again on reconfigure, instead call [new] storeReconfigureSwapDisk() --- src/cache_cf.cc | 7 +++++-- src/store_dir.cc | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 709035d296..a751ce4797 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $Id: cache_cf.cc,v 1.189 1997/05/15 23:30:58 wessels Exp $ + * $Id: cache_cf.cc,v 1.190 1997/05/16 07:43:54 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -877,7 +877,10 @@ parseCacheDir(void) if ((token = strtok(NULL, w_space))) if (!strcasecmp(token, "read-only")) readonly = 1; - storeAddSwapDisk(dir, size, l1, l2, readonly); + if (configured_once) + storeReconfigureSwapDisk(dir, size, l1, l2, readonly); + else + storeAddSwapDisk(dir, size, l1, l2, readonly); } int diff --git a/src/store_dir.cc b/src/store_dir.cc index 3598eb9593..ffeaff2aa5 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -69,6 +69,7 @@ storeAddSwapDisk(const char *path, int size, int l1, int l2, int read_only) xfree(SwapDirs); SwapDirs = tmp; } + debug(20,1,"Creating Swap Dir #%d in %s\n", ncache_dirs+1, path); tmp = SwapDirs + ncache_dirs; tmp->path = xstrdup(path); tmp->max_size = size; @@ -80,6 +81,21 @@ storeAddSwapDisk(const char *path, int size, int l1, int l2, int read_only) return ++ncache_dirs; } +void +storeReconfigureSwapDisk(const char *path, int size, int l1, int l2, int read_only) +{ + int i; + for (i = 0; i < ncache_dirs; i++) { + if (!strcmp(path, SwapDirs[i].path)) + break; + } + if (i == ncache_dirs) + return; + SwapDirs[i].max_size = size; + SwapDirs[i].read_only = read_only; + /* ignore the rest */ +} + static int storeVerifyOrCreateDir(const char *path) { -- 2.47.3