$NetBSD: patch-ad,v 1.4 2007/10/20 10:41:20 markd Exp $ --- kscd/libwm/plat_freebsd.c.orig 2005-10-05 13:22:14.000000000 +0000 +++ kscd/libwm/plat_freebsd.c @@ -378,6 +378,14 @@ gen_stop( struct wm_drive *d) return (ioctl(d->fd, CDIOCSTOP)); } /* gen_stop() */ +/* XXX */ +#ifdef __NetBSD__ +# include +# if __NetBSD_Version__ >= 299000900 /* 2.99.9 */ +# define HAVE_SYS_STATVFS_H 1 +# endif +#endif + /*----------------------------------------* * Eject the current CD, if there is one. *----------------------------------------*/ @@ -386,14 +394,22 @@ gen_eject( struct wm_drive *d ) { /* 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);