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 6f072d870d
commit 078f75c2a7
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
>>> for OpenBSD too ?
Copyright (C) 2010 - 2014 Thomas Schmitt <scdbackup@gmx.net>
Copyright (C) 2010 - 2016 Thomas Schmitt <scdbackup@gmx.net>
provided under GPLv2+
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 */
#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 */
#define BURN_OS_NON_SIGNAL_MACRO_LIST \
SIGKILL, SIGURG, SIGSTOP, SIGTSTP, SIGCONT, \
@ -42,6 +56,7 @@
/* The number of above list items */
#define BURN_OS_NON_SIGNAL_COUNT 12
#endif /* ! __OpenBSD__ */
/* The maximum size for a (SCSI) i/o transaction */
/* Important : MUST be at least 32768 ! */

View File

@ -3,7 +3,7 @@
Operating system specific libburn definitions and declarations.
The macros defined here are used by libburn modules in order to
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+
*/
@ -37,14 +37,21 @@
#else
#ifdef Libburn_use_sg_netbsD
/* To become: # ifdef __NetBSD__ */
#ifdef __NetBSD__
/* -------------------------- NetBSD with SCIOCCOMMAND --------------------- */
#include "os-netbsd.h"
#else
#ifdef __OpenBSD__
/* -------------------------- OpenBSD with SCIOCCOMMAND -------------------- */
#include "os-netbsd.h"
#else
#ifdef __FreeBSD__
@ -88,7 +95,8 @@
#endif /* ! __linux */
#endif /* ! __FreeBSD__kernel__ */
#endif /* ! __FreeBSD__ */
#endif /* ! Libburn_use_sg_netbsD */
#endif /* ! __OpenBSD__ */
#endif /* ! __NetBSD__ */
#endif /* ! Libburn_use_libcdiO */
#endif /* ! Libburn_use_sg_dummY */

View File

@ -1,13 +1,15 @@
/* -*- 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.
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,
http://netbsd.gw.com/cgi-bin/man-cgi?scsi+4+NetBSD-current,
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)
{
#ifdef __OpenBSD___
sprintf(msg, "internal OpenBSD SCIOCCOMMAND adapter sg-netbsd");
#else
sprintf(msg, "internal NetBSD SCIOCCOMMAND adapter sg-netbsd");
#endif
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;}
if (addr.type != TYPE_SCSI)
{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;
*channel_no = 0;
*target_no = addr.addr.scsi.target;
*lun_no = addr.addr.scsi.lun;
#endif /* ! __OpenBSD___ */
ret = 1;
ex:;
if (fd != -1)

View File

@ -1,7 +1,7 @@
/* sg.c
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+
*/
@ -11,12 +11,6 @@
#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
#include "sg-dummy.c"
@ -27,8 +21,12 @@
#include "sg-libcdio.c"
#else
#ifdef Libburn_use_sg_netbsD
/* To become: # ifdef __NetBSD__ */
#ifdef __NetBSD__
#include "sg-netbsd.c"
#else
#ifdef __OpenBSD__
#include "sg-netbsd.c"
@ -88,7 +86,8 @@ static int intentional_compiler_warning(void)
#endif /* ! __linux */
#endif /* ! __FreeBSD_kernel__ */
#endif /* ! __FreeBSD__ */
#endif /* ! Libburn_use_sg_netbsD */
#endif /* ! __OpenBSD__ */
#endif /* ! __NetBSD__ */
#endif /* ! Libburn_use_libcdiO */
#endif /* ! Libburn_use_sg_dummY */