From 92a5f7ed29e9ac74a51b595f9cb8bc823a6a97ef Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Wed, 28 Aug 2013 17:33:39 +0200 Subject: [PATCH] Fix compile errors in low level FreeBSD code. The current lowlevel FreeBSD specific SCSI code doesn't compile on FreeBSD. This patch at least makes sure that it compiles if it actually works is something else. --- src/lib/scsi_lli.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/lib/scsi_lli.c b/src/lib/scsi_lli.c index 14ab9b02886..6d4566f8cce 100644 --- a/src/lib/scsi_lli.c +++ b/src/lib/scsi_lli.c @@ -241,6 +241,14 @@ bool send_scsi_cmd_page(int fd, const char *device_name, #include #include +#ifndef SAM_STAT_CHECK_CONDITION +#define SAM_STAT_CHECK_CONDITION 0x2 +#endif + +#ifndef SAM_STAT_COMMAND_TERMINATED +#define SAM_STAT_COMMAND_TERMINATED 0x22 +#endif + /* * Core interface function to lowlevel SCSI interface. */ @@ -281,7 +289,7 @@ static inline bool do_scsi_cmd_page(int fd, const char *device_name, return false; } - ccb = cam_getccv(cam_dev); + ccb = cam_getccb(cam_dev); if (!ccb) { Emsg1(M_ERROR, 0, _("Failed to allocate new ccb for %s\n"), device_name); @@ -293,19 +301,19 @@ static inline bool do_scsi_cmd_page(int fd, const char *device_name, /* * Clear out structure, except for header that was filled for us. */ - memset(&ccb->ccb_h)[1], 0, sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + memset(&(&ccb->ccb_h)[1], 0, sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); cam_fill_csio(&ccb->csio, 1, /* retries */ NULL, /* cbfcnp */ direction, /* flags */ - MSG_SIMPLE_Q_TAG,, /* tagaction */ - cmd_page, /* dataptr */ + MSG_SIMPLE_Q_TAG, /* tagaction */ + (u_int8_t *)cmd_page, /* dataptr */ cmd_page_len, /* datalen */ sizeof(sense), /* senselength */ cdb_len, /* cdblength */ 15000 /* timeout (millisecs) */); - memcpy(ccb->csio.cdb_io.cdb_bytes, cdb, SPP_SP_CMD_LEN); + memcpy(ccb->csio.cdb_io.cdb_bytes, cdb, cdb_len); if (cam_send_ccb(cam_dev, ccb) < 0) { Emsg2(M_ERROR, 0, _("Failed to send ccb to device %s: %s\n"),