diff options
author | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2007-03-16 03:23:32 +0000 |
---|---|---|
committer | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2007-03-16 03:23:32 +0000 |
commit | b51126da5288a21b3f4bcfcd68585c69e1ccacd7 (patch) | |
tree | be6e7c4c8c13702f1e5db1b6d654894f6af85ab6 /usr.sbin | |
parent | fa1abc314f0511b52e7f5b16850ac9491ec8a1e5 (diff) | |
download | src-b51126da5288a21b3f4bcfcd68585c69e1ccacd7.tar.gz src-b51126da5288a21b3f4bcfcd68585c69e1ccacd7.zip |
Pass special device to the ufs_disk_fillout() function, instead of mount
point path. This way we properly handle the case when file system listed
in /etc/fstab was unmounted and another file system was mounted on the
same mount point.
Notes
Notes:
svn path=/head/; revision=167626
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/snapinfo/snapinfo.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/usr.sbin/snapinfo/snapinfo.c b/usr.sbin/snapinfo/snapinfo.c index d0f3f2beb384..a4b1a13250c3 100644 --- a/usr.sbin/snapinfo/snapinfo.c +++ b/usr.sbin/snapinfo/snapinfo.c @@ -42,7 +42,7 @@ void find_inum(char *path); void usage(void); int compare_function(const char *, const struct stat *, int, struct FTW *); -int find_snapshot(char *path); +int find_snapshot(struct statfs *sfs); int verbose; int cont_search; @@ -92,29 +92,26 @@ main(int argc, char **argv) fscount = getmntinfo(&mntbuf, MNT_WAIT); for (n = 0; n < fscount; n++) { if (!strncmp(mntbuf[n].f_fstypename, "ufs", 3)) { - if (all) - path = mntbuf[n].f_mntonname; - else if (strcmp(path, mntbuf[n].f_mntonname)) - continue; - - find_snapshot(path); - done++; + if (all || strcmp(path, mntbuf[n].f_mntonname) == 0) { + find_snapshot(&mntbuf[n]); + done++; + } } } - if (!done) + if (done == 0) usage(); return (0); } int -find_snapshot(char *path) +find_snapshot(struct statfs *sfs) { struct uufsd disk; int j, snapcount = 0; - if (ufs_disk_fillout(&disk, path) == -1) + if (ufs_disk_fillout(&disk, sfs->f_mntfromname) == -1) perror("ufs_disk_fillout"); if (verbose) @@ -123,7 +120,7 @@ find_snapshot(char *path) for (j = 0; j < FSMAXSNAP; j++) { if (disk.d_fs.fs_snapinum[j]) { inode = disk.d_fs.fs_snapinum[j]; - find_inum(path); + find_inum(sfs->f_mntonname); snapcount++; } } |