Experimentally regard FreeBSD /dev/da[0-9] and /dev/cd[0-9] as block device
This commit is contained in:
parent
48ba6972b4
commit
889feba810
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2010.01.12.165214"
|
#define Cdrskin_timestamP "2010.01.13.074028"
|
||||||
|
@ -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 burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname)
|
||||||
{
|
{
|
||||||
int ret = -1, fd = -1, role = 0;
|
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 */
|
/* 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 size = ((off_t) (512 * 1024 * 1024 - 1) * (off_t) 2048);
|
||||||
off_t read_size = -1;
|
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;
|
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) {
|
if (fname[0] != 0) {
|
||||||
memset(&stbuf, 0, sizeof(stbuf));
|
memset(&stbuf, 0, sizeof(stbuf));
|
||||||
fd = burn_drive__fd_from_special_adr(fname);
|
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
|
else
|
||||||
ret = stat(fname, &stbuf);
|
ret = stat(fname, &stbuf);
|
||||||
if (ret != -1) {
|
if (ret != -1) {
|
||||||
|
is_block_dev = S_ISBLK(stbuf.st_mode) ||
|
||||||
|
is_fabricated_block_dev;
|
||||||
if (S_ISREG(stbuf.st_mode))
|
if (S_ISREG(stbuf.st_mode))
|
||||||
read_size = stbuf.st_size;
|
read_size = stbuf.st_size;
|
||||||
else if (S_ISBLK(stbuf.st_mode)) {
|
else if (is_block_dev) {
|
||||||
ret = burn_os_stdio_capacity(fname,
|
ret = burn_os_stdio_capacity(fname,
|
||||||
&read_size);
|
&read_size);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
@ -1344,8 +1377,7 @@ int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname)
|
|||||||
(off_t) 2048;
|
(off_t) 2048;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret == -1 || S_ISBLK(stbuf.st_mode) ||
|
if (ret == -1 || is_block_dev || S_ISREG(stbuf.st_mode)) {
|
||||||
S_ISREG(stbuf.st_mode)) {
|
|
||||||
ret = burn_os_stdio_capacity(fname, &size);
|
ret = burn_os_stdio_capacity(fname, &size);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
libdax_msgs_submit(libdax_messenger, -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) &&
|
if (S_ISBLK(stbuf1.st_mode) && S_ISBLK(stbuf2.st_mode) &&
|
||||||
stbuf1.st_rdev == stbuf2.st_rdev)
|
stbuf1.st_rdev == stbuf2.st_rdev)
|
||||||
return 1; /* same major,minor device number */
|
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 */
|
/* Are both filesystem objects related to the same MMC drive */
|
||||||
if (conv_ret2 <= 0)
|
if (conv_ret2 <= 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user