Browse Source

Gave up use of burn_print() in libburn

1.1.8
Thomas Schmitt 10 years ago
parent
commit
ac4bfb128c
15 changed files with 47 additions and 154 deletions
  1. +1
    -1
      cdrskin/cdrskin_timestamp.h
  2. +0
    -16
      libburn/debug.c
  3. +5
    -20
      libburn/drive.c
  4. +5
    -1
      libburn/libburn.h
  5. +1
    -0
      libburn/libdax_msgs.h
  6. +2
    -37
      libburn/mmc.c
  7. +9
    -16
      libburn/read.c
  8. +1
    -3
      libburn/sg-freebsd-port.c
  9. +1
    -6
      libburn/sg-freebsd.c
  10. +1
    -3
      libburn/sg-libcdio.c
  11. +1
    -3
      libburn/sg-linux.c
  12. +1
    -3
      libburn/sg-solaris.c
  13. +2
    -18
      libburn/spc.c
  14. +17
    -5
      libburn/structure.c
  15. +0
    -22
      libburn/write.c

+ 1
- 1
cdrskin/cdrskin_timestamp.h View File

@ -1 +1 @@
#define Cdrskin_timestamP "2011.10.11.163842"
#define Cdrskin_timestamP "2011.10.12.100050"

+ 0
- 16
libburn/debug.c View File

@ -25,20 +25,4 @@ void burn_set_verbosity(int v)
burn_verbosity = v;
}
void burn_print(int level, const char *a, ...)
{
#ifdef WIN32
char debug_string_data[256];
#endif
va_list vl;
if (level <= burn_verbosity) {
va_start(vl, a);
#ifdef WIN32
vsprintf(debug_string_data, a, vl);
OutputDebugString(debug_string_data);
#else
vfprintf(stderr, a, vl);
#endif
}
}

+ 5
- 20
libburn/drive.c View File

@ -487,7 +487,10 @@ int burn_drive_grab(struct burn_drive *d, int le)
int ret, sose;
if (!d->released) {
burn_print(1, "can't grab - already grabbed\n");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020189, LIBDAX_MSGS_SEV_FATAL,
LIBDAX_MSGS_PRIO_LOW,
"Drive is already grabbed by libburn", 0, 0);
return 0;
}
if(d->drive_role != 1) {
@ -497,10 +500,8 @@ int burn_drive_grab(struct burn_drive *d, int le)
d->status = BURN_DISC_UNREADY;
errcode = d->grab(d);
if (errcode == 0) {
burn_print(1, "low level drive grab failed\n");
if (errcode == 0)
return 0;
}
d->busy = BURN_DRIVE_GRABBING;
if (le)
@ -614,7 +615,6 @@ struct burn_drive *burn_drive_finish_enum(struct burn_drive *d)
/* try to get the drive info */
ret = t->grab(t);
if (ret) {
burn_print(2, "getting drive info\n");
t->getcaps(t);
t->unlock(t);
t->released = 1;
@ -678,7 +678,6 @@ int burn_drive_release_fl(struct burn_drive *d, int flag)
{
if (d->released) {
/* ts A61007 */
/* burn_print(1, "second release on drive!\n"); */
libdax_msgs_submit(libdax_messenger,
d->global_index, 0x00020105,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
@ -827,9 +826,6 @@ void burn_disc_erase_sync(struct burn_drive *d, int fast)
{
int ret;
burn_print(1, "erasing drive %s %s\n", d->idata->vendor,
d->idata->product);
if (d->drive_role == 5) { /* Random access write-only drive */
ret = truncate(d->devname, (off_t) 0);
if (ret == -1) {
@ -1109,17 +1105,6 @@ void burn_drive_cancel(struct burn_drive *d)
*/
}
/* ts A61007 : defunct because unused */
#if 0
int burn_drive_get_block_types(struct burn_drive *d,
enum burn_write_types write_type)
{
burn_print(12, "write type: %d\n", write_type);
a ssert( /* (write_type >= BURN_WRITE_PACKET) && */
(write_type <= BURN_WRITE_RAW));
return d->block_types[write_type];
}
#endif
static void strip_spaces(char *str)
{


+ 5
- 1
libburn/libburn.h View File

@ -2272,7 +2272,11 @@ int burn_drive_set_buffer_waiting(struct burn_drive *d, int enable,
int min_percent, int max_percent);
/* these are for my debugging, they will disappear */
/* these are for my [Derek Foreman's ?] debugging, they will disappear */
/* ts B11012 :
Of course, API symbols will not disappear. But these functions are of
few use, as they only print DEBUG messages.
*/
void burn_structure_print_disc(struct burn_disc *d);
void burn_structure_print_session(struct burn_session *s);
void burn_structure_print_track(struct burn_track *t);


+ 1
- 0
libburn/libdax_msgs.h View File

@ -574,6 +574,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x00020186 (WARNING,HIGH) = Track damaged and not closed
0x00020187 (NOTE,HIGH) = Track not marked as damaged. No action taken.
0x00020188 (FAILURE,HIGH) = Cannot close damaged track on given media type
0x00020189 (FATAL,HIGH) = Drive is already grabbed by libburn
libdax_audioxtr:
0x00020200 (SORRY,HIGH) = Cannot open audio source file


+ 2
- 37
libburn/mmc.c View File

@ -849,8 +849,6 @@ void mmc_write_12(struct burn_drive *d, int start, struct buffer *buf)
len = buf->sectors;
burn_print(100, "trying to write %d at %d\n", len, start);
scsi_init_command(c, MMC_WRITE_12, sizeof(MMC_WRITE_12));
c->retry = 1;
mmc_int_to_four_char(c->opcode + 2, start);
@ -913,8 +911,6 @@ int mmc_write(struct burn_drive *d, int start, struct buffer *buf)
/* ts A61009 : buffer fill problems are to be handled by caller */
/* a ssert(buf->bytes >= buf->sectors);*/ /* can be == at 0... */
burn_print(100, "trying to write %d at %d\n", len, start);
/* ts A70711 */
if(d->wait_for_buffer_free)
mmc_wait_for_buffer_free(d, buf);
@ -1343,7 +1339,7 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len)
struct buffer *buf = NULL;
struct command *c = NULL;
int dlen;
int i, bpl= 12, old_alloc_len, t_idx, ret;
int i, old_alloc_len, t_idx, ret;
unsigned char *tdata;
char *msg = NULL;
@ -1438,8 +1434,6 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len)
{ret = 0; goto ex;}
tdata = c->page->data + 4;
burn_print(12, "TOC:\n");
d->disc = burn_disc_create();
if (d->disc == NULL) /* ts A70825 */
{ret = 0; goto ex;}
@ -1453,20 +1447,9 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len)
}
/* ts A61022 */
burn_print(bpl, "-----------------------------------\n");
for (i = 0; i < d->toc_entries; i++, tdata += 11) {
/* ts A61022: was burn_print level 12 */
burn_print(bpl, "S %d, PT %2.2Xh, TNO %d :", tdata[0],tdata[3],
tdata[2]);
burn_print(bpl, " MSF(%d:%d:%d)", tdata[4],tdata[5],tdata[6]);
burn_print(bpl, " PMSF(%d:%d:%d %d)",
tdata[8], tdata[9], tdata[10],
burn_msf_to_lba(tdata[8], tdata[9], tdata[10]));
burn_print(bpl, " - control %d, adr %d\n", tdata[1] & 0xF,
tdata[1] >> 4);
/*
fprintf(stderr, "libburn_experimental: toc entry #%d : %d %d %d\n",i,tdata[8], tdata[9], tdata[10]);
*/
@ -1518,9 +1501,6 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len)
&d->toc_entry[i];
}
/* ts A61022 */
burn_print(bpl, "-----------------------------------\n");
/* ts A70131 : was (d->status != BURN_DISC_BLANK) */
if (d->status == BURN_DISC_UNREADY)
d->status = BURN_DISC_FULL;
@ -2207,7 +2187,7 @@ void mmc_read_sectors(struct burn_drive *d,
const struct burn_read_opts *o, struct buffer *buf)
{
int temp;
int errorblock, req;
int req;
struct command *c;
c = &(d->casual_command);
@ -2222,8 +2202,6 @@ void mmc_read_sectors(struct burn_drive *d,
/* ts A61006 : i second that question */
/* a ssert(d->busy); */
burn_print(12, "reading %d from %d\n", len, start);
scsi_init_command(c, MMC_READ_CD, sizeof(MMC_READ_CD));
c->retry = 1;
temp = start;
@ -2259,19 +2237,6 @@ void mmc_read_sectors(struct burn_drive *d,
c->page = buf;
c->dir = FROM_DRIVE;
d->issue_command(d, c);
if (c->error) {
burn_print(12, "got an error over here\n");
burn_print(12, "%d, %d, %d, %d\n", c->sense[3], c->sense[4],
c->sense[5], c->sense[6]);
errorblock =
(c->sense[3] << 24) + (c->sense[4] << 16) +
(c->sense[5] << 8) + c->sense[6];
c->page->sectors = errorblock - start + 1;
burn_print(1, "error on block %d\n", errorblock);
burn_print(12, "error on block %d\n", errorblock);
burn_print(12, "returning %d sectors\n", c->page->sectors);
}
}
void mmc_erase(struct burn_drive *d, int fast)


+ 9
- 16
libburn/read.c View File

@ -115,7 +115,6 @@ drive, or only store a subset of the _opts structs in drives */
while (1) {
seclen = burn_sector_length_read(d, o);
burn_print(12, "received %d blocks\n", page.sectors);
for (i = 0; i < page.sectors; i++) {
burn_packet_process(d, page.data + seclen * i, o);
d->track_end--;
@ -123,7 +122,6 @@ drive, or only store a subset of the _opts structs in drives */
}
if ((d->cancel) || (drive_lba == LAST_SESSION_END(d))) {
burn_print(1, "finished or cancelled\n");
d->busy = BURN_DRIVE_IDLE;
if (!d->cancel)
d->toc->complete = 1;
@ -137,16 +135,14 @@ drive, or only store a subset of the _opts structs in drives */
if (d->currtrack >
d->toc->session[d->currsession].lasttrack) {
d->currsession++;
burn_print(12, "session switch to %d\n",
d->currsession);
burn_print(12, "skipping a lead out\n");
/* session switch to d->currsession */
/* skipping a lead out */
drive_lba = CURRENT_SESSION_START(d);
burn_print(12, "new lba %d\n", drive_lba);
/* XXX more of the same
end = burn_track_end(d, d->currsession,
d->currtrack);
*/ }
burn_print(12, "track switch to %d\n", d->currtrack);
*/
}
}
page.sectors = 0;
@ -201,6 +197,7 @@ static int bitcount(unsigned char *data, int n)
return count;
}
void burn_packet_process(struct burn_drive *d, unsigned char *data,
const struct burn_read_opts *o)
{
@ -214,12 +211,7 @@ void burn_packet_process(struct burn_drive *d, unsigned char *data,
if (o->c2errors) {
fb = bitcount(data + ptr, 294);
if (fb) {
burn_print(1, "%d damaged bits\n",
bitcount(data + ptr, 294));
burn_print(1, "sending error on %s %s\n",
d->idata->vendor, d->idata->product);
/* XXX send a burn_message! burn_message_error(d,
something); */
/* bitcount(data + ptr, 294) damaged bits */;
}
ptr += 294;
}
@ -259,12 +251,13 @@ void burn_packet_process(struct burn_drive *d, unsigned char *data,
#ifndef Libburn_no_crc_C
crc = (*(sub + 22) << 8) + *(sub + 23);
if (crc != crc_ccitt(sub + 12, 10)) {
/*
burn_print(1, "sending error on %s %s\n",
d->idata->vendor, d->idata->product);
/* e = burn_error();
e = burn_error();
e->drive = d;
*/
burn_print(1, "crc mismatch in Q\n");
*/;
}
#endif


+ 1
- 3
libburn/sg-freebsd-port.c View File

@ -493,10 +493,8 @@ int sg_grab(struct burn_drive *d)
*/
int sg_release(struct burn_drive *d)
{
if (d->cam == NULL) {
burn_print(1, "release an ungrabbed drive. die\n");
if (d->cam == NULL)
return 0;
}
sg_close_drive(d);
return 0;
}


+ 1
- 6
libburn/sg-freebsd.c View File

@ -508,12 +508,9 @@ static void enumerate_common(char *fname, int bus_no, int host_no,
/* try to get the drive info */
if (t->grab(t)) {
burn_print(2, "getting drive info\n");
t->getcaps(t);
t->unlock(t);
t->released = 1;
} else {
burn_print(2, "unable to grab new located drive\n");
}
/* ts A60821
@ -751,10 +748,8 @@ int sg_release(struct burn_drive *d)
if (mmc_function_spy(d, "sg_release") <= 0)
return 0;
if (d->cam == NULL) {
burn_print(1, "release an ungrabbed drive. die\n");
if (d->cam == NULL)
return 0;
}
mmc_function_spy(NULL, "sg_release ----------- closing.");


+ 1
- 3
libburn/sg-libcdio.c View File

@ -594,10 +594,8 @@ ex:;
*/
int sg_release(struct burn_drive *d)
{
if (d->p_cdio == NULL) {
burn_print(1, "release an ungrabbed drive. die\n");
if (d->p_cdio == NULL)
return 0;
}
sg_close_drive(d);
return 0;
}


+ 1
- 3
libburn/sg-linux.c View File

@ -1710,10 +1710,8 @@ int sg_release(struct burn_drive *d)
if (mmc_function_spy(d, "sg_release") <= 0)
return 0;
if (d->fd < 1) {
burn_print(1, "release an ungrabbed drive. die\n");
if (d->fd < 1)
return 0;
}
/* ts A60821
<<< debug: for tracing calls which might use open drive fds */


+ 1
- 3
libburn/sg-solaris.c View File

@ -561,10 +561,8 @@ ex:;
*/
int sg_release(struct burn_drive *d)
{
if (d->fd < 0) {
burn_print(1, "release an ungrabbed drive. die\n");
if (d->fd < 0)
return 0;
}
sg_close_drive(d);
return 0;
}


+ 2
- 18
libburn/spc.c View File

@ -628,7 +628,6 @@ void spc_select_error_params(struct burn_drive *d,
c->page->data[10] |= 4;
if (!o->hardware_error_recovery)
c->page->data[10] |= 1;
/*burn_print(1, "error parameter 0x%x\n", c->page->data[10]);*/
c->page->data[11] = d->params.retries;
c->dir = TO_DRIVE;
d->issue_command(d, c);
@ -672,7 +671,6 @@ void spc_sense_write_params(struct burn_drive *d)
m = d->mdata;
if (!c->error) {
page = c->page->data + 8;
burn_print(1, "write page length 0x%x\n", page[1]);
m->write_page_length = page[1];
m->write_page_valid = 1;
} else
@ -763,9 +761,6 @@ void spc_select_write_params(struct burn_drive *d,
c->page->bytes = alloc_len;
burn_print(12, "using write page length %d (valid %d)\n",
d->mdata->write_page_length, d->mdata->write_page_valid);
/* ts A61229 */
if (mmc_compose_mode_page_5(d, o, c->page->data + 8) <= 0)
goto ex;
@ -811,9 +806,6 @@ void spc_probe_write_modes(struct burn_drive *d)
/* ts A70213 : added pseudo try_write_type 4 to set a suitable mode */
while (try_write_type != 5) {
burn_print(9, "trying %d, %d\n", try_write_type,
try_block_type);
/* ts A70213 */
if (try_write_type == 4) {
/* Pseudo write type NONE . Set a useable write mode */
@ -852,10 +844,9 @@ void spc_probe_write_modes(struct burn_drive *d)
spc_decode_sense(c->sense, 0, &key, &asc, &ascq);
if (key)
burn_print(7, "%d not supported\n", try_block_type);
/* try_block_type not supported */;
else {
burn_print(7, "%d:%d SUPPORTED MODE!\n",
try_write_type, try_block_type);
/* try_write_type, try_block_type is supported mode */
if (try_write_type == 2) /* sao */
d->block_types[try_write_type] =
BURN_BLOCK_SAO;
@ -1036,9 +1027,6 @@ enum response scsi_error_msg(struct burn_drive *d, unsigned char *sense,
sprintf(msg, "[%X %2.2X %2.2X] ", *key, *asc, *ascq);
msg= msg + strlen(msg);
burn_print(12, "CONDITION: 0x%x 0x%x 0x%x on %s %s\n",
*key, *asc, *ascq, d->idata->vendor, d->idata->product);
switch (*asc) {
case 0x00:
if (*key > 0 || *ascq > 0)
@ -1334,10 +1322,6 @@ enum response scsi_error(struct burn_drive *d, unsigned char *sense,
BURN_ALLOC_MEM(msg, char, 160);
resp = scsi_error_msg(d, sense, senselen, msg, &key, &asc, &ascq);
if (asc == 0 || asc == 0x3A)
burn_print(12, "%s\n", msg);
else
burn_print(1, "%s\n", msg);
ex:;
if (ret == -1)
resp = FAIL;


+ 17
- 5
libburn/structure.c View File

@ -242,8 +242,12 @@ int burn_session_remove_track(struct burn_session *s, struct burn_track *t)
void burn_structure_print_disc(struct burn_disc *d)
{
int i;
char msg[40];
burn_print(12, "This disc has %d sessions\n", d->sessions);
sprintf(msg, "This disc has %d sessions", d->sessions);
libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
for (i = 0; i < d->sessions; i++) {
burn_structure_print_session(d->session[i]);
}
@ -251,16 +255,25 @@ void burn_structure_print_disc(struct burn_disc *d)
void burn_structure_print_session(struct burn_session *s)
{
int i;
char msg[40];
burn_print(12, " Session has %d tracks\n", s->tracks);
sprintf(msg, " Session has %d tracks", s->tracks);
libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
for (i = 0; i < s->tracks; i++) {
burn_structure_print_track(s->track[i]);
}
}
void burn_structure_print_track(struct burn_track *t)
{
burn_print(12, "(%p) track size %d sectors\n", t,
burn_track_get_sectors(t));
char msg[80];
sprintf(msg, " track size %d sectors",
burn_track_get_sectors(t));
libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
}
void burn_track_define_data(struct burn_track *t, int offset, int tail,
@ -398,7 +411,6 @@ int burn_track_get_sectors(struct burn_track *t)
sectors = size / seclen;
if (size % seclen)
sectors++;
burn_print(1, "%d sectors of %d length\n", sectors, seclen);
return sectors;
}


+ 0
- 22
libburn/write.c View File

@ -412,7 +412,6 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
goto failed;
runtime += 150;
burn_print(1, "toc for %d tracks:\n", ntr);
d->toc_entries = ntr + 3;
/* ts A61009 */
@ -513,8 +512,6 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
e[3 + i].pframe = f;
e[3 + i].adr = 1;
e[3 + i].control = type_to_ctrl(tar[i]->mode);
burn_print(1, "track %d control %d\n", tar[i]->mode,
e[3 + i].control);
ret = add_cue(sheet, ctladr | 1, i + 1, 1, form, 0, runtime);
if (ret <= 0)
@ -566,11 +563,6 @@ XXX this is untested :)
e[2].pmin = m;
e[2].psec = s;
e[2].pframe = f;
burn_print(1, "run time is %d (%d:%d:%d)\n", runtime, m, s, f);
for (i = 0; i < d->toc_entries; i++)
burn_print(1, "point %d (%02d:%02d:%02d)\n",
d->toc_entry[i].point, d->toc_entry[i].pmin,
d->toc_entry[i].psec, d->toc_entry[i].pframe);
ret = add_cue(sheet, ctladr | 1, 0xAA, 1, 1, 0, runtime);
if (ret <= 0)
goto failed;
@ -612,8 +604,6 @@ int burn_write_leadin(struct burn_write_opts *o,
d->busy = BURN_DRIVE_WRITING_LEADIN;
burn_print(5, first ? " first leadin\n" : " leadin\n");
if (first)
count = 0 - d->alba - 150;
else
@ -642,7 +632,6 @@ int burn_write_leadout(struct burn_write_opts *o,
d->busy = BURN_DRIVE_WRITING_LEADOUT;
d->rlba = -150;
burn_print(5, first ? " first leadout\n" : " leadout\n");
if (first)
count = 6750;
else
@ -667,7 +656,6 @@ int burn_write_session(struct burn_write_opts *o, struct burn_session *s)
int i, ret;
d->rlba = 0;
burn_print(1, " writing a session\n");
for (i = 0; i < s->tracks; i++) {
if (!burn_write_track(o, s, i))
{ ret = 0; goto ex; }
@ -798,8 +786,6 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
burn_disc_init_track_status(o, s, tnum, sectors);
burn_print(12, "track %d is %d sectors long\n", tnum, sectors);
/* ts A61030 : this cannot happen. tnum is always < s->tracks */
if (tnum == s->tracks)
tmp = sectors > 150 ? 150 : sectors;
@ -830,8 +816,6 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
fprintf(stderr,"LIBBURN_DEBUG: TNUM=%d TRACKS=%d TMP=%d\n",
tnum, s->tracks, tmp);
burn_print(1, "last track, leadout prep\n");
/* ts A61023 */
if ((i%64)==0)
d->read_buffer_capacity(d);
@ -2484,8 +2468,6 @@ calloc() seems not to have the desired effect. valgrind warns:
}
}
burn_print(1, "sync write of %d CD sessions\n", disc->sessions);
/* Apparently some drives require this command to be sent, and a few drives
return crap. so we send the command, then ignore the result.
*/
@ -2618,9 +2600,6 @@ return crap. so we send the command, then ignore the result.
burn_drive_mark_unready(d, 0);
burn_drive_inquire_media(d);
burn_print(1, "done\n");
/* <<< d->busy = BURN_DRIVE_IDLE; */
/* ts A61012 : This return was traditionally missing. I suspect this
to have caused Cdrskin_eject() failures */
goto ex;
@ -2629,7 +2608,6 @@ fail:
d->sync_cache(d);
fail_wo_sync:;
usleep(500001); /* ts A61222: to avoid a warning from remove_worker()*/
burn_print(1, "done - failed\n");
libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010b,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Burn run failed", 0, 0);


Loading…
Cancel
Save