~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/userspace-api/ioctl/cdrom.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/userspace-api/ioctl/cdrom.rst (Version linux-6.12-rc7) and /Documentation/userspace-api/ioctl/cdrom.rst (Version linux-5.18.19)


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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php