git: 6a61917a4b64 - stable/14 - sg: Add sg(4) man page

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 22 May 2024 21:11:00 UTC
The branch stable/14 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=6a61917a4b641c2e3ebba19bd13a0e5472b6885f

commit 6a61917a4b641c2e3ebba19bd13a0e5472b6885f
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-05-06 22:28:09 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-05-22 21:10:51 +0000

    sg: Add sg(4) man page
    
    Add minimal sg(4) manual page. This implements a subset of the Linux
    IOCTL interface for either native FreeBSD programs, or for Linux
    binaries in the linuxulator.
    
    Noticed by:     Lexi Winter
    Sponsored by:   Netflix
    
    (cherry picked from commit 08b4520338349bc065ec184b32a6e700cb8e34ec)
---
 share/man/man4/Makefile |  1 +
 share/man/man4/sg.4     | 63 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 222422526180..a97c92b960f5 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -492,6 +492,7 @@ MAN=	aac.4 \
 	send.4 \
 	ses.4 \
 	${_sfxge.4} \
+	sg.4 \
 	sge.4 \
 	siba.4 \
 	siftr.4 \
diff --git a/share/man/man4/sg.4 b/share/man/man4/sg.4
new file mode 100644
index 000000000000..bf7cb93cfb09
--- /dev/null
+++ b/share/man/man4/sg.4
@@ -0,0 +1,63 @@
+.\"
+.\" Copyright (c) 2024 Netflix, Inc.
+.\"
+.\" SPDX-License-Expression: BSD-2-Clause
+.\"
+.Dd May 6, 2024
+.Dt SG 4
+.Os
+.Sh NAME
+.Nm sg
+.Nd Linux ioclt-compatible SCSI passthru device
+.Sh SYNOPSIS
+.Cd device sg
+.Cd device scbus
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a Linux compatible scsi passthru device.
+This driver attaches to all
+.Xr cam 4
+peripheral devices.
+It is similar to the
+.Xr pass 4
+device, but uses the Linux interfaces, rather than the FreeBSD CAM interfaces.
+.Sh IOCTL
+The following subset of the Linux sg ioctl interfaces are implemented:
+.Bl -tag -width 12
+.It Va SG_SET_TIMEOUT
+.Fa u_int to
+Set the timeout in milliseconds.
+.It Va SG_GET_TIMEOUT
+Get the timeout in milliseconds
+.It Va SG_GET_RESERVED_SIZE
+.Fa u_int
+Returns the size of the I/O one can do this device.
+.It Va SG_GET_SCSI_ID
+.Fa struct sg_scsi_id
+Returns the bus number, channel, scsi bus ID number, lun and other information
+about the SCSI device.
+.It Va SG_GET_SG_TABLESIZE
+.Fa u_int
+Returns the table size, though hard wired to 0.
+.It Va SG_GET_VERSION_NUM
+.Fa u_int
+Return the version number that is implemented.
+.It Va SG_IO
+.Fa struct sg_io_hdr
+.El
+All other ioctl interfaces return
+.Va ENODEV .
+.Sh FILES
+.Bl -tag -width ".Pa /dev/sg*" -compact
+.It Pa /dev/sg*
+Passthru devices.
+.El
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr pass 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 7.0 .