From: Stelian Pop Date: Fri, 16 Nov 2001 14:09:07 +0000 (+0000) Subject: Fixed the remote tape/file detection in restore. X-Git-Tag: release_0_4b25~4 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=80dea6355164a9c0231e8d7f4dcfb3fca0858f7d;p=dump.git Fixed the remote tape/file detection in restore. --- diff --git a/CHANGES b/CHANGES index a3d7952..7d31426 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.142 2001/11/13 12:11:05 stelian Exp $ +$Id: CHANGES,v 1.143 2001/11/16 14:09:07 stelian Exp $ Changes between versions 0.4b24 and 0.4b25 (released ??????????????????) ======================================================================== @@ -21,6 +21,14 @@ Changes between versions 0.4b24 and 0.4b25 (released ??????????????????) to Clemens Stiglechner for the patch. +6. Add the -l option to restore to specify if, when doing a + remote restore, the file used to access the backup is a + regular file (the defaults being a tape drive). Restore needs + to know this information when reading a remote compressed + dump. Previously, this information was autodetected, but + the autodetection code fails (with ioctl: Inappropriate ioctl + for device) when using a non Linux remote box. + Changes between versions 0.4b23 and 0.4b24 (released September 12, 2001) ======================================================================== diff --git a/restore/main.c b/restore/main.c index ad04968..8862d0d 100644 --- a/restore/main.c +++ b/restore/main.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.31 2001/11/13 12:11:42 stelian Exp $"; + "$Id: main.c,v 1.32 2001/11/16 14:09:07 stelian Exp $"; #endif /* not lint */ #include @@ -82,7 +82,7 @@ static const char rcsid[] = int bflag = 0, cvtflag = 0, dflag = 0, vflag = 0, yflag = 0; int hflag = 1, mflag = 1, Mflag = 0, Nflag = 0, Vflag = 0, zflag = 0; -int uflag = 0; +int uflag = 0, lflag = 0; int dokerberos = 0; char command = '\0'; long dumpnum = 1; @@ -158,7 +158,7 @@ main(int argc, char *argv[]) #ifdef KERBEROS "k" #endif - "mMN" + "lmMN" #ifdef USE_QFA "Q:" #endif @@ -214,6 +214,9 @@ main(int argc, char *argv[]) ch, command); command = ch; break; + case 'l': + lflag = 1; + break; case 'm': mflag = 0; break; @@ -280,7 +283,11 @@ main(int argc, char *argv[]) atexit(cleanup); - if (command == 'C' && inputdev[0] != '/' && strcmp(inputdev, "-")) { + if (command == 'C' && inputdev[0] != '/' && strcmp(inputdev, "-") +#ifdef RRESTORE + && !strchr(inputdev, ':') +#endif + ) { /* since we chdir into the directory we are comparing * to, we must retain the full tape path */ char wd[MAXPATHLEN], fullpathinput[MAXPATHLEN]; @@ -527,12 +534,12 @@ usage(void) (void)fprintf(stderr, "usage:\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n", - __progname, " -C [-c" kerbflag "MvVy] [-b blocksize] [-D filesystem] [-f file] [-F script] [-s fileno]", - __progname, " -i [-ch" kerbflag "mMuvVy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno]", - __progname, " -r [-c" kerbflag "MuvVy] [-b blocksize] [-f file] [-F script] [-s fileno] [-T directory]", - __progname, " -R [-c" kerbflag "MuvVy] [-b blocksize] [-f file] [-F script] [-s fileno] [-T directory]", - __progname, " -t [-ch" kerbflag "MuvVy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno] [-X filelist] [file ...]", - __progname, " -x [-ch" kerbflag "mMuvVy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno] [-X filelist] [file ...]"); + __progname, " -C [-c" kerbflag "lMvVy] [-b blocksize] [-D filesystem] [-f file] [-F script] [-s fileno]", + __progname, " -i [-ch" kerbflag "lmMuvVy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno]", + __progname, " -r [-c" kerbflag "lMuvVy] [-b blocksize] [-f file] [-F script] [-s fileno] [-T directory]", + __progname, " -R [-c" kerbflag "lMuvVy] [-b blocksize] [-f file] [-F script] [-s fileno] [-T directory]", + __progname, " -t [-ch" kerbflag "lMuvVy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno] [-X filelist] [file ...]", + __progname, " -x [-ch" kerbflag "lmMuvVy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno] [-X filelist] [file ...]"); exit(1); } diff --git a/restore/restore.8.in b/restore/restore.8.in index b838b1a..ced86a4 100644 --- a/restore/restore.8.in +++ b/restore/restore.8.in @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: restore.8.in,v 1.18 2001/11/10 23:51:00 stelian Exp $ +.\" $Id: restore.8.in,v 1.19 2001/11/16 14:09:07 stelian Exp $ .\" .Dd __DATE__ .Dt RESTORE 8 @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm restore .Fl C -.Op Fl ckMvVy +.Op Fl cklMvVy .Op Fl b Ar blocksize .Op Fl D Ar filesystem .Op Fl f Ar file @@ -49,7 +49,7 @@ .Op Fl T Ar directory .Nm restore .Fl i -.Op Fl chkmMNuvVy +.Op Fl chklmMNuvVy .Op Fl b Ar blocksize .Op Fl f Ar file .Op Fl F Ar script @@ -58,7 +58,7 @@ .Op Fl T Ar directory .Nm restore .Fl R -.Op Fl ckMNuvVy +.Op Fl cklMNuvVy .Op Fl b Ar blocksize .Op Fl f Ar file .Op Fl F Ar script @@ -66,7 +66,7 @@ .Op Fl T Ar directory .Nm restore .Fl r -.Op Fl ckMNuvVy +.Op Fl cklMNuvVy .Op Fl b Ar blocksize .Op Fl f Ar file .Op Fl F Ar script @@ -74,7 +74,7 @@ .Op Fl T Ar directory .Nm restore .Fl t -.Op Fl chkMNuvVy +.Op Fl chklMNuvVy .Op Fl b Ar blocksize .Op Fl f Ar file .Op Fl F Ar script @@ -85,7 +85,7 @@ .Op file ... .Nm restore .Fl x -.Op Fl chkmMNuvVy +.Op Fl chklmMNuvVy .Op Fl b Ar blocksize .Op Fl f Ar file .Op Fl F Ar script @@ -368,6 +368,13 @@ Extract the actual directory, rather than the files that it references. This prevents hierarchical restoration of complete subtrees from the dump. +.It Fl l +When doing remote restores, assume the remote file is a +regular file (instead of a tape device). If you're restoring +a remote compressed file, you will need to specify this +option or +.Nm restore +will fail to access it correctly. .It Fl m Extract by inode numbers rather than by file name. This is useful if only a few files are being extracted, diff --git a/restore/restore.h b/restore/restore.h index 8e35380..9f5b9c0 100644 --- a/restore/restore.h +++ b/restore/restore.h @@ -5,7 +5,7 @@ * Stelian Pop , 1999-2000 * Stelian Pop - AlcĂ´ve , 2000 * - * $Id: restore.h,v 1.18 2001/09/12 10:21:49 stelian Exp $ + * $Id: restore.h,v 1.19 2001/11/16 14:09:07 stelian Exp $ */ /* @@ -55,6 +55,7 @@ extern int cvtflag; /* convert from old to new tape format */ extern int bflag; /* set input block size */ extern int dflag; /* print out debugging info */ extern int hflag; /* restore heirarchies */ +extern int lflag; /* assume remote filename is a regular file */ extern int mflag; /* restore by name instead of inode number */ extern int Mflag; /* multi-volume restore */ extern int Vflag; /* multi-volume on a single device like CDROM */ diff --git a/restore/tape.c b/restore/tape.c index 344ca3b..cd133cb 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -46,7 +46,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.47 2001/09/12 10:21:49 stelian Exp $"; + "$Id: tape.c,v 1.48 2001/11/16 14:09:07 stelian Exp $"; #endif /* not lint */ #include @@ -1929,7 +1929,7 @@ setmagtapein(void) { /* need to know if input is really from a tape */ #ifdef RRESTORE if (host) - magtapein = rmtioctl(MTNOP, 1) != -1; + magtapein = !lflag; else #endif magtapein = ioctl(mt, MTIOCGET, (char *)&mt_stat) == 0;