From 61ae57db5644ea213c5f6e71034a210758481548 Mon Sep 17 00:00:00 2001 From: mckusick Date: Thu, 6 Jul 2000 02:03:11 +0000 Subject: Teach fsck about snapshot files. These changes should have no effect on operation of fsck on filesystems without snapshots. If you get compilation errors, be sure that you have copies of /usr/include/sys/mount.h (1.94), /usr/include/sys/stat.h (1.21), and /usr/include/ufs/ffs/fs.h (1.16) as of July 4, 2000 or later. --- sbin/fsck_ffs/setup.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sbin/fsck_ffs/setup.c') diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 49bbc8d..6c4098c 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -82,6 +82,7 @@ setup(dev) havesb = 0; fswritefd = -1; + cursnapshot = 0; skipclean = fflag ? 0 : preen; if (stat(dev, &statb) < 0) { printf("Can't stat %s: %s\n", dev, strerror(errno)); @@ -89,9 +90,13 @@ setup(dev) } if ((statb.st_mode & S_IFMT) != S_IFCHR && (statb.st_mode & S_IFMT) != S_IFBLK) { - pfatal("%s is not a disk device", dev); - if (reply("CONTINUE") == 0) - return (0); + if ((statb.st_flags & SF_SNAPSHOT) != 0) { + cursnapshot = statb.st_ino; + } else { + pfatal("%s is not a disk device", dev); + if (reply("CONTINUE") == 0) + return (0); + } } if ((fsreadfd = open(dev, O_RDONLY)) < 0) { printf("Can't open %s: %s\n", dev, strerror(errno)); @@ -378,6 +383,8 @@ readsb(listerr) memmove(altsblock.fs_csp, sblock.fs_csp, sizeof sblock.fs_csp); altsblock.fs_maxcluster = sblock.fs_maxcluster; memmove(altsblock.fs_fsmnt, sblock.fs_fsmnt, sizeof sblock.fs_fsmnt); + memmove(altsblock.fs_snapinum, sblock.fs_snapinum, + sizeof sblock.fs_snapinum); memmove(altsblock.fs_sparecon, sblock.fs_sparecon, sizeof sblock.fs_sparecon); /* -- cgit v1.1