libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libcdio-devel] [RFC] New API iso9660_statv2_t as API/ABI compatible


From: Thomas Schmitt
Subject: Re: [Libcdio-devel] [RFC] New API iso9660_statv2_t as API/ABI compatible way to read files >= 4 GiB
Date: Mon, 09 Jul 2018 23:05:37 +0200

Hi,

i wrote:
> > * Old iso9660_stat_t with only additional member .total_size,

Pete Batard wrote:
> I still don't see how that would work unless we assume that all extents
> except the last are exactly 4 GB.

By old

  lsn_t     lsn;   /**< start logical sector number */

and new
            /**v combined size of all extents, in bytes */
  uint64_t  total_size;

If there are no gaps, then simply read .total_size bytes beginning
at .lsn.
If there are gaps, then libcdio would throw error and not list the
affected file by calls like iso9660_fs_readdir().


> And even then, unless you create new
> attributes somewhere, I have no idea where you'll pull the LSNs values you
> need to compare

I augment my example of today by a condition which i forgot:

    lsn_t extent_lsn;
    ...

    extent_lsn = from_733 (p_iso9660_dir->extent);

    /* Important: Test here with previous .total_size */
    if (p_stat->total_size > 0) {
      /* This is a follow-up extent. Check for a gap. */
      if (p_stat->lsn + p_stat->total_size / ISO_BLOCKSIZE != extent_lsn
          || p_stat->total_size % ISO_BLOCKSIZE) {

        /* >>> Gap detected. Throw error. <<< */;

        return NULL;
      }
    } else {
      /* No extent with data before. Record this start as overall start. */
      p_stat->lsn = extent_lsn;
    }

    /* Only now update .total_size */
    p_stat->total_size += from_733 (p_iso9660_dir->size);

If the tested start lsn of each follow-up extent matches the gaplessly
computed end of the combined predecessor extents, then there can be no gap.


> Unless you can actively detect and refuse multiextent ISOs that libcdio
> cannot process, this is a NO_GO for me.

I understand and i can.
The only problem i see is how to get a test ISO with gap. I will have
to patch one binarily.


Have a nice day :)

Thomas




reply via email to

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