2006-01-20 04:51:25 +01:00
|
|
|
$NetBSD: patch-ad,v 1.3 2006/01/20 03:51:25 joerg Exp $
|
2004-05-04 13:30:17 +02:00
|
|
|
|
2006-01-20 04:51:25 +01:00
|
|
|
--- kscd/libwm/plat_freebsd.c.orig 2005-10-05 13:22:14.000000000 +0000
|
|
|
|
+++ kscd/libwm/plat_freebsd.c
|
|
|
|
@@ -30,7 +30,7 @@
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
-#if defined(__FreeBSD__) || defined(__FreeBSD) || defined(__NetBSD__) || defined (__NetBSD)
|
|
|
|
+#if defined(__FreeBSD__) || defined(__FreeBSD) || defined(__NetBSD__) || defined (__NetBSD) || defined(__DragonFly__)
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
@@ -61,7 +61,7 @@
|
|
|
|
#else
|
|
|
|
# define LEFT_PORT 0
|
|
|
|
# define RIGHT_PORT 1
|
|
|
|
-# if __FreeBSD_version < 300000
|
|
|
|
+# if defined(__FreeBSD_version) && __FreeBSD_version < 300000
|
|
|
|
# include <scsi.h>
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
@@ -378,6 +378,14 @@ gen_stop( struct wm_drive *d)
|
2004-05-04 13:30:17 +02:00
|
|
|
return (ioctl(d->fd, CDIOCSTOP));
|
|
|
|
} /* gen_stop() */
|
|
|
|
|
|
|
|
+/* XXX */
|
|
|
|
+#ifdef __NetBSD__
|
|
|
|
+# include <sys/param.h>
|
2005-09-06 10:10:57 +02:00
|
|
|
+# if __NetBSD_Version__ >= 299000900 /* 2.99.9 */
|
2004-05-04 13:30:17 +02:00
|
|
|
+# define HAVE_SYS_STATVFS_H 1
|
|
|
|
+# endif
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
/*----------------------------------------*
|
|
|
|
* Eject the current CD, if there is one.
|
|
|
|
*----------------------------------------*/
|
2006-01-20 04:51:25 +01:00
|
|
|
@@ -386,14 +394,22 @@ gen_eject( struct wm_drive *d )
|
2004-05-04 13:30:17 +02:00
|
|
|
{
|
|
|
|
/* On some systems, we can check to see if the CD is mounted. */
|
|
|
|
struct stat stbuf;
|
|
|
|
+#ifdef HAVE_SYS_STATVFS_H
|
|
|
|
+ struct statvfs buf;
|
|
|
|
+#else
|
|
|
|
struct statfs buf;
|
|
|
|
+#endif
|
|
|
|
int rval;
|
|
|
|
|
|
|
|
if (fstat(d->fd, &stbuf) != 0)
|
|
|
|
return (-2);
|
|
|
|
|
|
|
|
/* Is this a mounted filesystem? */
|
|
|
|
+#ifdef HAVE_SYS_STATVFS_H
|
|
|
|
+ if (fstatvfs(stbuf.st_rdev, &buf) == 0)
|
|
|
|
+#else
|
|
|
|
if (fstatfs(stbuf.st_rdev, &buf) == 0)
|
|
|
|
+#endif
|
|
|
|
return (-3);
|
|
|
|
|
|
|
|
rval = ioctl(d->fd, CDIOCALLOW);
|