1*0daf62d9SStanislav Sedov /* 2*0daf62d9SStanislav Sedov * Copyright (c) 2000 Peter Edwards 3*0daf62d9SStanislav Sedov * Copyright (c) 1988, 1993 4*0daf62d9SStanislav Sedov * The Regents of the University of California. All rights reserved. 5*0daf62d9SStanislav Sedov * 6*0daf62d9SStanislav Sedov * This code is derived from software contributed to Berkeley by Peter Edwards 7*0daf62d9SStanislav Sedov * 8*0daf62d9SStanislav Sedov * Redistribution and use in source and binary forms, with or without 9*0daf62d9SStanislav Sedov * modification, are permitted provided that the following conditions 10*0daf62d9SStanislav Sedov * are met: 11*0daf62d9SStanislav Sedov * 1. Redistributions of source code must retain the above copyright 12*0daf62d9SStanislav Sedov * notice, this list of conditions and the following disclaimer. 13*0daf62d9SStanislav Sedov * 2. Redistributions in binary form must reproduce the above copyright 14*0daf62d9SStanislav Sedov * notice, this list of conditions and the following disclaimer in the 15*0daf62d9SStanislav Sedov * documentation and/or other materials provided with the distribution. 16*0daf62d9SStanislav Sedov * 3. All advertising materials mentioning features or use of this software 17*0daf62d9SStanislav Sedov * must display the following acknowledgement: 18*0daf62d9SStanislav Sedov * This product includes software developed by the University of 19*0daf62d9SStanislav Sedov * California, Berkeley and its contributors. 20*0daf62d9SStanislav Sedov * 4. Neither the name of the University nor the names of its contributors 21*0daf62d9SStanislav Sedov * may be used to endorse or promote products derived from this software 22*0daf62d9SStanislav Sedov * without specific prior written permission. 23*0daf62d9SStanislav Sedov * 24*0daf62d9SStanislav Sedov * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25*0daf62d9SStanislav Sedov * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26*0daf62d9SStanislav Sedov * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27*0daf62d9SStanislav Sedov * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28*0daf62d9SStanislav Sedov * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29*0daf62d9SStanislav Sedov * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30*0daf62d9SStanislav Sedov * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31*0daf62d9SStanislav Sedov * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32*0daf62d9SStanislav Sedov * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33*0daf62d9SStanislav Sedov * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34*0daf62d9SStanislav Sedov * SUCH DAMAGE. 35*0daf62d9SStanislav Sedov */ 36*0daf62d9SStanislav Sedov 37*0daf62d9SStanislav Sedov /* 38*0daf62d9SStanislav Sedov * XXX - 39*0daf62d9SStanislav Sedov * This had to be separated from fstat.c because cd9660s has namespace 40*0daf62d9SStanislav Sedov * conflicts with UFS. 41*0daf62d9SStanislav Sedov */ 42*0daf62d9SStanislav Sedov 43*0daf62d9SStanislav Sedov #include <sys/cdefs.h> 44*0daf62d9SStanislav Sedov __FBSDID("$FreeBSD$"); 45*0daf62d9SStanislav Sedov 46*0daf62d9SStanislav Sedov #include <sys/param.h> 47*0daf62d9SStanislav Sedov #include <sys/stat.h> 48*0daf62d9SStanislav Sedov #include <sys/time.h> 49*0daf62d9SStanislav Sedov #include <sys/vnode.h> 50*0daf62d9SStanislav Sedov #include <sys/mount.h> 51*0daf62d9SStanislav Sedov 52*0daf62d9SStanislav Sedov #include <netinet/in.h> 53*0daf62d9SStanislav Sedov 54*0daf62d9SStanislav Sedov #include <err.h> 55*0daf62d9SStanislav Sedov 56*0daf62d9SStanislav Sedov #include <isofs/cd9660/cd9660_node.h> 57*0daf62d9SStanislav Sedov #define _KERNEL 58*0daf62d9SStanislav Sedov #include <isofs/cd9660/iso.h> 59*0daf62d9SStanislav Sedov #undef _KERNEL 60*0daf62d9SStanislav Sedov 61*0daf62d9SStanislav Sedov #include <kvm.h> 62*0daf62d9SStanislav Sedov #include <stdio.h> 63*0daf62d9SStanislav Sedov 64*0daf62d9SStanislav Sedov #include "libprocstat.h" 65*0daf62d9SStanislav Sedov #include "common_kvm.h" 66*0daf62d9SStanislav Sedov 67*0daf62d9SStanislav Sedov int 68*0daf62d9SStanislav Sedov isofs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn) 69*0daf62d9SStanislav Sedov { 70*0daf62d9SStanislav Sedov struct iso_node isonode; 71*0daf62d9SStanislav Sedov struct iso_mnt mnt; 72*0daf62d9SStanislav Sedov 73*0daf62d9SStanislav Sedov if (!kvm_read_all(kd, (unsigned long)VTOI(vp), &isonode, 74*0daf62d9SStanislav Sedov sizeof(isonode))) { 75*0daf62d9SStanislav Sedov warnx("can't read iso_node at %p", 76*0daf62d9SStanislav Sedov (void *)VTOI(vp)); 77*0daf62d9SStanislav Sedov return (1); 78*0daf62d9SStanislav Sedov } 79*0daf62d9SStanislav Sedov if (!kvm_read_all(kd, (unsigned long)isonode.i_mnt, &mnt, 80*0daf62d9SStanislav Sedov sizeof(mnt))) { 81*0daf62d9SStanislav Sedov warnx("can't read iso_mnt at %p", 82*0daf62d9SStanislav Sedov (void *)VTOI(vp)); 83*0daf62d9SStanislav Sedov return (1); 84*0daf62d9SStanislav Sedov } 85*0daf62d9SStanislav Sedov vn->vn_fsid = dev2udev(kd, mnt.im_dev); 86*0daf62d9SStanislav Sedov vn->vn_mode = (mode_t)isonode.inode.iso_mode; 87*0daf62d9SStanislav Sedov vn->vn_fileid = (long)isonode.i_number; 88*0daf62d9SStanislav Sedov vn->vn_size = (u_long)isonode.i_size; 89*0daf62d9SStanislav Sedov return (0); 90*0daf62d9SStanislav Sedov } 91