change size of cycbuff

Yury July july at mtu.ru
Fri Dec 3 19:31:00 UTC 1999


> Hello,
> 
> This is embarrassing. I have created cycbuffs of 10 GB size,
> but I accidentially specified a length of 20 GB in cycbuff.conf.
> Can I go ahead and decrease the length field in cycbuff.conf, or
> will I run into trouble ? I don_t want to lose the data in those
> buffers. They have reached 7 GB now :-)
> 
> Thanks,
> 
> Michael


Yes, you can safely reduce your cycbuff, but don't forget to
change it's header with cnfsheadconf utility.
(e.g. cnfsheadconf -w -c BIG1 ).
You'll have to convert your new cycbuff length into big hex string
somehow or apply the following patch to cnfsheadconf and
just supply decimal number of bytes when it prompts like this:
Lena [34505914368 (0000000808b67800)] =>

By the way, wy not to make cnfsheadconf to deal with more
convinient decimal values by default in -current? 


--------------------------------------------------------------------
70a71,95
> sub hex2bint {
> 
>     my $d = shift; 
>     my $o = 0;
> 
>     while ($d > 0) {
>         my $h = bmod("$d",'16');
>         $d = bdiv("$d",'16');
>         $h =~ s/^\+//;
>         $h='a' if $h eq '10';
>         $h='b' if $h eq '11';
>         $h='c' if $h eq '12';
>         $h='d' if $h eq '13';
>         $h='e' if $h eq '14';
>         $h='f' if $h eq '15';
>         $h =~ s/^\+//;
>         $o="$h$o";  
>     }
> 
>     return "$o";
> }
> 
> 
> 
> 
251c276
<     my($free) = hex($freea);
---
>     my($free) = bhex($freea);
282c307,314
<       print "Free [$freea (len = $lena) ] => ";
---
>       print "Lena [$len ($lena)] => ";
>       $in = <>;
>       chop $in;
>       if ($in ne "") {
>             $in=hex2bint($in);
>           $lena = sprintf("%0.17s\0", $in);
>       }
>       print "Free [$free (freea = $freea) ] => ";
--------------------------------------------------------------------


----------------------------
/* cc -O -o /usr/local/bin/trunc trunc.c */
#include <unistd.h>
#include <sys/param.h>

main (int argc,char**argv) {
  off_t o=-1;

  if(argc<2){

     printf("usage: %s <file-name> <bytes>\n",argv[0]);
     exit(1);
  }
  sscanf(argv[2], "%qu", &o);
  printf("trunc %s %qu\n",argv[1], o);
  truncate(argv[1], o );

}
----------------------------

-- 
Regards,
Yury July


More information about the inn-workers mailing list