Hello community, here is the log from the commit of package dd_rescue for openSUSE:Factory checked in at 2012-05-29 10:33:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dd_rescue (Old) and /work/SRC/openSUSE:Factory/.dd_rescue.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dd_rescue", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/dd_rescue/dd_rescue.changes 2012-05-22 08:12:42.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.dd_rescue.new/dd_rescue.changes 2012-05-29 10:33:12.000000000 +0200 @@ -1,0 +2,8 @@ +Sat May 26 10:10:51 UTC 2012 - [email protected] + +- Update to version 1.28: + * Better defaults for hard and softblock sizes (4k/64k for + buffered I/O, 512/1M for direct IO). + * Copying of access times with the option -p fixed. + +------------------------------------------------------------------- Old: ---- dd_rescue-1.27.tar.gz New: ---- dd_rescue-1.28.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dd_rescue.spec ++++++ --- /var/tmp/diff_new_pack.1k96Zu/_old 2012-05-29 10:33:17.000000000 +0200 +++ /var/tmp/diff_new_pack.1k96Zu/_new 2012-05-29 10:33:17.000000000 +0200 @@ -16,13 +16,13 @@ # Name: dd_rescue -Version: 1.27 +Version: 1.28 Release: 0 Summary: Data Copying in the Presence of I/O Errors License: GPL-2.0 or GPL-3.0 Url: http://www.garloff.de/kurt/linux/ddrescue/ Group: System/Base -Source0: http://www.garloff.de/kurt/linux/ddrescue/%{name}-%{version}.tar.gz +Source0: http://garloff.de/kurt/linux/ddrescue/%{name}-%{version}.tar.gz BuildRequires: libfallocate-devel-static Requires: bc Recommends: dd_rhelp ++++++ dd_rescue-1.27.tar.gz -> dd_rescue-1.28.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue/Makefile new/dd_rescue/Makefile --- old/dd_rescue/Makefile 2012-04-27 23:16:25.000000000 +0200 +++ new/dd_rescue/Makefile 2012-05-19 22:46:14.000000000 +0200 @@ -1,8 +1,8 @@ # Makefile for dd_rescue # (c) [email protected], 99/10/09, GNU GPL -# $Id: Makefile,v 1.41 2012/04/27 21:08:49 garloff Exp $ +# $Id: Makefile,v 1.42 2012/05/19 20:46:14 garloff Exp $ -VERSION = 1.27 +VERSION = 1.28 DESTDIR = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue/README.dd_rescue new/dd_rescue/README.dd_rescue --- old/dd_rescue/README.dd_rescue 2012-05-17 21:39:34.000000000 +0200 +++ new/dd_rescue/README.dd_rescue 2012-05-19 22:52:36.000000000 +0200 @@ -119,7 +119,7 @@ previously.) * Support for direct I/O; this will circumvent kernel buffering and thus will expose medium errors right away. With - dd_rescue -b4k -B4k -d -D -A bdev bdev you will read a bdev and write + dd_rescue -d -D -A bdev bdev you will read a bdev and write things back to itself -- if some unreadable blocks are found, those will be filled with zeros -- the defect management of your hardware might result in all of your disk to be usable again afterwards, @@ -160,4 +160,4 @@ Kurt Garloff <[email protected]>, 2000-08-30 -$Id: README.dd_rescue,v 1.13 2012/05/17 19:39:34 garloff Exp $ +$Id: README.dd_rescue,v 1.14 2012/05/19 20:52:36 garloff Exp $ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue/dd_rescue.c new/dd_rescue/dd_rescue.c --- old/dd_rescue/dd_rescue.c 2012-05-17 21:32:02.000000000 +0200 +++ new/dd_rescue/dd_rescue.c 2012-05-19 22:46:14.000000000 +0200 @@ -1,5 +1,5 @@ -/* dd_rescue.c */ -/* +/** dd_rescue.c + * * dd_rescue copies your data from one file to another. Files might as well be * block devices, such as hd partitions. Unlike dd, it does not necessarily * abort on errors but continues to copy the disk, possibly leaving holes @@ -8,9 +8,12 @@ * for rescueing data of crashed disk, and that's the reason it has been * written by me. * - * Copyright (C) Kurt Garloff <[email protected]>, 11/1997 -- 01/2012 - * License: GNU GPL v2 or v3 + * Copyright (C) Kurt Garloff <[email protected]>, 11/1997 -- 05/2012 * + * Improvements from LAB Valentin, see + * http://www.kalysto.org/utilities/dd_rhelp/index.en.html + * + * License: GNU GPL v2 or v3 * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) @@ -25,13 +28,10 @@ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * - * Improvements from LAB Valentin, see - * http://www.tharbad.ath.cx/~vaab/kalysto/Utilities/dd_rhelp/dd_rhelp_en.html - */ +*/ -/* +/** * TODO: - * - Change default block sizes as suggested bz Jan Kara ... * - Provide options to copy ACLs/xattrs as well * - Use termcap to fetch cursor up/down codes * - Better handling of write errors: also try sub blocks @@ -49,16 +49,25 @@ # define "(unknown compiler)" #endif -#define ID "$Id: dd_rescue.c,v 1.129 2012/05/17 19:32:02 garloff Exp $" +#define ID "$Id: dd_rescue.c,v 1.130 2012/05/19 20:46:14 garloff Exp $" -#ifndef SOFTBLOCKSIZE -# define SOFTBLOCKSIZE 65536 +#ifndef BUF_SOFTBLOCKSIZE +# define BUF_SOFTBLOCKSIZE 65536 #endif -#ifndef HARDBLOCKSIZE -# define HARDBLOCKSIZE 512 +#ifndef BUF_HARDBLOCKSIZE +# define BUF_HARDBLOCKSIZE pagesize #endif +#ifndef DIO_SOFTBLOCKSIZE +# define DIO_SOFTBLOCKSIZE 1048576 +#endif + +#ifndef DIO_HARDBLOCKSIZE +# define DIO_HARDBLOCKSIZE 512 +#endif + + #define _GNU_SOURCE #define _LARGEFILE_SOURCE #define _FILE_OFFSET_BITS 64 @@ -126,6 +135,8 @@ struct timezone tz; clock_t startclock; +unsigned int pagesize = 4096; + #ifndef UP # define UP "\x1b[A" # define DOWN "\n" @@ -168,7 +179,7 @@ (float) (t2->tv_usec - t1->tv_usec) * 1e-6; } -/* Write to file and simultaneously log to logfdile, if existing */ +/** Write to file and simultaneously log to logfdile, if existing */ int fplog(FILE* const file, const char * const fmt, ...) { int ret = 0; @@ -228,7 +239,7 @@ return fdes; } -/* Checks whether files are seekable */ +/** Checks whether files are seekable */ static void check_seekable(const int id, const int od) { errno = 0; @@ -248,14 +259,14 @@ errno = 0; } -/* Calc position in graph */ +/** Calc position in graph */ inline int gpos(off_t off) { static const int glen = 40; //strlen(graph) - 2; return 1+(glen*off/ilen); } -/* Prepare graph */ +/** Prepare graph */ static void preparegraph() { if (!ilen || ipos > ilen) @@ -285,7 +296,7 @@ graph[off] = '-'; } -/* Tries to determine size of input file */ +/** Tries to determine size of input file */ void input_length() { struct stat stbuf; @@ -485,6 +496,37 @@ } } +int copyperm(int ifd, int ofd) +{ + int err; + mode_t fmode; + struct stat stbuf; + err = fstat(ifd, &stbuf); + if (err) + return err; + fmode = stbuf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX); + err = fchown(ofd, stbuf.st_uid, stbuf.st_gid); + if (err) + fmode &= ~(S_ISUID | S_ISGID); + err += fchmod(ofd, fmode); + return err; +} + +/** File time copy */ +int copytimes(const char* inm, const char* onm) +{ + int err; + struct stat stbuf; + struct utimbuf utbuf; + err = stat(inm, &stbuf); + if (err) + return err; + utbuf.actime = stbuf.st_atime; + utbuf.modtime = stbuf.st_mtime; + err = utime(onm, &utbuf); + return err; +} + static int mayexpandfile() { struct stat st; @@ -541,12 +583,14 @@ free(buf); if (graph) free(graph); + if (pres) + copytimes(iname, oname); if (oname) free(oname); return errs; } -/* is the block zero ? */ +/** is the block zero ? */ static int blockiszero(const unsigned char* blk, const int ln) { unsigned long* ptr = (unsigned long*)blk; @@ -905,37 +949,6 @@ } #endif -int copyperm(int ifd, int ofd) -{ - int err; - mode_t fmode; - struct stat stbuf; - err = fstat(ifd, &stbuf); - if (err) - return err; - fmode = stbuf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX); - err = fchown(ofd, stbuf.st_uid, stbuf.st_gid); - if (err) - fmode &= ~(S_ISUID | S_ISGID); - err += fchmod(ofd, fmode); - return err; -} - -/* File time copy */ -int copytimes(const char* inm, const char* onm) -{ - int err; - struct stat stbuf; - struct utimbuf utbuf; - err = stat(inm, &stbuf); - if (err) - return err; - utbuf.actime = stbuf.st_atime; - utbuf.modtime = stbuf.st_mtime; - err = utime(onm, &utbuf); - return err; -} - static off_t readint(const char* const ptr) { char *es; double res; @@ -981,8 +994,8 @@ fprintf(stderr, "USAGE: dd_rescue [options] infile outfile\n"); fprintf(stderr, "Options: -s ipos start position in input file (default=0),\n"); fprintf(stderr, " -S opos start position in output file (def=ipos),\n"); - fprintf(stderr, " -b softbs block size for copy operation (def=%i),\n", SOFTBLOCKSIZE ); - fprintf(stderr, " -B hardbs fallback block size in case of errs (def=%i),\n", HARDBLOCKSIZE ); + fprintf(stderr, " -b softbs block size for copy operation (def=%i, %i for -d),\n", BUF_SOFTBLOCKSIZE, DIO_SOFTBLOCKSIZE); + fprintf(stderr, " -B hardbs fallback block size in case of errs (def=%i, %i for -d),\n", BUF_HARDBLOCKSIZE, DIO_HARDBLOCKSIZE); fprintf(stderr, " -e maxerr exit after maxerr errors (def=0=infinite),\n"); fprintf(stderr, " -m maxxfer maximum amount of data to be transfered (def=0=inf),\n"); fprintf(stderr, " -y syncfrq frequency of fsync calls on outfile (def=512*softbs),\n"); @@ -1009,7 +1022,7 @@ fprintf(stderr, " -v verbose operation,\n"); fprintf(stderr, " -V display version and exit,\n"); fprintf(stderr, " -h display this help and exit.\n"); - fprintf(stderr, "Note: Sizes may be given in units b(=512), k(=1024), M(=1024^2) or G(1024^3) bytes\n"); + fprintf(stderr, "Sizes may be given in units b(=512), k(=1024), M(=1024^2) or G(1024^3) bytes\n"); fprintf(stderr, "This program is useful to rescue data in case of I/O errors, because\n"); fprintf(stderr, " it does not necessarily abort or truncate the output.\n"); } @@ -1054,7 +1067,7 @@ #endif /* defaults */ - softbs = SOFTBLOCKSIZE; hardbs = HARDBLOCKSIZE; + softbs = 0; hardbs = 0; /* marker for defaults */ maxerr = 0; ipos = (off_t)-1; opos = (off_t)-1; maxxfer = 0; reverse = 0; dotrunc = 0; abwrerr = 0; sparse = 0; nosparse = 0; verbose = 0; quiet = 0; interact = 0; force = 0; pres = 0; @@ -1066,6 +1079,10 @@ ides = -1; odes = -1; logfd = 0; nrerr = 0; buf = 0; i_chr = 0; o_chr = 0; +#ifdef _SC_PAGESIZE + pagesize = sysconf(_SC_PAGESIZE); +#endif + while ((c = getopt(argc, argv, ":rtfihqvVwaAdDkpPb:B:m:e:s:S:l:o:y:")) != -1) { switch (c) { case 'r': reverse = 1; break; @@ -1129,6 +1146,21 @@ logfd = fdopen(c, "a"); } + /* Defaults for blocksizes */ + if (softbs == 0) { + if (o_dir_in) + softbs = DIO_SOFTBLOCKSIZE; + else + softbs = BUF_SOFTBLOCKSIZE; + } + if (hardbs == 0) { + if (o_dir_in) + hardbs = DIO_HARDBLOCKSIZE; + else + hardbs = BUF_HARDBLOCKSIZE; + } + fplog(stderr, "dd_rescue: (info): Using softbs=%lu, hardbs=%lu\n", softbs, hardbs); + /* sanity checks */ #ifdef O_DIRECT if ((o_dir_in || o_dir_out) && hardbs < 512) { @@ -1140,7 +1172,7 @@ if (o_dir_in || o_dir_out) fplog(stderr, "dd_rescue: (warning): We don't handle misalignment of last block w/ O_DIRECT!\n"); -#endif +#endif if (softbs < hardbs) { fplog(stderr, "dd_rescue: (warning): setting hardbs from %i to softbs %i!\n", @@ -1148,11 +1180,6 @@ hardbs = softbs; } - if (hardbs <= 0) { - fplog(stderr, "dd_rescue: (fatal): you're crazy to set block size to %i!\n", hardbs); - cleanup(); exit(15); - } - /* Set sync frequency */ /* if (syncsz == -1) @@ -1167,7 +1194,7 @@ ipos = 0; #ifdef O_DIRECT - if (posix_memalign(&mp, sysconf(_SC_PAGESIZE), softbs)) { + if (posix_memalign(&mp, pagesize, softbs)) { fplog(stderr, "dd_rescue: (fatal): allocation of aligned buffer failed!\n"); cleanup(); exit(18); } @@ -1374,8 +1401,6 @@ gettimeofday(¤ttime, NULL); printreport(); cleanup(); - if (pres) - copytimes(iname, oname); return c; } -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
