Made several changes for freebsd support

This commit is contained in:
Mario Danic 2006-10-12 17:35:06 +00:00
parent 16086d5a7b
commit 86bfcea2b3
6 changed files with 41 additions and 10 deletions

View File

@ -29,7 +29,11 @@ static int signal_list[]= {
SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, SIGTERM,
SIGUSR1, SIGUSR2, SIGXCPU, SIGTSTP, SIGTTIN,
SIGTTOU,
SIGBUS, SIGPOLL, SIGPROF, SIGSYS, SIGTRAP,
SIGBUS,
#ifdef __Linux__
SIGPOLL,
#endif
SIGPROF, SIGSYS, SIGTRAP,
SIGVTALRM, SIGXCPU, SIGXFSZ, -1
};
static char *signal_name_list[]= {
@ -37,7 +41,11 @@ static char *signal_name_list[]= {
"SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM",
"SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN",
"SIGTTOU",
"SIGBUS", "SIGPOLL", "SIGPROF", "SIGSYS", "SIGTRAP",
"SIGBUS",
#ifdef __Linux__
"SIGPOLL",
#endif
"SIGPROF", "SIGSYS", "SIGTRAP",
"SIGVTALRM", "SIGXCPU", "SIGXFSZ", "@"
};
static int signal_list_count= 24;

View File

@ -2,7 +2,11 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifdef __Linux__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include <unistd.h>
#include <signal.h>
@ -61,11 +65,16 @@ void burn_drive_free_all(void)
/* ts A60822 */
int burn_drive_is_open(struct burn_drive *d)
{
#if defined(__Linux__)
/* 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
return 1;
}
@ -456,7 +465,7 @@ static void strip_spaces(char *str)
static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out)
{
struct scsi_inquiry_data *id;
struct burn_scsi_inquiry_data *id;
/* ts A61007 : now prevented in enumerate_common() */
#if 0
@ -467,7 +476,7 @@ static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out)
if (!d->idata->valid || !d->mdata->valid)
return 0;
id = (struct scsi_inquiry_data *)d->idata;
id = (struct burn_scsi_inquiry_data *)d->idata;
memcpy(out->vendor, id->vendor, sizeof(id->vendor));
strip_spaces(out->vendor);

View File

@ -1,6 +1,10 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
#ifdef __Linux__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include <unistd.h>
#include <signal.h>

View File

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

View File

@ -75,7 +75,7 @@ int spc_get_erase_progress(struct burn_drive *d)
void spc_inquiry(struct burn_drive *d)
{
struct buffer buf;
struct scsi_inquiry_data *id;
struct burn_scsi_inquiry_data *id;
struct command c;
memcpy(c.opcode, SPC_INQUIRY, sizeof(SPC_INQUIRY));
@ -87,7 +87,7 @@ void spc_inquiry(struct burn_drive *d)
c.dir = FROM_DRIVE;
d->issue_command(d, &c);
id = (struct scsi_inquiry_data *)d->idata;
id = (struct burn_scsi_inquiry_data *)d->idata;
id->vendor[8] = 0;
id->product[16] = 0;
id->revision[4] = 0;

View File

@ -8,15 +8,18 @@
#include <pthread.h>
/* sg data structures */
#include <sys/types.h>
#ifdef __Linux__
/* XXX Why do we need this here? */
#include <scsi/sg.h>
#include <scsi/scsi.h>
#endif
/* 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
#define BUFFER_SIZE 65536/2
enum transfer_direction
{ TO_DRIVE, FROM_DRIVE, NO_TRANSFER };
@ -55,7 +58,7 @@ struct command
struct buffer *page;
};
struct scsi_inquiry_data
struct burn_scsi_inquiry_data
{
char vendor[9];
char product[17];
@ -101,7 +104,11 @@ struct burn_drive
int channel;
int lun;
char *devname;
#if defined(__Linux__)
int fd;
#elif defined(__FreeBSD__)
struct cam_device* cam;
#endif
/* ts A60926 : trying to lock against growisofs /dev/srN, /dev/scdN */
int sibling_count;
@ -174,7 +181,7 @@ struct burn_drive
int (*test_unit_ready) (struct burn_drive * d);
void (*probe_write_modes) (struct burn_drive * d);
struct params params;
struct scsi_inquiry_data *idata;
struct burn_scsi_inquiry_data *idata;
struct scsi_mode_data *mdata;
int toc_entries;
struct burn_toc_entry *toc_entry;