]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - cciss.cpp
Enhance dh_clean to clean up better
[mirror_smartmontools-debian.git] / cciss.cpp
index d425f8e1a73b0c7e03d286355d250788a269c89f..bf074ed88baceb258e9286e132b4c8473c64564f 100644 (file)
--- a/cciss.cpp
+++ b/cciss.cpp
@@ -1,10 +1,11 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
+#include <errno.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>
 #    define _HAVE_CCISS
 #  endif
 #  include <asm/byteorder.h>
-#  define be32toh __be32_to_cpu
-#elif defined(__FreeBSD__) && defined(HAVE_DEV_CISS_CISSIO_H)
+#  ifndef be32toh
+#    define be32toh __be32_to_cpu
+#  endif
+#elif defined(__FreeBSD__)
 #  include <sys/endian.h>
-#  include <dev/ciss/cissio.h>
+#  include CISS_LOCATION
+#  define _HAVE_CCISS
+#elif defined(__FreeBSD_kernel__)
+#  include <endian.h>
+#  ifdef __GLIBC__
+#  include <bsd/sys/cdefs.h>
+#  include <stdint.h>
+#  endif
+#  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 3945 2014-07-13 15:29:05Z chrfranke $"
+  CCISS_H_CVSID;
+
 typedef struct _ReportLUNdata_struct
 {
   uint32_t LUNListLength;      /* always big-endian */
@@ -177,7 +192,6 @@ static int cciss_getlun(int device, int target, unsigned char *physlun, int repo
     unsigned char CDB[16]= {0};
     ReportLunData_struct *luns;
     int reportlunsize = sizeof(*luns) + CISS_MAX_PHYS_LUN * 8;
-    int i;
     int ret;
 
     luns = (ReportLunData_struct *)malloc(reportlunsize);
@@ -209,7 +223,7 @@ static int cciss_getlun(int device, int target, unsigned char *physlun, int repo
          pout("%02x ",*stuff++);
        pout("%02x\n",*stuff++);
       }
-      pout("===== [%s] DATA END (%d Bytes) =====\n\n", "LUN DATA", sizeof(_ReportLUNdata_struct));
+      pout("===== [%s] DATA END (%u Bytes) =====\n\n", "LUN DATA", (unsigned)sizeof(_ReportLUNdata_struct));
     }
 
     if (target >= 0 && target < (int) be32toh(luns->LUNListLength) / 8)