diff options
author | Pedro Martelletto <pedro@cvs.openbsd.org> | 2005-12-17 13:56:03 +0000 |
---|---|---|
committer | Pedro Martelletto <pedro@cvs.openbsd.org> | 2005-12-17 13:56:03 +0000 |
commit | e38aaba8f021e6def58a61effa27cb8f5d2016d9 (patch) | |
tree | 78491aa5b6f11214545647b5b29de21ef9789e13 /usr.bin/fstat/fstat.c | |
parent | 0d772ba1a2978d65a104b1e7715edea2ea7f6d2b (diff) |
Remove the 'on disk' inode (dinode) from the 'in memory' inode in UFS.
Instead of having the dinode inside the inode structure itself, we now
have just a pointer to it, and use a separate pool to allocate dinodes
as needed. Inspiration from FreeBSD, various testing for a while, thanks.
Diffstat (limited to 'usr.bin/fstat/fstat.c')
-rw-r--r-- | usr.bin/fstat/fstat.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index 32c0fdd71b2..fbd81584673 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fstat.c,v 1.53 2005/12/13 22:21:02 mickey Exp $ */ +/* $OpenBSD: fstat.c,v 1.54 2005/12/17 13:56:02 pedro Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -37,7 +37,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.53 2005/12/13 22:21:02 mickey Exp $"; +static char *rcsid = "$OpenBSD: fstat.c,v 1.54 2005/12/17 13:56:02 pedro Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -509,12 +509,22 @@ int ufs_filestat(struct vnode *vp, struct filestat *fsp) { struct inode inode; + struct ufs1_dinode di1; if (!KVM_READ(VTOI(vp), &inode, sizeof (inode))) { dprintf("can't read inode at %p for pid %ld", VTOI(vp), (long)Pid); return 0; } + + if (!KVM_READ(inode.i_din1, &di1, sizeof(struct ufs1_dinode))) { + dprintf("can't read dinode at %p for pid %ld", + inode.i_din1, (long)Pid); + return (0); + } + + inode.i_din1 = &di1; + fsp->fsid = inode.i_dev & 0xffff; fsp->fileid = (long)inode.i_number; fsp->mode = inode.i_ffs_mode; @@ -528,12 +538,22 @@ int ext2fs_filestat(struct vnode *vp, struct filestat *fsp) { struct inode inode; + struct ext2fs_dinode e2di; if (!KVM_READ(VTOI(vp), &inode, sizeof (inode))) { dprintf("can't read inode at %p for pid %ld", VTOI(vp), (long)Pid); return 0; } + + if (!KVM_READ(inode.i_e2din, &e2di, sizeof(struct ext2fs_dinode))) { + dprintf("can't read dinode at %p for pid %ld", + inode.i_e2din, (long)Pid); + return (0); + } + + inode.i_e2din = &e2di; + fsp->fsid = inode.i_dev & 0xffff; fsp->fileid = (long)inode.i_number; fsp->mode = inode.i_e2fs_mode; |