• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/linux/linux-2.6/Documentation/cdrom/

Lines Matching refs:to

45   There is plenty of source code around as examples of how to write a driver.
48 hardware has allowed \linux\ to support many different hardware devices.
49 Unfortunately, the very openness that has allowed \linux\ to support
51 device driver to differ significantly from one device to another.
53 devices; the way a particular drive reacts to a `standard' $ioctl()$
54 call varies greatly from one device driver to another. To avoid making
60 This document describes an effort to establish Uniform behavior across
73 adapted their drives to one or more of the already existing electrical
77 scheme, either a separate driver had to be written, or an existing
78 driver had to be enhanced. History has delivered us \cdrom\ support for
85 which was expressed through \cdromh, it appeared to be a rather wild
89 features of the software interface had been added to accommodate the
94 others do not. Some drivers lock the door upon opening the device, to
95 prevent an incoherent file system, but others don't, to allow software
100 I decided to start a discussion on how to make all the \linux\ \cdrom\
103 encouraged me to write the \UCD\ which this document is intended to
105 driver is intended to be an additional software layer that sits on top
107 additional layer, it is possible to have all the different \cdrom\
111 The goal of the \UCD\ is {\em not\/} to alienate driver developers who
112 have not yet taken steps to support this effort. The goal of \UCD\ is
113 simply to give people writing application programs for \cdrom\ drives
118 programmer's interface defined in \cdromh. This guide was written to
119 help \cdrom\ driver developers adapt their code to use the \UCD\ code
130 standard. At the time of the last update to this document (November
131 1997) it is becoming difficult to even {\em find} anything less than a
139 led to the danger of different drivers forgetting to do important things
141 importantly, this led to the divergence of behavior, which has already
144 For this reason, the \UCD\ was created to enforce consistent \cdrom\
145 drive behavior, and to provide a common set of services to the various
151 \cdrom\ drivers' header files to the kernel's cdrom directory. This was
152 done to help ensure that the user is only presented with only one cdrom
156 block-devices such as floppy or hard disc drives), to define a set
187 standardized. The actual interface to the various types of \cdrom\
190 that are common to all \cdrom\ (and really, all removable-media
202 \cdrom\ device. This structure is conceptually connected to the major
208 connected to the minor number of the device.
212 low-level device driver though a call to:
216 information needed for the kernel to interface with the low-level
218 structure is a pointer to the $cdrom_device_ops$ structure of the
222 of pointers to the functions which are implemented in the low-level
224 through the functions in this structure. It is impossible to know all
226 list may need to be expanded from time to time as new technologies are
227 developed. For example, CD-R and CD-R/W drives are beginning to become
228 popular, and support will soon need to be added for them. For now, the
231 \halign{$#$\ \hfil&$#$\ \hfil&\hbox to 10em{$#$\hss}&
257 it should add a function pointer to this $struct$. When a particular
281 \halign{$#$\ \hfil&$#$\ \hfil&\hbox to 10em{$#$\hss}&
304 The $mask$ flags can be used to mask out some of the capabilities listed
305 in $ops\to capability$, if a specific drive doesn't support a feature
314 A few registers contain variables local to the \cdrom\ drive. The
315 flags $options$ are used to specify how the general \cdrom\ routines
317 flexibility to adapt to the different users' wishes (and {\em not\/} the
319 the case in the old scheme). The register $mc_flags$ is used to buffer
320 the information from $media_changed()$ to two separate queues. Other
321 data that is specific to a minor drive, can be accessed through $handle$,
322 which can point to a data structure specific to the low-level driver.
331 it will `sanitize' the format by making requests to the low-level
347 $Open()$ should try to open the device for a specific $purpose$, which
366 the door, should be left over to the general routine $cdrom_release()$.
388 This function is very similar to the original function in $struct\
389 file_operations$. It returns 1 if the medium of the device $cdi\to
395 changes to software (\eg, an auto-mounting daemon).
428 \cdrom\ drives can obtain very high head rates (up to $24\times$ is
440 or 150\,kB/sec file system data). So to request that a \cdrom\ drive
459 device $cdi\to dev$, the start of the last session of the current disc
477 same format. The return argument to this function is a pointer to a
485 listen to commands anymore). Preferably, control is returned to the
488 driver to time out.
496 audio-control. We have decided to leave these to be accessed through a
500 though. It sanitizes the address format type to $CDROM_MSF$ (Minutes,
510 errors should be according to the standards, whatever they are. When
512 possible to return the error code to the calling program. (We may decide
513 to sanitize the return value in $cdrom_ioctl()$ though, in order to
514 guarantee a uniform interface to the audio-player software.)
519 Some $ioctl$s seem to be specific to certain \cdrom\ drives. That is,
520 they are introduced to service some capabilities of certain drives. In
529 bend their backs to cope with this incoherence (to which I would be
530 opposed). Furthermore, it is very difficult for the hardware to find
535 Because there are so many $ioctl$s that seem to be introduced to
550 \cdromc\ supplies the possibility to indicate the {\em capabilities\/}
570 The capability flag is declared $const$, to prevent drivers from
586 There is no $ioctl$ to set the mask\dots The reason is that
587 I think it is better to control the {\em behavior\/} rather than the
593 drives, in order to satisfy different users' wishes, hopefully
594 independently of the ideas of the respective author who happened to
595 have made the drive's support available to the \linux\ community. The
599 CDO_AUTO_CLOSE& try to close tray upon device $open()$\cr
600 CDO_AUTO_EJECT& try to open tray on last device $close()$\cr
601 CDO_USE_FFLAGS& use $file_pointer\rightarrow f_flags$ to indicate
603 CDO_LOCK& try to lock door if device is opened\cr
611 new $ioctl$s implemented in \cdromc, that allow you to control the
625 \newsection{The need to know the purpose of opening the \cdrom\ device}
628 either by reading/writing to the device file, or by issuing
629 controlling commands to the device, by the device's $ioctl()$
631 two entirely different purposes. One is to mount removable
632 file systems, \cdrom s, the other is to play audio CD's. Audio commands
636 that the device can {\em always\/} be opened in order to give the
640 original purpose of \cdrom s is) we would like to make sure that the
643 in a number of i/o errors reported by the VFS to the kernel when an
645 particularly elegant way to find out that there is no \cdrom\ inserted;
646 it more-or-less looks like the old IBM-PC trying to read an empty floppy
656 behavior of the $open()$ call. Audio use simply wants to open the
657 device in order to get a file handle which is needed for issuing
658 $ioctl$ commands, while data use wants to open for correct and
664 permission flags). Most option flags simply don't make sense to
666 $O_SYNC$ have no meaning to a \cdrom.
668 We therefore propose to use the flag $O_NONBLOCK$ to indicate
671 subsequent calls to the device don't cause the calling process to
687 You might hesitate to accept this proposal as it comes from the
692 and are large enough to set their own standard. They do not have to
694 configurations.\footnote{Incidentally, I think that SUN's approach to
701 position in the directory tree, on every system. When I wanted to
706 We believe that using $O_NONBLOCK$ to indicate that a device is being opened
708 community. All the CD-player authors will have to be informed, we can
709 even send in our own patches to the programs. The use of $O_NONBLOCK$
712 to old behavior by a call to $ioctl(file_descriptor, CDROM_CLEAR_OPTIONS,
726 tray is found to be open, an attempt to close the tray is made. Then,
729 are passed is the return value zero. The door is locked to prevent file
739 maintainers and user program developers) to adopt the new \cdrom\
744 Only a few routines in \cdromc\ are exported to the drivers. In this
746 over' the \cdrom\ interface to the kernel. The header file belonging
747 to \cdromc\ is called \cdromh. Formerly, some of the contents of this
754 A pointer to this structure is assigned to the $fops$ field
767 failure. The structure $<device>_info$ should have a pointer to the
782 Unregistering device $cdi$ with minor number $MINOR(cdi\to dev)$ removes
794 $cdrom_device_ops$ connected to the device. Then, the program flow is
795 transferred to the device_dependent $open()$ call.
802 reached 0, the allocated buffers are flushed by calls to $sync_dev(dev)$
827 \item[CDROMEJECT_SW] If $arg\not=0$, set behavior to auto-close (close
829 set behavior to non-moving on $open()$ and $release()$ calls.
836 The following set of $ioctl$s are all implemented through a call to
863 The following $ioctl$s have been introduced to allow user programs to
882 the last call. Note that calls to $cdrom_media_changed$ by the VFS
888 \item[CDROM_DRIVE_STATUS] Returns the status of the drive by a call to
892 $ioctl$ call to $CDROMSUBCHNL$. For juke-boxes, an extra argument
897 drive. It should be viewed as a complement to $CDROM_DRIVE_STATUS$.
899 disc that is inserted in the drive. This functionality used to be
904 various digital information has lead to many different disc types.
907 also very common for CDs to have some tracks with data, and some
940 drive. Refer to section \ref{capability} for more information on
945 to do this. Same semantics as CDROM_LOCKDOOR.
950 Finally, all other $ioctl$s are passed to the function $dev_ioctl()$,
953 \newsection{How to update your driver}
961 $\&<your-drive>_fops$ to $\&cdrom_fops$.
962 \item Just after that line, add the following to register with the \UCD:
964 Similarly, add a call to $unregister_cdrom()$ at the appropriate place.
965 \item Copy an example of the device-operations $struct$ to your
967 entries to names corresponding to your driver, or names you just
968 happen to like. If your driver doesn't support a certain function,
973 driver, and modify the entries according to your needs. If your
977 according to prototypes listed in \cdromh, and specifications given
979 the code in a large part, and you will almost certainly need to adapt the
981 \item Rename your $<device>_ioctl()$ function to $audio_ioctl$ and
984 just calls to the routines you adapted in the previous step.
989 statement look similar to:
994 \item All remaining $ioctl$ cases must be moved to a separate
1000 \item Try to recompile the drivers. We advise you to use modules, both
1007 Thanks to all the people involved. First, Erik Andersen, who has
1009 \cdrom-related code in the 2.1-kernel. Thanks to Scott Snyder and
1010 Gerd Knorr, who were the first to implement this interface for SCSI
1012 structures relative to kernel~2.0. Further thanks to Heiko Eissfeldt,
1015 enough to give suggestions and criticisms during the writing. Finally
1016 of course, I want to thank Linus Torvalds for making this possible in