Removed remaining 31/32-bit bottlenecks from stdio writing

This commit is contained in:
Thomas Schmitt 2024-03-03 21:14:17 +01:00
parent e5a8d91e4d
commit f84d038121
5 changed files with 35 additions and 28 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2024.03.03.152344" #define Cdrskin_timestamP "2024.03.03.201314"

View File

@ -946,11 +946,11 @@ static int print_time(int flag)
#endif /* Libburn_write_time_debuG */ #endif /* Libburn_write_time_debuG */
int mmc_write(struct burn_drive *d, int start, struct buffer *buf) int mmc_write(struct burn_drive *d, off_t start_long, struct buffer *buf)
{ {
int cancelled; int cancelled;
struct command *c; struct command *c;
int len, key, asc, ascq; int len, key, asc, ascq, start;
char *msg = NULL; char *msg = NULL;
#ifdef Libburn_write_time_debuG #ifdef Libburn_write_time_debuG
@ -962,6 +962,16 @@ fprintf(stderr, "libburn_DEBUG: buffer sectors= %d bytes= %d\n",
buf->sectors, buf->bytes); buf->sectors, buf->bytes);
*/ */
if (start_long > (off_t) 0x7fffffff) {
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002012d,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Exceeding range of signed integer block addresses",
0, 0);
d->cancel = 1;
return BE_CANCELLED;
}
start = start_long;
c = &(d->casual_command); c = &(d->casual_command);

View File

@ -27,7 +27,7 @@ void mmc_close_disc(struct burn_write_opts *o);
void mmc_close(struct burn_drive *, int session, int track); void mmc_close(struct burn_drive *, int session, int track);
void mmc_get_event(struct burn_drive *); void mmc_get_event(struct burn_drive *);
int mmc_write(struct burn_drive *, int start, struct buffer *buf); int mmc_write(struct burn_drive *, off_t start, struct buffer *buf);
void mmc_write_12(struct burn_drive *d, int start, struct buffer *buf); void mmc_write_12(struct burn_drive *d, int start, struct buffer *buf);
void mmc_sync_cache(struct burn_drive *); void mmc_sync_cache(struct burn_drive *);
void mmc_load(struct burn_drive *); void mmc_load(struct burn_drive *);

View File

@ -335,7 +335,7 @@ struct burn_drive
int stdio_fd; int stdio_fd;
int nwa; /* next writeable address */ off_t nwa; /* next writeable address */
int alba; /* absolute lba */ int alba; /* absolute lba */
int rlba; /* relative lba in section */ int rlba; /* relative lba in section */
int start_lba; int start_lba;
@ -467,7 +467,7 @@ struct burn_drive
/* ts A61021 */ /* ts A61021 */
void (*read_atip) (struct burn_drive *); void (*read_atip) (struct burn_drive *);
int (*write) (struct burn_drive *, int, struct buffer *); int (*write) (struct burn_drive *, off_t, struct buffer *);
void (*read_toc) (struct burn_drive *); void (*read_toc) (struct burn_drive *);
void (*lock) (struct burn_drive *); void (*lock) (struct burn_drive *);
void (*unlock) (struct burn_drive *); void (*unlock) (struct burn_drive *);

View File

@ -1027,7 +1027,7 @@ static int burn_write_leadin_cdtext(struct burn_write_opts *o,
} }
#endif /* Libburn_debug_cd_texT */ #endif /* Libburn_debug_cd_texT */
err = d->write(d, write_lba, buf); err = d->write(d, (off_t) write_lba, buf);
if (err == BE_CANCELLED) if (err == BE_CANCELLED)
{ ret = 0; goto ex; } { ret = 0; goto ex; }
write_lba += sectors; write_lba += sectors;
@ -1074,10 +1074,10 @@ ex:;
} }
/* ts A61218 : outsourced from burn_write_track() */ /* ts A61218 / C40303 : outsourced from burn_write_track() */
int burn_disc_init_track_status(struct burn_write_opts *o, int burn_disc_init_track_status(struct burn_write_opts *o,
struct burn_session *s, struct burn_track *t, struct burn_session *s, struct burn_track *t,
int tnum, int sectors) int tnum, off_t sectors)
{ {
struct burn_drive *d = o->drive; struct burn_drive *d = o->drive;
@ -1179,8 +1179,8 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
/* <<< */ /* <<< */
sprintf(msg, sprintf(msg,
"TAO pre-track %2.2d : get_nwa(%d)=%d, d=%d , demand=%.f , cap=%.f\n", "TAO pre-track %2.2d : get_nwa(%d)=%d, d=%.f , demand=%.f , cap=%.f\n",
tnum+1, nwa, ret, d->nwa, tnum+1, nwa, ret, (double) d->nwa,
(double) burn_track_get_sectors_2(t, 1) * 2048.0, (double) burn_track_get_sectors_2(t, 1) * 2048.0,
(double) d->media_capacity_remaining); (double) d->media_capacity_remaining);
libdax_msgs_submit(libdax_messenger, d->global_index, libdax_msgs_submit(libdax_messenger, d->global_index,
@ -1209,7 +1209,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
{ ret = 0; goto ex; } { ret = 0; goto ex; }
open_ended = burn_track_is_open_ended(t); open_ended = burn_track_is_open_ended(t);
burn_disc_init_track_status(o, s, t, tnum, sectors); burn_disc_init_track_status(o, s, t, tnum, (off_t) sectors);
/* ts A61030 : this cannot happen. tnum is always < s->tracks */ /* ts A61030 : this cannot happen. tnum is always < s->tracks */
if (tnum == s->tracks) if (tnum == s->tracks)
@ -1570,8 +1570,8 @@ int burn_disc_open_track_dvd_minus_r(struct burn_write_opts *o,
d->send_write_parameters(d, NULL, -1, o); d->send_write_parameters(d, NULL, -1, o);
ret = d->get_nwa(d, -1, &lba, &nwa); ret = d->get_nwa(d, -1, &lba, &nwa);
sprintf(msg, sprintf(msg,
"DVD pre-track %2.2d : get_nwa(%d), ret= %d , d->nwa= %d", "DVD pre-track %2.2d : get_nwa(%d), ret= %d , d->nwa= %.f",
tnum+1, nwa, ret, d->nwa); tnum+1, nwa, ret, (double) d->nwa);
libdax_msgs_submit(libdax_messenger, d->global_index, 0x00000002, libdax_msgs_submit(libdax_messenger, d->global_index, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, msg,0,0); LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, msg,0,0);
if (nwa > d->nwa) if (nwa > d->nwa)
@ -1632,8 +1632,8 @@ int burn_disc_open_track_dvd_plus_r(struct burn_write_opts *o,
BURN_ALLOC_MEM(msg, char, 160); BURN_ALLOC_MEM(msg, char, 160);
ret = d->get_nwa(d, -1, &lba, &nwa); ret = d->get_nwa(d, -1, &lba, &nwa);
sprintf(msg, sprintf(msg,
"DVD+R pre-track %2.2d : get_nwa(%d), ret= %d , d->nwa= %d", "DVD+R pre-track %2.2d : get_nwa(%d), ret= %d , d->nwa= %.f",
tnum+1, nwa, ret, d->nwa); tnum+1, nwa, ret, (double) d->nwa);
libdax_msgs_submit(libdax_messenger, d->global_index, 0x00000002, libdax_msgs_submit(libdax_messenger, d->global_index, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, msg,0,0); LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, msg,0,0);
if (nwa > d->nwa) if (nwa > d->nwa)
@ -1936,7 +1936,7 @@ int burn_dvd_write_track(struct burn_write_opts *o,
/* (offset padding is done within sector_data()) */ /* (offset padding is done within sector_data()) */
burn_disc_init_track_status(o, s, t, tnum, sectors); burn_disc_init_track_status(o, s, t, tnum, (off_t) sectors);
for (i = 0; open_ended || i < sectors; i++) { for (i = 0; open_ended || i < sectors; i++) {
/* From time to time inquire drive buffer */ /* From time to time inquire drive buffer */
@ -2233,7 +2233,8 @@ int burn_disc_setup_dvd_minus_rw(struct burn_write_opts *o,
if (o->start_byte >= 0) { if (o->start_byte >= 0) {
d->nwa = o->start_byte / 32768; /* align to 32 kB */ d->nwa = o->start_byte / 32768; /* align to 32 kB */
sprintf(msg, "Write start address is %d * 32768", d->nwa); sprintf(msg, "Write start address is %.f * 32768",
(double) d->nwa);
libdax_msgs_submit(libdax_messenger, d->global_index, libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020127, 0x00020127,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
@ -2335,8 +2336,8 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
d->nwa = 0; d->nwa = 0;
if (o->start_byte >= 0) { if (o->start_byte >= 0) {
d->nwa = o->start_byte / 2048; d->nwa = o->start_byte / 2048;
sprintf(msg, "Write start address is %d * 2048", sprintf(msg, "Write start address is %.f * 2048",
d->nwa); (double) d->nwa);
libdax_msgs_submit(libdax_messenger, d->global_index, libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020127, 0x00020127,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
@ -2658,7 +2659,7 @@ ex:;
/* ts A70910 : to be used as burn_drive.write(), emulating mmc_write() */ /* ts A70910 : to be used as burn_drive.write(), emulating mmc_write() */
int burn_stdio_mmc_write(struct burn_drive *d, int start, struct buffer *buf) int burn_stdio_mmc_write(struct burn_drive *d, off_t start, struct buffer *buf)
{ {
int ret; int ret;
off_t start_byte; off_t start_byte;
@ -2701,7 +2702,7 @@ int burn_stdio_mmc_write(struct burn_drive *d, int start, struct buffer *buf)
/* ts A70910 : to be used as burn_drive.write(), /* ts A70910 : to be used as burn_drive.write(),
emulating mmc_write() with simulated writing. */ emulating mmc_write() with simulated writing. */
int burn_stdio_mmc_dummy_write(struct burn_drive *d, int start, int burn_stdio_mmc_dummy_write(struct burn_drive *d, off_t start,
struct buffer *buf) struct buffer *buf)
{ {
if (d->cancel) if (d->cancel)
@ -2846,11 +2847,7 @@ int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s,
sectors = burn_track_get_sectors_2_v2(t, 1); sectors = burn_track_get_sectors_2_v2(t, 1);
if (sectors < 0) if (sectors < 0)
{ret = 0; goto ex;} {ret = 0; goto ex;}
burn_disc_init_track_status(o, s, t, tnum, sectors);
/* >>> (int) cast will be removed when burn_disc_init_track_status()
>>> gets off_t sectors */;
burn_disc_init_track_status(o, s, t, tnum, (int) sectors);
open_ended = burn_track_is_open_ended(t); open_ended = burn_track_is_open_ended(t);
t->end_on_premature_eoi = (o->write_type == BURN_WRITE_TAO); t->end_on_premature_eoi = (o->write_type == BURN_WRITE_TAO);