/* $OpenBSD: kvm_cd9660.c,v 1.2 2009/06/20 20:20:43 millert Exp $ */ /* * Copyright (c) 2009 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #if defined(LIBC_SCCS) && !defined(lint) static char *rcsid = "$OpenBSD: kvm_cd9660.c,v 1.2 2009/06/20 20:20:43 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include #define _KERNEL #include #undef _KERNEL #include #include #include #include #include #include #include #include #include "kvm_private.h" int _kvm_stat_cd9660(kvm_t *kd, struct kinfo_file2 *kf, struct vnode *vp) { struct iso_node inode; if (KREAD(kd, (u_long)VTOI(vp), &inode)) { _kvm_err(kd, kd->program, "can't read inode at %p", VTOI(vp)); return (-1); } kf->va_fsid = inode.i_dev & 0xffff; kf->va_fileid = (long)inode.i_number; kf->va_mode = inode.inode.iso_mode; kf->va_size = inode.i_size; kf->va_rdev = inode.i_dev; return (0); }