1============================
2Summary of CDROM ioctl calls
3============================
4
5- Edward A. Falk <efalk@google.com>
6
7November, 2004
8
9This document attempts to describe the ioctl(2) calls supported by
10the CDROM layer.  These are by-and-large implemented (as of Linux 2.6)
11in drivers/cdrom/cdrom.c and drivers/block/scsi_ioctl.c
12
13ioctl values are listed in <linux/cdrom.h>.  As of this writing, they
14are as follows:
15
16	========================  ===============================================
17	CDROMPAUSE		  Pause Audio Operation
18	CDROMRESUME		  Resume paused Audio Operation
19	CDROMPLAYMSF		  Play Audio MSF (struct cdrom_msf)
20	CDROMPLAYTRKIND		  Play Audio Track/index (struct cdrom_ti)
21	CDROMREADTOCHDR		  Read TOC header (struct cdrom_tochdr)
22	CDROMREADTOCENTRY	  Read TOC entry (struct cdrom_tocentry)
23	CDROMSTOP		  Stop the cdrom drive
24	CDROMSTART		  Start the cdrom drive
25	CDROMEJECT		  Ejects the cdrom media
26	CDROMVOLCTRL		  Control output volume (struct cdrom_volctrl)
27	CDROMSUBCHNL		  Read subchannel data (struct cdrom_subchnl)
28	CDROMREADMODE2		  Read CDROM mode 2 data (2336 Bytes)
29				  (struct cdrom_read)
30	CDROMREADMODE1		  Read CDROM mode 1 data (2048 Bytes)
31				  (struct cdrom_read)
32	CDROMREADAUDIO		  (struct cdrom_read_audio)
33	CDROMEJECT_SW		  enable(1)/disable(0) auto-ejecting
34	CDROMMULTISESSION	  Obtain the start-of-last-session
35				  address of multi session disks
36				  (struct cdrom_multisession)
37	CDROM_GET_MCN		  Obtain the "Universal Product Code"
38				  if available (struct cdrom_mcn)
39	CDROM_GET_UPC		  Deprecated, use CDROM_GET_MCN instead.
40	CDROMRESET		  hard-reset the drive
41	CDROMVOLREAD		  Get the drive's volume setting
42				  (struct cdrom_volctrl)
43	CDROMREADRAW		  read data in raw mode (2352 Bytes)
44				  (struct cdrom_read)
45	CDROMREADCOOKED		  read data in cooked mode
46	CDROMSEEK		  seek msf address
47	CDROMPLAYBLK		  scsi-cd only, (struct cdrom_blk)
48	CDROMREADALL		  read all 2646 bytes
49	CDROMGETSPINDOWN	  return 4-bit spindown value
50	CDROMSETSPINDOWN	  set 4-bit spindown value
51	CDROMCLOSETRAY		  pendant of CDROMEJECT
52	CDROM_SET_OPTIONS	  Set behavior options
53	CDROM_CLEAR_OPTIONS	  Clear behavior options
54	CDROM_SELECT_SPEED	  Set the CD-ROM speed
55	CDROM_SELECT_DISC	  Select disc (for juke-boxes)
56	CDROM_MEDIA_CHANGED	  Check is media changed
57	CDROM_TIMED_MEDIA_CHANGE  Check if media changed
58				  since given time
59				  (struct cdrom_timed_media_change_info)
60	CDROM_DRIVE_STATUS	  Get tray position, etc.
61	CDROM_DISC_STATUS	  Get disc type, etc.
62	CDROM_CHANGER_NSLOTS	  Get number of slots
63	CDROM_LOCKDOOR		  lock or unlock door
64	CDROM_DEBUG		  Turn debug messages on/off
65	CDROM_GET_CAPABILITY	  get capabilities
66	CDROMAUDIOBUFSIZ	  set the audio buffer size
67	DVD_READ_STRUCT		  Read structure
68	DVD_WRITE_STRUCT	  Write structure
69	DVD_AUTH		  Authentication
70	CDROM_SEND_PACKET	  send a packet to the drive
71	CDROM_NEXT_WRITABLE	  get next writable block
72	CDROM_LAST_WRITTEN	  get last block written on disc
73	========================  ===============================================
74
75
76The information that follows was determined from reading kernel source
77code.  It is likely that some corrections will be made over time.
78
79------------------------------------------------------------------------------
80
81General:
82
83	Unless otherwise specified, all ioctl calls return 0 on success
84	and -1 with errno set to an appropriate value on error.  (Some
85	ioctls return non-negative data values.)
86
87	Unless otherwise specified, all ioctl calls return -1 and set
88	errno to EFAULT on a failed attempt to copy data to or from user
89	address space.
90
91	Individual drivers may return error codes not listed here.
92
93	Unless otherwise specified, all data structures and constants
94	are defined in <linux/cdrom.h>
95
96------------------------------------------------------------------------------
97
98
99CDROMPAUSE
100	Pause Audio Operation
101
102
103	usage::
104
105	  ioctl(fd, CDROMPAUSE, 0);
106
107
108	inputs:
109		none
110
111
112	outputs:
113		none
114
115
116	error return:
117	  - ENOSYS	cd drive not audio-capable.
118
119
120CDROMRESUME
121	Resume paused Audio Operation
122
123
124	usage::
125
126	  ioctl(fd, CDROMRESUME, 0);
127
128
129	inputs:
130		none
131
132
133	outputs:
134		none
135
136
137	error return:
138	  - ENOSYS	cd drive not audio-capable.
139
140
141CDROMPLAYMSF
142	Play Audio MSF
143
144	(struct cdrom_msf)
145
146
147	usage::
148
149	  struct cdrom_msf msf;
150
151	  ioctl(fd, CDROMPLAYMSF, &msf);
152
153	inputs:
154		cdrom_msf structure, describing a segment of music to play
155
156
157	outputs:
158		none
159
160
161	error return:
162	  - ENOSYS	cd drive not audio-capable.
163
164	notes:
165		- MSF stands for minutes-seconds-frames
166		- LBA stands for logical block address
167		- Segment is described as start and end times, where each time
168		  is described as minutes:seconds:frames.
169		  A frame is 1/75 of a second.
170
171
172CDROMPLAYTRKIND
173	Play Audio Track/index
174
175	(struct cdrom_ti)
176
177
178	usage::
179
180	  struct cdrom_ti ti;
181
182	  ioctl(fd, CDROMPLAYTRKIND, &ti);
183
184	inputs:
185		cdrom_ti structure, describing a segment of music to play
186
187
188	outputs:
189		none
190
191
192	error return:
193	  - ENOSYS	cd drive not audio-capable.
194
195	notes:
196		- Segment is described as start and end times, where each time
197		  is described as a track and an index.
198
199
200
201CDROMREADTOCHDR
202	Read TOC header
203
204	(struct cdrom_tochdr)
205
206
207	usage::
208
209	  cdrom_tochdr header;
210
211	  ioctl(fd, CDROMREADTOCHDR, &header);
212
213	inputs:
214		cdrom_tochdr structure
215
216
217	outputs:
218		cdrom_tochdr structure
219
220
221	error return:
222	  - ENOSYS	cd drive not audio-capable.
223
224
225
226CDROMREADTOCENTRY
227	Read TOC entry
228
229	(struct cdrom_tocentry)
230
231
232	usage::
233
234	  struct cdrom_tocentry entry;
235
236	  ioctl(fd, CDROMREADTOCENTRY, &entry);
237
238	inputs:
239		cdrom_tocentry structure
240
241
242	outputs:
243		cdrom_tocentry structure
244
245
246	error return:
247	  - ENOSYS	cd drive not audio-capable.
248	  - EINVAL	entry.cdte_format not CDROM_MSF or CDROM_LBA
249	  - EINVAL	requested track out of bounds
250	  - EIO		I/O error reading TOC
251
252	notes:
253		- TOC stands for Table Of Contents
254		- MSF stands for minutes-seconds-frames
255		- LBA stands for logical block address
256
257
258
259CDROMSTOP
260	Stop the cdrom drive
261
262
263	usage::
264
265	  ioctl(fd, CDROMSTOP, 0);
266
267
268	inputs:
269		none
270
271
272	outputs:
273		none
274
275
276	error return:
277	  - ENOSYS	cd drive not audio-capable.
278
279	notes:
280	  - Exact interpretation of this ioctl depends on the device,
281	    but most seem to spin the drive down.
282
283
284CDROMSTART
285	Start the cdrom drive
286
287
288	usage::
289
290	  ioctl(fd, CDROMSTART, 0);
291
292
293	inputs:
294		none
295
296
297	outputs:
298		none
299
300
301	error return:
302	  - ENOSYS	cd drive not audio-capable.
303
304	notes:
305	  - Exact interpretation of this ioctl depends on the device,
306	    but most seem to spin the drive up and/or close the tray.
307	    Other devices ignore the ioctl completely.
308
309
310CDROMEJECT
311	- Ejects the cdrom media
312
313
314	usage::
315
316	  ioctl(fd, CDROMEJECT, 0);
317
318
319	inputs:
320		none
321
322
323	outputs:
324		none
325
326
327	error returns:
328	  - ENOSYS	cd drive not capable of ejecting
329	  - EBUSY	other processes are accessing drive, or door is locked
330
331	notes:
332		- See CDROM_LOCKDOOR, below.
333
334
335
336
337CDROMCLOSETRAY
338	pendant of CDROMEJECT
339
340
341	usage::
342
343	  ioctl(fd, CDROMCLOSETRAY, 0);
344
345
346	inputs:
347		none
348
349
350	outputs:
351		none
352
353
354	error returns:
355	  - ENOSYS	cd drive not capable of closing the tray
356	  - EBUSY	other processes are accessing drive, or door is locked
357
358	notes:
359		- See CDROM_LOCKDOOR, below.
360
361
362
363
364CDROMVOLCTRL
365	Control output volume (struct cdrom_volctrl)
366
367
368	usage::
369
370	  struct cdrom_volctrl volume;
371
372	  ioctl(fd, CDROMVOLCTRL, &volume);
373
374	inputs:
375		cdrom_volctrl structure containing volumes for up to 4
376		channels.
377
378	outputs:
379		none
380
381
382	error return:
383	  - ENOSYS	cd drive not audio-capable.
384
385
386
387CDROMVOLREAD
388	Get the drive's volume setting
389
390	(struct cdrom_volctrl)
391
392
393	usage::
394
395	  struct cdrom_volctrl volume;
396
397	  ioctl(fd, CDROMVOLREAD, &volume);
398
399	inputs:
400		none
401
402
403	outputs:
404		The current volume settings.
405
406
407	error return:
408	  - ENOSYS	cd drive not audio-capable.
409
410
411
412CDROMSUBCHNL
413	Read subchannel data
414
415	(struct cdrom_subchnl)
416
417
418	usage::
419
420	  struct cdrom_subchnl q;
421
422	  ioctl(fd, CDROMSUBCHNL, &q);
423
424	inputs:
425		cdrom_subchnl structure
426
427
428	outputs:
429		cdrom_subchnl structure
430
431
432	error return:
433	  - ENOSYS	cd drive not audio-capable.
434	  - EINVAL	format not CDROM_MSF or CDROM_LBA
435
436	notes:
437		- Format is converted to CDROM_MSF or CDROM_LBA
438		  as per user request on return
439
440
441
442CDROMREADRAW
443	read data in raw mode (2352 Bytes)
444
445	(struct cdrom_read)
446
447	usage::
448
449	  union {
450
451	    struct cdrom_msf msf;		/* input */
452	    char buffer[CD_FRAMESIZE_RAW];	/* return */
453	  } arg;
454	  ioctl(fd, CDROMREADRAW, &arg);
455
456	inputs:
457		cdrom_msf structure indicating an address to read.
458
459		Only the start values are significant.
460
461	outputs:
462		Data written to address provided by user.
463
464
465	error return:
466	  - EINVAL	address less than 0, or msf less than 0:2:0
467	  - ENOMEM	out of memory
468
469	notes:
470		- As of 2.6.8.1, comments in <linux/cdrom.h> indicate that this
471		  ioctl accepts a cdrom_read structure, but actual source code
472		  reads a cdrom_msf structure and writes a buffer of data to
473		  the same address.
474
475		- MSF values are converted to LBA values via this formula::
476
477		    lba = (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET;
478
479
480
481
482CDROMREADMODE1
483	Read CDROM mode 1 data (2048 Bytes)
484
485	(struct cdrom_read)
486
487	notes:
488		Identical to CDROMREADRAW except that block size is
489		CD_FRAMESIZE (2048) bytes
490
491
492
493CDROMREADMODE2
494	Read CDROM mode 2 data (2336 Bytes)
495
496	(struct cdrom_read)
497
498	notes:
499		Identical to CDROMREADRAW except that block size is
500		CD_FRAMESIZE_RAW0 (2336) bytes
501
502
503
504CDROMREADAUDIO
505	(struct cdrom_read_audio)
506
507	usage::
508
509	  struct cdrom_read_audio ra;
510
511	  ioctl(fd, CDROMREADAUDIO, &ra);
512
513	inputs:
514		cdrom_read_audio structure containing read start
515		point and length
516
517	outputs:
518		audio data, returned to buffer indicated by ra
519
520
521	error return:
522	  - EINVAL	format not CDROM_MSF or CDROM_LBA
523	  - EINVAL	nframes not in range [1 75]
524	  - ENXIO	drive has no queue (probably means invalid fd)
525	  - ENOMEM	out of memory
526
527
528CDROMEJECT_SW
529	enable(1)/disable(0) auto-ejecting
530
531
532	usage::
533
534	  int val;
535
536	  ioctl(fd, CDROMEJECT_SW, val);
537
538	inputs:
539		Flag specifying auto-eject flag.
540
541
542	outputs:
543		none
544
545
546	error return:
547	  - ENOSYS	Drive is not capable of ejecting.
548	  - EBUSY	Door is locked
549
550
551
552
553CDROMMULTISESSION
554	Obtain the start-of-last-session address of multi session disks
555
556	(struct cdrom_multisession)
557
558	usage::
559
560	  struct cdrom_multisession ms_info;
561
562	  ioctl(fd, CDROMMULTISESSION, &ms_info);
563
564	inputs:
565		cdrom_multisession structure containing desired
566
567	  format.
568
569	outputs:
570		cdrom_multisession structure is filled with last_session
571		information.
572
573	error return:
574	  - EINVAL	format not CDROM_MSF or CDROM_LBA
575
576
577CDROM_GET_MCN
578	Obtain the "Universal Product Code"
579	if available
580
581	(struct cdrom_mcn)
582
583
584	usage::
585
586	  struct cdrom_mcn mcn;
587
588	  ioctl(fd, CDROM_GET_MCN, &mcn);
589
590	inputs:
591		none
592
593
594	outputs:
595		Universal Product Code
596
597
598	error return:
599	  - ENOSYS	Drive is not capable of reading MCN data.
600
601	notes:
602		- Source code comments state::
603
604		    The following function is implemented, although very few
605		    audio discs give Universal Product Code information, which
606		    should just be the Medium Catalog Number on the box.  Note,
607		    that the way the code is written on the CD is /not/ uniform
608		    across all discs!
609
610
611
612
613CDROM_GET_UPC
614	CDROM_GET_MCN  (deprecated)
615
616
617	Not implemented, as of 2.6.8.1
618
619
620
621CDROMRESET
622	hard-reset the drive
623
624
625	usage::
626
627	  ioctl(fd, CDROMRESET, 0);
628
629
630	inputs:
631		none
632
633
634	outputs:
635		none
636
637
638	error return:
639	  - EACCES	Access denied:  requires CAP_SYS_ADMIN
640	  - ENOSYS	Drive is not capable of resetting.
641
642
643
644
645CDROMREADCOOKED
646	read data in cooked mode
647
648
649	usage::
650
651	  u8 buffer[CD_FRAMESIZE]
652
653	  ioctl(fd, CDROMREADCOOKED, buffer);
654
655	inputs:
656		none
657
658
659	outputs:
660		2048 bytes of data, "cooked" mode.
661
662
663	notes:
664		Not implemented on all drives.
665
666
667
668
669
670CDROMREADALL
671	read all 2646 bytes
672
673
674	Same as CDROMREADCOOKED, but reads 2646 bytes.
675
676
677
678CDROMSEEK
679	seek msf address
680
681
682	usage::
683
684	  struct cdrom_msf msf;
685
686	  ioctl(fd, CDROMSEEK, &msf);
687
688	inputs:
689		MSF address to seek to.
690
691
692	outputs:
693		none
694
695
696
697
698CDROMPLAYBLK
699	scsi-cd only
700
701	(struct cdrom_blk)
702
703
704	usage::
705
706	  struct cdrom_blk blk;
707
708	  ioctl(fd, CDROMPLAYBLK, &blk);
709
710	inputs:
711		Region to play
712
713
714	outputs:
715		none
716
717
718
719
720CDROMGETSPINDOWN
721	usage::
722
723	  char spindown;
724
725	  ioctl(fd, CDROMGETSPINDOWN, &spindown);
726
727	inputs:
728		none
729
730
731	outputs:
732		The value of the current 4-bit spindown value.
733
734
735
736
737
738CDROMSETSPINDOWN
739	usage::
740
741	  char spindown
742
743	  ioctl(fd, CDROMSETSPINDOWN, &spindown);
744
745	inputs:
746		4-bit value used to control spindown (TODO: more detail here)
747
748
749	outputs:
750		none
751
752
753
754
755
756
757CDROM_SET_OPTIONS
758	Set behavior options
759
760
761	usage::
762
763	  int options;
764
765	  ioctl(fd, CDROM_SET_OPTIONS, options);
766
767	inputs:
768		New values for drive options.  The logical 'or' of:
769
770	    ==============      ==================================
771	    CDO_AUTO_CLOSE	close tray on first open(2)
772	    CDO_AUTO_EJECT	open tray on last release
773	    CDO_USE_FFLAGS	use O_NONBLOCK information on open
774	    CDO_LOCK		lock tray on open files
775	    CDO_CHECK_TYPE	check type on open for data
776	    ==============      ==================================
777
778	outputs:
779		Returns the resulting options settings in the
780		ioctl return value.  Returns -1 on error.
781
782	error return:
783	  - ENOSYS	selected option(s) not supported by drive.
784
785
786
787
788CDROM_CLEAR_OPTIONS
789	Clear behavior options
790
791
792	Same as CDROM_SET_OPTIONS, except that selected options are
793	turned off.
794
795
796
797CDROM_SELECT_SPEED
798	Set the CD-ROM speed
799
800
801	usage::
802
803	  int speed;
804
805	  ioctl(fd, CDROM_SELECT_SPEED, speed);
806
807	inputs:
808		New drive speed.
809
810
811	outputs:
812		none
813
814
815	error return:
816	  - ENOSYS	speed selection not supported by drive.
817
818
819
820CDROM_SELECT_DISC
821	Select disc (for juke-boxes)
822
823
824	usage::
825
826	  int disk;
827
828	  ioctl(fd, CDROM_SELECT_DISC, disk);
829
830	inputs:
831		Disk to load into drive.
832
833
834	outputs:
835		none
836
837
838	error return:
839	  - EINVAL	Disk number beyond capacity of drive
840
841
842
843CDROM_MEDIA_CHANGED
844	Check is media changed
845
846
847	usage::
848
849	  int slot;
850
851	  ioctl(fd, CDROM_MEDIA_CHANGED, slot);
852
853	inputs:
854		Slot number to be tested, always zero except for jukeboxes.
855
856		May also be special values CDSL_NONE or CDSL_CURRENT
857
858	outputs:
859		Ioctl return value is 0 or 1 depending on whether the media
860
861	  has been changed, or -1 on error.
862
863	error returns:
864	  - ENOSYS	Drive can't detect media change
865	  - EINVAL	Slot number beyond capacity of drive
866	  - ENOMEM	Out of memory
867
868
869
870CDROM_DRIVE_STATUS
871	Get tray position, etc.
872
873
874	usage::
875
876	  int slot;
877
878	  ioctl(fd, CDROM_DRIVE_STATUS, slot);
879
880	inputs:
881		Slot number to be tested, always zero except for jukeboxes.
882
883		May also be special values CDSL_NONE or CDSL_CURRENT
884
885	outputs:
886		Ioctl return value will be one of the following values
887
888	  from <linux/cdrom.h>:
889
890	    =================== ==========================
891	    CDS_NO_INFO		Information not available.
892	    CDS_NO_DISC
893	    CDS_TRAY_OPEN
894	    CDS_DRIVE_NOT_READY
895	    CDS_DISC_OK
896	    -1			error
897	    =================== ==========================
898
899	error returns:
900	  - ENOSYS	Drive can't detect drive status
901	  - EINVAL	Slot number beyond capacity of drive
902	  - ENOMEM	Out of memory
903
904
905
906
907CDROM_DISC_STATUS
908	Get disc type, etc.
909
910
911	usage::
912
913	  ioctl(fd, CDROM_DISC_STATUS, 0);
914
915
916	inputs:
917		none
918
919
920	outputs:
921		Ioctl return value will be one of the following values
922
923	  from <linux/cdrom.h>:
924
925	    - CDS_NO_INFO
926	    - CDS_AUDIO
927	    - CDS_MIXED
928	    - CDS_XA_2_2
929	    - CDS_XA_2_1
930	    - CDS_DATA_1
931
932	error returns:
933		none at present
934
935	notes:
936	    - Source code comments state::
937
938
939		Ok, this is where problems start.  The current interface for
940		the CDROM_DISC_STATUS ioctl is flawed.  It makes the false
941		assumption that CDs are all CDS_DATA_1 or all CDS_AUDIO, etc.
942		Unfortunately, while this is often the case, it is also
943		very common for CDs to have some tracks with data, and some
944		tracks with audio.	Just because I feel like it, I declare
945		the following to be the best way to cope.  If the CD has
946		ANY data tracks on it, it will be returned as a data CD.
947		If it has any XA tracks, I will return it as that.	Now I
948		could simplify this interface by combining these returns with
949		the above, but this more clearly demonstrates the problem
950		with the current interface.  Too bad this wasn't designed
951		to use bitmasks...	       -Erik
952
953		Well, now we have the option CDS_MIXED: a mixed-type CD.
954		User level programmers might feel the ioctl is not very
955		useful.
956				---david
957
958
959
960
961CDROM_CHANGER_NSLOTS
962	Get number of slots
963
964
965	usage::
966
967	  ioctl(fd, CDROM_CHANGER_NSLOTS, 0);
968
969
970	inputs:
971		none
972
973
974	outputs:
975		The ioctl return value will be the number of slots in a
976		CD changer.  Typically 1 for non-multi-disk devices.
977
978	error returns:
979		none
980
981
982
983CDROM_LOCKDOOR
984	lock or unlock door
985
986
987	usage::
988
989	  int lock;
990
991	  ioctl(fd, CDROM_LOCKDOOR, lock);
992
993	inputs:
994		Door lock flag, 1=lock, 0=unlock
995
996
997	outputs:
998		none
999
1000
1001	error returns:
1002	  - EDRIVE_CANT_DO_THIS
1003
1004				Door lock function not supported.
1005	  - EBUSY
1006
1007				Attempt to unlock when multiple users
1008				have the drive open and not CAP_SYS_ADMIN
1009
1010	notes:
1011		As of 2.6.8.1, the lock flag is a global lock, meaning that
1012		all CD drives will be locked or unlocked together.  This is
1013		probably a bug.
1014
1015		The EDRIVE_CANT_DO_THIS value is defined in <linux/cdrom.h>
1016		and is currently (2.6.8.1) the same as EOPNOTSUPP
1017
1018
1019
1020CDROM_DEBUG
1021	Turn debug messages on/off
1022
1023
1024	usage::
1025
1026	  int debug;
1027
1028	  ioctl(fd, CDROM_DEBUG, debug);
1029
1030	inputs:
1031		Cdrom debug flag, 0=disable, 1=enable
1032
1033
1034	outputs:
1035		The ioctl return value will be the new debug flag.
1036
1037
1038	error return:
1039	  - EACCES	Access denied:  requires CAP_SYS_ADMIN
1040
1041
1042
1043CDROM_GET_CAPABILITY
1044	get capabilities
1045
1046
1047	usage::
1048
1049	  ioctl(fd, CDROM_GET_CAPABILITY, 0);
1050
1051
1052	inputs:
1053		none
1054
1055
1056	outputs:
1057		The ioctl return value is the current device capability
1058		flags.  See CDC_CLOSE_TRAY, CDC_OPEN_TRAY, etc.
1059
1060
1061
1062CDROMAUDIOBUFSIZ
1063	set the audio buffer size
1064
1065
1066	usage::
1067
1068	  int arg;
1069
1070	  ioctl(fd, CDROMAUDIOBUFSIZ, val);
1071
1072	inputs:
1073		New audio buffer size
1074
1075
1076	outputs:
1077		The ioctl return value is the new audio buffer size, or -1
1078		on error.
1079
1080	error return:
1081	  - ENOSYS	Not supported by this driver.
1082
1083	notes:
1084		Not supported by all drivers.
1085
1086
1087
1088
1089DVD_READ_STRUCT			Read structure
1090
1091	usage::
1092
1093	  dvd_struct s;
1094
1095	  ioctl(fd, DVD_READ_STRUCT, &s);
1096
1097	inputs:
1098		dvd_struct structure, containing:
1099
1100	    =================== ==========================================
1101	    type		specifies the information desired, one of
1102				DVD_STRUCT_PHYSICAL, DVD_STRUCT_COPYRIGHT,
1103				DVD_STRUCT_DISCKEY, DVD_STRUCT_BCA,
1104				DVD_STRUCT_MANUFACT
1105	    physical.layer_num	desired layer, indexed from 0
1106	    copyright.layer_num	desired layer, indexed from 0
1107	    disckey.agid
1108	    =================== ==========================================
1109
1110	outputs:
1111		dvd_struct structure, containing:
1112
1113	    =================== ================================
1114	    physical		for type == DVD_STRUCT_PHYSICAL
1115	    copyright		for type == DVD_STRUCT_COPYRIGHT
1116	    disckey.value	for type == DVD_STRUCT_DISCKEY
1117	    bca.{len,value}	for type == DVD_STRUCT_BCA
1118	    manufact.{len,valu}	for type == DVD_STRUCT_MANUFACT
1119	    =================== ================================
1120
1121	error returns:
1122	  - EINVAL	physical.layer_num exceeds number of layers
1123	  - EIO		Received invalid response from drive
1124
1125
1126
1127DVD_WRITE_STRUCT		Write structure
1128
1129	Not implemented, as of 2.6.8.1
1130
1131
1132
1133DVD_AUTH			Authentication
1134
1135	usage::
1136
1137	  dvd_authinfo ai;
1138
1139	  ioctl(fd, DVD_AUTH, &ai);
1140
1141	inputs:
1142		dvd_authinfo structure.  See <linux/cdrom.h>
1143
1144
1145	outputs:
1146		dvd_authinfo structure.
1147
1148
1149	error return:
1150	  - ENOTTY	ai.type not recognized.
1151
1152
1153
1154CDROM_SEND_PACKET
1155	send a packet to the drive
1156
1157
1158	usage::
1159
1160	  struct cdrom_generic_command cgc;
1161
1162	  ioctl(fd, CDROM_SEND_PACKET, &cgc);
1163
1164	inputs:
1165		cdrom_generic_command structure containing the packet to send.
1166
1167
1168	outputs:
1169		none
1170
1171	  cdrom_generic_command structure containing results.
1172
1173	error return:
1174	  - EIO
1175
1176			command failed.
1177	  - EPERM
1178
1179			Operation not permitted, either because a
1180			write command was attempted on a drive which
1181			is opened read-only, or because the command
1182			requires CAP_SYS_RAWIO
1183	  - EINVAL
1184
1185			cgc.data_direction not set
1186
1187
1188
1189CDROM_NEXT_WRITABLE
1190	get next writable block
1191
1192
1193	usage::
1194
1195	  long next;
1196
1197	  ioctl(fd, CDROM_NEXT_WRITABLE, &next);
1198
1199	inputs:
1200		none
1201
1202
1203	outputs:
1204		The next writable block.
1205
1206
1207	notes:
1208		If the device does not support this ioctl directly, the
1209
1210	  ioctl will return CDROM_LAST_WRITTEN + 7.
1211
1212
1213
1214CDROM_LAST_WRITTEN
1215	get last block written on disc
1216
1217
1218	usage::
1219
1220	  long last;
1221
1222	  ioctl(fd, CDROM_LAST_WRITTEN, &last);
1223
1224	inputs:
1225		none
1226
1227
1228	outputs:
1229		The last block written on disc
1230
1231
1232	notes:
1233		If the device does not support this ioctl directly, the
1234		result is derived from the disc's table of contents.  If the
1235		table of contents can't be read, this ioctl returns an
1236		error.
1237