Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
295771dc
Commit
295771dc
authored
Jul 25, 2013
by
Eric Cano
Browse files
Created the inquiry CDB structure and replaced some hardcoding.
parent
7190813a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Drive/Drive.hh
View file @
295771dc
...
...
@@ -87,16 +87,16 @@ namespace Tape {
void
SCSI_inquiry
(
int
fd
)
{
unsigned
char
dataBuff
[
130
];
unsigned
char
senseBuff
[
256
];
unsigned
char
cdb
[
6
];
SCSI
::
Structures
::
inquiryCDB_t
cdb
;
memset
(
&
cdb
,
0
,
sizeof
(
cdb
));
memset
(
&
dataBuff
,
0
,
sizeof
(
dataBuff
));
/* Build command */
cdb
[
0
]
=
SCSI
::
Commands
::
INQUIRY
;
cdb
.
opCode
=
SCSI
::
Commands
::
INQUIRY
;
sg_io_hdr_t
sgh
;
memset
(
&
sgh
,
0
,
sizeof
(
sgh
));
sgh
.
interface_id
=
'S'
;
sgh
.
cmdp
=
cdb
;
sgh
.
cmdp
=
(
unsigned
char
*
)
&
cdb
;
sgh
.
cmd_len
=
sizeof
(
cdb
);
sgh
.
sbp
=
senseBuff
;
sgh
.
mx_sb_len
=
255
;
...
...
SCSI/Structures.hh
View file @
295771dc
...
...
@@ -29,8 +29,31 @@
#include
<arpa/inet.h>
namespace
SCSI
{
/**
* Structures as defined in the SCSI specifications, and helper functions for them.
* SPC-4 (SCSI primary commands) can be found at:
* http://hackipedia.org/Hardware/SCSI/Primary%20Commands/SCSI%20Primary%20Commands%20-%204.pdf
*
* and SSC-3 (SCSI stream commands, i.e. tape drives) at:
* http://hackipedia.org/Hardware/SCSI/Stream%20Commands/SCSI%20Stream%20Commands%20-%203.pdf
*/
namespace
Structures
{
/*
* Inquiry CDB as described in SPC-4.
*/
typedef
struct
{
unsigned
char
opCode
;
unsigned
char
EVPD
:
1
;
unsigned
char
:
7
;
unsigned
char
pageCode
;
char
allocationLength
[
2
];
unsigned
char
control
;
}
inquiryCDB_t
;
/*
* Inquiry data as described in SPC-4.
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment