.TH cohtune "" "" "Command"
.PC "Set a variable within a device driver"
\fBcohtune \fIdriver tagfield \fB"\fItagfield \fB= \fIvalue\^\fB"\fR
.PP
The command
.B cohtune
sets the
.I tagfield
to
.I value
within the given device driver
.IR driver .
You can then use the command
.B idmkcoh
to build a new kernel that incorporates your changes.
When you boot the new kernel, your changes will have been made.
.PP
.II Space.c
.B cohtune
works by modifying the file
.B Space.c
for
.IR driver .
Each device driver has such a file, that sets user-definable
dimensions of its operation.
When you invoke the command
.B idmkcoh
to build a new kernel, \*(CO automatically checks whether a
.B Space.c
module that have changed, compiles it, and links it into the newly
built kernel.
.B idmkcoh
also recompiles every
.B Space.c
whenever you change a tunable variable in the kernel, just to ensure
that all drivers are synchronized with changes in the kernel.
.PP
.II hai
For example, the file
.B /etc/conf/hai/Space.c
gives the user-settable variable for the driver
.BR hai ,
which is \*(CO's host-adapter-independent SCSI driver.
This file contains, among others, the variable
.BR HAI_TAPE .
This variable is a bit-map; bit
.I n
is turned on if there is a SCSI tape device at SCSI ID
.IR n .
If you have installed a SCSI tape as SCSI device 3,
then type the following command:
.DM
	cohtune hai "HAI_TAPE" "int HAI_TAPE = 0x08"
.DE
.PP
The value 0x08 turns on bit 3.
As you can see,
.B cohtune
finds the line in
.B /etc/conf/hai/Space.c
that contains the string
.B HAI_TAPE
and is not commented out of the source, and replaces it with the line
.DM
	int HAI_TAPE = 0x08
.DE
.PP
You can read a driver's
.B Space.c
to see how you can configure it.
.B Space.c
also gives some useful clues as to how the driver works and how it is
currently configured.
.PP
You should
.I never
modify a
.B Space.c
by hand.
If you do so, you run the risk of building a kernel that does not boot,
or trashes your file system.
.SH "See Also"
.Xr "commands," commands
.Xr "device drivers," device_dr
.Xr "idenable," idenable
.Xr "idmkcoh," idmkcoh
.Xr "idtune" idtune
.SH Notes
.B cohtune
cannot be used with \*(ST drivers.
.PP
Note that
.B cohtune
peforms no checks whatsoever on the content of the string
with which you replace
.IR tagfield
It should only be used by people familiar with C
programming, because setting invalid values may cause errors that are
difficult to diagnose.
.IR "Caveat utilitor" .
.PP
Because of the primitive nature of
.BR cohtune ,
we recommend that users not
use it directly, but work instead through the configuration shell scripts
supplied by the driver's developer (which typically live in directory
\fB/etc/conf/\fIdriver\fR)
that can interactively generate the correct sequence of
.B cohtune
commands.
