Ticket #10: 65_freebsd.2.patch

File 65_freebsd.2.patch, 2.6 KB (added by Giuseppe Iuculano, 11 years ago)

Fix FTBFS on GNU/kFreeBSD

  • cciss.cpp

    a b  
    1919#  include <sys/endian.h>
    2020#  include <dev/ciss/cissio.h>
    2121#  define _HAVE_CCISS
     22#elif defined(__FreeBSD_kernel__) && defined(HAVE_DEV_CISS_CISSIO_H)
     23#  include <endian.h>
     24#  include <dev/ciss/cissio.h>
     25#  define _HAVE_CCISS
    2226#endif
    2327
    2428#ifdef _HAVE_CCISS
  • os_freebsd.cpp

    a b  
    4949
    5050#define USBDEV "/dev/usb"
    5151
    52 #if __FreeBSD_version >= 800000
     52#if (__FreeBSD_version >= 800000) || (__FreeBSD_kernel_version >= 800000)
    5353#include <libusb20_desc.h>
    5454#include <libusb20.h>
    5555#else
    private: 
    178178  const char * m_mode; ///< Mode string for deviceopen().
    179179};
    180180
     181#ifdef __GLIBC__
     182static inline void * reallocf(void *ptr, size_t size) {
     183   void *rv = realloc(ptr, size);
     184   if(rv == NULL)
     185     free(ptr);
     186   return rv;
     187   }
     188#endif
    181189
    182190freebsd_smart_device::~freebsd_smart_device() throw()
    183191{
    int freebsd_ata_device::ata_command_inte 
    745753#endif
    746754  return -1;
    747755
    748 #if __FreeBSD_version < 502000
     756#if (__FreeBSD_version < 502000) && (__FreeBSD_kernel_version < 502000)
    749757  printwarning(NO_RETURN,NULL);
    750758#endif
    751759
    int do_normal_scsi_cmnd_io(int fd, struc 
    13571365
    13581366  if (cam_send_ccb(cam_dev,ccb) < 0) {
    13591367    warn("error sending SCSI ccb");
    1360 #if __FreeBSD_version > 500000
     1368#if (__FreeBSD_version > 500000) || (__FreeBSD_kernel_version > 500000)
    13611369    cam_error_print(cam_dev,ccb,CAM_ESF_ALL,CAM_EPF_ALL,stderr);
    13621370#endif
    13631371    cam_freeccb(ccb);
    int do_normal_scsi_cmnd_io(int fd, struc 
    13651373  }
    13661374
    13671375  if (((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) && ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR)) {
    1368 #if __FreeBSD_version > 500000
     1376#if (__FreeBSD_version > 500000) || (__FreeBSD_kernel_version > 500000)
    13691377    cam_error_print(cam_dev,ccb,CAM_ESF_ALL,CAM_EPF_ALL,stderr);
    13701378#endif
    13711379    cam_freeccb(ccb);
    bool freebsd_smart_interface::scan_smart 
    19982006}
    19992007
    20002008
    2001 #if __FreeBSD_version < 800000 // without this build fail on FreeBSD 8
     2009#if (__FreeBSD_version < 800000) || (__FreeBSD_kernel_version < 800000) // without this build fail on FreeBSD 8
    20022010static char done[USB_MAX_DEVICES];
    20032011
    20042012static int usbdevinfo(int f, int a, int rec, int busno, unsigned short & vendor_id,
    static int usbdevinfo(int f, int a, int  
    20542062static int usbdevlist(int busno,unsigned short & vendor_id,
    20552063  unsigned short & product_id, unsigned short & version)
    20562064{
    2057 #if __FreeBSD_version >= 800000 // libusb2 interface
     2065#if (__FreeBSD_version >= 800000) || (__FreeBSD_kernel_version >= 800000) // libusb2 interface
    20582066  struct libusb20_device *pdev = NULL;
    20592067  struct libusb20_backend *pbe;
    20602068  uint32_t matches = 0;