New API function burn_drive_leave_locked()

This commit is contained in:
Thomas Schmitt 2007-09-18 09:05:05 +00:00
parent f17d3c9c18
commit 61b112f45a
3 changed files with 40 additions and 7 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.09.18.072234"
#define Cdrskin_timestamP "2007.09.18.090713"

View File

@ -114,6 +114,8 @@ void burn_drive_free_all(void)
/* ts A60822 */
int burn_drive_is_open(struct burn_drive *d)
{
if (d->drive_role != 1)
return (d->stdio_fd >= 0);
/* ts A61021 : moved decision to sg.c */
return d->drive_is_open(d);
}
@ -421,7 +423,10 @@ int burn_drive_mark_unready(struct burn_drive *d)
}
void burn_drive_release(struct burn_drive *d, int le)
/* ts A70918 : outsourced from burn_drive_release() and enhanced */
/** @param flag bit0-2 = mode : 0=unlock , 1=unlock+eject , 2=leave locked
*/
int burn_drive_release_fl(struct burn_drive *d, int flag)
{
if (d->released) {
/* ts A61007 */
@ -430,7 +435,7 @@ void burn_drive_release(struct burn_drive *d, int le)
d->global_index, 0x00020105,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Drive is already released", 0, 0);
return;
return 0;
}
/* ts A61007 */
@ -441,12 +446,13 @@ void burn_drive_release(struct burn_drive *d, int le)
d->global_index, 0x00020106,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Drive is busy on attempt to close", 0, 0);
return;
return 0;
}
if (d->drive_role == 1) {
d->unlock(d);
if (le)
if ((flag & 7) != 2)
d->unlock(d);
if ((flag & 7) == 1)
d->eject(d);
d->release(d);
}
@ -455,9 +461,24 @@ void burn_drive_release(struct burn_drive *d, int le)
/* ts A61125 : outsourced model aspects */
burn_drive_mark_unready(d);
return 1;
}
/* API */
void burn_drive_release(struct burn_drive *d, int le)
{
burn_drive_release_fl(d, !!le);
}
/* ts A70918 */
/* API */
int burn_drive_leave_locked(struct burn_drive *d, int flag)
{
return burn_drive_release_fl(d, 2);
}
/* ts A61007 : former void burn_wait_all() */
/* @param flag bit0= demand freed drives (else released drives) */

View File

@ -829,13 +829,25 @@ 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).
Linux: The drive is unlocked afterwards. (O_EXCL , F_SETLK).
Linux: The drive device file is not reserved afterwards. (O_EXCL, F_SETLK).
@param drive The drive to release.
@param eject Nonzero to make the drive eject the disc in it.
*/
void burn_drive_release(struct burn_drive *drive, int eject);
/* ts A70918 */
/** Like burn_drive_release() but keeping the drive tray closed and its
eject button disabled. This physically locked drive state will last until
the drive is grabbed again and released via burn_drive_release().
Programs like eject, cdrecord, growisofs will break that ban too.
@param drive The drive to release and leave locked.
@param flag Bitfield for control purposes (unused yet, submit 0)
@return 1 means success, <=0 means failure
*/
int burn_drive_leave_locked(struct burn_drive *d, int flag);
/** Returns what kind of disc a drive is holding. This function may need to be
called more than once to get a proper status from it. See burn_disc_status
for details.