Copyright © 1996 Dieter Baron and Armin Obersteiner
This is a draft edition of the libscsi documentation,
and is consistent with libscsi {No value for ‘VERSION’}.
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Some applications (such as cd players and cd writers) need direct access to SCSI devices. Although most operating system provide such services, each does so in a different way; writing portable software is painfull.
One goal of libscsi is to encapsulate these system dependencies and to provide a uniform interface to the application. See section Low Level Functions.
The other is to provide convenience functions for SCSI commands, to avoid programming errors and to render programs more readable. These are grouped according to the sections of X3.131 (the ANSI standard for SCSI II) or devices for vendor specific commands.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
sc_close
closes device sdev, deallocating all resources
associated with it. sdev must not be passed to any libscsi
function afterwards.
The sc_send
function sends a command to device sdev.
cmd is the command descriptor block (CDB) of the command, cmdlen its length (in bytes).
Set direction to SC_READ
if data will be transferred from
the device to the host in the data in phase; to SC_WRITE
if data
will be transferred to the device during data out phase; or to 0 if no
data (besides the CDB) will be transferred.
If this is a write command (SC_WRITE
), data points to
datalen bytes to be transferred. If it is a read command
(SC_READ
), up to datalen bytes will be placed in
data.
On success, sc_send
return 0 for write and transferless commands
and the number of bytes read on read commands. On error, -1 is returend
and the error indicator and sense data in sdev are set.
On systems that timeout commands, sc_set_timeout
is used to
specify a timeout of timeout milliseconds for command completion
on device sdev.
If the timeout cannot be set as specified, -1 is returned. However, if the system does not timeout commands, this function is a noop, and 0 is returned.
If the underlying system supports only one global timeout value for all devices, it is expected of the interface functions to set it appropriatly for each device before sending a command.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You have to create the files 'lib/xx_????.c' and 'scsi/xx.h' (or just add prototypes to it). xx - command type OR device type OR product ???? - command name If you've included more commands or support for other devices please contact us for inclusion in our distribution.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To port libscsi to a new platform, you have to provide definitions for
the SCSI
structure and the low level functions sc_open
,
sc_close
, sc_send
, and sc_set_timeout
. They should
behave as documented in See section Low Level Functions. Look at
the provided interfaces (scsi/os_{netbsd,amiga}.h
and
lib/os_{netbsd,amiga}.c
) for examples.
Remove the symbolic links scsi/os.h
and lib/os.c
, and
place your header and soruce files there.
If you want to make your interface part of the distribution, pick a name
and place it in the files scsi/os_name.h
and
lib/os_name.c
. Also, edit configure.in
to recognize
systems supporting your interface.
Also, send us your new interface, so we can include it in future releases.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section contains interface specific notes, such as the syntax and semantics of device names or constraints.
5.1 AmigaDOS | ||
5.2 NetBSD |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
device:unit
For example, gvpscsi.device:2
, or simplified, gvpscsi:2
.
Also, gvpscsi
is equivalent to gvpscsi.device:0
and
gvpscsi:0
.
Developed and tested with: A2000 (total 7MB), A2630 (2MB), GVP Series II, some SCSI devices: hd, cd, zip.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
d
. (So, for sd0
, the
zeroth SCSI hard disk, the name would be /dev/rsd0d
.) As a
shorthand, one can specify the device (e.g. sd0
), rather than the
file name.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jump to: | A E I N P |
---|
Jump to: | A E I N P |
---|
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jump to: | S |
---|
Index Entry | Section | ||
---|---|---|---|
| |||
S | |||
sc_close | 2 Low Level Functions | ||
sc_open | 2 Low Level Functions | ||
sc_send | 2 Low Level Functions | ||
sc_set_timeout | 2 Low Level Functions | ||
|
Jump to: | S |
---|
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[Top] | [Contents] | [Index] | [ ? ] |
[Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March 28, 2025 using texi2html 5.0.
The buttons in the navigation panels have the following meaning:
Button | Name | Go to | From 1.2.3 go to |
---|---|---|---|
[ << ] | FastBack | Beginning of this chapter or previous chapter | 1 |
[ < ] | Back | Previous section in reading order | 1.2.2 |
[ Up ] | Up | Up section | 1.2 |
[ > ] | Forward | Next section in reading order | 1.2.4 |
[ >> ] | FastForward | Next chapter | 2 |
[Top] | Top | Cover (top) of document | |
[Contents] | Contents | Table of contents | |
[Index] | Index | Index | |
[ ? ] | About | About (help) |
where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:
This document was generated on March 28, 2025 using texi2html 5.0.