aboutsummaryrefslogtreecommitdiff
path: root/lib/sg_cmds_basic.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2015-12-01 20:16:07 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2015-12-01 20:16:07 +0000
commit6c14f9acc45d7fb35e0aab1ca3a76a00509d53d0 (patch)
treec8fcb911f62665b0f64b8080bb5c64c48255289a /lib/sg_cmds_basic.c
parentb83bf2f2e6adfd2431017963365f3dd13f21757d (diff)
downloadsg3_utils-6c14f9acc45d7fb35e0aab1ca3a76a00509d53d0.tar.gz
sg_timestamp: new, to report or set timestamp
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@650 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'lib/sg_cmds_basic.c')
-rw-r--r--lib/sg_cmds_basic.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/sg_cmds_basic.c b/lib/sg_cmds_basic.c
index 89fe3ffc..0ede2d84 100644
--- a/lib/sg_cmds_basic.c
+++ b/lib/sg_cmds_basic.c
@@ -22,6 +22,7 @@
#include "sg_lib.h"
#include "sg_cmds_basic.h"
#include "sg_pt.h"
+#include "sg_unaligned.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -33,7 +34,7 @@
#endif
-static const char * version_str = "1.70 20150511";
+static const char * version_str = "1.71 20151130";
#define SENSE_BUFF_LEN 64 /* Arbitrary, could be larger */
@@ -289,8 +290,7 @@ sg_ll_inquiry(int sg_fd, int cmddt, int evpd, int pg_op, void * resp,
inqCmdBlk[1] |= 1;
inqCmdBlk[2] = (unsigned char)pg_op;
/* 16 bit allocation length (was 8) is a recent SPC-3 addition */
- inqCmdBlk[3] = (unsigned char)((mx_resp_len >> 8) & 0xff);
- inqCmdBlk[4] = (unsigned char)(mx_resp_len & 0xff);
+ sg_put_unaligned_be16((uint16_t)mx_resp_len, inqCmdBlk + 3);
if (verbose) {
pr2ws(" inquiry cdb: ");
for (k = 0; k < INQUIRY_CMDLEN; ++k)
@@ -565,10 +565,7 @@ sg_ll_report_luns(int sg_fd, int select_report, void * resp, int mx_resp_len,
struct sg_pt_base * ptvp;
rlCmdBlk[2] = select_report & 0xff;
- rlCmdBlk[6] = (mx_resp_len >> 24) & 0xff;
- rlCmdBlk[7] = (mx_resp_len >> 16) & 0xff;
- rlCmdBlk[8] = (mx_resp_len >> 8) & 0xff;
- rlCmdBlk[9] = mx_resp_len & 0xff;
+ sg_put_unaligned_be32((uint32_t)mx_resp_len, rlCmdBlk + 6);
if (verbose) {
pr2ws(" report luns cdb: ");
for (k = 0; k < REPORT_LUNS_CMDLEN; ++k)