diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1997-05-31 07:37:59 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1997-05-31 07:37:59 +0000 |
commit | f7771174e97d4eac514be2c99e18096850a74852 (patch) | |
tree | adec9217f0a7ae94b2f040fa3ab927a29added90 /usr.sbin/pstat | |
parent | 165607ca1ac4fc9ddeef1a37a3e584b31f9fddea (diff) |
Support for ext2fs vnodes.
Diffstat (limited to 'usr.sbin/pstat')
-rw-r--r-- | usr.sbin/pstat/pstat.c | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index 90c6d7f267d..5d6ed26c249 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pstat.c,v 1.8 1997/05/30 13:28:38 downsj Exp $ */ +/* $OpenBSD: pstat.c,v 1.9 1997/05/31 07:37:58 downsj Exp $ */ /* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 from: static char sccsid[] = "@(#)pstat.c 8.9 (Berkeley) 2/16/94"; #else -static char *rcsid = "$OpenBSD: pstat.c,v 1.8 1997/05/30 13:28:38 downsj Exp $"; +static char *rcsid = "$OpenBSD: pstat.c,v 1.9 1997/05/31 07:37:58 downsj Exp $"; #endif #endif /* not lint */ @@ -151,6 +151,8 @@ void ttymode __P((void)); void ttyprt __P((struct tty *)); void ufs_header __P((void)); int ufs_print __P((struct vnode *)); +void ext2fs_header __P((void)); +int ext2fs_print __P((struct vnode *)); void usage __P((void)); void vnode_header __P((void)); void vnode_print __P((struct vnode *, struct vnode *)); @@ -280,6 +282,9 @@ vnodemode() } else if (!strncmp(ST.f_fstypename, MOUNT_NFS, MFSNAMELEN)) { nfs_header(); + } else if (!strncmp(ST.f_fstypename, MOUNT_EXT2FS, + MFSNAMELEN)) { + ext2fs_header(); } (void)printf("\n"); } @@ -289,6 +294,9 @@ vnodemode() ufs_print(vp); } else if (!strncmp(ST.f_fstypename, MOUNT_NFS, MFSNAMELEN)) { nfs_print(vp); + } else if (!strncmp(ST.f_fstypename, MOUNT_EXT2FS, + MFSNAMELEN)) { + ext2fs_print(vp); } (void)printf("\n"); } @@ -419,6 +427,52 @@ ufs_print(vp) } void +ext2fs_header() +{ + (void)printf(" FILEID IFLAG SZ"); +} + +int +ext2fs_print(vp) + struct vnode *vp; +{ + register int flag; + struct inode inode, *ip = &inode; + char flagbuf[16], *flags = flagbuf; + char *name; + mode_t type; + + KGETRET(VTOI(vp), &inode, sizeof(struct inode), "vnode's inode"); + flag = ip->i_flag; + if (flag & IN_LOCKED) + *flags++ = 'L'; + if (flag & IN_WANTED) + *flags++ = 'W'; + if (flag & IN_RENAME) + *flags++ = 'R'; + if (flag & IN_UPDATE) + *flags++ = 'U'; + if (flag & IN_ACCESS) + *flags++ = 'A'; + if (flag & IN_CHANGE) + *flags++ = 'C'; + if (flag & IN_MODIFIED) + *flags++ = 'M'; + if (flag & IN_SHLOCK) + *flags++ = 'S'; + if (flag & IN_EXLOCK) + *flags++ = 'E'; + if (flag & IN_LWAIT) + *flags++ = 'Z'; + if (flag == 0) + *flags++ = '-'; + *flags = '\0'; + + (void)printf(" %6d %5s %2d", ip->i_number, flagbuf, ip->i_e2fs_size); + return (0); +} + +void nfs_header() { (void)printf(" FILEID NFLAG RDEV|SZ"); |