summaryrefslogtreecommitdiffstats
path: root/usr.bin/fstat
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2002-09-14 18:51:10 +0000
committernjl <njl@FreeBSD.org>2002-09-14 18:51:10 +0000
commit72ca599da8f5817cafe0a099badc41c9ee3dd5d4 (patch)
treeee5a1f2c7c4df6a65881f254e38b8c4670108428 /usr.bin/fstat
parentc14b63a0b916969d4bd1cdaa0e58a7761edeab74 (diff)
downloadFreeBSD-src-72ca599da8f5817cafe0a099badc41c9ee3dd5d4.zip
FreeBSD-src-72ca599da8f5817cafe0a099badc41c9ee3dd5d4.tar.gz
Userland changes to go with vnode->v_tag change.
Diffstat (limited to 'usr.bin/fstat')
-rw-r--r--usr.bin/fstat/fstat.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
index 4d1c10f..38736ff 100644
--- a/usr.bin/fstat/fstat.c
+++ b/usr.bin/fstat/fstat.c
@@ -474,7 +474,7 @@ vtrans(vp, i, flag)
{
struct vnode vn;
struct filestat fst;
- char rw[3], mode[15];
+ char rw[3], mode[15], tagstr[12], *tagptr;
const char *badtype, *filename;
filename = badtype = NULL;
@@ -483,42 +483,37 @@ vtrans(vp, i, flag)
(void *)vp, Pid);
return;
}
- if (vn.v_type == VNON || vn.v_tag == VT_NON)
+ if (!KVM_READ(&vp->v_tag, &tagptr, sizeof tagptr) ||
+ !KVM_READ(tagptr, tagstr, sizeof tagstr)) {
+ dprintf(stderr, "can't read v_tag at %p for pid %d\n",
+ (void *)vp, Pid);
+ return;
+ }
+ tagstr[sizeof(tagstr) - 1] = '\0';
+ if (vn.v_type == VNON)
badtype = "none";
else if (vn.v_type == VBAD)
badtype = "bad";
- else
- switch (vn.v_tag) {
- case VT_UFS:
+ else {
+ if (!strcmp("ufs", tagstr)) {
if (!ufs_filestat(&vn, &fst))
badtype = "error";
- break;
-
- case VT_DEVFS:
+ } else if (!strcmp("devfs", tagstr)) {
if (!devfs_filestat(&vn, &fst))
badtype = "error";
- break;
-
- case VT_NFS:
+ } else if (!strcmp("nfs", tagstr)) {
if (!nfs_filestat(&vn, &fst))
badtype = "error";
- break;
-
- case VT_MSDOSFS:
+ } else if (!strcmp("msdosfs", tagstr)) {
if (!msdosfs_filestat(&vn, &fst))
badtype = "error";
- break;
-
- case VT_ISOFS:
+ } else if (!strcmp("isofs", tagstr)) {
if (!isofs_filestat(&vn, &fst))
badtype = "error";
- break;
-
- default: {
- static char unknown[10];
- sprintf(unknown, "?(%x)", vn.v_tag);
+ } else {
+ static char unknown[32];
+ snprintf(unknown, sizeof unknown, "?(%s)", tagstr);
badtype = unknown;
- break;;
}
}
if (checkfile) {
OpenPOWER on IntegriCloud