All pastes #18654 Raw Edit

Someone

public text v1 · immutable
#18654 ·published 2005-07-27 20:12 UTC
rendered paste body
--- src/devices.c.orig  Mon May 30 23:10:56 2005
+++ src/devices.c       Wed Jul 27 22:08:37 2005
@@ -30,7 +30,19 @@
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
+
+#ifdef __FreeBSD__
+#include <sys/cdio.h>
+
+#define CDROM_DRIVE_STATUS     0x5326
+#define CDS_NO_DISC            1
+#define CDS_TRAY_OPEN          2
+#define CDS_DRIVE_NOT_READY    3
+#define CDS_DISC_OK            4
+#define CDSL_CURRENT           ((int) (~0U>>1))
+#else
 #include <linux/cdrom.h>
+#endif


 gint deviceadditionindex = 0;
@@ -714,9 +726,9 @@
        }


-   /* Use ioctl to send the CDROMEJECT command to the device
+   /* Use ioctl to send the CDROMEJECT (CDIOCEJECT on FreeBSD) command to the device
    */
-       if (ioctl(cdrom,CDROMEJECT,0)<0)
+       if (ioctl(cdrom,CDIOCEJECT,0)<0)
        {
         g_warning("Error ejecting cd from device %s",device);
                ret = FALSE;
@@ -768,8 +780,12 @@
     int ret = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);
     if (ret == -1)
        {
-               g_critical("devices_query_cdstatus - ioctl failed");
-           return FALSE;
+               #ifdef __FreeBSD__
+                       return TRUE;
+               #else
+                       g_critical("devices_query_cdstatus - ioctl failed");
+                       return FALSE;
+               #endif
     }
        switch (ret)
        {