Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3-0]: src/sbin/dump Pull up following revision(s) (requested by h...



details:   https://anonhg.NetBSD.org/src/rev/ceeef92e3ff7
branches:  netbsd-3-0
changeset: 579340:ceeef92e3ff7
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sat Nov 11 21:31:10 2006 +0000

description:
Pull up following revision(s) (requested by hannken in ticket #1573):
        sbin/dump/snapshot.h: revision 1.3 via patch
        sbin/dump/snapshot.c: revision 1.3 via patch
        sbin/dump/main.c: revision 1.63 via patch
        sbin/dump/tape.c: revision 1.47 via patch
        sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923  dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer%netbsd.org@localhost>

diffstat:

 sbin/dump/dump.h     |   3 ++-
 sbin/dump/main.c     |   9 ++++++---
 sbin/dump/snapshot.c |  16 +++++++++++++---
 sbin/dump/snapshot.h |   7 ++++---
 sbin/dump/tape.c     |   6 +++---
 5 files changed, 28 insertions(+), 13 deletions(-)

diffs (153 lines):

diff -r 126272ba6aea -r ceeef92e3ff7 sbin/dump/dump.h
--- a/sbin/dump/dump.h  Sat Nov 11 21:21:50 2006 +0000
+++ b/sbin/dump/dump.h  Sat Nov 11 21:31:10 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dump.h,v 1.39 2004/04/21 01:05:32 christos Exp $       */
+/*     $NetBSD: dump.h,v 1.39.4.1 2006/11/11 21:31:10 bouyer Exp $     */
 
 /*-
  * Copyright (c) 1980, 1993
@@ -91,6 +91,7 @@
  *     All calculations done in 0.1" units!
  */
 char   *disk;          /* name of the disk file */
+char   *disk_dev;      /* name of the raw device we are dumping */
 char   *tape;          /* name of the tape file */
 char   *dumpdates;     /* name of the file containing dump date information*/
 char   *temp;          /* name of the file for doing rewrite of dumpdates */
diff -r 126272ba6aea -r ceeef92e3ff7 sbin/dump/main.c
--- a/sbin/dump/main.c  Sat Nov 11 21:21:50 2006 +0000
+++ b/sbin/dump/main.c  Sat Nov 11 21:31:10 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.57.2.1 2005/04/21 19:04:34 tron Exp $       */
+/*     $NetBSD: main.c,v 1.57.2.1.2.1 2006/11/11 21:31:10 bouyer Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.6 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.57.2.1 2005/04/21 19:04:34 tron Exp $");
+__RCSID("$NetBSD: main.c,v 1.57.2.1.2.1 2006/11/11 21:31:10 bouyer Exp $");
 #endif
 #endif /* not lint */
 
@@ -272,6 +272,7 @@
         */
        getfstab();             /* /etc/fstab snarfed */
        disk = NULL;
+       disk_dev = NULL;
        mountpoint = NULL;
        dirc = 0;
        for (i = 0; i < argc; i++) {
@@ -428,7 +429,8 @@
                snap_internal = 0;
        }
        if (snap_backup != NULL || snap_internal) {
-               diskfd = snap_open(mntinfo->f_mntonname, snap_backup, &tnow);
+               diskfd = snap_open(mntinfo->f_mntonname, snap_backup,
+                   &tnow, &disk_dev);
                if (diskfd < 0) {
                        msg("Cannot open snapshot of %s\n",
                                mntinfo->f_mntonname);
@@ -440,6 +442,7 @@
                        msg("Cannot open %s\n", disk);
                        exit(X_STARTUP);
                }
+               disk_dev = disk;
        }
        sync();
 
diff -r 126272ba6aea -r ceeef92e3ff7 sbin/dump/snapshot.c
--- a/sbin/dump/snapshot.c      Sat Nov 11 21:21:50 2006 +0000
+++ b/sbin/dump/snapshot.c      Sat Nov 11 21:31:10 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: snapshot.c,v 1.2.2.3 2005/04/21 19:05:37 tron Exp $    */
+/*     $NetBSD: snapshot.c,v 1.2.2.3.2.1 2006/11/11 21:31:10 bouyer Exp $      */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -47,6 +47,7 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 
 #include "snapshot.h"
@@ -56,10 +57,11 @@
  * using the second argument as backing store and return an open file
  * descriptor for the snapshot.  If the second argument is NULL, use the first
  * as backing store.  If the third argument is not NULL, it gets the time the
- * snapshot was created.
+ * snapshot was created.  If the fourth argument is not NULL, it gets the
+ * snapshot device path.
  */
 int
-snap_open(char *mountpoint, char *backup, time_t *snap_date)
+snap_open(char *mountpoint, char *backup, time_t *snap_date, char **snap_dev)
 {
        int i, fd, israw, fsinternal, dounlink, flags;
        char path[MAXPATHLEN], fss_dev[14];
@@ -142,6 +144,14 @@
                        continue;
                }
 
+               if (snap_dev != NULL) {
+                       *snap_dev = strdup(fss_dev);
+                       if (*snap_dev == NULL) {
+                               ioctl(fd, FSSIOCCLR);
+                               goto fail;
+                       }
+               }
+
                flags |= FSS_UNCONFIG_ON_CLOSE;
                if (ioctl(fd, FSSIOCGET, &fsg) < 0 ||
                    ioctl(fd, FSSIOFSET, &flags) < 0 ||
diff -r 126272ba6aea -r ceeef92e3ff7 sbin/dump/snapshot.h
--- a/sbin/dump/snapshot.h      Sat Nov 11 21:21:50 2006 +0000
+++ b/sbin/dump/snapshot.h      Sat Nov 11 21:31:10 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: snapshot.h,v 1.2.2.3 2005/04/21 19:05:37 tron Exp $    */
+/*     $NetBSD: snapshot.h,v 1.2.2.3.2.1 2006/11/11 21:31:10 bouyer Exp $      */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -41,6 +41,7 @@
  * using the second argument as backing store and return an open file
  * descriptor for the snapshot.  If the second argument is NULL, use the first
  * as backing store.  If the third argument is not NULL, it gets the time the
- * snapshot was created.
+ * snapshot was created.  If the fourth argument is not NULL, it gets the
+ * snapshot device path.
  */
-int snap_open(char *, char *, time_t *);
+int snap_open(char *, char *, time_t *, char **);
diff -r 126272ba6aea -r ceeef92e3ff7 sbin/dump/tape.c
--- a/sbin/dump/tape.c  Sat Nov 11 21:21:50 2006 +0000
+++ b/sbin/dump/tape.c  Sat Nov 11 21:31:10 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tape.c,v 1.44 2004/08/08 09:46:16 lukem Exp $  */
+/*     $NetBSD: tape.c,v 1.44.4.1 2006/11/11 21:31:10 bouyer Exp $     */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)tape.c     8.4 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: tape.c,v 1.44 2004/08/08 09:46:16 lukem Exp $");
+__RCSID("$NetBSD: tape.c,v 1.44.4.1 2006/11/11 21:31:10 bouyer Exp $");
 #endif
 #endif /* not lint */
 
@@ -819,7 +819,7 @@
         * Need our own seek pointer.
         */
        (void) close(diskfd);
-       if ((diskfd = open(disk, O_RDONLY)) < 0)
+       if ((diskfd = open(disk_dev, O_RDONLY)) < 0)
                quit("slave couldn't reopen disk: %s\n", strerror(errno));
 
        /*



Home | Main Index | Thread Index | Old Index