Module Name: src
Committed By: mlelstv
Date: Wed Sep 16 07:27:41 UTC 2009
Modified Files:
src/usr.sbin/pstat: pstat.c
Log Message:
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.114 -r1.115 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.114 src/usr.sbin/pstat/pstat.c:1.115
--- src/usr.sbin/pstat/pstat.c:1.114 Sat Apr 18 08:05:18 2009
+++ src/usr.sbin/pstat/pstat.c Wed Sep 16 07:27:41 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: pstat.c,v 1.114 2009/04/18 08:05:18 lukem Exp $ */
+/* $NetBSD: pstat.c,v 1.115 2009/09/16 07:27:41 mlelstv 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.114 2009/04/18 08:05:18 lukem Exp $");
+__RCSID("$NetBSD: pstat.c,v 1.115 2009/09/16 07:27:41 mlelstv 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
@@ -476,6 +477,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;
@@ -483,13 +485,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;
}