$NetBSD: patch-ad,v 1.2 2005/09/06 08:10:59 abs Exp $

--- kscd/libwm/plat_freebsd.c.orig	2003-05-05 22:19:39.000000000 +1000
+++ kscd/libwm/plat_freebsd.c	2004-05-04 19:17:17.000000000 +1000
@@ -380,6 +380,14 @@
   return (ioctl(d->fd, CDIOCSTOP));
 } /* gen_stop() */
 
+/* XXX */
+#ifdef __NetBSD__
+# include <sys/param.h>
+# if __NetBSD_Version__ >= 299000900	 /* 2.99.9 */
+#  define HAVE_SYS_STATVFS_H 1
+# endif
+#endif
+
 /*----------------------------------------*
  * Eject the current CD, if there is one.
  *----------------------------------------*/
@@ -388,14 +396,22 @@
 {
   /* 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);
