1*dadffc77Slukem /* $NetBSD: isofs.c,v 1.7 2009/04/12 06:36:12 lukem Exp $ */
2591a9688Slukem /*-
3591a9688Slukem * Copyright (c) 1988, 1993
4591a9688Slukem * The Regents of the University of California. All rights reserved.
5591a9688Slukem *
6591a9688Slukem * Redistribution and use in source and binary forms, with or without
7591a9688Slukem * modification, are permitted provided that the following conditions
8591a9688Slukem * are met:
9591a9688Slukem * 1. Redistributions of source code must retain the above copyright
10591a9688Slukem * notice, this list of conditions and the following disclaimer.
11591a9688Slukem * 2. Redistributions in binary form must reproduce the above copyright
12591a9688Slukem * notice, this list of conditions and the following disclaimer in the
13591a9688Slukem * documentation and/or other materials provided with the distribution.
1489aaa1bbSagc * 3. Neither the name of the University nor the names of its contributors
15591a9688Slukem * may be used to endorse or promote products derived from this software
16591a9688Slukem * without specific prior written permission.
17591a9688Slukem *
18591a9688Slukem * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19591a9688Slukem * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20591a9688Slukem * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21591a9688Slukem * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22591a9688Slukem * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23591a9688Slukem * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24591a9688Slukem * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25591a9688Slukem * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26591a9688Slukem * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27591a9688Slukem * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28591a9688Slukem * SUCH DAMAGE.
29591a9688Slukem */
30591a9688Slukem
31591a9688Slukem #include <sys/cdefs.h>
32*dadffc77Slukem __RCSID("$NetBSD: isofs.c,v 1.7 2009/04/12 06:36:12 lukem Exp $");
33591a9688Slukem
34591a9688Slukem #include <sys/param.h>
35591a9688Slukem #include <sys/time.h>
36591a9688Slukem #include <sys/vnode.h>
37591a9688Slukem #include <sys/mount.h>
38591a9688Slukem
39591a9688Slukem #include <isofs/cd9660/iso.h>
40591a9688Slukem #include <isofs/cd9660/cd9660_extern.h>
41591a9688Slukem #include <isofs/cd9660/cd9660_node.h>
42591a9688Slukem
43591a9688Slukem #include <kvm.h>
44591a9688Slukem #include <err.h>
45591a9688Slukem #include "fstat.h"
46591a9688Slukem
47591a9688Slukem int
isofs_filestat(struct vnode * vp,struct filestat * fsp)4855388191Schristos isofs_filestat(struct vnode *vp, struct filestat *fsp)
49591a9688Slukem {
50591a9688Slukem struct iso_node inode;
51591a9688Slukem
52591a9688Slukem if (!KVM_READ(VTOI(vp), &inode, sizeof (inode))) {
53591a9688Slukem dprintf("can't read inode at %p for pid %d", VTOI(vp), Pid);
54591a9688Slukem return 0;
55591a9688Slukem }
56591a9688Slukem fsp->fsid = inode.i_dev & 0xffff;
57*dadffc77Slukem fsp->fileid = inode.i_number;
58591a9688Slukem fsp->mode = inode.inode.iso_mode;
59591a9688Slukem fsp->size = inode.i_size;
60591a9688Slukem fsp->rdev = inode.i_dev;
61591a9688Slukem return 1;
62591a9688Slukem }
63