diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1997-05-30 12:27:51 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1997-05-30 12:27:51 +0000 |
commit | 50c743d51677122798793c287001e7531a4b66b2 (patch) | |
tree | a309358b36329dcbbcc2d9eb3436417713c808d2 /usr.bin/fstat | |
parent | d5f09135a1c85f461033b440191a050b1e817f4b (diff) |
Fix FFS and add ext2fs support.
Diffstat (limited to 'usr.bin/fstat')
-rw-r--r-- | usr.bin/fstat/fstat.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index b674c8e2efa..85afe667f77 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fstat.c,v 1.8 1997/01/15 23:42:30 millert Exp $ */ +/* $OpenBSD: fstat.c,v 1.9 1997/05/30 12:27:50 downsj Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -41,7 +41,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)fstat.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$OpenBSD: fstat.c,v 1.8 1997/01/15 23:42:30 millert Exp $"; +static char *rcsid = "$OpenBSD: fstat.c,v 1.9 1997/05/30 12:27:50 downsj Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -146,7 +146,7 @@ int maxfiles; kvm_t *kd; -int ufs_filestat(), nfs_filestat(); +int ufs_filestat(), ext2fs_filestat(), nfs_filestat(); void dofiles(), getinetproto(), socktrans(); void usage(), vtrans(); @@ -400,9 +400,6 @@ vtrans(vp, i, flag) else switch (vn.v_tag) { case VT_UFS: - if (!ufs_filestat(&vn, &fst)) - badtype = "error"; - break; case VT_MFS: if (!ufs_filestat(&vn, &fst)) badtype = "error"; @@ -411,6 +408,10 @@ vtrans(vp, i, flag) if (!nfs_filestat(&vn, &fst)) badtype = "error"; break; + case VT_EXT2FS: + if (!ext2fs_filestat(&vn, &fst)) + badtype = "error"; + break; default: { static char unknown[20]; sprintf(badtype = unknown, "?(%x)", vn.v_tag); @@ -488,9 +489,30 @@ ufs_filestat(vp, fsp) } fsp->fsid = inode.i_dev & 0xffff; fsp->fileid = (long)inode.i_number; - fsp->mode = (mode_t)inode.i_mode; - fsp->size = (u_long)inode.i_size; - fsp->rdev = inode.i_rdev; + fsp->mode = (mode_t)inode.i_ffs_mode; + fsp->size = (u_long)inode.i_ffs_size; + fsp->rdev = inode.i_ffs_rdev; + + return 1; +} + +int +ext2fs_filestat(vp, fsp) + struct vnode *vp; + struct filestat *fsp; +{ + struct inode inode; + + if (!KVM_READ(VTOI(vp), &inode, sizeof (inode))) { + dprintf(stderr, "can't read inode at %x for pid %d\n", + VTOI(vp), Pid); + return 0; + } + fsp->fsid = inode.i_dev & 0xffff; + fsp->fileid = (long)inode.i_number; + fsp->mode = (mode_t)inode.i_e2fs_mode; + fsp->size = (u_long)inode.i_e2fs_size; + fsp->rdev = 0; /* XXX */ return 1; } |