diff options
author | mckusick <mckusick@FreeBSD.org> | 2000-07-06 02:03:11 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2000-07-06 02:03:11 +0000 |
commit | 61ae57db5644ea213c5f6e71034a210758481548 (patch) | |
tree | 5bfded644e81cd5a948de9bc77c23fea5fb4c941 /sbin/fsck_ffs/setup.c | |
parent | fc37193d7575813e332e1faffa470fe104a69c99 (diff) | |
download | FreeBSD-src-61ae57db5644ea213c5f6e71034a210758481548.zip FreeBSD-src-61ae57db5644ea213c5f6e71034a210758481548.tar.gz |
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.
Diffstat (limited to 'sbin/fsck_ffs/setup.c')
-rw-r--r-- | sbin/fsck_ffs/setup.c | 13 |
1 files changed, 10 insertions, 3 deletions
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); /* |