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