Documentation/scsi/scsi-generic.rst

Source file repositories/reference/linux-study-clean/Documentation/scsi/scsi-generic.rst

File Facts

System
Linux kernel
Corpus path
Documentation/scsi/scsi-generic.rst
Extension
.rst
Size
3757 bytes
Lines
108
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GPL-2.0

========================
SCSI Generic (sg) driver
========================

                                                        20020126

Introduction
============
The SCSI Generic driver (sg) is one of the four "high level" SCSI device
drivers along with sd, st and sr (disk, tape and CD-ROM respectively). Sg
is more generalized (but lower level) than its siblings and tends to be
used on SCSI devices that don't fit into the already serviced categories.
Thus sg is used for scanners, CD writers and reading audio CDs digitally
amongst other things.

Rather than document the driver's interface here, version information
is provided plus pointers (i.e. URLs) where to find documentation
and examples.


Major versions of the sg driver
===============================
There are three major versions of sg found in the Linux kernel (lk):
      - sg version 1 (original) from 1992 to early 1999 (lk 2.2.5) .
	It is based in the sg_header interface structure.
      - sg version 2 from lk 2.2.6 in the 2.2 series. It is based on
	an extended version of the sg_header interface structure.
      - sg version 3 found in the lk 2.4 series (and the lk 2.5 series).
	It adds the sg_io_hdr interface structure.


Sg driver documentation
=======================
The most recent documentation of the sg driver is kept at

- https://sg.danny.cz/sg/

This describes the sg version 3 driver found in the lk 2.4 series.

Documentation (large version) for the version 2 sg driver found in the
lk 2.2 series can be found at

- https://sg.danny.cz/sg/p/scsi-generic_long.txt.

The original documentation for the sg driver (prior to lk 2.2.6) can be
found in the LDP archives at

- https://tldp.org/HOWTO/archived/SCSI-Programming-HOWTO/index.html

A more general description of the Linux SCSI subsystem of which sg is a
part can be found at https://www.tldp.org/HOWTO/SCSI-2.4-HOWTO .


Example code and utilities
==========================
There are two packages of sg utilities:

    =========   ==========================================================
    sg3_utils   for the sg version 3 driver found in lk 2.4
    sg_utils    for the sg version 2 (and original) driver found in lk 2.2
                and earlier
    =========   ==========================================================

Both packages will work in the lk 2.4 series. However, sg3_utils offers more
capabilities. They can be found at: https://sg.danny.cz/sg/sg3_utils.html and
freecode.com

Another approach is to look at the applications that use the sg driver.

Annotation

Implementation Notes