libcdio-devel
[Top][All Lists]
Advanced

[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: Sat, 15 Dec 2018 20:52:28 +0100

Hi,

> Evening everyone,

Great timing. I am just done with properly failing to reproduce a xorriso
problem in a 32 bit VM. (Procrastinated since a week. Now the ball is back
in the Guix yard.)


> I've sucked Thomas' changes into my cdio-paranoia branch,

Thanks a lot for adopting them.


> ++ WARN: ioctl CDIOREADMSADDR failed: Invalid argument

Try whether it helps to initialize variable "addr" in
get_disc_last_lsn_netbsd() to 0 before submitting it to the ioctl().

--------------------------------------------------------------------------
Research:

http://fxr.watson.org/fxr/source/sys/cdio.h?v=OPENBSD#L192

  /* read LBA start of a given session; 0=last, others not yet supported */
  #define CDIOREADMSADDR _IOWR('c', 6, int)

https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/cdio.h

  /* read LBA start of a given session; 0=last, others not yet supported */
  #define CDIOREADMSADDR _IOWR('c', 6, int)

What do the remarks mean by "0=last" ?
Shall the "given session" be sent down and exchanged for the lba ?

Looks like this is really true:

http://fxr.watson.org/fxr/source/scsi/cd.c?v=OPENBSD#L945

  945         case CDIOREADMSADDR: {
  946                 struct cd_toc *toc;
  947                 int sessno = *(int *)addr;
  948                 struct cd_toc_entry *cte;
  949 
  950                 if (sessno != 0) {
  951                         error = EINVAL;
  952                         break;
  953                 }
  ...
  979                 *(int *)addr = (toc->header.len >= 10 && cte->track > 1) ?
  980                         cte->addr.lba : 0;

http://fxr.watson.org/fxr/source/dev/scsipi/cd.c?v=NETBSD#L1499

 1499         case CDIOREADMSADDR: {
 1500                 /* READ TOC format 0 command, length of first track only 
*/
 1501                 int sessno = *(int*)addr;
 1502 
 1503                 if (sessno != 0)
 1504                         return (EINVAL);
 1505 
 1506                 return (cdreadmsaddr(cd, &toc, addr));

But in
  
https://github.com/vext01/libcdio/blob/openbsd_fixes_to_master_for_merge/lib/driver/netbsd.c
the submitted argument points to the uninitialized variable "addr":

  static driver_return_code_t
  get_last_session_netbsd(void *p_user_data, lsn_t *i_last_session)
  {
    const _img_private_t *p_env = p_user_data;
    int addr;

    if (ioctl(p_env->gen.fd, CDIOREADMSADDR, &addr) == 0) {

--------------------------------------------------------------------------

> * https://github.com/vext01/libcdio/commits/openbsd_fixes_to_master_for_merge
> * https://github.com/vext01/libcdio-paranoia/commits/start-track-num-not-one
> Do you guys want to check them before we do the merges?

I will have a look hopefully tomorrow.


Have a nice day :)

Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]