From: wessels <> Date: Sat, 12 Oct 1996 01:53:09 +0000 (+0000) Subject: adding X-Git-Tag: SQUID_3_0_PRE1~5675 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d36b569d05019c180178cb7fa6cbc63df3337725;p=thirdparty%2Fsquid.git adding --- diff --git a/scripts/upgrade-1.0-store.pl b/scripts/upgrade-1.0-store.pl new file mode 100755 index 0000000000..7682ab3a53 --- /dev/null +++ b/scripts/upgrade-1.0-store.pl @@ -0,0 +1,143 @@ +#!/usr/local/bin/perl + +# $Id: upgrade-1.0-store.pl,v 1.1 1996/10/11 19:53:09 wessels Exp $ + +select(STDERR); $|=1; +select(STDOUT); $|=1; + +$USAGE="$0: swaplog cachedir1 cachedir2 ...\n"; + +$dry_run = 0; + +$swaplog = shift || die $USAGE; +(@cachedirs = @ARGV) || die $USAGE; +$ncache_dirs = $#cachedirs + 1; + +$OLD_SWAP_DIRECTORIES = 100; +$NEW_SWAP_DIRECTORIES_L1 = 16; +$NEW_SWAP_DIRECTORIES_L2 = 256; + +$EEXIST = 17; # check your /usr/include/errno.h + +print <; + +exit(1) unless ($ans =~ /^y$/ || $ans =~ /^yes$/); + +# make new directories +foreach $c (@cachedirs) { + $cn = "$c.new"; + &my_mkdir ($cn); + foreach $d1 (0..($NEW_SWAP_DIRECTORIES_L1-1)) { + $p1 = sprintf "$cn/%02X", $d1; + &my_mkdir ($p1); + foreach $d2 (0..($NEW_SWAP_DIRECTORIES_L2-1)) { + $p2 = sprintf "$p1/%02X", $d2; + &my_mkdir ($p2); + } + } +} + +$newlog = "$swaplog.1.1"; +open (newlog, ">$newlog") || die "$newlog: $!\n"; +select(newlog); $|=1; select(STDOUT); +open (swaplog) || die "$swaplog: $!\n"; +$count = 0; +while () { + chop; + ($file,$url,$expires,$timestamp,$size) = split; + @F = split('/', $file); + $oldfileno = pop @F; + $oldpath = &old_fileno_to_path($oldfileno); + unless (@S = stat($oldpath)) { + print "$oldpath: $!\n"; + next; + } + unless ($S[7] == $size) { + print "$oldpath: Wrong Size.\n"; + next; + } + $newpath = &new_fileno_to_path($oldfileno); + next unless &my_link($oldpath,$newpath); + printf newlog "%08x %08x %08x %08x %9d %s\n", + $oldfileno, + $timestamp, + $expires, + $timestamp, # lastmod + $size, + $url; + $count++; +} + + +print < $t\n"; + return 1 if ($dry_run); + unlink($t); + $rc = link ($f,$t); + warn "$t: $!\n" unless ($rc); + $rc; +}