> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man9/cd.9.md).

# cd.9

`cd` — CAM SCSI 子系统的 CDROM 驱动程序

## 名称

`cd`

## 描述

`cd` 设备驱动程序为支持 CDROM 类型命令的 CDROM 驱动器（SCSI 类型 5）和 WORM 驱动器（SCSI 类型 4）提供只读接口。某些驱动器的行为可能与驱动程序预期不同。有关可能的标志信息，参见“特性”章节。

## 特性

每个 CD-ROM 设备对 SCSI 规范的解释可能不同。这可能导致驱动器需要在驱动程序中进行特殊处理。以下是驱动程序识别的特性列表。

**`CD_Q_NO_TOUCH`** 此标志告知驱动程序在附加时不探查驱动器以查看驱动器中是否有磁盘及其大小。此标志目前在 CAM `cd` 驱动程序中未实现。

**`CD_Q_BCD_TRACKS`** 此标志用于在返回轨道号时使用打包 BCD 而非纯十进制的有缺陷驱动器。如果驱动器似乎跳过轨道（跳过轨道 10-15），则你的驱动器需要此标志。

**`CD_Q_NO_CHANGER`** 此标志告知驱动程序所讨论的设备不是换盘器。这仅对于具有多个 LUN 且不属于换盘器的 CDROM 设备是必需的。

**`CD_Q_CHANGER`** 此标志告知驱动程序给定设备是多 LUN 换盘器。通常，驱动程序在看到大于 0 的 LUN 时会自动识别这一点。设置此标志的唯一作用是告知驱动程序通过换盘器调度代码运行换盘器 LUN 0 的初始读取容量命令。

**`CD_Q_10_BYTE_ONLY`** 此标志告知驱动程序给定设备仅接受 10 字节 MODE SENSE/MODE SELECT 命令。通常，这些类型的特性不应添加到 [cd(4)](/man/man4/cd.4.md) 驱动程序。原因是驱动程序会执行多项操作以尝试确定所讨论的驱动器是否需要 10 字节命令。首先，它发出 CAM Path Inquiry 命令以确定驱动器使用的协议是否通常仅允许 10 字节命令。（ATAPI 和 USB 是通常仅希望发送 10 字节命令的协议的两个突出示例。）然后，如果从 6 字节 MODE SENSE 或 MODE SELECT 命令收到 ILLEGAL REQUEST 错误，它会尝试发送 10 字节版本的命令。需要此特性的唯一原因是你的驱动器使用的协议（例如 SCSI）通常在 6 字节命令上没有问题。

## 文件

**`/sys/cam/scsi/scsi_cd.c`** 是驱动程序源文件。

## 参见

[cd(4)](/man/man4/cd.4.md), [scsi(4)](/man/man4/scsi.4.md)

## 历史

`cd` 手册页首次出现于 FreeBSD 2.2。

## 作者

本手册页由 John-Mark Gurney <jmg@FreeBSD.org> 编写。由 Kenneth Merry <ken@FreeBSD.org> 为 CAM 和 FreeBSD 3.0 更新。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man9/cd.9.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
