Browse Source

Made libburn and cdrskin build on my Linux again

trunk@386
Thomas Schmitt 15 years ago
parent
commit
170eb96356
  1. 3
      Makefile.am
  2. 25
      cdrskin/cleanup.c
  3. 37
      libburn/cleanup.c
  4. 21
      libburn/drive.c
  5. 6
      libburn/read.c
  6. 5
      libburn/sbc.c
  7. 6
      libburn/sg-linux.c
  8. 13
      libburn/sg.c
  9. 21
      libburn/transport.h

3
Makefile.am

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

25
cdrskin/cleanup.c

@ -23,6 +23,29 @@ typedef void (*sighandler_t)(int);
#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 */
static int signal_list[]= {
SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT,
@ -42,6 +65,8 @@ static char *signal_name_list[]= {
};
static int signal_list_count= 24;
#endif /* ! __FreeBSD__ */
/* Signals not to be caught */
static int non_signal_list[]= {
SIGKILL, SIGCHLD, SIGSTOP, SIGURG, -1

37
libburn/cleanup.c

@ -23,17 +23,15 @@ typedef void (*sighandler_t)(int);
#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,
#ifdef __Linux__
SIGPOLL,
#endif
SIGPROF, SIGSYS, SIGTRAP,
SIGBUS, SIGPROF, SIGSYS, SIGTRAP,
SIGVTALRM, SIGXCPU, SIGXFSZ, -1
};
static char *signal_name_list[]= {
@ -41,15 +39,34 @@ static char *signal_name_list[]= {
"SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM",
"SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN",
"SIGTTOU",
"SIGBUS",
#ifdef __Linux__
"SIGPOLL",
#endif
"SIGPROF", "SIGSYS", "SIGTRAP",
"SIGBUS", "SIGPROF", "SIGSYS", "SIGTRAP",
"SIGVTALRM", "SIGXCPU", "SIGXFSZ", "@"
};
static int signal_list_count= 23;
#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", "@"
};
static int signal_list_count= 24;
#endif /* ! __FreeBSD__ */
/* Signals not to be caught */
static int non_signal_list[]= {
SIGKILL, SIGCHLD, SIGSTOP, SIGURG, -1

21
libburn/drive.c

@ -2,11 +2,10 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifdef __Linux__
#include <malloc.h>
#else
/* #include <m alloc.h> ts A61013 : not in Linux man 3 malloc */
#include <stdlib.h>
#endif
#include <unistd.h>
#include <signal.h>
@ -65,16 +64,20 @@ void burn_drive_free_all(void)
/* ts A60822 */
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 */
if (d->fd == -1337)
return 0;
if (d->fd < 0)
return 0;
#elif defined(__FreeBSD__)
if (d->cam == NULL)
return 0;
#endif
#endif /* ! __FreeBSD__ */
return 1;
}

6
libburn/read.c

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

5
libburn/sbc.c

@ -2,11 +2,6 @@
/* 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 "transport.h"

6
libburn/sg-linux.c

@ -10,7 +10,9 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <malloc.h>
/* #include <m alloc.h> ts A61013 : not in Linux man 3 malloc */
#include <string.h>
#include <sys/poll.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.close_disc = mmc_close_disc;
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.mdata = malloc(sizeof(struct scsi_mode_data));
out.mdata->valid = 0;

13
libburn/sg.c

@ -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

21
libburn/transport.h

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

Loading…
Cancel
Save