New API call burn_get_read_capacity_v2()
This commit is contained in:
parent
f0d9795cd1
commit
e5a8d91e4d
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2024.03.03.105146"
|
#define Cdrskin_timestamP "2024.03.03.152344"
|
||||||
|
@ -3494,15 +3494,32 @@ int burn_drive_set_media_capacity_remaining(struct burn_drive *d, off_t value)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ts C40303 : API */
|
||||||
|
int burn_get_read_capacity_v2(struct burn_drive *d, off_t *capacity, int flag)
|
||||||
|
{
|
||||||
|
*capacity = d->media_read_capacity +
|
||||||
|
(d->media_read_capacity != 0x7fffffffffffffff);
|
||||||
|
return (d->media_read_capacity != 0x7fffffffffffffff);
|
||||||
|
}
|
||||||
|
|
||||||
/* ts A81215 : API */
|
/* ts A81215 : API */
|
||||||
int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag)
|
int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag)
|
||||||
{
|
{
|
||||||
*capacity = d->media_read_capacity +
|
int ret;
|
||||||
(d->media_read_capacity != 0x7fffffff);
|
off_t cap;
|
||||||
return (d->media_read_capacity != 0x7fffffff);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ret= burn_get_read_capacity_v2(d, &cap, flag);
|
||||||
|
if (cap < -0x7fffffff) {
|
||||||
|
*capacity = -0x7fffffff;
|
||||||
|
ret = 0;
|
||||||
|
} else if (cap > 0x7fffffff) {
|
||||||
|
*capacity = 0x7fffffff;
|
||||||
|
ret = 0;
|
||||||
|
} else {
|
||||||
|
*capacity = cap;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* ts A90903 : API */
|
/* ts A90903 : API */
|
||||||
int burn_disc_get_media_id(struct burn_drive *d,
|
int burn_disc_get_media_id(struct burn_drive *d,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* -*- 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 - 2021 Thomas Schmitt <scdbackup@gmx.net>
|
Copyright (c) 2006 - 2024 Thomas Schmitt <scdbackup@gmx.net>
|
||||||
Provided under GPL version 2 or later.
|
Provided under GPL version 2 or later.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -172,9 +172,10 @@ int burn_drive_grab_stdio(struct burn_drive *d, int flag);
|
|||||||
|
|
||||||
/* ts C10213 */
|
/* ts C10213 */
|
||||||
/* The size of limitless or oversized devices as pseudo drives */
|
/* The size of limitless or oversized devices as pseudo drives */
|
||||||
/* Do not change this value because of its meaning to
|
/* Do not lightheartedly change this value because of its meaning to
|
||||||
burn_drive.media_read_capacity in libburn/transport.h
|
burn_drive.media_read_capacity in libburn/transport.h
|
||||||
|
64 TiB = 2 exp 46 = 2 exp 35 blocks
|
||||||
*/
|
*/
|
||||||
#define BURN_DRIVE_MAX_BYTES ((off_t) (0x7ffffff0) * (off_t) 2048)
|
#define BURN_DRIVE_MAX_BYTES ((off_t) (0x800000000) * (off_t) 2048)
|
||||||
|
|
||||||
#endif /* __DRIVE */
|
#endif /* __DRIVE */
|
||||||
|
@ -4251,6 +4251,12 @@ int burn_random_access_write(struct burn_drive *d, off_t byte_address,
|
|||||||
*/
|
*/
|
||||||
int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag);
|
int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag);
|
||||||
|
|
||||||
|
/* ts C40303 */
|
||||||
|
/** Like burn_get_read_capacity(), but with off_t result.
|
||||||
|
@since 1.5.8
|
||||||
|
*/
|
||||||
|
int burn_get_read_capacity_v2(struct burn_drive *d, off_t *capacity, int flag);
|
||||||
|
|
||||||
|
|
||||||
/* ts A70812 */
|
/* ts A70812 */
|
||||||
/** Read data in random access mode.
|
/** Read data in random access mode.
|
||||||
|
@ -218,6 +218,7 @@ LIBBURN4_1.5.8 {
|
|||||||
burn_disc_get_sectors_v2;
|
burn_disc_get_sectors_v2;
|
||||||
burn_disc_track_lba_nwa_v2;
|
burn_disc_track_lba_nwa_v2;
|
||||||
burn_drive_get_status_v2;
|
burn_drive_get_status_v2;
|
||||||
|
burn_get_read_capacity_v2;
|
||||||
burn_session_get_sectors_v2;
|
burn_session_get_sectors_v2;
|
||||||
burn_track_get_sectors_v2;
|
burn_track_get_sectors_v2;
|
||||||
} LIBBURN4;
|
} LIBBURN4;
|
||||||
|
@ -1774,8 +1774,8 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len)
|
|||||||
TOC format 2 always reports 2 blocks more than are readable.
|
TOC format 2 always reports 2 blocks more than are readable.
|
||||||
So here it is possible to check and mark as trusted.
|
So here it is possible to check and mark as trusted.
|
||||||
*/
|
*/
|
||||||
if (highest_leadout > 0 && d->media_read_capacity != 0x7fffffff &&
|
if (highest_leadout > 0 && d->media_read_capacity != 0x7fffffffffffffff
|
||||||
!d->mr_capacity_trusted) {
|
&& !d->mr_capacity_trusted) {
|
||||||
if (highest_leadout - 3 == d->media_read_capacity) {
|
if (highest_leadout - 3 == d->media_read_capacity) {
|
||||||
d->mr_capacity_trusted = 1;
|
d->mr_capacity_trusted = 1;
|
||||||
libdax_msgs_submit(libdax_messenger, d->global_index,
|
libdax_msgs_submit(libdax_messenger, d->global_index,
|
||||||
@ -2015,7 +2015,7 @@ static int mmc_read_disc_info_al(struct burn_drive *d, int *alloc_len)
|
|||||||
d->media_lba_limit = 0;
|
d->media_lba_limit = 0;
|
||||||
|
|
||||||
/* ts A81210 */
|
/* ts A81210 */
|
||||||
d->media_read_capacity = 0x7fffffff;
|
d->media_read_capacity = 0x7fffffffffffffff;
|
||||||
d->mr_capacity_trusted = -1;
|
d->mr_capacity_trusted = -1;
|
||||||
|
|
||||||
/* ts A61202 */
|
/* ts A61202 */
|
||||||
@ -4967,7 +4967,7 @@ int mmc_read_capacity(struct burn_drive *d)
|
|||||||
|
|
||||||
BURN_ALLOC_MEM(buf, struct buffer, 1);
|
BURN_ALLOC_MEM(buf, struct buffer, 1);
|
||||||
BURN_ALLOC_MEM(c, struct command, 1);
|
BURN_ALLOC_MEM(c, struct command, 1);
|
||||||
d->media_read_capacity = 0x7fffffff;
|
d->media_read_capacity = 0x7fffffffffffffff;
|
||||||
d->mr_capacity_trusted = -1;
|
d->mr_capacity_trusted = -1;
|
||||||
mmc_start_if_needed(d, 1);
|
mmc_start_if_needed(d, 1);
|
||||||
if (mmc_function_spy(d, "mmc_read_capacity") <= 0)
|
if (mmc_function_spy(d, "mmc_read_capacity") <= 0)
|
||||||
@ -4981,11 +4981,7 @@ int mmc_read_capacity(struct burn_drive *d)
|
|||||||
c->page->sectors = 0;
|
c->page->sectors = 0;
|
||||||
c->dir = FROM_DRIVE;
|
c->dir = FROM_DRIVE;
|
||||||
d->issue_command(d, c);
|
d->issue_command(d, c);
|
||||||
d->media_read_capacity = mmc_four_char_to_int(c->page->data);
|
d->media_read_capacity = mmc_four_char_to_uint(c->page->data);
|
||||||
if (d->media_read_capacity < 0) {
|
|
||||||
d->media_read_capacity = 0x7fffffff;
|
|
||||||
{ret = 0; goto ex;}
|
|
||||||
}
|
|
||||||
if (d->current_profile >= 0x08 && d->current_profile <= 0x0A)
|
if (d->current_profile >= 0x08 && d->current_profile <= 0x0A)
|
||||||
d->mr_capacity_trusted = 0;
|
d->mr_capacity_trusted = 0;
|
||||||
else
|
else
|
||||||
@ -5505,7 +5501,7 @@ int mmc_setup_drive(struct burn_drive *d)
|
|||||||
d->last_track_no = 1;
|
d->last_track_no = 1;
|
||||||
d->media_capacity_remaining = 0;
|
d->media_capacity_remaining = 0;
|
||||||
d->media_lba_limit = 0;
|
d->media_lba_limit = 0;
|
||||||
d->media_read_capacity = 0x7fffffff;
|
d->media_read_capacity = 0x7fffffffffffffff;
|
||||||
d->mr_capacity_trusted = 0;
|
d->mr_capacity_trusted = 0;
|
||||||
d->pessimistic_buffer_free = 0;
|
d->pessimistic_buffer_free = 0;
|
||||||
d->pbf_altered = 0;
|
d->pbf_altered = 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* -*- 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 - 2014 Thomas Schmitt <scdbackup@gmx.net>
|
Copyright (c) 2006 - 2024 Thomas Schmitt <scdbackup@gmx.net>
|
||||||
Provided under GPL version 2 or later.
|
Provided under GPL version 2 or later.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -492,13 +492,13 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
|
|||||||
msg, 0, 0);
|
msg, 0, 0);
|
||||||
{ret = 0; goto ex;}
|
{ret = 0; goto ex;}
|
||||||
}
|
}
|
||||||
if (d->media_read_capacity != 0x7fffffff && byte_address >=
|
if (d->media_read_capacity != 0x7fffffffffffffff &&
|
||||||
((off_t) d->media_read_capacity + (off_t) 1) * (off_t) 2048) {
|
byte_address >= (d->media_read_capacity + 1) * (off_t) 2048) {
|
||||||
if (!(flag & 2)) {
|
if (!(flag & 2)) {
|
||||||
sprintf(msg,
|
sprintf(msg,
|
||||||
"Read start address %ds larger than number of readable blocks %d",
|
"Read start address %.fs larger than number of readable blocks %.f",
|
||||||
(int) (byte_address / 2048 + !!(byte_address % 2048)),
|
(double) (byte_address / 2048 + !!(byte_address % 2048)),
|
||||||
d->media_read_capacity + 1);
|
(double) (d->media_read_capacity + 1));
|
||||||
libdax_msgs_submit(libdax_messenger, d->global_index,
|
libdax_msgs_submit(libdax_messenger, d->global_index,
|
||||||
0x00020172, (flag & 32) ?
|
0x00020172, (flag & 32) ?
|
||||||
LIBDAX_MSGS_SEV_DEBUG : LIBDAX_MSGS_SEV_SORRY,
|
LIBDAX_MSGS_SEV_DEBUG : LIBDAX_MSGS_SEV_SORRY,
|
||||||
|
@ -371,13 +371,13 @@ struct burn_drive
|
|||||||
/* ts A70215 : if > 0 : first lba on media that is too high for write*/
|
/* ts A70215 : if > 0 : first lba on media that is too high for write*/
|
||||||
int media_lba_limit;
|
int media_lba_limit;
|
||||||
|
|
||||||
/* ts A81210 : Upper limit of readable data size,
|
/* ts A81210 / C40303 : Upper limit of readable data size,
|
||||||
0x7fffffff = unknown
|
0x7fffffffffffffff = unknown
|
||||||
0x7ffffff0 = BURN_DRIVE_MAX_BYTES / 2048
|
BURN_DRIVE_MAX_BYTES / 2048 = possibly truncated
|
||||||
possibly truncated to prevent 32 bit
|
or unknown stdio size
|
||||||
overflow, or unknown stdio size
|
|
||||||
*/
|
*/
|
||||||
int media_read_capacity;
|
off_t media_read_capacity;
|
||||||
|
|
||||||
/* ts B60305 : Whether READ CAPACITY of CD is credible:
|
/* ts B60305 : Whether READ CAPACITY of CD is credible:
|
||||||
-1= no READ CAPACITY yet , 0= untrusted READ CAPACITY
|
-1= no READ CAPACITY yet , 0= untrusted READ CAPACITY
|
||||||
1= READ CAPACITY confirmed or corrected by other commands
|
1= READ CAPACITY confirmed or corrected by other commands
|
||||||
|
Loading…
Reference in New Issue
Block a user