+/*
+ * cciss.cpp
+ *
+ * Home page of code is: http://www.smartmontools.org
+ *
+ * Copyright (C) 2007 Sergey Svishchev
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "config.h"
-#if defined(linux)
+#if defined(linux) || defined(__linux__)
# include <sys/ioctl.h>
# ifdef HAVE_LINUX_COMPILER_H
# include <linux/compiler.h>
# ifndef be32toh
# define be32toh __be32_to_cpu
# endif
-#elif defined(__FreeBSD__) && defined(HAVE_DEV_CISS_CISSIO_H)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <sys/endian.h>
-# include <dev/ciss/cissio.h>
-# define _HAVE_CCISS
-#elif defined(__FreeBSD_kernel__) && defined(HAVE_DEV_CISS_CISSIO_H)
-# include <endian.h>
-# include <dev/ciss/cissio.h>
+# include CISS_LOCATION
# define _HAVE_CCISS
#endif
#ifdef _HAVE_CCISS
#include "cciss.h"
-#include "int64.h"
#include "scsicmds.h"
#include "utility.h"
-const char * cciss_cpp_cvsid = "$Id: cciss.cpp 3266 2011-02-21 16:33:04Z chrfranke $"
+const char * cciss_cpp_cvsid = "$Id: cciss.cpp 4858 2018-12-16 17:59:59Z chrfranke $"
CCISS_H_CVSID;
typedef struct _ReportLUNdata_struct
unsigned char pBuf[512] = {0};
unsigned char phylun[8] = {0};
int iBufLen = 512;
- int status = -1;
int len = 0; // used later in the code.
- status = cciss_getlun(device, target, phylun, report);
+ int status = cciss_getlun(device, target, phylun, report);
if (report > 0)
printf(" cciss_getlun(%d, %d) = 0x%x; scsi3addr: %02x %02x %02x %02x %02x %02x %02x %02x\n",
device, target, status,
int trunc = (iop->dxfer_len > 256) ? 1 : 0;
printf(" Incoming data, len=%d%s:\n", (int)iop->dxfer_len,
(trunc ? " [only first 256 bytes shown]" : ""));
- dStrHex((const char*)iop->dxferp, (trunc ? 256 : iop->dxfer_len) , 1);
+ dStrHex(iop->dxferp, (trunc ? 256 : iop->dxfer_len) , 1);
}
}
return 0;
if (report > 1)
{
printf(" >>> Sense buffer, len=%d:\n", (int)len);
- dStrHex((const char *)pBuf, len , 1);
+ dStrHex((const uint8_t *)pBuf, len , 1);
}
}
if (report)
if ((err = ioctl(fd, CCISS_PASSTHRU, &iocommand)))
{
- fprintf(stderr, "CCISS ioctl error %d (fd %d CDBLen %d buf_size %d)\n",
+ fprintf(stderr, "CCISS ioctl error %d (fd %d CDBLen %u buf_size %u)\n",
fd, err, CDBlen, size);
}
return err;