Module Name: src
Committed By: snj
Date: Sat Sep 26 19:02:27 UTC 2009
Modified Files:
src/usr.sbin/pstat [netbsd-5]: pstat.c
Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1019):
usr.sbin/pstat/pstat.c: revision 1.115
Distinguish between UFS1 and UFS2 inodes by reading the ufsmount structure,
the previous heuristic of comparing the size fields of inode and dinode
failed.
To generate a diff of this commit:
cvs rdiff -u -r1.110.4.2 -r1.110.4.3 src/usr.sbin/pstat/pstat.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/pstat/pstat.c
diff -u src/usr.sbin/pstat/pstat.c:1.110.4.2 src/usr.sbin/pstat/pstat.c:1.110.4.3
--- src/usr.sbin/pstat/pstat.c:1.110.4.2 Sun Mar 15 20:24:55 2009
+++ src/usr.sbin/pstat/pstat.c Sat Sep 26 19:02:27 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: pstat.c,v 1.110.4.2 2009/03/15 20:24:55 snj Exp $ */
+/* $NetBSD: pstat.c,v 1.110.4.3 2009/09/26 19:02:27 snj Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)pstat.c 8.16 (Berkeley) 5/9/95";
#else
-__RCSID("$NetBSD: pstat.c,v 1.110.4.2 2009/03/15 20:24:55 snj Exp $");
+__RCSID("$NetBSD: pstat.c,v 1.110.4.3 2009/09/26 19:02:27 snj Exp $");
#endif
#endif /* not lint */
@@ -52,11 +52,12 @@
#include <sys/ucred.h>
#include <stdbool.h>
#define _KERNEL
-#include <sys/file.h>
-#include <ufs/ufs/inode.h>
#define NFS
#include <sys/mount.h>
#undef NFS
+#include <sys/file.h>
+#include <ufs/ufs/inode.h>
+#include <ufs/ufs/ufsmount.h>
#include <sys/uio.h>
#include <miscfs/genfs/layer.h>
#undef _KERNEL
@@ -467,6 +468,7 @@
struct ufs1_dinode dp1;
struct ufs2_dinode dp2;
} dip;
+ struct ufsmount ump;
char flags[sizeof(ufs_flags) / sizeof(ufs_flags[0])];
char dev[4 + 1 + 7 + 1]; /* 12bit marjor + 20bit minor */
char *name;
@@ -474,13 +476,15 @@
dev_t rdev;
KGETRET(VTOI(vp), &inode, sizeof(struct inode), "vnode's inode");
- KGETRET(ip->i_din.ffs1_din, &dip, sizeof (struct ufs1_dinode),
- "inode's dinode");
+ KGETRET(ip->i_ump, &ump, sizeof(struct ufsmount),
+ "vnode's mount point");
- if (ip->i_size == dip.dp1.di_size)
+ if (ump.um_fstype == UFS1) {
+ KGETRET(ip->i_din.ffs1_din, &dip, sizeof (struct ufs1_dinode),
+ "inode's dinode");
rdev = dip.dp1.di_rdev;
- else {
- KGETRET(ip->i_din.ffs1_din, &dip, sizeof (struct ufs2_dinode),
+ } else {
+ KGETRET(ip->i_din.ffs2_din, &dip, sizeof (struct ufs2_dinode),
"inode's UFS2 dinode");
rdev = dip.dp2.di_rdev;
}