summaryrefslogtreecommitdiff
path: root/usr.bin/fstat/fstat.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>1998-09-06 22:48:47 +0000
committerArtur Grabowski <art@cvs.openbsd.org>1998-09-06 22:48:47 +0000
commit4215a296701c19482a05b676f9b821a745d1fbbb (patch)
tree10897a101c31426c38e5d9a87627872f8f4d2ec4 /usr.bin/fstat/fstat.c
parentca298332c9649c2500f0e4f3d94401193db3349c (diff)
understand XFS nodes
Diffstat (limited to 'usr.bin/fstat/fstat.c')
-rw-r--r--usr.bin/fstat/fstat.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
index 9327cb36c88..c1609b062e0 100644
--- a/usr.bin/fstat/fstat.c
+++ b/usr.bin/fstat/fstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fstat.c,v 1.17 1998/07/09 20:28:00 mickey Exp $ */
+/* $OpenBSD: fstat.c,v 1.18 1998/09/06 22:48:46 art 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.17 1998/07/09 20:28:00 mickey Exp $";
+static char *rcsid = "$OpenBSD: fstat.c,v 1.18 1998/09/06 22:48:46 art Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -70,6 +70,8 @@ static char *rcsid = "$OpenBSD: fstat.c,v 1.17 1998/07/09 20:28:00 mickey Exp $"
#include <nfs/nfsnode.h>
#undef NFS
+#include <xfs/xfs_node.h>
+
#include <net/route.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -399,6 +401,10 @@ vtrans(vp, i, flag)
if (!msdos_filestat(&vn, &fst))
badtype = "error";
break;
+ case VT_XFS:
+ if (!xfs_filestat(&vn, &fst))
+ badtype = "error";
+ break;
default: {
static char unknown[30];
sprintf(badtype = unknown, "?(%x)", vn.v_tag);
@@ -571,6 +577,25 @@ nfs_filestat(vp, fsp)
return 1;
}
+int
+xfs_filestat(vp, fsp)
+ struct vnode *vp;
+ struct filestat *fsp;
+{
+ struct xfs_node xfs_node;
+
+ if (!KVM_READ(VNODE_TO_XNODE(vp), &xfs_node, sizeof (xfs_node))) {
+ dprintf("can't read xfs_node at %p for pid %d", VTOI(vp), Pid);
+ return 0;
+ }
+ fsp->fsid = xfs_node.attr.va_fsid;
+ fsp->fileid = (long)xfs_node.attr.va_fileid;
+ fsp->mode = xfs_node.attr.va_mode;
+ fsp->size = xfs_node.attr.va_size;
+ fsp->rdev = xfs_node.attr.va_rdev;
+
+ return 1;
+}
char *
getmnton(m)