diff -r mbuffer-20010628/CHANGES mbuffer-20010702/CHANGES 0a1,6 > 20010702: > - corrected message for mem-allocation > - added warning message for certain multi-volume use > - enhanced debugging messages > - (hopefully) last bugfix for multi-volume code > diff -r mbuffer-20010628/README mbuffer-20010702/README 53a54 > This code is known to not compile on Tru64. diff -r mbuffer-20010628/configure mbuffer-20010702/configure 648c648 < VERSION=20010628 --- > VERSION=20010702 diff -r mbuffer-20010628/configure.in mbuffer-20010702/configure.in 12c12 < VERSION=20010628 --- > VERSION=20010702 diff -r mbuffer-20010628/mbuffer.1.in mbuffer-20010702/mbuffer.1.in 46c46 < use blocksize of device for output (needed for some devices) --- > use blocksize of device for output (needed for some devices, slows output down) diff -r mbuffer-20010628/mbuffer.c mbuffer-20010702/mbuffer.c 30c30 < Numblocks = 256; --- > Numblocks = 256, Outblocksize = 0; 124c124 < out = (float)(((long long) Numout * Blocksize) >> 10) / diff; --- > out = (float)((Numout * Blocksize) >> 10) / diff; 185c185 < out = (float)(((long long) Numout * Blocksize) >> 10) / diff; --- > out = (float)((Numout * Blocksize) >> 10) / diff; 188c188 < diff, out ); --- > diff, out); 277a278 > debugmsg("requesting new output volume\n"); 288a290,309 > > void checkIncompleteOutput() > { > static int mulretry = 0; /* well this isn't really good design, > but better than a global variable */ > > debugmsg("Outblocksize = %i, mulretry = %i\n",Outblocksize,mulretry); > if ((0 != mulretry) || (0 == Outblocksize)) { > requestOutputVolume(); > debugmsg("resetting outputsize to normal\n"); > if (0 != mulretry) { > Outsize = mulretry; > mulretry = 0; > } > } else { > debugmsg("setting to new outputsize (end of device)\n"); > mulretry = Outsize; > Outsize = Outblocksize; > } > } 293c314 < int at = 0, err, fill, num, rest; --- > int at = 0, err, fill, rest; 303d323 < num = 0; 317d336 < debugmsg("outputThread: write %i\n",-num); 319c338,339 < err = write(Out,Buffer[at] + num, rest > Outsize ? Outsize : rest ); --- > err = write(Out,Buffer[at] + Blocksize - rest, rest > Outsize ? Outsize : rest); > debugmsg("outputThread: write(Out,Buffer[%i]+%i,%i) = %i\t(rest = %i)\n",at,Blocksize - rest,rest > Outsize ? Outsize : rest, err, rest); 322c342,345 < requestOutputVolume(); --- > /* request a new volume - but first check > * wheather we are really at the > * end of the device */ > checkIncompleteOutput(); 451d473 < "WARNING : multi-volume code is supposed to be buggy for big devices\n" 638c660 < infomsg("mapping temporary file to memory with %i blocks with %i byte (%i kB total)...\n",Numblocks,Blocksize,Numblocks*Blocksize/1024); --- > infomsg("mapping temporary file to memory with %i blocks with %Lu byte (%Lu kB total)...\n",Numblocks,Blocksize,(Numblocks*Blocksize) >> 10); 661c683 < infomsg("allocating memory for %i blocks with %i byte (%i kB total)...\n",Numblocks,Blocksize,Numblocks*Blocksize/1024); --- > infomsg("allocating memory for %i blocks with %Lu byte (%Lu kB total)...\n",Numblocks,Blocksize,(Numblocks*Blocksize) >> 10); 698,712c720,738 < if (setOutsize) { < debugmsg("checking blocksize for output...\n"); < if (-1 == fstat(Out,&st)) < fatal("could not stat output: %s\n",strerror(errno)); < if ((st.st_mode & S_IFBLK) || (st.st_mode & S_IFCHR)) { < infomsg("blocksize on output device is %i\n",st.st_blksize); < if (Blocksize%st.st_blksize != 0) < warningmsg("Blocksize should be a multiple of the blocksize of the output device (is %i)!\n",st.st_blksize); < if (Blocksize > st.st_blksize) { < infomsg("setting output blocksize to %i\n",st.st_blksize); < Outsize = st.st_blksize; < } < } else < infomsg("no device on output stream\n"); < } --- > debugmsg("checking output device...\n"); > if (-1 == fstat(Out,&st)) > fatal("could not stat output: %s\n",strerror(errno)); > if ((st.st_mode & S_IFBLK) || (st.st_mode & S_IFCHR)) { > infomsg("blocksize is %i bytes on output device\n",st.st_blksize); > if (Blocksize%st.st_blksize != 0) > warningmsg("Blocksize should be a multiple of the blocksize of the output device (is %i)!\n" > "This can cause corrupt data when writing to mulple volumes...\n",st.st_blksize); > Outblocksize = st.st_blksize; > if ((setOutsize) && (Blocksize > st.st_blksize)) { > infomsg("setting output blocksize to %i\n",st.st_blksize); > Outsize = st.st_blksize; > } > } else > infomsg("no device on output stream\n"); > #elif MULTIVOLUME > warningmsg("Could not stat output device (unsupported by system)!\n" > "This can result in incorrect written data when\n" > "using multiple volumes. Continue at your own risc!\n");