Page MenuHomeFreeBSD

D35912.id108678.diff
No OneTemporary

D35912.id108678.diff

Index: stand/libsa/libsa.3
===================================================================
--- stand/libsa/libsa.3
+++ stand/libsa/libsa.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 22, 2018
+.Dd August 1, 2022
.Dt LIBSA 3
.Os
.Sh NAME
@@ -502,6 +502,12 @@
.Sh MISC
.Bl -hang -width 10n
.It Xo
+.Ft char *
+.Fn devformat "struct devdesc *"
+.Xc
+.Pp
+Format the passed in device.
+.It Xo
.Ft void
.Fn twiddle void
.Xc
@@ -615,7 +621,7 @@
should clean up any allocation made by devopen only.
.It Xo
.Ft void
-.Fn abort
+.Fn __abort
.Xc
.Pp
Calls
@@ -687,6 +693,56 @@
Devices are exported by the supporting code via the array
.Vt struct devsw *devsw[]
which is a NULL terminated array of pointers to device switch structures.
+.Sh DRIVER INTERFACE
+The driver needs to provide a common set of entry points that are
+used by
+.Nm libsa
+to interface with the device.
+.Bd -literal
+struct devsw {
+ const char dv_name[DEV_NAMLEN];
+ int dv_type;
+ int (*dv_init)(void);
+ int (*dv_strategy)(void *devdata, int rw, daddr_t blk,
+ size_t size, char *buf, size_t *rsize);
+ int (*dv_open)(struct open_file *f, ...);
+ int (*dv_close)(struct open_file *f);
+ int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data);
+ int (*dv_print)(int verbose);
+ void (*dv_cleanup)(void);
+ void (*dv_fmtdev)(struct devdesc *);
+};
+.Ed
+.Bl -tag -width ".Fn dv_strategy"
+.It Fn dv_name
+The device's name.
+.It Fn dv_type
+Class of device.
+Each class will potentially have a different subclass of
+.Dv struct devdesc.
+.It Fn dv_init
+Driver initialization routine.
+This routine should probe for available units.
+Drivers are responsible for maintaining lists of units for later enumeration.
+No other driver routines may be called before
+.Fn dv_init
+returns.
+.It Fn dv_open
+The driver open routine.
+.It Fn dv_close
+The driver close routine.
+.It Fn dv_ioctl
+The driver ioctl routine.
+.It Fn dv_print
+Prints information about the available devices.
+Information should be presented with
+.Fn pager_output .
+.It Fn dv_cleanup
+Cleans up any memory used by the device before the next stage is run.
+.It Fn dv_fmtdev
+Converts the passed in devdesc to the canonical string representation
+for that device.
+.El
.Sh HISTORY
The
.Nm

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 18, 2:05 PM (6 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15864186
Default Alt Text
D35912.id108678.diff (2 KB)

Event Timeline