diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-11-13 03:48:10 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-11-13 03:48:10 +0000 |
commit | accfa7a6a7976a8bef491294a38f6f13530a79a1 (patch) | |
tree | e64b5044f8a773520f6ea7f073ed6558b79b0a7a /sys | |
parent | 22caac98029983a7e7cbaf6f346cf4545bc94a01 (diff) |
FIBMAP ioctl from Linux, only usable on ISO 9660 FS. Note that the lba
returned is in 512-byte sectors, so if you're going to use it for
things like DVD, you need to divide the result by 4 (for 2048-byte
sectors). OK deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/isofs/cd9660/cd9660_vnops.c | 25 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 6 |
2 files changed, 27 insertions, 4 deletions
diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index b634f9ced9c..86fb0318fb5 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vnops.c,v 1.11 1999/07/01 02:20:22 d Exp $ */ +/* $OpenBSD: cd9660_vnops.c,v 1.12 1999/11/13 03:48:09 angelos Exp $ */ /* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */ /*- @@ -55,6 +55,9 @@ #include <sys/vnode.h> #include <sys/malloc.h> #include <sys/dirent.h> +#include <sys/ioctl.h> +#include <sys/ioccom.h> +#include <sys/cdio.h> #include <miscfs/fifofs/fifo.h> #include <miscfs/specfs/specdev.h> @@ -375,8 +378,24 @@ int cd9660_ioctl(v) void *v; { - printf("You did ioctl for isofs !!\n"); - return (ENOTTY); + struct vop_ioctl_args /* { + struct vnode *a_vp; + u_long a_command; + caddr_t a_data; + int a_fflag; + struct ucred *a_cred; + struct proc *a_p; + } */ *ap = v; + daddr_t *block; + + switch (ap->a_command) { + case FIBMAP: + block = (daddr_t *)ap->a_data; + + return (VOP_BMAP(ap->a_vp, *block, NULL, block, 0)); + default: + return (ENOTTY); + } } /* ARGSUSED */ diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index a1c87adfb90..72cd75fa60e 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.22 1999/08/26 08:07:10 art Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.23 1999/11/13 03:48:09 angelos Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -53,6 +53,7 @@ #include <sys/vnode.h> #include <sys/ioctl.h> #include <sys/tty.h> +#include <sys/cdio.h> #include <vm/vm.h> @@ -418,6 +419,9 @@ vn_ioctl(fp, com, data, p) *(int *)data = vattr.va_size - fp->f_offset; return (0); } + if (com == FIBMAP) + return VOP_IOCTL(vp, com, data, fp->f_flag, + p->p_ucred, p); if (com == FIONBIO || com == FIOASYNC) /* XXX */ return (0); /* XXX */ /* fall into ... */ |