Made libburn and cdrskin build on my Linux again

This commit is contained in:
Thomas Schmitt 2006-10-13 10:22:21 +00:00
parent 62cf36d11f
commit 0accb7728a
9 changed files with 100 additions and 37 deletions

View File

@ -43,7 +43,7 @@ libburn_libburn_la_SOURCES = \
libburn/sbc.h \ libburn/sbc.h \
libburn/sector.c \ libburn/sector.c \
libburn/sector.h \ libburn/sector.h \
libburn/sg-@ARCH@.c \ libburn/sg.c \
libburn/sg.h \ libburn/sg.h \
libburn/source.h \ libburn/source.h \
libburn/source.c \ libburn/source.c \
@ -60,6 +60,7 @@ libburn_libburn_la_SOURCES = \
libburn/write.h \ libburn/write.h \
version.h version.h
## libburn/sg-@ARCH@.c \
libisofs_libisofs_la_LDFLAGS = \ libisofs_libisofs_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)

View File

@ -23,6 +23,29 @@ typedef void (*sighandler_t)(int);
#include "cleanup.h" #include "cleanup.h"
#ifdef __FreeBSD__
/* Signals to be caught */
static int signal_list[]= {
SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT,
SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, SIGTERM,
SIGUSR1, SIGUSR2, SIGXCPU, SIGTSTP, SIGTTIN,
SIGTTOU,
SIGBUS, SIGPROF, SIGSYS, SIGTRAP,
SIGVTALRM, SIGXCPU, SIGXFSZ, -1
};
static char *signal_name_list[]= {
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGABRT",
"SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM",
"SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN",
"SIGTTOU",
"SIGBUS", "SIGPROF", "SIGSYS", "SIGTRAP",
"SIGVTALRM", "SIGXCPU", "SIGXFSZ", "@"
};
static int signal_list_count= 23;
#else /* __FreeBSD__ */
/* Signals to be caught */ /* Signals to be caught */
static int signal_list[]= { static int signal_list[]= {
SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT,
@ -42,6 +65,8 @@ static char *signal_name_list[]= {
}; };
static int signal_list_count= 24; static int signal_list_count= 24;
#endif /* ! __FreeBSD__ */
/* Signals not to be caught */ /* Signals not to be caught */
static int non_signal_list[]= { static int non_signal_list[]= {
SIGKILL, SIGCHLD, SIGSTOP, SIGURG, -1 SIGKILL, SIGCHLD, SIGSTOP, SIGURG, -1

View File

@ -23,17 +23,15 @@ typedef void (*sighandler_t)(int);
#include "cleanup.h" #include "cleanup.h"
#ifdef __FreeBSD__
/* Signals to be caught */ /* Signals to be caught */
static int signal_list[]= { static int signal_list[]= {
SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT,
SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, SIGTERM, SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, SIGTERM,
SIGUSR1, SIGUSR2, SIGXCPU, SIGTSTP, SIGTTIN, SIGUSR1, SIGUSR2, SIGXCPU, SIGTSTP, SIGTTIN,
SIGTTOU, SIGTTOU,
SIGBUS, SIGBUS, SIGPROF, SIGSYS, SIGTRAP,
#ifdef __Linux__
SIGPOLL,
#endif
SIGPROF, SIGSYS, SIGTRAP,
SIGVTALRM, SIGXCPU, SIGXFSZ, -1 SIGVTALRM, SIGXCPU, SIGXFSZ, -1
}; };
static char *signal_name_list[]= { static char *signal_name_list[]= {
@ -41,15 +39,34 @@ static char *signal_name_list[]= {
"SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM", "SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM",
"SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN", "SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN",
"SIGTTOU", "SIGTTOU",
"SIGBUS", "SIGBUS", "SIGPROF", "SIGSYS", "SIGTRAP",
#ifdef __Linux__ "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "@"
"SIGPOLL", };
#endif static int signal_list_count= 23;
"SIGPROF", "SIGSYS", "SIGTRAP",
#else /* __FreeBSD__ */
/* Signals to be caught */
static int signal_list[]= {
SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT,
SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, SIGTERM,
SIGUSR1, SIGUSR2, SIGXCPU, SIGTSTP, SIGTTIN,
SIGTTOU,
SIGBUS, SIGPOLL, SIGPROF, SIGSYS, SIGTRAP,
SIGVTALRM, SIGXCPU, SIGXFSZ, -1
};
static char *signal_name_list[]= {
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGABRT",
"SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM",
"SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN",
"SIGTTOU",
"SIGBUS", "SIGPOLL", "SIGPROF", "SIGSYS", "SIGTRAP",
"SIGVTALRM", "SIGXCPU", "SIGXFSZ", "@" "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "@"
}; };
static int signal_list_count= 24; static int signal_list_count= 24;
#endif /* ! __FreeBSD__ */
/* Signals not to be caught */ /* Signals not to be caught */
static int non_signal_list[]= { static int non_signal_list[]= {
SIGKILL, SIGCHLD, SIGSTOP, SIGURG, -1 SIGKILL, SIGCHLD, SIGSTOP, SIGURG, -1

View File

@ -2,11 +2,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef __Linux__
#include <malloc.h> /* #include <m alloc.h> ts A61013 : not in Linux man 3 malloc */
#else
#include <stdlib.h> #include <stdlib.h>
#endif
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
@ -65,16 +64,20 @@ void burn_drive_free_all(void)
/* ts A60822 */ /* ts A60822 */
int burn_drive_is_open(struct burn_drive *d) int burn_drive_is_open(struct burn_drive *d)
{ {
#if defined(__Linux__) #if defined(__FreeBSD__)
if (d->cam == NULL)
return 0;
#else /* __FreeBSD__ */
/* a bit more detailed case distinction than needed */ /* a bit more detailed case distinction than needed */
if (d->fd == -1337) if (d->fd == -1337)
return 0; return 0;
if (d->fd < 0) if (d->fd < 0)
return 0; return 0;
#elif defined(__FreeBSD__)
if (d->cam == NULL) #endif /* ! __FreeBSD__ */
return 0;
#endif
return 1; return 1;
} }

View File

@ -1,10 +1,8 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
#ifdef __Linux__ /* #include <m alloc.h> ts A61013 : not in Linux man 3 malloc */
#include <malloc.h>
#else
#include <stdlib.h> #include <stdlib.h>
#endif
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>

View File

@ -2,11 +2,6 @@
/* scsi block commands */ /* scsi block commands */
#ifdef __Linux__
/* XXX Why do we need this here? */
#include <scsi/scsi.h>
#include <scsi/sg.h>
#endif
#include <string.h> #include <string.h>
#include "transport.h" #include "transport.h"

View File

@ -10,7 +10,9 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <malloc.h>
/* #include <m alloc.h> ts A61013 : not in Linux man 3 malloc */
#include <string.h> #include <string.h>
#include <sys/poll.h> #include <sys/poll.h>
#include <linux/hdreg.h> #include <linux/hdreg.h>
@ -452,7 +454,7 @@ static void enumerate_common(char *fname, int bus_no, int host_no,
out.get_nwa = mmc_get_nwa; out.get_nwa = mmc_get_nwa;
out.close_disc = mmc_close_disc; out.close_disc = mmc_close_disc;
out.close_session = mmc_close_session; out.close_session = mmc_close_session;
out.idata = malloc(sizeof(struct scsi_inquiry_data)); out.idata = malloc(sizeof(struct burn_scsi_inquiry_data));
out.idata->valid = 0; out.idata->valid = 0;
out.mdata = malloc(sizeof(struct scsi_mode_data)); out.mdata = malloc(sizeof(struct scsi_mode_data));
out.mdata->valid = 0; out.mdata->valid = 0;

13
trunk/libburn/sg.c Normal file
View File

@ -0,0 +1,13 @@
/* ts A61013 : It would be nice if autotools could do that job */
#ifdef __FreeBSD__
#include "sg-freebsd.c"
#else
#include "sg-linux.c"
#endif

View File

@ -8,18 +8,26 @@
#include <pthread.h> #include <pthread.h>
/* sg data structures */ /* sg data structures */
#include <sys/types.h> #include <sys/types.h>
#ifdef __Linux__
#ifdef __FreeBSD__
#define BUFFER_SIZE 65536/2
#else /* __FreeBSD__ */
/* XXX Why do we need this here? */ /* XXX Why do we need this here? */
/* ts A61013: because Linux wants to see them */
#include <scsi/sg.h> #include <scsi/sg.h>
#include <scsi/scsi.h> #include <scsi/scsi.h>
#endif #define BUFFER_SIZE 65536
#endif /* ! __FreeBSD__ */
/* kludge! glibc headers don't define all the SCSI shit that we use! */ /* kludge! glibc headers don't define all the SCSI shit that we use! */
#ifndef SG_GET_ACCESS_COUNT #ifndef SG_GET_ACCESS_COUNT
# define SG_GET_ACCESS_COUNT 0x2289 # define SG_GET_ACCESS_COUNT 0x2289
#endif #endif
#define BUFFER_SIZE 65536/2
enum transfer_direction enum transfer_direction
{ TO_DRIVE, FROM_DRIVE, NO_TRANSFER }; { TO_DRIVE, FROM_DRIVE, NO_TRANSFER };
@ -104,10 +112,11 @@ struct burn_drive
int channel; int channel;
int lun; int lun;
char *devname; char *devname;
#if defined(__Linux__)
int fd; #if defined(__FreeBSD__)
#elif defined(__FreeBSD__)
struct cam_device* cam; struct cam_device* cam;
#else
int fd;
#endif #endif
/* ts A60926 : trying to lock against growisofs /dev/srN, /dev/scdN */ /* ts A60926 : trying to lock against growisofs /dev/srN, /dev/scdN */