CD(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’Ώ CD(9) β€” the CDROM driver page, but make it make sense ✨

okay so bestie, welcome to CD(9), straight out of the Kernel Developer's Manual πŸŽ€ this is the page all about the cd driver and honestly it's giving "niche but iconic" β€” let's get into it πŸ’…


🌸 NAME 🌸

cd β€” the CDROM driver for the CAM SCSI subsystem πŸ¦‹


✨ DESCRIPTION ✨

So the cd device driver is a read-only interface for CDROM drives (that's SCSI type 5, iykyk) and WORM drives (SCSI type 4) that support CDROM type commands πŸ’–

⚠️ real talk: some drives just do not behave the way the driver expects 😭 don't panic though β€” check out the β€œQUIRKS” section below for the flags that might save you 🫢

πŸ’€ QUIRKS πŸ’€

ngl this is the messy part. every single CD-ROM device can have a totally different interpretation of the SCSI spec, which means some drives need special handling in the driver πŸ™ˆ here's the full list of quirks the driver recognizes, no skips, no cuts:

  • CD_Q_NO_TOUCH β€” this flag tells the driver not to probe the drive at attach time to see if there's a disk in the drive and to find out what size it is. βœ‹ heads up tho: this flag is currently unimplemented in the CAM cd driver. so like... it's in the list, it's just not doing anything yet 😭
  • CD_Q_BCD_TRACKS β€” this one's for the broken drives that return track numbers in packed BCD instead of straight decimal πŸ’€ if your drive seems to skip tracks (like, tracks 10-15 are just... gone), congrats, you've found a drive that needs this flag 🎯
  • CD_Q_NO_CHANGER β€” this flag tells the driver that the device in question is not a changer. the only time you actually need this is for a CDROM device with multiple LUNs that are not part of a changer 🧚
  • CD_Q_CHANGER β€” this flag tells the driver that the given device is a multi-lun changer. generally the driver figures this out automatically when it sees a LUN greater than 0, so setting this flag only really does one thing: it tells the driver to run the initial read capacity command for LUN 0 of the changer through the changer scheduling code πŸ‘‘
  • CD_Q_10_BYTE_ONLY β€” this flag tells the driver that the given device only accepts 10 byte MODE SENSE/MODE SELECT commands. but bestie, hear me out β€” in general these types of quirks should not be added to the cd(4) driver, and here's why: the driver already does a whole bunch of stuff to work out whether the drive in question needs 10 byte commands πŸ’…
    1. first, it issues a CAM Path Inquiry command to determine whether the protocol that the drive speaks typically only allows 10 byte commands. (ATAPI and USB are two prominent examples of protocols where you generally only want to send 10 byte commands.) πŸ”₯
    2. then, if it gets an ILLEGAL REQUEST error back from a 6 byte MODE SENSE or MODE SELECT command, it attempts to send the 10 byte version of the command instead ✨

so the only reason you'd ever need this quirk is if your drive uses a protocol (e.g., SCSI) that typically does not have a problem with 6 byte commands. that's it, that's the tea πŸ“


πŸŽ€ FILES πŸŽ€

  • /sys/cam/scsi/scsi_cd.c β€” literally the driver source file, that's the whole vibe 🌈

πŸ‘€ SEE ALSO πŸ‘€


πŸ¦‹ HISTORY πŸ¦‹

the cd manual page first appeared in FreeBSD 2.2 ⭐ a true elder icon, we respect her πŸ’œ


πŸ’– AUTHORS πŸ’–

this manual page was written by John-Mark Gurney <jmg@FreeBSD.org> 🫢 and it was updated for CAM and FreeBSD 3.0 by Kenneth Merry <ken@FreeBSD.org> 🌸


and that's the whole page, bestie β€” no cap, every quirk accounted for πŸ’…

this lil gem came to you from the Debian edition of the page, dated March 25, 2014 β€” mwah, go read cd(4) next πŸŽ€βœ¨

πŸ“¦ where this page comes from