Reacted on changed media profile of stdio-drives
This commit is contained in:
parent
e72b2fd732
commit
0b13c31b07
@ -1 +1 @@
|
||||
#define Cdrskin_timestamP "2007.09.07.102728"
|
||||
#define Cdrskin_timestamP "2007.09.07.123748"
|
||||
|
@ -130,8 +130,13 @@ static void remove_worker(pthread_t th)
|
||||
|
||||
static void *scan_worker_func(struct w_list *w)
|
||||
{
|
||||
burn_drive_scan_sync(w->u.scan.drives, w->u.scan.n_drives);
|
||||
w->u.scan.done = 1;
|
||||
int ret;
|
||||
|
||||
ret = burn_drive_scan_sync(w->u.scan.drives, w->u.scan.n_drives);
|
||||
if (ret <= 0)
|
||||
w->u.scan.done = -1;
|
||||
else
|
||||
w->u.scan.done = 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -165,7 +170,7 @@ drive_is_active:;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!workers) {
|
||||
if (workers == NULL) {
|
||||
/* start it */
|
||||
|
||||
/* ts A61007 : test moved up from burn_drive_scan_sync()
|
||||
|
@ -803,13 +803,24 @@ int burn_drive_scan_sync(struct burn_drive_info *drives[],
|
||||
/* ts A61115 : formerly sg_enumerate(); ata_enumerate(); */
|
||||
scsi_enumerate_drives();
|
||||
|
||||
count = burn_drive_count();
|
||||
if (count)
|
||||
*drives =
|
||||
malloc(sizeof(struct burn_drive_info) * count);
|
||||
else
|
||||
*drives = NULL;
|
||||
*n_drives = scanned = found = num_scanned = 0;
|
||||
count = burn_drive_count();
|
||||
if (count) {
|
||||
/* ts A70907 :
|
||||
Extra array element marks end of array. */
|
||||
*drives = calloc(count + 1,
|
||||
sizeof(struct burn_drive_info));
|
||||
if (*drives == NULL) {
|
||||
libdax_msgs_submit(libdax_messenger, -1,
|
||||
0x00000003,
|
||||
LIBDAX_MSGS_SEV_FATAL,
|
||||
LIBDAX_MSGS_PRIO_HIGH,
|
||||
"Out of virtual memory", 0, 0);
|
||||
return -1;
|
||||
} else
|
||||
(*drives)[count].drive = NULL; /* end mark */
|
||||
} else
|
||||
*drives = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
@ -864,32 +875,44 @@ int burn_drive_forget(struct burn_drive *d, int force)
|
||||
/* API call */
|
||||
int burn_drive_info_forget(struct burn_drive_info *info, int force)
|
||||
{
|
||||
return burn_drive_forget(info->drive, force);
|
||||
return burn_drive_forget(info->drive, force);
|
||||
}
|
||||
|
||||
|
||||
void burn_drive_info_free(struct burn_drive_info drive_infos[])
|
||||
{
|
||||
int i;
|
||||
|
||||
/* ts A60904 : ticket 62, contribution by elmom */
|
||||
/* clarifying the meaning and the identity of the victim */
|
||||
|
||||
/* ts A60904 : This looks a bit weird.
|
||||
if(drive_infos == NULL)
|
||||
return;
|
||||
|
||||
#ifndef Libburn_free_all_drives_on_infO
|
||||
/* ts A70907 : Solution for wrong behavior below */
|
||||
for (i = 0; drive_infos[i].drive != NULL; i++)
|
||||
return burn_drive_free(drive_infos[i].drive);
|
||||
#endif
|
||||
|
||||
/* ts A60904 : This looks a bit weird. [ts A70907 : not any more]
|
||||
burn_drive_info is not the manager of burn_drive but only its
|
||||
spokesperson. To my knowlege drive_infos from burn_drive_scan()
|
||||
are not memorized globally. */
|
||||
if(drive_infos != NULL)
|
||||
free((void *) drive_infos);
|
||||
free((void *) drive_infos);
|
||||
|
||||
/* >>> ts A70903 : THIS IS WRONG !
|
||||
It contradicts the API and endangers multi drive usage.
|
||||
#ifdef Libburn_free_all_drives_on_infO
|
||||
/* ts A70903 : THIS IS WRONG ! (disabled now)
|
||||
It endangers multi drive usage.
|
||||
This call is not entitled to delete all drives, only the
|
||||
ones of the array.
|
||||
ones of the array which it recieves a parmeter.
|
||||
|
||||
Problem: it is unclear how many items are listed in drive_infos
|
||||
Solution: add a dummy element to any burn_drive_info array with
|
||||
drive == NULL
|
||||
Problem: It was unclear how many items are listed in drive_infos
|
||||
Solution: Added a end marker element to any burn_drive_info array
|
||||
The mark can be recognized by having drive == NULL
|
||||
*/
|
||||
burn_drive_free_all();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1060,13 +1083,14 @@ int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname)
|
||||
}
|
||||
if (d->drive_role == 2) {
|
||||
d->status = BURN_DISC_BLANK;
|
||||
d->current_profile = 0; /* MMC reserved */
|
||||
d->current_profile = 0xffff; /* MMC for non-compliant drive */
|
||||
strcpy(d->current_profile_text,"stdio file");
|
||||
d->current_is_cd_profile = 0;
|
||||
d->current_is_supported_profile = 1;
|
||||
d->block_types[BURN_WRITE_TAO] = BURN_BLOCK_MODE1;
|
||||
d->block_types[BURN_WRITE_SAO] = BURN_BLOCK_MODE1;
|
||||
}
|
||||
} else
|
||||
d->current_profile = 0; /* Drives return this if empty */
|
||||
|
||||
*drive_infos = calloc(2, sizeof(struct burn_drive_info));
|
||||
if (*drive_infos == NULL)
|
||||
@ -1165,7 +1189,7 @@ int burn_drive_d_get_adr(struct burn_drive *d, char adr[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ts A60823 - A60923 */
|
||||
/* ts A60823 - A60923 */ /* A70906 : Now legacy API call */
|
||||
/** Inquire the persistent address of the given drive. */
|
||||
int burn_drive_get_adr(struct burn_drive_info *drive_info, char adr[])
|
||||
{
|
||||
|
@ -626,6 +626,12 @@ void burn_allow_untested_profiles(int yes);
|
||||
way to open one drive and to leave all others untouched. It bundles
|
||||
the following API calls to form a non-obtrusive way to use libburn:
|
||||
burn_drive_add_whitelist() , burn_drive_scan() , burn_drive_grab()
|
||||
|
||||
<<< Restriction in progress of being removed:
|
||||
To avoid memory leaks or dangling pointers one MUST shutdown all
|
||||
burn_drive_info arrays by burn_drive_info_free() before calling
|
||||
burn_drive_scan() a second time.
|
||||
|
||||
You are *strongly urged* to use this call whenever you know the drive
|
||||
address in advance.
|
||||
If not, then you have to use directly above calls. In that case, you are
|
||||
@ -670,8 +676,12 @@ void burn_drive_clear_whitelist(void);
|
||||
|
||||
/** Scan for drives. This function MUST be called until it returns nonzero.
|
||||
No drives may be in use when this is called.
|
||||
All drive pointers are invalidated by using this function. Do NOT store
|
||||
drive pointers across calls to this function or death AND pain will ensue.
|
||||
All pointers to struct burn_drive and all struct burn_drive_info arrays
|
||||
are invalidated by using this function. Do NOT store drive pointers across
|
||||
calls to this function !
|
||||
To avoid memory leaks or dangling pointers one MUST shutdown all
|
||||
burn_drive_info arrays by burn_drive_info_free() before calling
|
||||
bunr_drive_scan() a second time.
|
||||
After this call all drives depicted by the returned array are subject
|
||||
to eventual (O_EXCL) locking. See burn_preset_device_open(). This state
|
||||
ends either with burn_drive_info_forget() or with burn_drive_release().
|
||||
|
@ -284,6 +284,7 @@ Range "libdax_msgs" : 0x00000000 to 0x0000ffff
|
||||
0x00000000 (ALL,ZERO) = Initial setting in new libdax_msgs_item
|
||||
0x00000001 (DEBUG,ZERO) = Test error message
|
||||
0x00000002 (DEBUG,ZERO) = Debugging message
|
||||
0x00000003 (FATAL,HIGH) = Out of virtual memory
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user