Enabled SCSI command execution on OpenBSD. Thanks to SASANO Takayoshi.

This commit is contained in:
Thomas Schmitt 2016-07-21 10:29:15 +00:00
parent 9d99127fa9
commit 7f519b7356
5 changed files with 57 additions and 18 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2016.07.01.190459" #define Cdrskin_timestamP "2016.07.21.102919"

View File

@ -6,10 +6,11 @@
with MMC transport adapter sg-netbsd.c with MMC transport adapter sg-netbsd.c
>>> for OpenBSD too ? >>> for OpenBSD too ?
Copyright (C) 2010 - 2014 Thomas Schmitt <scdbackup@gmx.net> Copyright (C) 2010 - 2016 Thomas Schmitt <scdbackup@gmx.net>
provided under GPLv2+ provided under GPLv2+
Derived 2014 from libburn/os-solaris.c Derived 2014 from libburn/os-solaris.c
Adapted 2016 to OpenBSD by help of SASANO Takayoshi <uaa@mx5.nisiq.net>
*/ */
@ -33,6 +34,19 @@
/* The number of above list items */ /* The number of above list items */
#define BURN_OS_SIGNAL_COUNT 20 #define BURN_OS_SIGNAL_COUNT 20
#ifdef __OpenBSD__
/** To list all signals which shall surely not be caught */
#define BURN_OS_NON_SIGNAL_MACRO_LIST \
SIGKILL, SIGURG, SIGSTOP, SIGTSTP, SIGCONT, \
SIGCHLD, SIGTTIN, SIGTTOU, SIGIO, SIGWINCH, \
SIGINFO
/* The number of above list items */
#define BURN_OS_NON_SIGNAL_COUNT 11
#else /* __OpenBSD__ */
/** To list all signals which shall surely not be caught */ /** To list all signals which shall surely not be caught */
#define BURN_OS_NON_SIGNAL_MACRO_LIST \ #define BURN_OS_NON_SIGNAL_MACRO_LIST \
SIGKILL, SIGURG, SIGSTOP, SIGTSTP, SIGCONT, \ SIGKILL, SIGURG, SIGSTOP, SIGTSTP, SIGCONT, \
@ -42,6 +56,7 @@
/* The number of above list items */ /* The number of above list items */
#define BURN_OS_NON_SIGNAL_COUNT 12 #define BURN_OS_NON_SIGNAL_COUNT 12
#endif /* ! __OpenBSD__ */
/* The maximum size for a (SCSI) i/o transaction */ /* The maximum size for a (SCSI) i/o transaction */
/* Important : MUST be at least 32768 ! */ /* Important : MUST be at least 32768 ! */

View File

@ -3,7 +3,7 @@
Operating system specific libburn definitions and declarations. Operating system specific libburn definitions and declarations.
The macros defined here are used by libburn modules in order to The macros defined here are used by libburn modules in order to
avoid own system dependent case distinctions. avoid own system dependent case distinctions.
Copyright (C) 2009 - 2014 Thomas Schmitt <scdbackup@gmx.net>, Copyright (C) 2009 - 2016 Thomas Schmitt <scdbackup@gmx.net>,
provided under GPLv2+ provided under GPLv2+
*/ */
@ -37,14 +37,21 @@
#else #else
#ifdef Libburn_use_sg_netbsD #ifdef __NetBSD__
/* To become: # ifdef __NetBSD__ */
/* -------------------------- NetBSD with SCIOCCOMMAND --------------------- */ /* -------------------------- NetBSD with SCIOCCOMMAND --------------------- */
#include "os-netbsd.h" #include "os-netbsd.h"
#else
#ifdef __OpenBSD__
/* -------------------------- OpenBSD with SCIOCCOMMAND -------------------- */
#include "os-netbsd.h"
#else #else
#ifdef __FreeBSD__ #ifdef __FreeBSD__
@ -88,7 +95,8 @@
#endif /* ! __linux */ #endif /* ! __linux */
#endif /* ! __FreeBSD__kernel__ */ #endif /* ! __FreeBSD__kernel__ */
#endif /* ! __FreeBSD__ */ #endif /* ! __FreeBSD__ */
#endif /* ! Libburn_use_sg_netbsD */ #endif /* ! __OpenBSD__ */
#endif /* ! __NetBSD__ */
#endif /* ! Libburn_use_libcdiO */ #endif /* ! Libburn_use_libcdiO */
#endif /* ! Libburn_use_sg_dummY */ #endif /* ! Libburn_use_sg_dummY */

View File

@ -1,13 +1,15 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* /*
Copyright (c) 2010 - 2014 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2010 - 2016 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
Derived 2014 from libburn/sg-solaris.c with information learned from Derived 2014 from libburn/sg-solaris.c with information learned from
dvd+rw-tools, http://fxr.watson.org/fxr/source/sys/scsiio.h?v=NETBSD, dvd+rw-tools, http://fxr.watson.org/fxr/source/sys/scsiio.h?v=NETBSD,
http://netbsd.gw.com/cgi-bin/man-cgi?scsi+4+NetBSD-current, http://netbsd.gw.com/cgi-bin/man-cgi?scsi+4+NetBSD-current,
and experiments made by Freddy Fisker. and experiments made by Freddy Fisker.
Adapted 2016 to OpenBSD by help of SASANO Takayoshi <uaa@mx5.nisiq.net>.
*/ */
@ -312,7 +314,11 @@ static int guess_size_by_seek_set(int fd, off_t *bytes, int flag)
*/ */
int sg_id_string(char msg[1024], int flag) int sg_id_string(char msg[1024], int flag)
{ {
#ifdef __OpenBSD___
sprintf(msg, "internal OpenBSD SCIOCCOMMAND adapter sg-netbsd");
#else
sprintf(msg, "internal NetBSD SCIOCCOMMAND adapter sg-netbsd"); sprintf(msg, "internal NetBSD SCIOCCOMMAND adapter sg-netbsd");
#endif
return 1; return 1;
} }
@ -687,10 +693,21 @@ int sg_obtain_scsi_adr(char *path, int *bus_no, int *host_no, int *channel_no,
{ret = 0; goto ex;} {ret = 0; goto ex;}
if (addr.type != TYPE_SCSI) if (addr.type != TYPE_SCSI)
{ret = 0; goto ex;} {ret = 0; goto ex;}
#ifdef __OpenBSD___
*bus_no = *host_no = addr.scbus;
*target_no = addr.target;
*lun_no = addr.lun;
#else /* __OpenBSD___ */
*bus_no = *host_no = addr.addr.scsi.scbus; *bus_no = *host_no = addr.addr.scsi.scbus;
*channel_no = 0;
*target_no = addr.addr.scsi.target; *target_no = addr.addr.scsi.target;
*lun_no = addr.addr.scsi.lun; *lun_no = addr.addr.scsi.lun;
#endif /* ! __OpenBSD___ */
ret = 1; ret = 1;
ex:; ex:;
if (fd != -1) if (fd != -1)

View File

@ -1,7 +1,7 @@
/* sg.c /* sg.c
Switcher for operating system dependent transport level modules of libburn. Switcher for operating system dependent transport level modules of libburn.
Copyright (C) 2009 - 2014 Thomas Schmitt <scdbackup@gmx.net>, Copyright (C) 2009 - 2016 Thomas Schmitt <scdbackup@gmx.net>,
provided under GPLv2+ provided under GPLv2+
*/ */
@ -11,12 +11,6 @@
#endif #endif
/* <<< Until it is known whether this adapter would work on OpenBSD too */
#ifdef __NetBSD__
#define Libburn_use_sg_netbsD
#endif
#ifdef Libburn_use_sg_dummY #ifdef Libburn_use_sg_dummY
#include "sg-dummy.c" #include "sg-dummy.c"
@ -27,8 +21,12 @@
#include "sg-libcdio.c" #include "sg-libcdio.c"
#else #else
#ifdef Libburn_use_sg_netbsD #ifdef __NetBSD__
/* To become: # ifdef __NetBSD__ */
#include "sg-netbsd.c"
#else
#ifdef __OpenBSD__
#include "sg-netbsd.c" #include "sg-netbsd.c"
@ -88,7 +86,8 @@ static int intentional_compiler_warning(void)
#endif /* ! __linux */ #endif /* ! __linux */
#endif /* ! __FreeBSD_kernel__ */ #endif /* ! __FreeBSD_kernel__ */
#endif /* ! __FreeBSD__ */ #endif /* ! __FreeBSD__ */
#endif /* ! Libburn_use_sg_netbsD */ #endif /* ! __OpenBSD__ */
#endif /* ! __NetBSD__ */
#endif /* ! Libburn_use_libcdiO */ #endif /* ! Libburn_use_libcdiO */
#endif /* ! Libburn_use_sg_dummY */ #endif /* ! Libburn_use_sg_dummY */