"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libburn/drive.c" between
xorriso-1.5.2.tar.gz and xorriso-1.5.4.tar.gz

About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.

drive.c  (xorriso-1.5.2):drive.c  (xorriso-1.5.4)
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2017 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2020 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdlib.h> #include <stdlib.h>
skipping to change at line 186 skipping to change at line 186
/* ts A60906 */ /* ts A60906 */
int burn_drive_is_released(struct burn_drive *d) int burn_drive_is_released(struct burn_drive *d)
{ {
return !!d->released; return !!d->released;
} }
/* ts A60906 */ /* ts A60906 */
/** Inquires drive status in respect to degree of app usage. /** Inquires drive status in respect to degree of app usage.
@param return -2 = drive is forgotten @param return -2 = drive is forgotten
-1 = drive is closed (i.e. released explicitely) -1 = drive is closed (i.e. released explicitly)
0 = drive is open, not grabbed (after scan, before 1st grab) 0 = drive is open, not grabbed (after scan, before 1st grab)
1 = drive is grabbed but BURN_DRIVE_IDLE 1 = drive is grabbed but BURN_DRIVE_IDLE
2 = drive is grabbed, synchronous read/write interrupted 2 = drive is grabbed, synchronous read/write interrupted
10 = drive is grabbing (BURN_DRIVE_GRABBING) 10 = drive is grabbing (BURN_DRIVE_GRABBING)
100 = drive is busy in cancelable state 100 = drive is busy in cancelable state
1000 = drive is in non-cancelable state 1000 = drive is in non-cancelable state
Expect a monotonous sequence of usage severity to emerge in future. Expect a monotonous sequence of usage severity to emerge in future.
*/ */
int burn_drive_is_occupied(struct burn_drive *d) int burn_drive_is_occupied(struct burn_drive *d)
{ {
skipping to change at line 279 skipping to change at line 279
/* ts A61125 : media status aspects of burn_drive_grab() */ /* ts A61125 : media status aspects of burn_drive_grab() */
int burn_drive_inquire_media(struct burn_drive *d) int burn_drive_inquire_media(struct burn_drive *d)
{ {
/* ts A61225 : after loading the tray, mode page 2Ah can change */ /* ts A61225 : after loading the tray, mode page 2Ah can change */
d->getcaps(d); d->getcaps(d);
/* ts A61020 : d->status was set to BURN_DISC_BLANK as pure guess */ /* ts A61020 : d->status was set to BURN_DISC_BLANK as pure guess */
/* ts A71128 : run read_disc_info() for any recognizeable profile */ /* ts A71128 : run read_disc_info() for any recognizable profile */
if (d->current_profile > 0 || d->current_is_guessed_profile || if (d->current_profile > 0 || d->current_is_guessed_profile ||
(d->mdata->p2a_valid > 0 && (d->mdata->p2a_valid > 0 &&
(d->mdata->cdr_write || d->mdata->cdrw_write || (d->mdata->cdr_write || d->mdata->cdrw_write ||
d->mdata->dvdr_write || d->mdata->dvdram_write)) ) { d->mdata->dvdr_write || d->mdata->dvdram_write)) ) {
d->read_disc_info(d); d->read_disc_info(d);
} else { } else {
if (d->current_profile == -1 || d->current_is_cd_profile) if (d->current_profile == -1 || d->current_is_cd_profile)
d->read_toc(d); d->read_toc(d);
/* ts A70314 , B10712 */ /* ts A70314 , B10712 */
skipping to change at line 544 skipping to change at line 544
d->block_types[3] = 0; d->block_types[3] = 0;
d->toc_temp = 0; d->toc_temp = 0;
d->nwa = 0; d->nwa = 0;
d->alba = 0; d->alba = 0;
d->rlba = 0; d->rlba = 0;
d->cancel = 0; d->cancel = 0;
d->busy = BURN_DRIVE_IDLE; d->busy = BURN_DRIVE_IDLE;
d->thread_pid = 0; d->thread_pid = 0;
d->thread_pid_valid = 0; d->thread_pid_valid = 0;
memset(&(d->thread_tid), 0, sizeof(d->thread_tid)); memset(&(d->thread_tid), 0, sizeof(d->thread_tid));
d->medium_state_changed = 0;
d->set_streaming_exact_bit = 0;
d->set_streaming_err = 0;
d->toc_entries = 0; d->toc_entries = 0;
d->toc_entry = NULL; d->toc_entry = NULL;
d->disc = NULL; d->disc = NULL;
d->erasable = 0; d->erasable = 0;
d->write_opts = NULL; d->write_opts = NULL;
#ifdef Libburn_ticket_62_re_register_is_possiblE #ifdef Libburn_ticket_62_re_register_is_possiblE
/* ts A60904 : ticket 62, contribution by elmom */ /* ts A60904 : ticket 62, contribution by elmom */
/* Not yet accepted because no use case seen yet */ /* Not yet accepted because no use case seen yet */
/* ts A71015 : xorriso dialog imposes a use case now */ /* ts A71015 : xorriso dialog imposes a use case now */
skipping to change at line 860 skipping to change at line 863
d->progress.sessions = 1; d->progress.sessions = 1;
d->progress.track = 0; d->progress.track = 0;
d->progress.tracks = 1; d->progress.tracks = 1;
d->progress.index = 0; d->progress.index = 0;
d->progress.indices = 1; d->progress.indices = 1;
d->progress.start_sector = 0; d->progress.start_sector = 0;
d->progress.sectors = 0x10000; d->progress.sectors = 0x10000;
d->progress.sector = 0; d->progress.sector = 0;
#endif /* Libburn_reset_progress_asynC */ #endif /* Libburn_reset_progress_asynC */
d->medium_state_changed = 1;
d->erase(d, fast); d->erase(d, fast);
d->busy = BURN_DRIVE_ERASING; d->busy = BURN_DRIVE_ERASING;
#ifdef Libburn_old_progress_looP #ifdef Libburn_old_progress_looP
/* read the initial 0 stage */ /* read the initial 0 stage */
while (!d->test_unit_ready(d) && d->get_erase_progress(d) == 0) while (!d->test_unit_ready(d) && d->get_erase_progress(d) == 0)
sleep(1); sleep(1);
while ((d->progress.sector = d->get_erase_progress(d)) > 0 || while ((d->progress.sector = d->get_erase_progress(d)) > 0 ||
!d->test_unit_ready(d)) !d->test_unit_ready(d))
skipping to change at line 949 skipping to change at line 953
d->progress.index = 0; d->progress.index = 0;
d->progress.indices = 1; d->progress.indices = 1;
d->progress.start_sector = 0; d->progress.start_sector = 0;
d->progress.sectors = 0x10000; d->progress.sectors = 0x10000;
d->progress.sector = 0; d->progress.sector = 0;
#endif /* Libburn_reset_progress_asynC */ #endif /* Libburn_reset_progress_asynC */
stages = 1 + ((flag & 1) && size > 1024 * 1024); stages = 1 + ((flag & 1) && size > 1024 * 1024);
d->cancel = 0; d->cancel = 0;
d->busy = BURN_DRIVE_FORMATTING; d->busy = BURN_DRIVE_FORMATTING;
d->medium_state_changed = 1;
ret = d->format_unit(d, size, flag & 0xfff6); /* forward bits */ ret = d->format_unit(d, size, flag & 0xfff6); /* forward bits */
if (ret <= 0) if (ret <= 0)
d->cancel = 1; d->cancel = 1;
#ifdef Libburn_old_progress_looP #ifdef Libburn_old_progress_looP
while (!d->test_unit_ready(d) && d->get_erase_progress(d) == 0) while (!d->test_unit_ready(d) && d->get_erase_progress(d) == 0)
sleep(1); sleep(1);
while ((pseudo_sector = d->get_erase_progress(d)) > 0 || while ((pseudo_sector = d->get_erase_progress(d)) > 0 ||
skipping to change at line 1298 skipping to change at line 1303
out->write_simulate |= out->write_simulate |=
!!(feat->data[0] & 4); !!(feat->data[0] & 4);
} }
out->drive = d; out->drive = d;
#ifdef Libburn_dummy_probe_write_modeS #ifdef Libburn_dummy_probe_write_modeS
/* ts A91112 */ /* ts A91112 */
/* Set default block types. The call d->probe_write_modes() is quite /* Set default block types. The call d->probe_write_modes() is quite
obtrusive. It may be performed explicitely by new API call obtrusive. It may be performed explicitly by new API call
burn_drive_probe_cd_write_modes(). burn_drive_probe_cd_write_modes().
*/ */
if (out->write_dvdram || out->write_dvdr || if (out->write_dvdram || out->write_dvdr ||
out->write_cdrw || out->write_cdr) { out->write_cdrw || out->write_cdr) {
out->tao_block_types = d->block_types[BURN_WRITE_TAO] = out->tao_block_types = d->block_types[BURN_WRITE_TAO] =
BURN_BLOCK_MODE1 | BURN_BLOCK_RAW0; BURN_BLOCK_MODE1 | BURN_BLOCK_RAW0;
out->sao_block_types = d->block_types[BURN_WRITE_SAO] = out->sao_block_types = d->block_types[BURN_WRITE_SAO] =
BURN_BLOCK_SAO; BURN_BLOCK_SAO;
} else { } else {
out->tao_block_types = d->block_types[BURN_WRITE_TAO] = 0; out->tao_block_types = d->block_types[BURN_WRITE_TAO] = 0;
skipping to change at line 1393 skipping to change at line 1398
burn_wait_all() is obsoleted */ burn_wait_all() is obsoleted */
#if 0 #if 0
/* make sure the drives aren't in use */ /* make sure the drives aren't in use */
burn_wait_all(); /* make sure the queue cleans up burn_wait_all(); /* make sure the queue cleans up
before checking for the released before checking for the released
state */ state */
#endif /* 0 */ #endif /* 0 */
*n_drives = 0; *n_drives = 0;
/* ts A70907 : wether to scan from scratch or to extend */ /* ts A70907 : whether to scan from scratch or to extend */
for (i = 0; i < (int) sizeof(scanned); i++) for (i = 0; i < (int) sizeof(scanned); i++)
scanned[i] = 0; scanned[i] = 0;
if (flag & 1) { if (flag & 1) {
burn_drive_free_all(); burn_drive_free_all();
} else { } else {
for (i = 0; i <= drivetop; i++) for (i = 0; i <= drivetop; i++)
if (drive_array[i].global_index >= 0) if (drive_array[i].global_index >= 0)
scanned[i / 8] |= (1 << (i % 8)); scanned[i / 8] |= (1 << (i % 8));
} }
skipping to change at line 1532 skipping to change at line 1537
/* ts A60904 : This looks a bit weird. [ts A70907 : not any more] /* 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 burn_drive_info is not the manager of burn_drive but only its
spokesperson. To my knowledge drive_infos from burn_drive_scan() spokesperson. To my knowledge drive_infos from burn_drive_scan()
are not memorized globally. */ are not memorized globally. */
free((void *) drive_infos); free((void *) drive_infos);
#ifdef Libburn_free_all_drives_on_infO #ifdef Libburn_free_all_drives_on_infO
/* ts A70903 : THIS IS WRONG ! (disabled now) /* ts A70903 : THIS IS WRONG ! (disabled now)
It endangers multi drive usage. It endangers multi drive usage.
This call is not entitled to delete all drives, only the This call is not entitled to delete all drives, only the
ones of the array which it receives a parmeter. ones of the array which it receives a parameter.
Problem: It was unclear how many items are listed in drive_infos Problem: It was unclear how many items are listed in drive_infos
Solution: Added a end marker element to any burn_drive_info array Solution: Added a end marker element to any burn_drive_info array
The mark can be recognized by having drive == NULL The mark can be recognized by having drive == NULL
*/ */
burn_drive_free_all(); burn_drive_free_all();
#endif #endif
} }
struct burn_disc *burn_drive_get_disc(struct burn_drive *d) struct burn_disc *burn_drive_get_disc(struct burn_drive *d)
skipping to change at line 1560 skipping to change at line 1565
} }
void burn_drive_set_speed(struct burn_drive *d, int r, int w) void burn_drive_set_speed(struct burn_drive *d, int r, int w)
{ {
d->nominal_write_speed = w; d->nominal_write_speed = w;
if(d->drive_role != 1) if(d->drive_role != 1)
return; return;
d->set_speed(d, r, w); d->set_speed(d, r, w);
} }
int burn_drive_set_speed_exact(struct burn_drive *d, int r, int w)
{
int sose;
d->nominal_write_speed = w;
if(d->drive_role != 1)
return 0;
sose = d->silent_on_scsi_error;
d->silent_on_scsi_error = 3;
d->set_streaming_err = 0;
d->set_streaming_exact_bit = 1;
d->set_speed(d, r, w);
d->silent_on_scsi_error = sose;
d->set_streaming_exact_bit = 0;
return !d->set_streaming_err;
}
/* ts A70711 API function */ /* ts A70711 API function */
int burn_drive_set_buffer_waiting(struct burn_drive *d, int enable, int burn_drive_set_buffer_waiting(struct burn_drive *d, int enable,
int min_usec, int max_usec, int timeout_sec, int min_usec, int max_usec, int timeout_sec,
int min_percent, int max_percent) int min_percent, int max_percent)
{ {
if (enable >= 0) if (enable >= 0)
d->wait_for_buffer_free = !!enable; d->wait_for_buffer_free = !!enable;
if (min_usec >= 0) if (min_usec >= 0)
d->wfb_min_usec = min_usec; d->wfb_min_usec = min_usec;
skipping to change at line 1871 skipping to change at line 1893
/* ts A60823 */ /* ts A60823 */
/** Acquire a drive with known persistent address. /** Acquire a drive with known persistent address.
*/ */
int burn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], char* adr, int burn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], char* adr,
int load) int load)
{ {
unsigned int n_drives; unsigned int n_drives;
int ret, i; int ret, i;
/* check wether drive address is already registered */ /* check whether drive address is already registered */
for (i = 0; i <= drivetop; i++) for (i = 0; i <= drivetop; i++)
if (drive_array[i].global_index >= 0) if (drive_array[i].global_index >= 0)
if (strcmp(drive_array[i].devname, adr) == 0) if (strcmp(drive_array[i].devname, adr) == 0)
break; break;
if (i <= drivetop) { if (i <= drivetop) {
libdax_msgs_submit(libdax_messenger, i, libdax_msgs_submit(libdax_messenger, i,
0x0002014b, 0x0002014b,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Drive is already registered resp. scanned", "Drive is already registered resp. scanned",
0, 0); 0, 0);
skipping to change at line 1973 skipping to change at line 1995
/** Inquire the persistent address of the given drive. */ /** Inquire the persistent address of the given drive. */
int burn_drive_get_adr(struct burn_drive_info *drive_info, char adr[]) int burn_drive_get_adr(struct burn_drive_info *drive_info, char adr[])
{ {
int ret; int ret;
ret = burn_drive_d_get_adr(drive_info->drive, adr); ret = burn_drive_d_get_adr(drive_info->drive, adr);
return ret; return ret;
} }
/* ts A60922 ticket 33 */ /* ts A60922 ticket 33 */
/** Evaluate wether the given address would be enumerated by libburn */ /** Evaluate whether the given address would be enumerated by libburn */
int burn_drive_is_enumerable_adr(char *adr) int burn_drive_is_enumerable_adr(char *adr)
{ {
return sg_is_enumerable_adr(adr); return sg_is_enumerable_adr(adr);
} }
#define BURN_DRIVE_MAX_LINK_DEPTH 20 #define BURN_DRIVE_MAX_LINK_DEPTH 20
/* ts A60922 ticket 33 */ /* ts A60922 ticket 33 */
/* @param flag bit0= no debug messages /* @param flag bit0= no debug messages
bit1= resolve only links, bit1= resolve only links,
skipping to change at line 2980 skipping to change at line 3002
if (wt == BURN_WRITE_SAO) if (wt == BURN_WRITE_SAO)
o->multi_session = o->multi_track = 0; o->multi_session = o->multi_track = 0;
if (wt == BURN_WRITE_NONE || wt == BURN_WRITE_SAO || if (wt == BURN_WRITE_NONE || wt == BURN_WRITE_SAO ||
wt == BURN_WRITE_TAO) wt == BURN_WRITE_TAO)
o->might_simulate = 1; o->might_simulate = 1;
} else if (d->current_profile == 0x12 || } else if (d->current_profile == 0x12 ||
d->current_profile == 0x13 || d->current_profile == 0x13 ||
d->current_profile == 0x1a || d->current_profile == 0x1a ||
d->current_profile == 0x43 d->current_profile == 0x43
) { ) {
/* DVD-RAM, overwriteable DVD-RW, DVD+RW, BD-RE */ /* DVD-RAM, overwritable DVD-RW, DVD+RW, BD-RE */
o->start_adr = 1; o->start_adr = 1;
ret = burn_disc_get_formats(d, &status, &size, &dummy, ret = burn_disc_get_formats(d, &status, &size, &dummy,
&num_formats); &num_formats);
if (ret == 1) { if (ret == 1) {
if (status == BURN_FORMAT_IS_FORMATTED) if (status == BURN_FORMAT_IS_FORMATTED)
o->start_range_high = size - 2048; o->start_range_high = size - 2048;
if (d->current_profile == 0x13) { if (d->current_profile == 0x13) {
o->start_alignment = 32 * 1024; o->start_alignment = 32 * 1024;
for (i = 0; i < num_formats; i++) { for (i = 0; i < num_formats; i++) {
ret = burn_disc_get_format_descr(d, i, ret = burn_disc_get_format_descr(d, i,
skipping to change at line 3233 skipping to change at line 3255
burn__split_path(conv_adr2, &dpt2, &npt2); burn__split_path(conv_adr2, &dpt2, &npt2);
if (strcmp(npt1, npt2)) if (strcmp(npt1, npt2))
{ret = 0; goto ex;} /* basenames differ */ {ret = 0; goto ex;} /* basenames differ */
stat_ret1= stat(adr1, &stbuf1); stat_ret1= stat(adr1, &stbuf1);
stat_ret2= stat(adr2, &stbuf2); stat_ret2= stat(adr2, &stbuf2);
if (stat_ret1 != stat_ret2) if (stat_ret1 != stat_ret2)
{ret = 0; goto ex;} {ret = 0; goto ex;}
/* one dir existing, one not */ /* one dir existing, one not */
/* Both directories exist. The basenames are equal. /* Both directories exist. The basenames are equal.
So the adresses are equal if the directories are So the addresses are equal if the directories are
equal.*/ equal.*/
} }
if (stbuf1.st_ino == stbuf2.st_ino && if (stbuf1.st_ino == stbuf2.st_ino &&
stbuf1.st_dev == stbuf2.st_dev) stbuf1.st_dev == stbuf2.st_dev)
{ret = 1; goto ex;} /* same filesystem object */ {ret = 1; goto ex;} /* same filesystem object */
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)
{ret = 1; goto ex;}/* same major,minor device number */ {ret = 1; goto ex;}/* same major,minor device number */
if (S_ISCHR(stbuf1.st_mode) && S_ISCHR(stbuf2.st_mode) && if (S_ISCHR(stbuf1.st_mode) && S_ISCHR(stbuf2.st_mode) &&
skipping to change at line 3352 skipping to change at line 3374
/* ts A90909 : API */ /* ts A90909 : API */
/** /**
@param valid Replies bits which indicate the validity of other reply @param valid Replies bits which indicate the validity of other reply
parameters or the state of certain CD info bits: parameters or the state of certain CD info bits:
bit0= disc_type valid bit0= disc_type valid
bit1= disc_id valid bit1= disc_id valid
bit2= bar_code valid bit2= bar_code valid
bit3= disc_app_code valid bit3= disc_app_code valid
bit4= Disc is unrestricted (URU bit) bit4= Disc is unrestricted (URU bit)
bit5= Disc is nominally erasable (Erasable bit) bit5= Disc is nominally erasable (Erasable bit)
This will be set with overwriteable media which This will be set with overwritable media which
libburn normally considers to be unerasable blank. libburn normally considers to be unerasable blank.
*/ */
int burn_disc_get_cd_info(struct burn_drive *d, char disc_type[80], int burn_disc_get_cd_info(struct burn_drive *d, char disc_type[80],
unsigned int *disc_id, char bar_code[9], int *app_code, unsigned int *disc_id, char bar_code[9], int *app_code,
int *valid) int *valid)
{ {
if (d->disc_type == 0x00) { if (d->disc_type == 0x00) {
strcpy(disc_type, "CD-DA or CD-ROM"); strcpy(disc_type, "CD-DA or CD-ROM");
} else if (d->disc_type == 0x10) { } else if (d->disc_type == 0x10) {
strcpy(disc_type, "CD-I"); strcpy(disc_type, "CD-I");
 End of changes. 15 change blocks. 
11 lines changed or deleted 33 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)