aboutsummaryrefslogtreecommitdiff
path: root/include/libtio/io/scsi.h
blob: fd9cd7edcef1b789ab515c3475167e5f3889b978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef  LIBTIO_IO_SCSI_H
# define LIBTIO_IO_SCSI_H 20190429
# include "../cdefs.h"

TIO_BEGIN_NAMESPACE

/* An SCSI stream serves for interacting with an SCSI-enabled device.
 * Using such a stream, you can send an SCSI request and receive the answer.
 *
 * An SCSI request can be followed with data in two directions: to the
 * device and from the device:
 * `TIO_SCSI_DIREC_NONE`: no data.
 * `TIO_SCSI_DIREC_TO_DEV`: outgoing data.
 * `TIO_SCSI_DIREC_FROM_DEV`: incoming data. */

# define TIO_SCSI_DIREC_NONE     0
# define TIO_SCSI_DIREC_TO_DEV   1
# define TIO_SCSI_DIREC_FROM_DEV 2

/* Here is the request structure:
 *
 * `cmd`: the raw command buffer (of 6, 10, 12 or 16 bytes).
 * `cmd_len`: the command length (in bytes).
 * `direction` the data transfer direction.
 * `data`: the data to transfer (send or receive buffer).
 * `data_len`: the data length.
 * `status`: the status byte returned by the device. */

TIO_STRUCT(tio_scsi_request, tio_scsi_request_t)

struct tio_scsi_request {
	void   *tio_scsi_request_cmd;
	size_t  tio_scsi_request_cmd_len;
	int     tio_scsi_request_direction;
	void   *tio_scsi_request_data;
	size_t  tio_scsi_request_data_len;
	int     tio_scsi_request_status;
};

TIO_END_NAMESPACE

#endif /* LIBTIO_IO_SCSI_H */