New cdrskin options --drive_not_f_setlk and --drive_not_o_excl

This commit is contained in:
2007-04-04 18:43:23 +00:00
parent 4c85686aad
commit 76a9fa4fa2
6 changed files with 48 additions and 20 deletions

View File

@ -26,9 +26,13 @@ struct libdax_msgs *libdax_messenger= NULL;
int burn_running = 0;
/* ts A60813 : Linux: wether to use O_EXCL and/or O_NONBLOCK in libburn/sg.c */
/* ts A60813 : Linux: wether to use O_EXCL on open() of device files */
int burn_sg_open_o_excl = 1;
/* ts A70403 : Linux: wether to use fcntl(,F_SETLK,)
after open() of device files */
int burn_sg_fcntl_f_setlk = 1;
/* ts A70314 : Linux: what device family to use :
0= default family
1= sr
@ -128,11 +132,11 @@ void burn_preset_device_open(int exclusive, int blocking, int abort_on_busy)
/* a ssert(burn_running); */
if (!burn_running)
return;
burn_sg_open_o_excl= exclusive & 3;
burn_sg_use_family= (exclusive >> 2) & 15;
burn_sg_open_o_nonblock= !blocking;
burn_sg_open_abort_busy= !!abort_on_busy;
burn_sg_open_o_excl = exclusive & 3;
burn_sg_fcntl_f_setlk = !!(exclusive & 32);
burn_sg_use_family = (exclusive >> 2) & 15;
burn_sg_open_o_nonblock = !blocking;
burn_sg_open_abort_busy = !!abort_on_busy;
}

View File

@ -586,6 +586,8 @@ void burn_set_verbosity(int level);
8 = /dev/scd%d
16 = /dev/sg%d
Do not use other values !
Add 32 to demand an exclusive lock by fcntl(,F_SETLK,)
after open() has succeeded.
@param blocking Try to wait for drives which do not open immediately but
also do not return an error as well. (O_NONBLOCK)
This might stall indefinitely with /dev/hdX hard disks.
@ -772,8 +774,8 @@ int burn_drive_grab(struct burn_drive *drive, int load);
/** Release a drive. This should not be done until the drive is no longer
busy (see burn_drive_get_status). The drive is (O_EXCL) unlocked
afterwards.
busy (see burn_drive_get_status).
Linux: The drive is unlocked afterwards. (O_EXCL , F_SETLK).
@param drive The drive to release.
@param eject Nonzero to make the drive eject the disc in it.
*/

View File

@ -171,11 +171,13 @@ static void enumerate_common(char *fname, int bus_no, int host_no,
/* >>> ts A61115 : this needs mending. A Linux aspect shows up in cdrskin. */
/* ts A60813 : storage objects are in libburn/init.c
wether to use O_EXCL
wether to use O_EXCL with open(2) of devices
wether to use fcntl(,F_SETLK,) after open(2) of devices
what device family to use : 0=default, 1=sr, 2=scd, (3=st), 4=sg
wether to use O_NOBLOCK with open(2) on devices
wether to take O_EXCL rejection as fatal error */
extern int burn_sg_open_o_excl;
extern int burn_sg_fcntl_f_setlk;
extern int burn_sg_use_family;
extern int burn_sg_open_o_nonblock;
extern int burn_sg_open_abort_busy;
@ -304,14 +306,13 @@ static int sg_close_drive_fd(char *fname, int driveno, int *fd, int sorry)
*/
int sg_fcntl_lock(int *fd, char *fd_name)
{
#define Libburn_sg_with_fcntl_locK 1
#ifdef Libburn_sg_with_fcntl_locK
struct flock lockthing;
char msg[81];
int ret;
if (!burn_sg_fcntl_f_setlk)
return 1;
memset(&lockthing, 0, sizeof(lockthing));
lockthing.l_type = F_WRLCK;
lockthing.l_whence = SEEK_SET;
@ -330,9 +331,7 @@ int sg_fcntl_lock(int *fd, char *fd_name)
*fd = -1;
return(0);
}
#endif /* Libburn_sg_with_fcntl_locK */
return(1);
return 1;
}