From c26b7dbad93415ed3c872d46f6bd6aeae93c61f4 Mon Sep 17 00:00:00 2001 From: Yorick Hardy Date: Mon, 19 May 2003 21:46:09 +0000 Subject: [PATCH] Added the implementation for CDROM_GetIdeInterface on NetBSD. --- configure | 2 ++ configure.ac | 1 + dlls/ntdll/cdrom.c | 22 +++++++++++++++++++++- include/config.h.in | 3 +++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 5755c621934..4beb74533b6 100755 --- a/configure +++ b/configure @@ -13236,6 +13236,7 @@ done + for ac_header in \ @@ -13289,6 +13290,7 @@ for ac_header in \ sys/poll.h \ sys/ptrace.h \ sys/reg.h \ + sys/scsiio.h \ sys/shm.h \ sys/signal.h \ sys/socket.h \ diff --git a/configure.ac b/configure.ac index 80f74389baa..43b1fa61005 100644 --- a/configure.ac +++ b/configure.ac @@ -1007,6 +1007,7 @@ AC_CHECK_HEADERS(\ sys/poll.h \ sys/ptrace.h \ sys/reg.h \ + sys/scsiio.h \ sys/shm.h \ sys/signal.h \ sys/socket.h \ diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c index 6d4f7b394f8..a542aa5dc20 100644 --- a/dlls/ntdll/cdrom.c +++ b/dlls/ntdll/cdrom.c @@ -60,6 +60,9 @@ #ifdef HAVE_SYS_CDIO_H # include #endif +#ifdef HAVE_SYS_SCSIIO_H +# include +#endif #define NONAMELESSUNION #define NONAMELESSSTRUCT @@ -379,7 +382,24 @@ static int CDROM_GetIdeInterface(int fd, int* iface, int* device) *device = (minor(st.st_rdev) == 63 ? 1 : 0); return 1; } -#elif defined(__FreeBSD__) || defined(__NetBSD__) +#elif defined(__NetBSD__) + { + struct scsi_addr addr; + if (ioctl(fd, SCIOCIDENTIFY, &addr) != -1) { + switch (addr.type) { + /* for SCSI copy linux case, i.e. start at *iface = 11 */ + case TYPE_SCSI: *iface = 11 + addr.addr.scsi.scbus; + *device = addr.addr.scsi.target; + break; + case TYPE_ATAPI: *iface = addr.addr.atapi.atbus; + *device = addr.addr.atapi.drive; + break; + } + return 1; + } + return 0; + } +#elif defined(__FreeBSD__) FIXME("not implemented for BSD\n"); return 0; #else diff --git a/include/config.h.in b/include/config.h.in index 6fadc146b49..5eff5abb251 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -560,6 +560,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_REG_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SCSIIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SHM_H