[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD
From: |
Thomas Schmitt |
Subject: |
Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD |
Date: |
Mon, 29 Oct 2018 19:55:01 +0100 |
Hi,
independent of the reason why Edd Barrett's branch of libcdio does
not work for libcdio-cdparanoia on Greg Troxel's NetBSD, i give my opinion
about how to complete
https://github.com/vext01/libcdio/commit/e2f3919357b76d9fadb3d57f20d2b1e8198f32d1
"The TOC needs to be read in LBA format on OpenBSD. "
Function _cdio_read_toc() uses ioctl(CDIOREADTOCENTRIES) to obtain
a table-of-content with entries for each track and for the lead-out
pseudo track.
In
http://lists.gnu.org/archive/html/libcdio-devel/2018-10/msg00001.html
i see that this is where Greg Troxel started to make experiments.
> > > - req.address_format = CD_MSF_FORMAT;
> > > + req.address_format = CD_LBA_FORMAT;
> > > So it seems that moving NetBSD to CD_LBA_FORMAT at best needs more work,
I understand it is about union and struct in
https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/cdio.h
union msf_lba {
struct {
u_char unused;
u_char minute;
u_char second;
u_char frame;
} msf;
uint32_t lba;
u_char addr[4];
};
struct cd_toc_entry {
u_char nothing1;
#if BYTE_ORDER == LITTLE_ENDIAN
uint32_t control:4;
uint32_t addr_type:4;
#endif
#if BYTE_ORDER == BIG_ENDIAN
uint32_t addr_type:4;
uint32_t control:4;
#endif
u_char track;
u_char nothing2;
union msf_lba addr;
};
of which an array is delivered by ioctl(CDIOREADTOCENTRIES) into libcdio's
typedef struct {
...
struct cd_toc_entry tocent[100];
...
} _img_private_t;
The input parameter req.address_format chooses for the reply between
Minute:Second:Frame address format and LBA (i.e. sector number) format
in tocent[].addr.
So if in _cdio_read_toc() the requested address format is changed from MSF
to LBA, then the consumers of the result would either have to change their
expectations about the address format, or the call will have to convert
the LBA result to MFS.
The latter is of course preferable.
(Consumer would be e.g. cdio_get_track_msf().)
>From get_track_msf_netbsd() i derive this (totally untested) conversion
proposal for the end of _cdio_read_toc() in netbsd.c:
if (req.address_format != CD_MSF_FORMAT) {
int track_num;
msf_t msf;
for (track_num = 1; track_num <= TOTAL_TRACKS + 1;
track_num++) {
cdio_lba_to_msf(
(lba_t) _obj->tocent[track_num - 1].addr.lba,
&msf);
_obj->tocent[track_num - 1].addr.msf.minute = msf.m;
_obj->tocent[track_num - 1].addr.msf.second = msf.s;
_obj->tocent[track_num - 1].addr.msf.frame = msf.f;
}
}
(... and wonder what happens if the first track number of a CD is not 1,
which is perfectly legal ... well, if it fails, then get_track_msf_netbsd()
will fail too ...)
Have a nice day :)
Thomas
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, (continued)
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Edd Barrett, 2018/10/26
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Greg Troxel, 2018/10/26
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Greg Troxel, 2018/10/26
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Edd Barrett, 2018/10/29
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Thomas Schmitt, 2018/10/29
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Edd Barrett, 2018/10/29
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Thomas Schmitt, 2018/10/29
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Edd Barrett, 2018/10/29
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Edd Barrett, 2018/10/29
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Thomas Schmitt, 2018/10/29
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD,
Thomas Schmitt <=
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Thomas Schmitt, 2018/10/30
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Edd Barrett, 2018/10/30
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Rocky Bernstein, 2018/10/30
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Thomas Schmitt, 2018/10/30
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Greg Troxel, 2018/10/30
- Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD, Thomas Schmitt, 2018/10/31