diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 742a091..6b9f58c 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2010.01.12.165214" +#define Cdrskin_timestamP "2010.01.13.074028" diff --git a/libburn/drive.c b/libburn/drive.c index f63688d..65c0c3b 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -1318,6 +1318,7 @@ int burn_drive__fd_from_special_adr(char *adr) int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname) { int ret = -1, fd = -1, role = 0; + int is_fabricated_block_dev, is_block_dev = 0; /* divided by 512 it needs to fit into a signed long integer */ off_t size = ((off_t) (512 * 1024 * 1024 - 1) * (off_t) 2048); off_t read_size = -1; @@ -1326,6 +1327,36 @@ int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname) static int allow_role_3 = 1; +/* ts B00112 : + >>> this is just a test hack to work with an USB stick on FreeBSD +*/ +#ifdef __FreeBSD__ +#define Libburn_guess_block_devicE 1 +#endif +#ifdef __FreeBSD_kernel__ +#define Libburn_guess_block_devicE 1 +#endif + + is_fabricated_block_dev = 0; + +#ifdef Libburn_guess_block_devicE + { + char *spt; + spt = strrchr(fname, '/'); + if (spt == NULL) + spt = fname; + else + spt++; + if (spt[0] == 'd' && spt[1] == 'a' && + (spt[2] >= '0' || spt[2] <= '9') && spt[3] == 0) + is_fabricated_block_dev = 1; + if (spt[0] == 'c' && spt[1] == 'd' && + (spt[2] >= '0' || spt[2] <= '9') && spt[3] == 0) + is_fabricated_block_dev = 1; + + } +#endif /* Libburn_guess_block_devicE */ + if (fname[0] != 0) { memset(&stbuf, 0, sizeof(stbuf)); fd = burn_drive__fd_from_special_adr(fname); @@ -1334,9 +1365,11 @@ int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname) else ret = stat(fname, &stbuf); if (ret != -1) { + is_block_dev = S_ISBLK(stbuf.st_mode) || + is_fabricated_block_dev; if (S_ISREG(stbuf.st_mode)) read_size = stbuf.st_size; - else if (S_ISBLK(stbuf.st_mode)) { + else if (is_block_dev) { ret = burn_os_stdio_capacity(fname, &read_size); if (ret <= 0) @@ -1344,8 +1377,7 @@ int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname) (off_t) 2048; } } - if (ret == -1 || S_ISBLK(stbuf.st_mode) || - S_ISREG(stbuf.st_mode)) { + if (ret == -1 || is_block_dev || S_ISREG(stbuf.st_mode)) { ret = burn_os_stdio_capacity(fname, &size); if (ret == -1) { libdax_msgs_submit(libdax_messenger, -1, @@ -2637,6 +2669,9 @@ int burn_drive_equals_adr(struct burn_drive *d1, char *adr2_in, int role2) if (S_ISBLK(stbuf1.st_mode) && S_ISBLK(stbuf2.st_mode) && stbuf1.st_rdev == stbuf2.st_rdev) return 1; /* same major,minor device number */ + if (S_ISCHR(stbuf1.st_mode) && S_ISCHR(stbuf2.st_mode) && + stbuf1.st_rdev == stbuf2.st_rdev) + return 1; /* same major,minor device number */ /* Are both filesystem objects related to the same MMC drive */ if (conv_ret2 <= 0)