Get hold of the files cdrom.c and ucdrom.h, they should be in
the directory tree that came with this documentation.
Include <linux/ucdrom.h> just after cdrom.h.
change the 3rd argument of
registerblkdev from
SPMamp; < your - drive > fops to
&cdromfops.
Just after that line, add a line to register to the CDROM routines:
registercdrom(major, < name > , < your - drive > dops);
Similarly, add a call to
unregistercdrom().
Copy an example of the device-operations struct to your source,
e.g., from cm206.ccm206dops, and change all entries to names
corresponding to your driver, or names you just happen to like. If
your driver doesn't support a certain function, make the entry
NULL. At the entry
capability you should list all capabilities
your drive could support, in principle. If your drive has a capability
that is not listed, please send me a message.
Implement all functions in your
< device > dops structure,
according to prototypes listed in ucdrom.h, and specifications given in
section . Most likely you have already implemented
the code in a large part, and you may just have to adapt the prototype
and return values.
Rename your
< device > ioctl () function to
audioioctl and
change the prototype a little. Remove entries listed in the first part
in section , if your code was OK, these are just calls
to the routines you adapted in the previous step.
You may remove all remaining memory checking code in the
audioioctl () function that deals with audio commands (these are
listed in the second part of section ). There is no
need for memory allocation either, so most cases in the switch
statement look similar to:
All remaining ioctl cases must be moved to a separate
function,
< device > ioctl, the device-dependent ioctls. Note that
memory checking and allocation must be kept in this code!
Change the prototypes of
< device > open() and
< device > release(), and remove any strategic code (i.e., tray
movement, door locking, etc.).
Try to recompile the drivers. We advice you to use modules, both
for cdrom.o and your driver, as debugging is much easier this
way.