diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 81d52f9..1afb978 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2010.01.18.103410" +#define Cdrskin_timestamP "2010.01.21.104741" diff --git a/libburn/sg-freebsd.c b/libburn/sg-freebsd.c index 712d241..f376605 100644 --- a/libburn/sg-freebsd.c +++ b/libburn/sg-freebsd.c @@ -17,10 +17,12 @@ #include /* XXX */ - /* ts A70909 */ #include +/* ts B00121 */ +#include /* DIOCGMEDIASIZE */ + #include "transport.h" #include "drive.h" @@ -910,6 +912,7 @@ int burn_os_stdio_capacity(char *path, off_t *bytes) char testpath[4096], *cpt; long blocks; off_t add_size = 0; + int fd, ret; testpath[0] = 0; blocks = *bytes / 512; @@ -944,6 +947,15 @@ int burn_os_stdio_capacity(char *path, off_t *bytes) #endif /* Libburn_if_this_was_linuX */ + } else if(S_ISCHR(stbuf.st_mode)) { + fd = open(path, O_RDONLY); + if (fd == -1) + return -2; + ret = ioctl(fd, DIOCGMEDIASIZE, &add_size); + close(fd); + if (ret == -1) + return -2; + *bytes = add_size; } else if(S_ISREG(stbuf.st_mode)) { add_size = stbuf.st_blocks * (off_t) 512; strcpy(testpath, path); diff --git a/libburn/sg-libcdio.c b/libburn/sg-libcdio.c index 2b536bc..a812cbc 100644 --- a/libburn/sg-libcdio.c +++ b/libburn/sg-libcdio.c @@ -111,12 +111,19 @@ Send feedback to libburn-hackers@pykix.org . #endif #ifdef __FreeBSD__ -/* To avoid ATAPI devices */ -#define Libburn_guess_freebsd_atapi_devicE 1 +#define Libburn_is_on_freebsD 1 #endif #ifdef __FreeBSD_kernel__ -#define Libburn_guess_freebsd_atapi_devicE 1 +#define Libburn_is_on_freebsD 1 #endif +#ifdef Libburn_is_on_freebsD +/* To avoid ATAPI devices */ +#define Libburn_guess_freebsd_atapi_devicE 1 +/* To obtain size of disk-like devices */ +#include /* DIOCGMEDIASIZE */ +#endif /* Libburn_is_on_freebsD */ + +#define Libburn_guess_freebsd_atapi_devicE 1 #include #include @@ -679,8 +686,9 @@ int sg_obtain_scsi_adr(char *path, int *bus_no, int *host_no, int *channel_no, if (p_cdio == NULL) return 0; - /* Try whether a Linux address tuple is available */ - tuple = (char *) cdio_get_arg(p_cdio, "scsi-tuple-linux"); + /* Try whether a bus,host,channel,target,lun address tuple is + available */ + tuple = (char *) cdio_get_arg(p_cdio, "scsi-tuple"); if (tuple != NULL) if (tuple[0]) { sscanf(tuple, "%d,%d,%d,%d,%d", bus_no, host_no, channel_no, target_no, lun_no); @@ -841,6 +849,22 @@ int burn_os_stdio_capacity(char *path, off_t *bytes) #endif /* __linux */ +#ifdef Libburn_is_on_freebsD + + } else if(S_ISCHR(stbuf.st_mode)) { + int fd, ret; + + fd = open(path, O_RDONLY); + if (fd == -1) + return -2; + ret = ioctl(fd, DIOCGMEDIASIZE, &add_size); + close(fd); + if (ret == -1) + return -2; + *bytes = add_size; + +#endif/* Libburn_is_on_freebsD */ + } else if(S_ISREG(stbuf.st_mode)) { add_size = stbuf.st_blocks * (off_t) 512; strcpy(testpath, path);