Home | History | Annotate | Line # | Download | only in common
linux_cdrom.c revision 1.26
      1  1.26        ad /*	$NetBSD: linux_cdrom.c,v 1.26 2008/03/21 21:54:58 ad Exp $ */
      2   1.1  christos 
      3   1.1  christos /*
      4  1.26        ad  * Copyright (c) 1997, 2008 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.10     lukem 
     36  1.10     lukem #include <sys/cdefs.h>
     37  1.26        ad __KERNEL_RCSID(0, "$NetBSD: linux_cdrom.c,v 1.26 2008/03/21 21:54:58 ad Exp $");
     38   1.1  christos 
     39   1.1  christos #include <sys/param.h>
     40   1.1  christos #include <sys/systm.h>
     41   1.1  christos #include <sys/ioctl.h>
     42   1.1  christos #include <sys/file.h>
     43   1.1  christos #include <sys/filedesc.h>
     44   1.1  christos #include <sys/mount.h>
     45   1.1  christos #include <sys/proc.h>
     46   1.1  christos #include <sys/cdio.h>
     47   1.5   mycroft #include <sys/dvdio.h>
     48  1.20  christos #include <sys/malloc.h>
     49   1.2       erh 
     50   1.2       erh #include <sys/syscallargs.h>
     51   1.1  christos 
     52   1.3  christos #include <compat/linux/common/linux_types.h>
     53   1.3  christos #include <compat/linux/common/linux_ioctl.h>
     54   1.3  christos #include <compat/linux/common/linux_signal.h>
     55   1.3  christos #include <compat/linux/common/linux_util.h>
     56  1.24     njoly #include <compat/linux/common/linux_ipc.h>
     57  1.24     njoly #include <compat/linux/common/linux_sem.h>
     58   1.3  christos #include <compat/linux/common/linux_cdrom.h>
     59   1.3  christos 
     60   1.1  christos #include <compat/linux/linux_syscallargs.h>
     61   1.1  christos 
     62   1.6      fvdl static int bsd_to_linux_msf_lba(unsigned address_format, union msf_lba *bml,
     63   1.6      fvdl 				union linux_cdrom_addr *llml);
     64   1.6      fvdl 
     65  1.13  christos #if DEBUG_LINUX
     66  1.11  christos #define DPRINTF(x) uprintf x
     67   1.1  christos #else
     68   1.1  christos #define DPRINTF(x)
     69   1.1  christos #endif
     70   1.1  christos 
     71   1.6      fvdl /*
     72   1.6      fvdl  * XXX from dev/scsipi/cd.c
     73   1.6      fvdl  */
     74   1.6      fvdl #define MAXTRACK 99
     75   1.6      fvdl 
     76   1.6      fvdl static int
     77   1.6      fvdl bsd_to_linux_msf_lba(unsigned address_format, union msf_lba *bml,
     78   1.6      fvdl 		      union linux_cdrom_addr *llml)
     79   1.6      fvdl {
     80   1.6      fvdl 	switch (address_format) {
     81   1.6      fvdl 	case CD_LBA_FORMAT:
     82   1.6      fvdl 		llml->lba = bml->lba;
     83   1.6      fvdl 		break;
     84   1.6      fvdl 	case CD_MSF_FORMAT:
     85   1.6      fvdl 		llml->msf.minute = bml->msf.minute;
     86   1.6      fvdl 		llml->msf.second = bml->msf.second;
     87   1.6      fvdl 		llml->msf.frame = bml->msf.frame;
     88   1.6      fvdl 		break;
     89   1.6      fvdl 	default:
     90   1.6      fvdl 		return -1;
     91   1.6      fvdl 	}
     92   1.6      fvdl 	return 0;
     93   1.6      fvdl }
     94   1.6      fvdl 
     95   1.1  christos int
     96  1.25       dsl linux_ioctl_cdrom(struct lwp *l, const struct linux_sys_ioctl_args *uap, register_t *retval)
     97  1.25       dsl {
     98  1.25       dsl 	/* {
     99   1.1  christos 		syscallarg(int) fd;
    100   1.1  christos 		syscallarg(u_long) com;
    101  1.22  christos 		syscallarg(void *) data;
    102  1.25       dsl 	} */
    103   1.1  christos 	int error, idata;
    104   1.1  christos 	u_long com, ncom;
    105  1.26        ad 	file_t *fp;
    106  1.26        ad 	int (*ioctlf)(file_t *, u_long, void *);
    107   1.1  christos 
    108  1.20  christos 	union {
    109  1.20  christos 		struct linux_cdrom_blk ll_blk;
    110  1.20  christos 		struct linux_cdrom_msf ll_msf;
    111  1.20  christos 		struct linux_cdrom_ti ll_ti;
    112  1.20  christos 		struct linux_cdrom_tochdr ll_tochdr;
    113  1.20  christos 		struct linux_cdrom_tocentry ll_tocentry;
    114  1.20  christos 		struct linux_cdrom_subchnl ll_subchnl;
    115  1.20  christos 		struct linux_cdrom_volctrl ll_volctrl;
    116  1.20  christos 		struct linux_cdrom_multisession ll_session;
    117  1.20  christos 		dvd_struct ll_ds;
    118  1.20  christos 		dvd_authinfo ll_dai;
    119  1.20  christos 	} *u1;
    120  1.20  christos 
    121  1.20  christos #define l_blk u1->ll_blk
    122  1.20  christos #define l_msf u1->ll_msf
    123  1.20  christos #define l_ti u1->ll_ti
    124  1.20  christos #define l_tochdr u1->ll_tochdr
    125  1.20  christos #define l_tocentry u1->ll_tocentry
    126  1.20  christos #define l_subchnl u1->ll_subchnl
    127  1.20  christos #define l_volctrl u1->ll_volctrl
    128  1.20  christos #define l_session u1->ll_session
    129  1.20  christos #define ds u1->ll_ds
    130  1.20  christos #define dai u1->ll_dai
    131  1.20  christos 
    132  1.20  christos 	union {
    133  1.20  christos 		struct ioc_play_blocks tt_blocks;
    134  1.20  christos 		struct ioc_play_msf tt_msf;
    135  1.20  christos 		struct ioc_play_track tt_track;
    136  1.20  christos 		struct ioc_toc_header tt_header;
    137  1.23       dsl 		struct ioc_read_toc_entry_buf tt_toc_entry;
    138  1.23       dsl 		struct ioc_read_subchannel_buf tt_subchannel;
    139  1.20  christos 		struct ioc_vol tt_vol;
    140  1.20  christos 	} *u2;
    141  1.20  christos 
    142  1.20  christos #define	t_blocks u2->tt_blocks
    143  1.20  christos #define	t_msf u2->tt_msf
    144  1.20  christos #define	t_track u2->tt_track
    145  1.20  christos #define	t_header u2->tt_header
    146  1.20  christos #define	t_toc_entry u2->tt_toc_entry
    147  1.20  christos #define	t_subchannel u2->tt_subchannel
    148  1.20  christos #define	t_vol u2->tt_vol
    149  1.20  christos 
    150  1.20  christos 	struct cd_toc_entry *entry;
    151   1.1  christos 
    152  1.26        ad 	if ((fp = fd_getfile(SCARG(uap, fd))) == NULL)
    153   1.1  christos 		return (EBADF);
    154   1.1  christos 
    155   1.1  christos 	com = SCARG(uap, com);
    156   1.1  christos 	ioctlf = fp->f_ops->fo_ioctl;
    157   1.6      fvdl 	retval[0] = error = 0;
    158   1.1  christos 
    159  1.20  christos 	u1 = malloc(sizeof(*u1), M_TEMP, M_WAITOK);
    160  1.20  christos 	u2 = malloc(sizeof(*u2), M_TEMP, M_WAITOK);
    161  1.20  christos 
    162   1.1  christos 	switch(com) {
    163   1.1  christos 	case LINUX_CDROMPLAYMSF:
    164   1.1  christos 		error = copyin(SCARG(uap, data), &l_msf, sizeof l_msf);
    165   1.1  christos 		if (error)
    166   1.6      fvdl 			break;
    167   1.1  christos 
    168   1.1  christos 		t_msf.start_m = l_msf.cdmsf_min0;
    169   1.1  christos 		t_msf.start_s = l_msf.cdmsf_sec0;
    170   1.1  christos 		t_msf.start_f = l_msf.cdmsf_frame0;
    171   1.1  christos 		t_msf.end_m = l_msf.cdmsf_min1;
    172   1.1  christos 		t_msf.end_s = l_msf.cdmsf_sec1;
    173   1.1  christos 		t_msf.end_f = l_msf.cdmsf_frame1;
    174   1.1  christos 
    175  1.26        ad 		error = ioctlf(fp, CDIOCPLAYMSF, &t_msf);
    176   1.6      fvdl 		break;
    177   1.1  christos 
    178   1.1  christos 	case LINUX_CDROMPLAYTRKIND:
    179   1.1  christos 		error = copyin(SCARG(uap, data), &l_ti, sizeof l_ti);
    180   1.1  christos 		if (error)
    181   1.6      fvdl 			break;
    182   1.1  christos 
    183   1.1  christos 		t_track.start_track = l_ti.cdti_trk0;
    184   1.1  christos 		t_track.start_index = l_ti.cdti_ind0;
    185   1.1  christos 		t_track.end_track = l_ti.cdti_trk1;
    186   1.1  christos 		t_track.end_index = l_ti.cdti_ind1;
    187   1.1  christos 
    188  1.26        ad 		error = ioctlf(fp, CDIOCPLAYTRACKS, &t_track);
    189   1.6      fvdl 		break;
    190   1.1  christos 
    191   1.1  christos 	case LINUX_CDROMREADTOCHDR:
    192  1.26        ad 		error = ioctlf(fp, CDIOREADTOCHEADER, &t_header);
    193   1.1  christos 		if (error)
    194   1.6      fvdl 			break;
    195   1.1  christos 
    196   1.1  christos 		l_tochdr.cdth_trk0 = t_header.starting_track;
    197   1.1  christos 		l_tochdr.cdth_trk1 = t_header.ending_track;
    198   1.1  christos 
    199   1.6      fvdl 		error = copyout(&l_tochdr, SCARG(uap, data), sizeof l_tochdr);
    200   1.6      fvdl 		break;
    201   1.1  christos 
    202   1.1  christos 	case LINUX_CDROMREADTOCENTRY:
    203   1.1  christos 		error = copyin(SCARG(uap, data), &l_tocentry,
    204   1.1  christos 			       sizeof l_tocentry);
    205   1.1  christos 		if (error)
    206   1.6      fvdl 			break;
    207  1.18     perry 
    208  1.23       dsl 		t_toc_entry.req.address_format = l_tocentry.cdte_format;
    209  1.23       dsl 		t_toc_entry.req.starting_track = l_tocentry.cdte_track;
    210  1.23       dsl 		t_toc_entry.req.data_len = sizeof *entry;
    211  1.23       dsl 		t_toc_entry.req.data = NULL;
    212   1.1  christos 
    213  1.26        ad 		error = ioctlf(fp, CDIOREADTOCENTRIES_BUF, &t_toc_entry);
    214   1.1  christos 		if (error)
    215   1.6      fvdl 			break;
    216   1.1  christos 
    217  1.23       dsl 		l_tocentry.cdte_adr = t_toc_entry.entry[0].addr_type;
    218  1.23       dsl 		l_tocentry.cdte_ctrl = t_toc_entry.entry[0].control;
    219  1.23       dsl 		if (bsd_to_linux_msf_lba(t_toc_entry.entry[0].addr_type,
    220  1.23       dsl 		    &t_toc_entry.entry[0].addr, &l_tocentry.cdte_addr) < 0) {
    221  1.13  christos 			DPRINTF(("linux_ioctl: unknown format msf/lba\n"));
    222   1.6      fvdl 			error = EINVAL;
    223   1.1  christos 			break;
    224   1.1  christos 		}
    225  1.18     perry 
    226   1.6      fvdl 		error = copyout(&l_tocentry, SCARG(uap, data),
    227   1.1  christos 			       sizeof l_tocentry);
    228   1.6      fvdl 		break;
    229  1.18     perry 
    230   1.1  christos 	case LINUX_CDROMVOLCTRL:
    231   1.1  christos 		error = copyin(SCARG(uap, data), &l_volctrl, sizeof l_volctrl);
    232   1.1  christos 		if (error)
    233   1.6      fvdl 			break;
    234   1.1  christos 
    235   1.1  christos 		t_vol.vol[0] = l_volctrl.channel0;
    236   1.1  christos 		t_vol.vol[1] = l_volctrl.channel1;
    237   1.1  christos 		t_vol.vol[2] = l_volctrl.channel2;
    238   1.1  christos 		t_vol.vol[3] = l_volctrl.channel3;
    239   1.1  christos 
    240  1.26        ad 		error = ioctlf(fp, CDIOCSETVOL, &t_vol);
    241   1.6      fvdl 		break;
    242   1.1  christos 
    243   1.1  christos 	case LINUX_CDROMVOLREAD:
    244  1.26        ad 		error = ioctlf(fp, CDIOCGETVOL, &t_vol);
    245   1.1  christos 		if (error)
    246   1.6      fvdl 			break;
    247   1.1  christos 
    248   1.1  christos 		l_volctrl.channel0 = t_vol.vol[0];
    249   1.1  christos 		l_volctrl.channel1 = t_vol.vol[1];
    250   1.1  christos 		l_volctrl.channel2 = t_vol.vol[2];
    251   1.1  christos 		l_volctrl.channel3 = t_vol.vol[3];
    252   1.1  christos 
    253   1.6      fvdl 		error = copyout(&l_volctrl, SCARG(uap, data), sizeof l_volctrl);
    254   1.6      fvdl 		break;
    255   1.1  christos 
    256   1.1  christos 	case LINUX_CDROMSUBCHNL:
    257   1.1  christos 		error = copyin(SCARG(uap, data), &l_subchnl, sizeof l_subchnl);
    258   1.1  christos 		if (error)
    259   1.6      fvdl 			break;
    260   1.7      fvdl 
    261  1.23       dsl 		t_subchannel.req.address_format = CD_MSF_FORMAT;
    262  1.23       dsl 		t_subchannel.req.track = 0;
    263  1.23       dsl 		t_subchannel.req.data_format = l_subchnl.cdsc_format;
    264  1.23       dsl 		t_subchannel.req.data_len = sizeof t_subchannel.info;
    265  1.23       dsl 		t_subchannel.req.data = NULL;
    266   1.1  christos 		DPRINTF(("linux_ioctl: CDROMSUBCHNL %d %d\n",
    267   1.1  christos 			 l_subchnl.cdsc_format, l_subchnl.cdsc_trk));
    268   1.1  christos 
    269  1.26        ad 		error = ioctlf(fp, CDIOCREADSUBCHANNEL_BUF, &t_subchannel);
    270   1.1  christos 		if (error)
    271   1.6      fvdl 			break;
    272   1.1  christos 
    273  1.23       dsl 		l_subchnl.cdsc_audiostatus = t_subchannel.info.header.audio_status;
    274  1.23       dsl 		l_subchnl.cdsc_adr = t_subchannel.info.what.position.addr_type;
    275  1.23       dsl 		l_subchnl.cdsc_ctrl = t_subchannel.info.what.position.control;
    276  1.23       dsl 		l_subchnl.cdsc_ind = t_subchannel.info.what.position.index_number;
    277  1.18     perry 
    278   1.6      fvdl 		DPRINTF(("linux_ioctl: CDIOCREADSUBCHANNEL %d %d %d\n",
    279  1.23       dsl 			t_subchannel.info.header.audio_status,
    280  1.23       dsl 			t_subchannel.info.header.data_len[0],
    281  1.23       dsl 			t_subchannel.info.header.data_len[1]));
    282   1.6      fvdl 		DPRINTF(("(more) %d %d %d %d %d\n",
    283  1.23       dsl 			t_subchannel.info.what.position.data_format,
    284  1.23       dsl 			t_subchannel.info.what.position.control,
    285  1.23       dsl 			t_subchannel.info.what.position.addr_type,
    286  1.23       dsl 			t_subchannel.info.what.position.track_number,
    287  1.23       dsl 			t_subchannel.info.what.position.index_number));
    288  1.23       dsl 
    289  1.23       dsl 		if (bsd_to_linux_msf_lba(t_subchannel.req.address_format,
    290  1.23       dsl 				     &t_subchannel.info.what.position.absaddr,
    291  1.23       dsl 				     &l_subchnl.cdsc_absaddr) < 0 ||
    292  1.23       dsl 		    bsd_to_linux_msf_lba(t_subchannel.req.address_format,
    293  1.23       dsl 				     &t_subchannel.info.what.position.reladdr,
    294  1.23       dsl 				     &l_subchnl.cdsc_reladdr) < 0) {
    295   1.6      fvdl 			DPRINTF(("linux_ioctl: unknown format msf/lba\n"));
    296   1.6      fvdl 			error = EINVAL;
    297   1.6      fvdl 			break;
    298   1.6      fvdl 		}
    299   1.1  christos 
    300   1.6      fvdl 		error = copyout(&l_subchnl, SCARG(uap, data), sizeof l_subchnl);
    301   1.6      fvdl 		break;
    302   1.1  christos 
    303   1.1  christos 	case LINUX_CDROMPLAYBLK:
    304   1.1  christos 		error = copyin(SCARG(uap, data), &l_blk, sizeof l_blk);
    305   1.1  christos 		if (error)
    306   1.6      fvdl 			break;
    307   1.1  christos 
    308   1.1  christos 		t_blocks.blk = l_blk.from;
    309   1.1  christos 		t_blocks.len = l_blk.len;
    310   1.1  christos 
    311  1.26        ad 		error = ioctlf(fp, CDIOCPLAYBLOCKS, &t_blocks);
    312   1.6      fvdl 		break;
    313   1.1  christos 
    314   1.1  christos 	case LINUX_CDROMEJECT_SW:
    315   1.1  christos 		error = copyin(SCARG(uap, data), &idata, sizeof idata);
    316   1.1  christos 		if (error)
    317   1.6      fvdl 			break;
    318   1.1  christos 
    319   1.1  christos 		if (idata == 1)
    320   1.1  christos 			ncom = CDIOCALLOW;
    321   1.1  christos 		else
    322   1.1  christos 			ncom = CDIOCPREVENT;
    323  1.26        ad 		error = ioctlf(fp, ncom, NULL);
    324   1.1  christos 		break;
    325   1.1  christos 
    326   1.1  christos 	case LINUX_CDROMPAUSE:
    327  1.26        ad 		error = ioctlf(fp, CDIOCPAUSE, NULL);
    328   1.1  christos 		break;
    329   1.1  christos 
    330   1.1  christos 	case LINUX_CDROMRESUME:
    331  1.26        ad 		error = ioctlf(fp, CDIOCRESUME, NULL);
    332   1.1  christos 		break;
    333   1.1  christos 
    334   1.1  christos 	case LINUX_CDROMSTOP:
    335  1.26        ad 		error = ioctlf(fp, CDIOCSTOP, NULL);
    336   1.1  christos 		break;
    337   1.1  christos 
    338   1.1  christos 	case LINUX_CDROMSTART:
    339  1.26        ad 		error = ioctlf(fp, CDIOCSTART, NULL);
    340   1.1  christos 		break;
    341   1.1  christos 
    342   1.1  christos 	case LINUX_CDROMEJECT:
    343  1.26        ad 		error = ioctlf(fp, CDIOCEJECT, NULL);
    344   1.1  christos 		break;
    345   1.1  christos 
    346   1.1  christos 	case LINUX_CDROMRESET:
    347  1.26        ad 		error = ioctlf(fp, CDIOCRESET, NULL);
    348   1.6      fvdl 		break;
    349   1.6      fvdl 
    350   1.6      fvdl 	case LINUX_CDROMMULTISESSION:
    351   1.6      fvdl 		error = copyin(SCARG(uap, data), &l_session, sizeof l_session);
    352   1.6      fvdl 		if (error)
    353   1.6      fvdl 			break;
    354   1.6      fvdl 
    355  1.26        ad 		error = ioctlf(fp, CDIOREADTOCHEADER, &t_header);
    356   1.6      fvdl 		if (error)
    357   1.6      fvdl 			break;
    358   1.6      fvdl 
    359  1.23       dsl 		t_toc_entry.req.address_format = l_session.addr_format;
    360  1.23       dsl 		t_toc_entry.req.starting_track = 0;
    361  1.23       dsl 		t_toc_entry.req.data_len = sizeof t_toc_entry.entry;
    362  1.23       dsl 		t_toc_entry.req.data = NULL;
    363   1.6      fvdl 
    364  1.26        ad 		error = ioctlf(fp, CDIOREADTOCENTRIES_BUF, &t_toc_entry);
    365   1.6      fvdl 		if (error)
    366   1.6      fvdl 			break;
    367   1.6      fvdl 
    368   1.6      fvdl 		if (bsd_to_linux_msf_lba(l_session.addr_format,
    369  1.23       dsl 		    &t_toc_entry.entry[0].addr, &l_session.addr) < 0) {
    370   1.6      fvdl 			error = EINVAL;
    371   1.6      fvdl 			break;
    372   1.6      fvdl 		}
    373   1.6      fvdl 
    374   1.6      fvdl 		l_session.xa_flag =
    375   1.6      fvdl 		    t_header.starting_track != t_header.ending_track;
    376   1.6      fvdl 
    377   1.6      fvdl 		error = copyout(&l_session, SCARG(uap, data), sizeof l_session);
    378   1.6      fvdl 		break;
    379   1.6      fvdl 
    380   1.6      fvdl 	case LINUX_CDROMCLOSETRAY:
    381  1.26        ad 		error = ioctlf(fp, CDIOCCLOSE, NULL);
    382   1.6      fvdl 		break;
    383   1.6      fvdl 
    384   1.6      fvdl 	case LINUX_CDROM_LOCKDOOR:
    385   1.6      fvdl 		ncom = SCARG(uap, data) != 0 ? CDIOCPREVENT : CDIOCALLOW;
    386  1.26        ad 		error = ioctlf(fp, ncom, NULL);
    387   1.6      fvdl 		break;
    388   1.6      fvdl 
    389   1.6      fvdl 	case LINUX_CDROM_SET_OPTIONS:
    390   1.6      fvdl 	case LINUX_CDROM_CLEAR_OPTIONS:
    391   1.6      fvdl 		/* whatever you say */
    392   1.6      fvdl 		break;
    393   1.6      fvdl 
    394   1.6      fvdl 	case LINUX_CDROM_DEBUG:
    395   1.6      fvdl 		ncom = SCARG(uap, data) != 0 ? CDIOCSETDEBUG : CDIOCCLRDEBUG;
    396  1.26        ad 		error = ioctlf(fp, ncom, NULL);
    397   1.6      fvdl 		break;
    398   1.6      fvdl 
    399   1.6      fvdl 	case LINUX_CDROM_SELECT_SPEED:
    400   1.6      fvdl 	case LINUX_CDROM_SELECT_DISC:
    401   1.6      fvdl 	case LINUX_CDROM_MEDIA_CHANGED:
    402   1.6      fvdl 	case LINUX_CDROM_DRIVE_STATUS:
    403   1.6      fvdl 	case LINUX_CDROM_DISC_STATUS:
    404   1.6      fvdl 	case LINUX_CDROM_CHANGER_NSLOTS:
    405   1.6      fvdl 	case LINUX_CDROM_GET_CAPABILITY:
    406   1.7      fvdl 		error = ENOSYS;
    407   1.1  christos 		break;
    408   1.5   mycroft 
    409   1.5   mycroft 	case LINUX_DVD_READ_STRUCT:
    410   1.5   mycroft 		error = copyin(SCARG(uap, data), &ds, sizeof ds);
    411   1.5   mycroft 		if (error)
    412   1.6      fvdl 			break;
    413  1.26        ad 		error = ioctlf(fp, DVD_READ_STRUCT, &ds);
    414   1.5   mycroft 		if (error)
    415   1.6      fvdl 			break;
    416   1.5   mycroft 		error = copyout(&ds, SCARG(uap, data), sizeof ds);
    417   1.6      fvdl 		break;
    418   1.5   mycroft 
    419   1.5   mycroft 	case LINUX_DVD_WRITE_STRUCT:
    420   1.5   mycroft 		error = copyin(SCARG(uap, data), &ds, sizeof ds);
    421   1.5   mycroft 		if (error)
    422   1.6      fvdl 			break;
    423  1.26        ad 		error = ioctlf(fp, DVD_WRITE_STRUCT, &ds);
    424   1.5   mycroft 		if (error)
    425   1.6      fvdl 			break;
    426   1.5   mycroft 		error = copyout(&ds, SCARG(uap, data), sizeof ds);
    427   1.6      fvdl 		break;
    428   1.5   mycroft 
    429   1.5   mycroft 	case LINUX_DVD_AUTH:
    430   1.5   mycroft 		error = copyin(SCARG(uap, data), &dai, sizeof dai);
    431   1.5   mycroft 		if (error)
    432   1.6      fvdl 			break;
    433  1.26        ad 		error = ioctlf(fp, DVD_AUTH, &dai);
    434   1.5   mycroft 		if (error)
    435   1.6      fvdl 			break;
    436   1.5   mycroft 		error = copyout(&dai, SCARG(uap, data), sizeof dai);
    437   1.6      fvdl 		break;
    438   1.5   mycroft 
    439   1.1  christos 
    440   1.1  christos 	default:
    441   1.4  christos 		DPRINTF(("linux_ioctl: unimplemented ioctl %08lx\n", com));
    442   1.6      fvdl 		error = EINVAL;
    443   1.1  christos 	}
    444   1.1  christos 
    445  1.26        ad 	fd_putfile(SCARG(uap, fd));
    446  1.20  christos 	free(u1, M_TEMP);
    447  1.20  christos 	free(u2, M_TEMP);
    448   1.6      fvdl 	return error;
    449   1.1  christos }
    450