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