1 |
|
|
/* $OpenBSD: kvm_cd9660.c,v 1.7 2016/10/02 23:11:55 guenther Exp $ */ |
2 |
|
|
|
3 |
|
|
/* |
4 |
|
|
* Copyright (c) 2009 Todd C. Miller <Todd.Miller@courtesan.com> |
5 |
|
|
* |
6 |
|
|
* Permission to use, copy, modify, and distribute this software for any |
7 |
|
|
* purpose with or without fee is hereby granted, provided that the above |
8 |
|
|
* copyright notice and this permission notice appear in all copies. |
9 |
|
|
* |
10 |
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
11 |
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
12 |
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
13 |
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
14 |
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
15 |
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 |
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 |
|
|
*/ |
18 |
|
|
|
19 |
|
|
#include <sys/param.h> |
20 |
|
|
#include <sys/ucred.h> |
21 |
|
|
#define _KERNEL |
22 |
|
|
#include <sys/mount.h> |
23 |
|
|
#undef _KERNEL |
24 |
|
|
#include <sys/lock.h> |
25 |
|
|
#include <sys/vnode.h> |
26 |
|
|
#include <sys/sysctl.h> |
27 |
|
|
|
28 |
|
|
#include <isofs/cd9660/iso.h> |
29 |
|
|
#include <isofs/cd9660/cd9660_extern.h> |
30 |
|
|
#include <isofs/cd9660/cd9660_node.h> |
31 |
|
|
|
32 |
|
|
#include <limits.h> |
33 |
|
|
#include <kvm.h> |
34 |
|
|
#include <db.h> |
35 |
|
|
|
36 |
|
|
#include "kvm_private.h" |
37 |
|
|
#include "kvm_file.h" |
38 |
|
|
|
39 |
|
|
int |
40 |
|
|
_kvm_stat_cd9660(kvm_t *kd, struct kinfo_file *kf, struct vnode *vp) |
41 |
|
|
{ |
42 |
|
|
struct iso_node inode; |
43 |
|
|
|
44 |
|
|
if (KREAD(kd, (u_long)VTOI(vp), &inode)) { |
45 |
|
|
_kvm_err(kd, kd->program, "can't read inode at %p", VTOI(vp)); |
46 |
|
|
return (-1); |
47 |
|
|
} |
48 |
|
|
kf->va_fsid = inode.i_dev & 0xffff; |
49 |
|
|
kf->va_fileid = (long)inode.i_number; |
50 |
|
|
kf->va_mode = inode.inode.iso_mode; |
51 |
|
|
kf->va_size = inode.i_size; |
52 |
|
|
kf->va_rdev = inode.i_dev; |
53 |
|
|
kf->va_nlink = inode.inode.iso_links; |
54 |
|
|
|
55 |
|
|
return (0); |
56 |
|
|
} |