Annotation of src/usr.bin/fstat/isofs.c, Revision 1.3
1.3 ! deraadt 1: /* $OpenBSD: isofs.c,v 1.2 1998/07/09 20:28:02 mickey Exp $ */
1.1 deraadt 2:
3: /*-
4: * Copyright (c) 1988, 1993
5: * The Regents of the University of California. All rights reserved.
6: *
7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions
9: * are met:
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * 2. Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: * 3. All advertising materials mentioning features or use of this software
16: * must display the following acknowledgement:
17: * This product includes software developed by the University of
18: * California, Berkeley and its contributors.
19: * 4. Neither the name of the University nor the names of its contributors
20: * may be used to endorse or promote products derived from this software
21: * without specific prior written permission.
22: *
23: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33: * SUCH DAMAGE.
34: */
35:
36: #include <sys/param.h>
37: #include <sys/time.h>
38: #include <sys/proc.h>
39: #include <sys/user.h>
40: #include <sys/stat.h>
41: #include <sys/vnode.h>
42: #include <sys/socket.h>
43: #include <sys/socketvar.h>
44: #include <sys/domain.h>
45: #include <sys/protosw.h>
46: #include <sys/unpcb.h>
47: #include <sys/sysctl.h>
48: #include <sys/filedesc.h>
49: #define _KERNEL
50: #include <sys/file.h>
51: #include <sys/mount.h>
52: #undef _KERNEL
53: #define NFS
54: #include <nfs/nfsproto.h>
55: #include <nfs/rpcv2.h>
56: #include <nfs/nfs.h>
57: #include <nfs/nfsnode.h>
58: #undef NFS
59:
60: #include <isofs/cd9660/iso.h>
61: #include <isofs/cd9660/cd9660_extern.h>
62: #include <isofs/cd9660/cd9660_node.h>
63:
64: #include <ctype.h>
65: #include <errno.h>
66: #include <kvm.h>
67: #include <limits.h>
68: #include <nlist.h>
69: #include <paths.h>
70: #include <pwd.h>
71: #include <stdio.h>
72: #include <stdlib.h>
73: #include <string.h>
74: #include <unistd.h>
1.2 mickey 75: #include <err.h>
1.1 deraadt 76: #include "fstat.h"
77:
78: extern pid_t Pid;
79:
80: int
81: isofs_filestat(vp, fsp)
82: struct vnode *vp;
83: struct filestat *fsp;
84: {
85: struct iso_node inode;
86:
87: if (!KVM_READ(VTOI(vp), &inode, sizeof (inode))) {
1.2 mickey 88: dprintf("can't read inode at %p for pid %d", VTOI(vp), Pid);
1.1 deraadt 89: return 0;
90: }
91: fsp->fsid = inode.i_dev & 0xffff;
92: fsp->fileid = (long)inode.i_number;
93: fsp->mode = inode.inode.iso_mode;
94: fsp->size = inode.i_size;
95: fsp->rdev = inode.i_dev;
96: return 1;
97: }