Skip to content
Snippets Groups Projects
Commit 20602971 authored by samm2's avatar samm2
Browse files

fix FTBFS on GNU/kFreeBSD (ticket #10)

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2918 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 9da03540
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,8 @@ NOTES FOR FUTURE RELEASES: see TODO file.
<DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
[AS] FreeBSD: fix FTBFS on GNU/kFreeBSD (reported by derevko).
[AS] FreeBSD: Add USB autodetection to smartd DEVICESCAN directive.
[CF] Add USB ID of Myson Century CS8818, add some comments.
......
......@@ -19,6 +19,10 @@
# 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>
# define _HAVE_CCISS
#endif
#ifdef _HAVE_CCISS
......
......@@ -49,7 +49,7 @@
#define USBDEV "/dev/usb"
#if __FreeBSD_version >= 800000
#if (__FreeBSD_version >= 800000) || (__FreeBSD_kernel_version >= 800000)
#include <libusb20_desc.h>
#include <libusb20.h>
#else
......@@ -178,6 +178,14 @@ private:
const char * m_mode; ///< Mode string for deviceopen().
};
#ifdef __GLIBC__
static inline void * reallocf(void *ptr, size_t size) {
void *rv = realloc(ptr, size);
if(rv == NULL)
free(ptr);
return rv;
}
#endif
freebsd_smart_device::~freebsd_smart_device() throw()
{
......@@ -745,7 +753,7 @@ int freebsd_ata_device::ata_command_interface(smart_command_set command, int sel
#endif
return -1;
#if __FreeBSD_version < 502000
#if (__FreeBSD_version < 502000) && (__FreeBSD_kernel_version < 502000)
printwarning(NO_RETURN,NULL);
#endif
......@@ -1357,7 +1365,7 @@ int do_normal_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
if (cam_send_ccb(cam_dev,ccb) < 0) {
warn("error sending SCSI ccb");
#if __FreeBSD_version > 500000
#if (__FreeBSD_version > 500000) || (__FreeBSD_kernel_version > 500000)
cam_error_print(cam_dev,ccb,CAM_ESF_ALL,CAM_EPF_ALL,stderr);
#endif
cam_freeccb(ccb);
......@@ -1365,7 +1373,7 @@ int do_normal_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
}
if (((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) && ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR)) {
#if __FreeBSD_version > 500000
#if (__FreeBSD_version > 500000) || (__FreeBSD_kernel_version > 500000)
cam_error_print(cam_dev,ccb,CAM_ESF_ALL,CAM_EPF_ALL,stderr);
#endif
cam_freeccb(ccb);
......@@ -2003,7 +2011,7 @@ bool freebsd_smart_interface::scan_smart_devices(smart_device_list & devlist,
}
#if __FreeBSD_version < 800000 // without this build fail on FreeBSD 8
#if (__FreeBSD_version < 800000) || (__FreeBSD_kernel_version < 800000) // without this build fail on FreeBSD 8
static char done[USB_MAX_DEVICES];
static int usbdevinfo(int f, int a, int rec, int busno, unsigned short & vendor_id,
......@@ -2059,7 +2067,7 @@ static int usbdevinfo(int f, int a, int rec, int busno, unsigned short & vendor_
static int usbdevlist(int busno,unsigned short & vendor_id,
unsigned short & product_id, unsigned short & version)
{
#if __FreeBSD_version >= 800000 // libusb2 interface
#if (__FreeBSD_version >= 800000) || (__FreeBSD_kernel_version >= 800000) // libusb2 interface
struct libusb20_device *pdev = NULL;
struct libusb20_backend *pbe;
uint32_t matches = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment