Home | History | Annotate | Line # | Download | only in common
linux_cdrom.c revision 1.5.6.1
      1  1.5.6.1        he /*	$NetBSD: linux_cdrom.c,v 1.5.6.1 2001/03/30 21:37:59 he Exp $ */
      2      1.1  christos 
      3      1.1  christos /*
      4      1.1  christos  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5      1.1  christos  * All rights reserved.
      6      1.1  christos  *
      7      1.1  christos  * Redistribution and use in source and binary forms, with or without
      8      1.1  christos  * modification, are permitted provided that the following conditions
      9      1.1  christos  * are met:
     10      1.1  christos  * 1. Redistributions of source code must retain the above copyright
     11      1.1  christos  *    notice, this list of conditions and the following disclaimer.
     12      1.1  christos  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1  christos  *    notice, this list of conditions and the following disclaimer in the
     14      1.1  christos  *    documentation and/or other materials provided with the distribution.
     15      1.1  christos  * 3. All advertising materials mentioning features or use of this software
     16      1.1  christos  *    must display the following acknowledgement:
     17      1.1  christos  *        This product includes software developed by the NetBSD
     18      1.1  christos  *        Foundation, Inc. and its contributors.
     19      1.1  christos  * 4. Neither the name of The NetBSD Foundation nor the names of its
     20      1.1  christos  *    contributors may be used to endorse or promote products derived
     21      1.1  christos  *    from this software without specific prior written permission.
     22      1.1  christos  *
     23      1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     24      1.1  christos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     25      1.1  christos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     26      1.1  christos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     27      1.1  christos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     28      1.1  christos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29      1.1  christos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30      1.1  christos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     31      1.1  christos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     32      1.1  christos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     33      1.1  christos  * POSSIBILITY OF SUCH DAMAGE.
     34      1.1  christos  */
     35      1.1  christos 
     36      1.1  christos #include <sys/param.h>
     37      1.1  christos #include <sys/systm.h>
     38      1.1  christos #include <sys/ioctl.h>
     39      1.1  christos #include <sys/file.h>
     40      1.1  christos #include <sys/filedesc.h>
     41      1.1  christos #include <sys/mount.h>
     42      1.1  christos #include <sys/proc.h>
     43      1.1  christos #include <sys/cdio.h>
     44      1.5   mycroft #include <sys/dvdio.h>
     45      1.2       erh 
     46      1.2       erh #include <sys/syscallargs.h>
     47      1.1  christos 
     48      1.3  christos #include <compat/linux/common/linux_types.h>
     49      1.3  christos #include <compat/linux/common/linux_ioctl.h>
     50      1.3  christos #include <compat/linux/common/linux_signal.h>
     51      1.3  christos #include <compat/linux/common/linux_util.h>
     52      1.3  christos #include <compat/linux/common/linux_cdrom.h>
     53      1.3  christos 
     54      1.1  christos #include <compat/linux/linux_syscallargs.h>
     55      1.1  christos 
     56  1.5.6.1        he static int bsd_to_linux_msf_lba(unsigned address_format, union msf_lba *bml,
     57  1.5.6.1        he 				union linux_cdrom_addr *llml);
     58  1.5.6.1        he 
     59      1.1  christos #if 0
     60      1.1  christos #define DPRINTF(x) printf x
     61      1.1  christos #else
     62      1.1  christos #define DPRINTF(x)
     63      1.1  christos #endif
     64      1.1  christos 
     65  1.5.6.1        he /*
     66  1.5.6.1        he  * XXX from dev/scsipi/cd.c
     67  1.5.6.1        he  */
     68  1.5.6.1        he #define MAXTRACK 99
     69  1.5.6.1        he 
     70  1.5.6.1        he static int
     71  1.5.6.1        he bsd_to_linux_msf_lba(unsigned address_format, union msf_lba *bml,
     72  1.5.6.1        he 		      union linux_cdrom_addr *llml)
     73  1.5.6.1        he {
     74  1.5.6.1        he 	switch (address_format) {
     75  1.5.6.1        he 	case CD_LBA_FORMAT:
     76  1.5.6.1        he 		llml->lba = bml->lba;
     77  1.5.6.1        he 		break;
     78  1.5.6.1        he 	case CD_MSF_FORMAT:
     79  1.5.6.1        he 		llml->msf.minute = bml->msf.minute;
     80  1.5.6.1        he 		llml->msf.second = bml->msf.second;
     81  1.5.6.1        he 		llml->msf.frame = bml->msf.frame;
     82  1.5.6.1        he 		break;
     83  1.5.6.1        he 	default:
     84  1.5.6.1        he 		return -1;
     85  1.5.6.1        he 	}
     86  1.5.6.1        he 	return 0;
     87  1.5.6.1        he }
     88  1.5.6.1        he 
     89      1.1  christos int
     90      1.1  christos linux_ioctl_cdrom(p, uap, retval)
     91      1.1  christos 	struct proc *p;
     92      1.1  christos 	struct linux_sys_ioctl_args /* {
     93      1.1  christos 		syscallarg(int) fd;
     94      1.1  christos 		syscallarg(u_long) com;
     95      1.1  christos 		syscallarg(caddr_t) data;
     96      1.1  christos 	} */ *uap;
     97      1.1  christos 	register_t *retval;
     98      1.1  christos {
     99      1.1  christos 	int error, idata;
    100      1.1  christos 	u_long com, ncom;
    101      1.1  christos 	caddr_t sg;
    102      1.1  christos 	struct file *fp;
    103      1.1  christos 	struct filedesc *fdp;
    104      1.1  christos 	int (*ioctlf) __P((struct file *, u_long, caddr_t, struct proc *));
    105      1.1  christos 
    106      1.1  christos 	struct linux_cdrom_blk l_blk;
    107      1.1  christos 	struct linux_cdrom_msf l_msf;
    108      1.1  christos 	struct linux_cdrom_ti l_ti;
    109      1.1  christos 	struct linux_cdrom_tochdr l_tochdr;
    110      1.1  christos 	struct linux_cdrom_tocentry l_tocentry;
    111      1.1  christos 	struct linux_cdrom_subchnl l_subchnl;
    112      1.1  christos 	struct linux_cdrom_volctrl l_volctrl;
    113  1.5.6.1        he 	struct linux_cdrom_multisession l_session;
    114      1.1  christos 
    115      1.1  christos 	struct ioc_play_blocks t_blocks;
    116      1.1  christos 	struct ioc_play_msf t_msf;
    117      1.1  christos 	struct ioc_play_track t_track;
    118      1.1  christos 	struct ioc_toc_header t_header;
    119      1.1  christos 	struct cd_toc_entry *entry, t_entry;
    120      1.1  christos 	struct ioc_read_toc_entry t_toc_entry;
    121      1.1  christos 	struct cd_sub_channel_info *info, t_info;
    122      1.1  christos 	struct ioc_read_subchannel t_subchannel;
    123      1.1  christos 	struct ioc_vol t_vol;
    124      1.1  christos 
    125      1.5   mycroft 	dvd_struct ds;
    126      1.5   mycroft 	dvd_authinfo dai;
    127      1.5   mycroft 
    128      1.1  christos 	fdp = p->p_fd;
    129      1.1  christos 	if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles ||
    130  1.5.6.1        he 	    (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL ||
    131  1.5.6.1        he 	    (fp->f_iflags & FIF_WANTCLOSE) != 0)
    132      1.1  christos 		return (EBADF);
    133      1.1  christos 
    134  1.5.6.1        he 	FILE_USE(fp);
    135  1.5.6.1        he 
    136      1.1  christos 	com = SCARG(uap, com);
    137      1.1  christos 	ioctlf = fp->f_ops->fo_ioctl;
    138  1.5.6.1        he 	retval[0] = error = 0;
    139      1.1  christos 
    140      1.1  christos 	switch(com) {
    141      1.1  christos 	case LINUX_CDROMPLAYMSF:
    142      1.1  christos 		error = copyin(SCARG(uap, data), &l_msf, sizeof l_msf);
    143      1.1  christos 		if (error)
    144  1.5.6.1        he 			break;
    145      1.1  christos 
    146      1.1  christos 		t_msf.start_m = l_msf.cdmsf_min0;
    147      1.1  christos 		t_msf.start_s = l_msf.cdmsf_sec0;
    148      1.1  christos 		t_msf.start_f = l_msf.cdmsf_frame0;
    149      1.1  christos 		t_msf.end_m = l_msf.cdmsf_min1;
    150      1.1  christos 		t_msf.end_s = l_msf.cdmsf_sec1;
    151      1.1  christos 		t_msf.end_f = l_msf.cdmsf_frame1;
    152      1.1  christos 
    153  1.5.6.1        he 		error = ioctlf(fp, CDIOCPLAYMSF, (caddr_t)&t_msf, p);
    154  1.5.6.1        he 		break;
    155      1.1  christos 
    156      1.1  christos 	case LINUX_CDROMPLAYTRKIND:
    157      1.1  christos 		error = copyin(SCARG(uap, data), &l_ti, sizeof l_ti);
    158      1.1  christos 		if (error)
    159  1.5.6.1        he 			break;
    160      1.1  christos 
    161      1.1  christos 		t_track.start_track = l_ti.cdti_trk0;
    162      1.1  christos 		t_track.start_index = l_ti.cdti_ind0;
    163      1.1  christos 		t_track.end_track = l_ti.cdti_trk1;
    164      1.1  christos 		t_track.end_index = l_ti.cdti_ind1;
    165      1.1  christos 
    166  1.5.6.1        he 		error = ioctlf(fp, CDIOCPLAYTRACKS, (caddr_t)&t_track, p);
    167  1.5.6.1        he 		break;
    168      1.1  christos 
    169      1.1  christos 	case LINUX_CDROMREADTOCHDR:
    170      1.1  christos 		error = ioctlf(fp, CDIOREADTOCHEADER, (caddr_t)&t_header, p);
    171      1.1  christos 		if (error)
    172  1.5.6.1        he 			break;
    173      1.1  christos 
    174      1.1  christos 		l_tochdr.cdth_trk0 = t_header.starting_track;
    175      1.1  christos 		l_tochdr.cdth_trk1 = t_header.ending_track;
    176      1.1  christos 
    177  1.5.6.1        he 		error = copyout(&l_tochdr, SCARG(uap, data), sizeof l_tochdr);
    178  1.5.6.1        he 		break;
    179      1.1  christos 
    180      1.1  christos 	case LINUX_CDROMREADTOCENTRY:
    181      1.1  christos 		error = copyin(SCARG(uap, data), &l_tocentry,
    182      1.1  christos 			       sizeof l_tocentry);
    183      1.1  christos 		if (error)
    184  1.5.6.1        he 			break;
    185      1.1  christos 
    186      1.1  christos 		sg = stackgap_init(p->p_emul);
    187      1.1  christos 		entry = stackgap_alloc(&sg, sizeof *entry);
    188      1.1  christos 		t_toc_entry.address_format = l_tocentry.cdte_format;
    189      1.1  christos 		t_toc_entry.starting_track = l_tocentry.cdte_track;
    190      1.1  christos 		t_toc_entry.data_len = sizeof *entry;
    191      1.1  christos 		t_toc_entry.data = entry;
    192      1.1  christos 
    193  1.5.6.1        he 		error = ioctlf(fp, CDIOREADTOCENTRIES, (caddr_t)&t_toc_entry,
    194      1.1  christos 			       p);
    195      1.1  christos 		if (error)
    196  1.5.6.1        he 			break;
    197      1.1  christos 
    198      1.1  christos 		error = copyin(entry, &t_entry, sizeof t_entry);
    199      1.1  christos 		if (error)
    200  1.5.6.1        he 			break;
    201      1.1  christos 
    202      1.1  christos 		l_tocentry.cdte_adr = t_entry.addr_type;
    203      1.1  christos 		l_tocentry.cdte_ctrl = t_entry.control;
    204  1.5.6.1        he 		if (bsd_to_linux_msf_lba(t_entry.addr_type, &t_entry.addr,
    205  1.5.6.1        he 		    &l_tocentry.cdte_addr) < 0) {
    206      1.1  christos 			printf("linux_ioctl: unknown format msf/lba\n");
    207  1.5.6.1        he 			error = EINVAL;
    208  1.5.6.1        he 			break;
    209      1.1  christos 		}
    210      1.1  christos 
    211  1.5.6.1        he 		error = copyout(&l_tocentry, SCARG(uap, data),
    212      1.1  christos 			       sizeof l_tocentry);
    213  1.5.6.1        he 		break;
    214      1.1  christos 
    215      1.1  christos 	case LINUX_CDROMVOLCTRL:
    216      1.1  christos 		error = copyin(SCARG(uap, data), &l_volctrl, sizeof l_volctrl);
    217      1.1  christos 		if (error)
    218  1.5.6.1        he 			break;
    219      1.1  christos 
    220      1.1  christos 		t_vol.vol[0] = l_volctrl.channel0;
    221      1.1  christos 		t_vol.vol[1] = l_volctrl.channel1;
    222      1.1  christos 		t_vol.vol[2] = l_volctrl.channel2;
    223      1.1  christos 		t_vol.vol[3] = l_volctrl.channel3;
    224      1.1  christos 
    225  1.5.6.1        he 		error = ioctlf(fp, CDIOCSETVOL, (caddr_t)&t_vol, p);
    226  1.5.6.1        he 		break;
    227      1.1  christos 
    228      1.1  christos 	case LINUX_CDROMVOLREAD:
    229      1.1  christos 		error = ioctlf(fp, CDIOCGETVOL, (caddr_t)&t_vol, p);
    230      1.1  christos 		if (error)
    231  1.5.6.1        he 			break;
    232      1.1  christos 
    233      1.1  christos 		l_volctrl.channel0 = t_vol.vol[0];
    234      1.1  christos 		l_volctrl.channel1 = t_vol.vol[1];
    235      1.1  christos 		l_volctrl.channel2 = t_vol.vol[2];
    236      1.1  christos 		l_volctrl.channel3 = t_vol.vol[3];
    237      1.1  christos 
    238  1.5.6.1        he 		error = copyout(&l_volctrl, SCARG(uap, data), sizeof l_volctrl);
    239  1.5.6.1        he 		break;
    240      1.1  christos 
    241      1.1  christos 	case LINUX_CDROMSUBCHNL:
    242      1.1  christos 		error = copyin(SCARG(uap, data), &l_subchnl, sizeof l_subchnl);
    243      1.1  christos 		if (error)
    244  1.5.6.1        he 			break;
    245  1.5.6.1        he 
    246      1.1  christos 		sg = stackgap_init(p->p_emul);
    247      1.1  christos 		info = stackgap_alloc(&sg, sizeof *info);
    248  1.5.6.1        he 		t_subchannel.address_format = CD_MSF_FORMAT;
    249  1.5.6.1        he 		t_subchannel.track = 0;
    250  1.5.6.1        he 		t_subchannel.data_format = l_subchnl.cdsc_format;
    251      1.1  christos 		t_subchannel.data_len = sizeof *info;
    252      1.1  christos 		t_subchannel.data = info;
    253      1.1  christos 		DPRINTF(("linux_ioctl: CDROMSUBCHNL %d %d\n",
    254      1.1  christos 			 l_subchnl.cdsc_format, l_subchnl.cdsc_trk));
    255      1.1  christos 
    256      1.1  christos 		error = ioctlf(fp, CDIOCREADSUBCHANNEL, (caddr_t)&t_subchannel,
    257      1.1  christos 			       p);
    258      1.1  christos 		if (error)
    259  1.5.6.1        he 			break;
    260      1.1  christos 
    261      1.1  christos 		error = copyin(info, &t_info, sizeof t_info);
    262      1.1  christos 		if (error)
    263  1.5.6.1        he 			break;
    264      1.1  christos 
    265  1.5.6.1        he 		l_subchnl.cdsc_audiostatus = t_info.header.audio_status;
    266  1.5.6.1        he 		l_subchnl.cdsc_adr = t_info.what.position.addr_type;
    267  1.5.6.1        he 		l_subchnl.cdsc_ctrl = t_info.what.position.control;
    268  1.5.6.1        he 		l_subchnl.cdsc_ind = t_info.what.position.index_number;
    269      1.1  christos 
    270  1.5.6.1        he 		DPRINTF(("linux_ioctl: CDIOCREADSUBCHANNEL %d %d %d\n",
    271  1.5.6.1        he 			t_info.header.audio_status,
    272  1.5.6.1        he 			t_info.header.data_len[0],
    273  1.5.6.1        he 			t_info.header.data_len[1]));
    274  1.5.6.1        he 		DPRINTF(("(more) %d %d %d %d %d\n",
    275  1.5.6.1        he 			t_info.what.position.data_format,
    276  1.5.6.1        he 			t_info.what.position.control,
    277  1.5.6.1        he 			t_info.what.position.addr_type,
    278  1.5.6.1        he 			t_info.what.position.track_number,
    279  1.5.6.1        he 			t_info.what.position.index_number));
    280  1.5.6.1        he 
    281  1.5.6.1        he 		if (bsd_to_linux_msf_lba(t_subchannel.address_format,
    282  1.5.6.1        he 					 &t_info.what.position.absaddr,
    283  1.5.6.1        he 					 &l_subchnl.cdsc_absaddr) < 0 ||
    284  1.5.6.1        he 		    bsd_to_linux_msf_lba(t_subchannel.address_format,
    285  1.5.6.1        he 					 &t_info.what.position.reladdr,
    286  1.5.6.1        he 					 &l_subchnl.cdsc_reladdr) < 0) {
    287  1.5.6.1        he 			DPRINTF(("linux_ioctl: unknown format msf/lba\n"));
    288  1.5.6.1        he 			error = EINVAL;
    289  1.5.6.1        he 			break;
    290  1.5.6.1        he 		}
    291      1.1  christos 
    292  1.5.6.1        he 		error = copyout(&l_subchnl, SCARG(uap, data), sizeof l_subchnl);
    293  1.5.6.1        he 		break;
    294      1.1  christos 
    295      1.1  christos 	case LINUX_CDROMPLAYBLK:
    296      1.1  christos 		error = copyin(SCARG(uap, data), &l_blk, sizeof l_blk);
    297      1.1  christos 		if (error)
    298  1.5.6.1        he 			break;
    299      1.1  christos 
    300      1.1  christos 		t_blocks.blk = l_blk.from;
    301      1.1  christos 		t_blocks.len = l_blk.len;
    302      1.1  christos 
    303  1.5.6.1        he 		error = ioctlf(fp, CDIOCPLAYBLOCKS, (caddr_t)&t_blocks, p);
    304  1.5.6.1        he 		break;
    305      1.1  christos 
    306      1.1  christos 	case LINUX_CDROMEJECT_SW:
    307      1.1  christos 		error = copyin(SCARG(uap, data), &idata, sizeof idata);
    308      1.1  christos 		if (error)
    309  1.5.6.1        he 			break;
    310      1.1  christos 
    311      1.1  christos 		if (idata == 1)
    312      1.1  christos 			ncom = CDIOCALLOW;
    313      1.1  christos 		else
    314      1.1  christos 			ncom = CDIOCPREVENT;
    315  1.5.6.1        he 		error = ioctlf(fp, ncom, NULL, p);
    316      1.1  christos 		break;
    317      1.1  christos 
    318      1.1  christos 	case LINUX_CDROMPAUSE:
    319  1.5.6.1        he 		error = ioctlf(fp, CDIOCPAUSE, NULL, p);
    320      1.1  christos 		break;
    321      1.1  christos 
    322      1.1  christos 	case LINUX_CDROMRESUME:
    323  1.5.6.1        he 		error = ioctlf(fp, CDIOCRESUME, NULL, p);
    324      1.1  christos 		break;
    325      1.1  christos 
    326      1.1  christos 	case LINUX_CDROMSTOP:
    327  1.5.6.1        he 		error = ioctlf(fp, CDIOCSTOP, NULL, p);
    328      1.1  christos 		break;
    329      1.1  christos 
    330      1.1  christos 	case LINUX_CDROMSTART:
    331  1.5.6.1        he 		error = ioctlf(fp, CDIOCSTART, NULL, p);
    332      1.1  christos 		break;
    333      1.1  christos 
    334      1.1  christos 	case LINUX_CDROMEJECT:
    335  1.5.6.1        he 		error = ioctlf(fp, CDIOCEJECT, NULL, p);
    336      1.1  christos 		break;
    337      1.1  christos 
    338      1.1  christos 	case LINUX_CDROMRESET:
    339  1.5.6.1        he 		error = ioctlf(fp, CDIOCRESET, NULL, p);
    340  1.5.6.1        he 		break;
    341  1.5.6.1        he 
    342  1.5.6.1        he 	case LINUX_CDROMMULTISESSION:
    343  1.5.6.1        he 		error = copyin(SCARG(uap, data), &l_session, sizeof l_session);
    344  1.5.6.1        he 		if (error)
    345  1.5.6.1        he 			break;
    346  1.5.6.1        he 
    347  1.5.6.1        he 		error = ioctlf(fp, CDIOREADTOCHEADER, (caddr_t)&t_header, p);
    348  1.5.6.1        he 		if (error)
    349  1.5.6.1        he 			break;
    350  1.5.6.1        he 
    351  1.5.6.1        he 		sg = stackgap_init(p->p_emul);
    352  1.5.6.1        he 		entry = stackgap_alloc(&sg, sizeof *entry);
    353  1.5.6.1        he 		t_toc_entry.address_format = l_session.addr_format;
    354  1.5.6.1        he 		t_toc_entry.starting_track = 0;
    355  1.5.6.1        he 		t_toc_entry.data_len = sizeof *entry;
    356  1.5.6.1        he 		t_toc_entry.data = entry;
    357  1.5.6.1        he 
    358  1.5.6.1        he 		error = ioctlf(fp, CDIOREADTOCENTRIES,
    359  1.5.6.1        he 		    (caddr_t)&t_toc_entry, p);
    360  1.5.6.1        he 		if (error)
    361  1.5.6.1        he 			break;
    362  1.5.6.1        he 
    363  1.5.6.1        he 		error = copyin(entry, &t_entry, sizeof t_entry);
    364  1.5.6.1        he 		if (error)
    365  1.5.6.1        he 			break;
    366  1.5.6.1        he 
    367  1.5.6.1        he 		if (bsd_to_linux_msf_lba(l_session.addr_format,
    368  1.5.6.1        he 		    &t_entry.addr, &l_session.addr) < 0) {
    369  1.5.6.1        he 			error = EINVAL;
    370  1.5.6.1        he 			break;
    371  1.5.6.1        he 		}
    372  1.5.6.1        he 
    373  1.5.6.1        he 		l_session.xa_flag =
    374  1.5.6.1        he 		    t_header.starting_track != t_header.ending_track;
    375  1.5.6.1        he 
    376  1.5.6.1        he 		error = copyout(&l_session, SCARG(uap, data), sizeof l_session);
    377  1.5.6.1        he 		break;
    378  1.5.6.1        he 
    379  1.5.6.1        he 	case LINUX_CDROMCLOSETRAY:
    380  1.5.6.1        he 		error = ioctlf(fp, CDIOCCLOSE, NULL, p);
    381  1.5.6.1        he 		break;
    382  1.5.6.1        he 
    383  1.5.6.1        he 	case LINUX_CDROM_LOCKDOOR:
    384  1.5.6.1        he 		ncom = SCARG(uap, data) != 0 ? CDIOCPREVENT : CDIOCALLOW;
    385  1.5.6.1        he 		error = ioctlf(fp, ncom, NULL, p);
    386  1.5.6.1        he 		break;
    387  1.5.6.1        he 
    388  1.5.6.1        he 	case LINUX_CDROM_SET_OPTIONS:
    389  1.5.6.1        he 	case LINUX_CDROM_CLEAR_OPTIONS:
    390  1.5.6.1        he 		/* whatever you say */
    391  1.5.6.1        he 		break;
    392  1.5.6.1        he 
    393  1.5.6.1        he 	case LINUX_CDROM_DEBUG:
    394  1.5.6.1        he 		ncom = SCARG(uap, data) != 0 ? CDIOCSETDEBUG : CDIOCCLRDEBUG;
    395  1.5.6.1        he 		error = ioctlf(fp, ncom, NULL, p);
    396  1.5.6.1        he 		break;
    397  1.5.6.1        he 
    398  1.5.6.1        he 	case LINUX_CDROM_SELECT_SPEED:
    399  1.5.6.1        he 	case LINUX_CDROM_SELECT_DISC:
    400  1.5.6.1        he 	case LINUX_CDROM_MEDIA_CHANGED:
    401  1.5.6.1        he 	case LINUX_CDROM_DRIVE_STATUS:
    402  1.5.6.1        he 	case LINUX_CDROM_DISC_STATUS:
    403  1.5.6.1        he 	case LINUX_CDROM_CHANGER_NSLOTS:
    404  1.5.6.1        he 	case LINUX_CDROM_GET_CAPABILITY:
    405  1.5.6.1        he 		error = ENOSYS;
    406      1.1  christos 		break;
    407      1.5   mycroft 
    408      1.5   mycroft 	case LINUX_DVD_READ_STRUCT:
    409      1.5   mycroft 		error = copyin(SCARG(uap, data), &ds, sizeof ds);
    410      1.5   mycroft 		if (error)
    411  1.5.6.1        he 			break;
    412      1.5   mycroft 		error = ioctlf(fp, DVD_READ_STRUCT, (caddr_t)&ds, p);
    413      1.5   mycroft 		if (error)
    414  1.5.6.1        he 			break;
    415      1.5   mycroft 		error = copyout(&ds, SCARG(uap, data), sizeof ds);
    416  1.5.6.1        he 		break;
    417      1.5   mycroft 
    418      1.5   mycroft 	case LINUX_DVD_WRITE_STRUCT:
    419      1.5   mycroft 		error = copyin(SCARG(uap, data), &ds, sizeof ds);
    420      1.5   mycroft 		if (error)
    421  1.5.6.1        he 			break;
    422      1.5   mycroft 		error = ioctlf(fp, DVD_WRITE_STRUCT, (caddr_t)&ds, p);
    423      1.5   mycroft 		if (error)
    424  1.5.6.1        he 			break;
    425      1.5   mycroft 		error = copyout(&ds, SCARG(uap, data), sizeof ds);
    426  1.5.6.1        he 		break;
    427      1.5   mycroft 
    428      1.5   mycroft 	case LINUX_DVD_AUTH:
    429      1.5   mycroft 		error = copyin(SCARG(uap, data), &dai, sizeof dai);
    430      1.5   mycroft 		if (error)
    431  1.5.6.1        he 			break;
    432      1.5   mycroft 		error = ioctlf(fp, DVD_AUTH, (caddr_t)&dai, p);
    433      1.5   mycroft 		if (error)
    434  1.5.6.1        he 			break;
    435      1.5   mycroft 		error = copyout(&dai, SCARG(uap, data), sizeof dai);
    436  1.5.6.1        he 		break;
    437      1.5   mycroft 
    438      1.1  christos 
    439      1.1  christos 	default:
    440      1.4  christos 		DPRINTF(("linux_ioctl: unimplemented ioctl %08lx\n", com));
    441  1.5.6.1        he 		error = EINVAL;
    442      1.1  christos 	}
    443      1.1  christos 
    444  1.5.6.1        he 	FILE_UNUSE(fp, p);
    445  1.5.6.1        he 	return error;
    446      1.1  christos }
    447