10daf62d9SStanislav Sedov /* 20daf62d9SStanislav Sedov * Copyright (c) 2000 Peter Edwards 30daf62d9SStanislav Sedov * Copyright (c) 1988, 1993 40daf62d9SStanislav Sedov * The Regents of the University of California. All rights reserved. 50daf62d9SStanislav Sedov * 60daf62d9SStanislav Sedov * This code is derived from software contributed to Berkeley by Peter Edwards 70daf62d9SStanislav Sedov * 80daf62d9SStanislav Sedov * Redistribution and use in source and binary forms, with or without 90daf62d9SStanislav Sedov * modification, are permitted provided that the following conditions 100daf62d9SStanislav Sedov * are met: 110daf62d9SStanislav Sedov * 1. Redistributions of source code must retain the above copyright 120daf62d9SStanislav Sedov * notice, this list of conditions and the following disclaimer. 130daf62d9SStanislav Sedov * 2. Redistributions in binary form must reproduce the above copyright 140daf62d9SStanislav Sedov * notice, this list of conditions and the following disclaimer in the 150daf62d9SStanislav Sedov * documentation and/or other materials provided with the distribution. 160daf62d9SStanislav Sedov * 3. All advertising materials mentioning features or use of this software 170daf62d9SStanislav Sedov * must display the following acknowledgement: 180daf62d9SStanislav Sedov * This product includes software developed by the University of 190daf62d9SStanislav Sedov * California, Berkeley and its contributors. 200daf62d9SStanislav Sedov * 4. Neither the name of the University nor the names of its contributors 210daf62d9SStanislav Sedov * may be used to endorse or promote products derived from this software 220daf62d9SStanislav Sedov * without specific prior written permission. 230daf62d9SStanislav Sedov * 240daf62d9SStanislav Sedov * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 250daf62d9SStanislav Sedov * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 260daf62d9SStanislav Sedov * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 270daf62d9SStanislav Sedov * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 280daf62d9SStanislav Sedov * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 290daf62d9SStanislav Sedov * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 300daf62d9SStanislav Sedov * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 310daf62d9SStanislav Sedov * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 320daf62d9SStanislav Sedov * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 330daf62d9SStanislav Sedov * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 340daf62d9SStanislav Sedov * SUCH DAMAGE. 350daf62d9SStanislav Sedov */ 360daf62d9SStanislav Sedov 370daf62d9SStanislav Sedov /* 380daf62d9SStanislav Sedov * XXX - 390daf62d9SStanislav Sedov * This had to be separated from fstat.c because cd9660s has namespace 400daf62d9SStanislav Sedov * conflicts with UFS. 410daf62d9SStanislav Sedov */ 420daf62d9SStanislav Sedov 430daf62d9SStanislav Sedov #include <sys/cdefs.h> 440daf62d9SStanislav Sedov __FBSDID("$FreeBSD$"); 450daf62d9SStanislav Sedov 460daf62d9SStanislav Sedov #include <sys/param.h> 470daf62d9SStanislav Sedov #include <sys/stat.h> 480daf62d9SStanislav Sedov #include <sys/time.h> 490daf62d9SStanislav Sedov #include <sys/vnode.h> 500daf62d9SStanislav Sedov #include <sys/mount.h> 510daf62d9SStanislav Sedov 520daf62d9SStanislav Sedov #include <netinet/in.h> 530daf62d9SStanislav Sedov 540daf62d9SStanislav Sedov #include <err.h> 550daf62d9SStanislav Sedov 560daf62d9SStanislav Sedov #define _KERNEL 570daf62d9SStanislav Sedov #include <isofs/cd9660/iso.h> 580daf62d9SStanislav Sedov #undef _KERNEL 59*f9d593d7SConrad Meyer #include <isofs/cd9660/cd9660_node.h> 600daf62d9SStanislav Sedov 610daf62d9SStanislav Sedov #include <kvm.h> 620daf62d9SStanislav Sedov #include <stdio.h> 630daf62d9SStanislav Sedov 640daf62d9SStanislav Sedov #include "libprocstat.h" 650daf62d9SStanislav Sedov #include "common_kvm.h" 660daf62d9SStanislav Sedov 670daf62d9SStanislav Sedov int 680daf62d9SStanislav Sedov isofs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn) 690daf62d9SStanislav Sedov { 700daf62d9SStanislav Sedov struct iso_node isonode; 710daf62d9SStanislav Sedov struct iso_mnt mnt; 720daf62d9SStanislav Sedov 730daf62d9SStanislav Sedov if (!kvm_read_all(kd, (unsigned long)VTOI(vp), &isonode, 740daf62d9SStanislav Sedov sizeof(isonode))) { 750daf62d9SStanislav Sedov warnx("can't read iso_node at %p", 760daf62d9SStanislav Sedov (void *)VTOI(vp)); 770daf62d9SStanislav Sedov return (1); 780daf62d9SStanislav Sedov } 790daf62d9SStanislav Sedov if (!kvm_read_all(kd, (unsigned long)isonode.i_mnt, &mnt, 800daf62d9SStanislav Sedov sizeof(mnt))) { 810daf62d9SStanislav Sedov warnx("can't read iso_mnt at %p", 820daf62d9SStanislav Sedov (void *)VTOI(vp)); 830daf62d9SStanislav Sedov return (1); 840daf62d9SStanislav Sedov } 850daf62d9SStanislav Sedov vn->vn_fsid = dev2udev(kd, mnt.im_dev); 860daf62d9SStanislav Sedov vn->vn_mode = (mode_t)isonode.inode.iso_mode; 87e458cb77SGleb Kurtsou vn->vn_fileid = isonode.i_number; 88e458cb77SGleb Kurtsou vn->vn_size = isonode.i_size; 890daf62d9SStanislav Sedov return (0); 900daf62d9SStanislav Sedov } 91