summaryrefslogtreecommitdiff
path: root/lib/mlibc/options/linux/include/scsi/sg.h
blob: a9dfc7a272800d06035044276534c02d95ece51a (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

#ifndef _LINUX_SCSI_SG_H
#define _LINUX_SCSI_SG_H

#define SG_IO 0x2285

#define SG_GET_VERSION_NUM 0x2282

#define SG_FLAG_DIRECT_IO 1
#define SG_FLAG_LUN_INHIBIT 2

#define SG_INFO_OK 0x0
#define SG_INFO_OK_MASK 0x1

#define SG_DXFER_NONE (-1)
#define SG_DXFER_TO_DEV (-2)
#define SG_DXFER_FROM_DEV (-3)
#define SG_DXFER_TO_FROM_DEV (-4)

#ifdef __cplusplus
extern "C" {
#endif

typedef struct sg_io_hdr {
    int interface_id;
    int dxfer_direction;
    unsigned char cmd_len;
    unsigned char mx_sb_len;
    unsigned short iovec_count;
    unsigned int dxfer_len;
    void *dxferp;
    unsigned char *cmdp;
    unsigned char *sbp;
    unsigned int timeout;
    unsigned int flags;
    int pack_id;
    void *usr_ptr;
    unsigned char status;
    unsigned char masked_status;
    unsigned char msg_status;
    unsigned char sb_len_wr;
    unsigned short host_status;
    unsigned short driver_status;
    int resid;
    unsigned int duration;
    unsigned int info;
} sg_io_hdr_t;

struct sg_scsi_id {
    int host_no;
    int channel;
    int scsi_id;
    int lun;
    int scsi_type;
    short int h_cmd_per_lun;
    short int d_queue_depth;
    int unused[2];
};

typedef struct sg_req_info {
    char req_state;
    char orphan;
    char sg_io_owned;
    char problem;
    int pack_id;
    void *usr_ptr;
    unsigned int duration;

    int unused;
} sg_req_info_t;

#ifdef __cplusplus
}
#endif

#endif // _LINUX_SCSI_SG_H