libcdio-devel
[Top][All Lists]
Advanced

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

[Libcdio-devel] [PATCH v2] add multi extent ISO9660 file support to libc


From: Pete Batard
Subject: [Libcdio-devel] [PATCH v2] add multi extent ISO9660 file support to libcdio
Date: Mon, 25 Jun 2018 23:16:46 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

Hi,

This is the updated version of the multi-extent patch, which, this time, is designed not to break compatibility with the existing API.

As such, the old struct iso9660_stat_s fields remain accessible, but are now are guarded under a DO_NOT_WANT_COMPATIBILITY macro (that I am reusing as it was already present to guard other deprecated elements), which has the benefit of:

1. Clearly signalling to developers that the old attributes will be deprecated, _eventually_, and that they should move to using the new API and add extents processing to their code.

2. Allow people who may be annoyed at the idea that we are wasting some space through the duplication of some of attributes, to remove the wastage by using DO_NOT_WANT_COMPATIBILITY during compilation.

As suggested by Thomas, we are also dropping the provision of a 'secsize' equivalent in the extents attribute, which was mostly redundant, in favour of using the newly introduced CDIO_EXTENT_BLOCKS() macro to compute the size of an extent in blocks.

The examples and tests are also modified accordingly, with, in the case of util.c, some validation of the deprecated API usage, by inserting a dual clause with DO_NOT_WANT_COMPATIBILITY defined/undefined (whereupon our current tests, which do not have the macro defined, will use the deprecated fields).

isolist.c has also been modified to report the number of extents used by a file entry, with an output that (when applied against the content of [1]) will look like:

$ ./isolist /c/Downloads/file_of_4gb.iso
Preparer : XORRISO-1.2.2 2012.04.02.133001, LIBISOBURN-1.2.2, LIBISOFS-1.2.2, LIBBURN-1.2.2
Volume     : ISOIMAGE
d [LSN       50]         2048 /.
d [LSN       50]         2048 /..
- [LSN  2098231]            4 /aaa
- [LSN       55]   4297064448 /file_of_4gb [2 extents]
- [LSN  2098232]            4 /zzz

I should point out that, for convenience reasons, I am leveraging the fact that the maximum number of extents we support is 8, so that we only need a single digit for our report in isolist.c.

If you want to validate this new proposal, you can clone the new 'pbatard-multiextent2' branch which I have just pushed. I have tested this branch against Windows/MinGW and Linux/gcc and confirmed that all tests passed.

Unfortunately, due to time constraints, as well as the relative complexity of having to contend with >4GB files, I do not think I will be in a position to add a test to validate the extraction of a multiextent file anytime soon. So if anybody else wants to take a stab at it, you're more than welcome!

Regards,

/Pete

[1] https://dev.haiku-os.org/raw-attachment/ticket/8473/file_of_4gb.iso.bz2
From 930851b3e1396bb200868758372a8c8d8cde6ea0 Mon Sep 17 00:00:00 2001
From: Pete Batard <address@hidden>
Date: Mon, 25 Jun 2018 22:31:54 +0100
Subject: [PATCH v2] Add support for ISO9660 multi extent files

This change expands the iso9660_stat_s struct to add support for processing
multiple extents. The new structure is compatible with the current API,
provided the DO_NOT_WANT_COMPATIBILITY macro is not defined.

Examples and tests are also modified to use the updated API.
---
 example/extract.c        |  36 +++---
 example/isofile.c        |  29 ++---
 example/isofile2.c       |  33 +++---
 example/isolist.c        |  17 ++-
 include/cdio/iso9660.h   |  28 ++++-
 lib/iso9660/iso9660_fs.c | 250 +++++++++++++++++++++++----------------
 src/iso-read.c           |  12 +-
 src/util.c               |  26 ++++
 test/testisocd.c         |   6 +-
 test/testisocd2.c        |   8 +-
 test/testisocd_joliet.c  |  10 +-
 11 files changed, 278 insertions(+), 177 deletions(-)

diff --git a/example/extract.c b/example/extract.c
index a9f5a313..c7214de2 100644
--- a/example/extract.c
+++ b/example/extract.c
@@ -174,9 +174,9 @@ static int iso_extract_files(iso9660_t* p_iso, const char 
*psz_path)
   CdioListNode_t *p_entnode;
   iso9660_stat_t *p_statbuf;
   CdioISO9660FileList_t* p_entlist;
-  size_t i;
+  size_t i, j;
   lsn_t lsn;
-  int64_t i_file_length;
+  int64_t i_extent_length;
 
   if ((p_iso == NULL) || (psz_path == NULL))
     return 1;
@@ -210,22 +210,24 @@ static int iso_extract_files(iso9660_t* p_iso, const char 
*psz_path)
         fprintf(stderr, "  Unable to create file\n");
         goto out;
       }
-      i_file_length = p_statbuf->size;
-      for (i = 0; i_file_length > 0; i++) {
-        memset(buf, 0, ISO_BLOCKSIZE);
-        lsn = p_statbuf->lsn + i;
-        if (iso9660_iso_seek_read(p_iso, buf, lsn, 1) != ISO_BLOCKSIZE) {
-          fprintf(stderr, "  Error reading ISO9660 file %s at LSN %lu\n",
-            psz_iso_name, (long unsigned int)lsn);
-          goto out;
-        }
-        fwrite(buf, (size_t)MIN(i_file_length, ISO_BLOCKSIZE), 1, fd);
-        if (ferror(fd)) {
-         fprintf(stderr, "  Error writing file %s: %s\n", psz_iso_name,
-                 strerror(errno));
-          goto out;
+      for (j = 0; j < p_statbuf->num_extents; j++) {
+        i_extent_length = p_statbuf->extent_size[j];
+        for (i = 0; i_extent_length > 0; i++) {
+          memset(buf, 0, ISO_BLOCKSIZE);
+          lsn = p_statbuf->extent_lsn[j] + i;
+          if (iso9660_iso_seek_read(p_iso, buf, lsn, 1) != ISO_BLOCKSIZE) {
+            fprintf(stderr, "  Error reading ISO9660 file %s at LSN %lu\n",
+              psz_iso_name, (long unsigned int)lsn);
+            goto out;
+          }
+          fwrite(buf, (size_t)MIN(i_extent_length, ISO_BLOCKSIZE), 1, fd);
+          if (ferror(fd)) {
+            fprintf(stderr, "  Error writing file %s: %s\n", psz_iso_name,
+              strerror(errno));
+            goto out;
+          }
+          i_extent_length -= ISO_BLOCKSIZE;
         }
-        i_file_length -= ISO_BLOCKSIZE;
       }
       fclose(fd);
       fd = NULL;
diff --git a/example/isofile.c b/example/isofile.c
index bcfe06a5..aead4929 100644
--- a/example/isofile.c
+++ b/example/isofile.c
@@ -67,7 +67,7 @@ main(int argc, const char *argv[])
 {
   iso9660_stat_t *p_statbuf;
   FILE *p_outfd;
-  int i;
+  int i, j;
   char const *psz_image;
   char const *psz_fname;
   iso9660_t *p_iso;
@@ -115,29 +115,26 @@ main(int argc, const char *argv[])
     }
 
   /* Copy the blocks from the ISO-9660 filesystem to the local filesystem. */
-  {
-    const unsigned int i_blocks = CEILING(p_statbuf->size, ISO_BLOCKSIZE);
-    for (i = 0; i < i_blocks ; i++) 
-    {
+  for (j = 0; j < p_statbuf->num_extents; j++) {
+    const unsigned int i_blocks = CEILING(p_statbuf->extent_size[j], 
ISO_BLOCKSIZE);
+    for (i = 0; i < i_blocks ; i++) {
       char buf[ISO_BLOCKSIZE];
-      const lsn_t lsn = p_statbuf->lsn + i;
+      const lsn_t lsn = p_statbuf->extent_lsn[j] + i;
 
       memset (buf, 0, ISO_BLOCKSIZE);
-      
-      if ( ISO_BLOCKSIZE != iso9660_iso_seek_read (p_iso, buf, lsn, 1) )
-      {
+
+      if ( ISO_BLOCKSIZE != iso9660_iso_seek_read (p_iso, buf, lsn, 1) ) {
        fprintf(stderr, "Error reading ISO 9660 file %s at LSN %lu\n",
                psz_fname, (long unsigned int) lsn);
        my_exit(4);
       }
-      
+
       fwrite (buf, ISO_BLOCKSIZE, 1, p_outfd);
-      
-      if (ferror (p_outfd))
-       {
-         perror ("fwrite()");
-         my_exit(5);
-       }
+
+      if (ferror (p_outfd)) {
+       perror ("fwrite()");
+       my_exit(5);
+      }
     }
   }
   
diff --git a/example/isofile2.c b/example/isofile2.c
index 7148f2fb..b9ff85ff 100644
--- a/example/isofile2.c
+++ b/example/isofile2.c
@@ -79,7 +79,7 @@ main(int argc, const char *argv[])
 {
   iso9660_stat_t *p_statbuf;
   FILE *p_outfd;
-  int i;
+  int i, j;
   char const *psz_image;
   char const *psz_fname;
   char translated_name[256];
@@ -135,28 +135,27 @@ main(int argc, const char *argv[])
     }
 
   /* Copy the blocks from the ISO-9660 filesystem to the local filesystem. */
-  {
-    const unsigned int i_blocks = CEILING(p_statbuf->size, ISO_BLOCKSIZE);
+  for (j = 0; j < p_statbuf->num_extents; j++) {
+    const unsigned int i_blocks = CEILING(p_statbuf->extent_size[j], 
ISO_BLOCKSIZE);
     for (i = 0; i < i_blocks; i ++) {
-       char buf[ISO_BLOCKSIZE];
-       const lsn_t lsn = p_statbuf->lsn + i;
+      char buf[ISO_BLOCKSIZE];
+      const lsn_t lsn = p_statbuf->extent_lsn[j] + i;
 
-       memset (buf, 0, ISO_BLOCKSIZE);
+      memset (buf, 0, ISO_BLOCKSIZE);
 
-       if ( 0 != cdio_read_data_sectors (p_cdio, buf, lsn, ISO_BLOCKSIZE, 1) )
-         {
-           fprintf(stderr, "Error reading ISO 9660 file at lsn %lu\n",
-                   (long unsigned int) p_statbuf->lsn);
-           my_exit(4);
-         }
+      if ( 0 != cdio_read_data_sectors (p_cdio, buf, lsn, ISO_BLOCKSIZE, 1) ) {
+       fprintf(stderr, "Error reading ISO 9660 file at lsn %lu\n",
+               (long unsigned int) lsn);
+       my_exit(4);
+      }
 
-       fwrite (buf, ISO_BLOCKSIZE, 1, p_outfd);
+      fwrite (buf, ISO_BLOCKSIZE, 1, p_outfd);
 
-       if (ferror (p_outfd)) {
-           perror ("fwrite()");
-           my_exit(5);
-       }
+      if (ferror (p_outfd)) {
+       perror ("fwrite()");
+       my_exit(5);
       }
+    }
   }
 
 
diff --git a/example/isolist.c b/example/isolist.c
index 1168250b..2a6c4b32 100644
--- a/example/isolist.c
+++ b/example/isolist.c
@@ -52,6 +52,7 @@
 
 #include <cdio/cdio.h>
 #include <cdio/iso9660.h>
+#include <inttypes.h>
 
 #define print_vd_info(title, fn)         \
   if (fn(p_iso, &psz_str)) {             \
@@ -68,7 +69,8 @@ main(int argc, const char *argv[])
   CdioListNode_t *p_entnode;
   char const *psz_fname;
   iso9660_t *p_iso;
-  const char *psz_path="/";
+  const char *psz_path = "/";
+  char psz_extents[] = " [# extents]";
 
   if (argc > 1)
     psz_fname = argv[1];
@@ -105,15 +107,18 @@ main(int argc, const char *argv[])
       iso9660_stat_t *p_statbuf =
        (iso9660_stat_t *) _cdio_list_node_data (p_entnode);
       iso9660_name_translate(p_statbuf->filename, filename);
-      printf ("%s [LSN %6d] %8u %s%s\n",
-             _STAT_DIR == p_statbuf->type ? "d" : "-",
-             p_statbuf->lsn, p_statbuf->size, psz_path, filename);
+
+       if (p_statbuf->num_extents > 1)
+           psz_extents[2] = '0' + p_statbuf->num_extents;
+       printf ("%s [LSN %8d] %12" PRIi64 " %s%s%s\n",
+               _STAT_DIR == p_statbuf->type ? "d" : "-",
+               p_statbuf->extent_lsn[0], p_statbuf->total_size, psz_path, 
filename,
+               p_statbuf->num_extents < 2 ? "" : psz_extents);
     }
 
-   iso9660_filelist_free(p_entlist);
+    iso9660_filelist_free(p_entlist);
   }
 
-
   iso9660_close(p_iso);
   return 0;
 }
diff --git a/include/cdio/iso9660.h b/include/cdio/iso9660.h
index c653cdb8..819834b9 100644
--- a/include/cdio/iso9660.h
+++ b/include/cdio/iso9660.h
@@ -156,6 +156,9 @@ extern enum iso_vd_enum_s {
 /*! \brief Maximum number of characters in a volume-set id. */
 #define ISO_MAX_VOLUMESET_ID 128
 
+/*! \brief Maximum number of multi file extent licdio supports. */
+#define ISO_MAX_MULTIEXTENT 8
+
 /*! String inside frame which identifies an ISO 9660 filesystem. This
     string is the "id" field of an iso9660_pvd_t or an iso9660_svd_t.
 */
@@ -163,6 +166,8 @@ extern const char ISO_STANDARD_ID[sizeof("CD001")-1];
 
 #define ISO_STANDARD_ID      "CD001"
 
+#define CDIO_EXTENT_BLOCKS(size) ((size + (ISO_BLOCKSIZE - 1)) / ISO_BLOCKSIZE)
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -529,17 +534,32 @@ typedef CdioList_t CdioISO9660DirList_t;
 */
 struct iso9660_stat_s { /* big endian!! */
 
- iso_rock_statbuf_t rr;              /**< Rock Ridge-specific fields  */
+  iso_rock_statbuf_t rr;              /**< Rock Ridge-specific fields  */
 
   struct tm          tm;              /**< time on entry - FIXME merge with
                                          one of entries above, like ctime? */
+#ifndef DO_NOT_WANT_COMPATIBILITY
+  /* Legacy API (Deprecated) */
   lsn_t              lsn;             /**< start logical sector number */
-  uint32_t           size;            /**< total size in bytes */
-  uint32_t           secsize;         /**< number of sectors allocated */
+  uint32_t           size;            /**< size of the first extent, in bytes 
*/
+  uint32_t           secsize;         /**< size of the first extent, in 
sectors */
+#endif /* DO_NOT_WANT_COMPATIBILITY */
+
+  /* Multi-Extent API */
+  uint32_t           num_extents;     /**< number of extents */
+                     /**v combined size of all extents, in bytes */
+  uint64_t           total_size;
+                     /**v start logical sector number for each extent */
+  lsn_t              extent_lsn[ISO_MAX_MULTIEXTENT];
+                     /**v size of each extent */
+  uint32_t           extent_size[ISO_MAX_MULTIEXTENT];
+  /* NB: If you need to access the 'secsize' equivalent for an extent,
+   * you should use CDIO_EXTENT_BLOCKS(extent_size[extent_nr]) */
+
   iso9660_xa_t       xa;              /**< XA attributes */
   enum { _STAT_FILE = 1, _STAT_DIR = 2 } type;
   bool               b_xa;
-  char         filename[EMPTY_ARRAY_SIZE]; /**< filename */
+  char               filename[EMPTY_ARRAY_SIZE];    /**< filename */
 };
 
 /** A mask used in iso9660_ifs_read_vd which allows what kinds
diff --git a/lib/iso9660/iso9660_fs.c b/lib/iso9660/iso9660_fs.c
index 33f47711..2d48fab3 100644
--- a/lib/iso9660/iso9660_fs.c
+++ b/lib/iso9660/iso9660_fs.c
@@ -299,8 +299,8 @@ check_pvd (const iso9660_pvd_t *p_pvd, cdio_log_level_t 
log_level)
 
   if (strncmp (p_pvd->id, ISO_STANDARD_ID, strlen (ISO_STANDARD_ID)))
     {
-      cdio_log (log_level, "unexpected ID encountered (expected `"
-               ISO_STANDARD_ID "', got `%.5s')", p_pvd->id);
+      cdio_log (log_level, "unexpected ID encountered (expected '"
+               ISO_STANDARD_ID "', got '%.5s')", p_pvd->id);
       return false;
     }
   return true;
@@ -777,39 +777,59 @@ iso9660_check_dir_block_end(iso9660_dir_t *p_iso9660_dir, 
unsigned *offset)
 
 
 static iso9660_stat_t *
-_iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, bool_3way_t b_xa,
-                        uint8_t u_joliet_level)
+_iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir,
+                        iso9660_stat_t *last_p_stat,
+                        bool_3way_t b_xa, uint8_t u_joliet_level)
 {
   uint8_t dir_len= iso9660_get_dir_len(p_iso9660_dir);
   iso711_t i_fname;
   unsigned int stat_len;
-  iso9660_stat_t *p_stat = NULL;
+  iso9660_stat_t *p_stat = last_p_stat;
+  char rr_fname[256] = "";
+  int  i_rr_fname;
 
   if (!dir_len) return NULL;
 
-  i_fname  = from_711(p_iso9660_dir->filename.len);
+  i_fname = from_711(p_iso9660_dir->filename.len);
 
   /* .. string in statbuf is one longer than in p_iso9660_dir's listing '\1' */
-  stat_len      = sizeof(iso9660_stat_t)+i_fname+2;
+  stat_len = sizeof(iso9660_stat_t) + i_fname + 2;
 
-  p_stat          = calloc(1, stat_len);
+  /* Reuse multiextent p_stat if not NULL */
   if (!p_stat)
-    {
+    p_stat = calloc(1, stat_len);
+  if (!p_stat) {
     cdio_warn("Couldn't calloc(1, %d)", stat_len);
     return NULL;
-    }
+  }
   p_stat->type    = (p_iso9660_dir->file_flags & ISO_DIRECTORY)
     ? _STAT_DIR : _STAT_FILE;
-  p_stat->lsn     = from_733 (p_iso9660_dir->extent);
-  p_stat->size    = from_733 (p_iso9660_dir->size);
-  p_stat->secsize = _cdio_len2blocks (p_stat->size, ISO_BLOCKSIZE);
+  p_stat->extent_lsn[p_stat->num_extents] = from_733 (p_iso9660_dir->extent);
+  p_stat->extent_size[p_stat->num_extents] = from_733 (p_iso9660_dir->size);
+  p_stat->total_size += p_stat->extent_size[p_stat->num_extents];
   p_stat->rr.b3_rock = dunno; /*FIXME should do based on mask */
   p_stat->b_xa    = false;
 
-  {
-    char rr_fname[256] = "";
+#ifndef DO_NOT_WANT_COMPATIBILITY
+  if (p_stat->num_extents == 0) {
+    p_stat->lsn = p_stat->extent_lsn[0];
+    p_stat->size = p_stat->extent_size[0];
+    p_stat->secsize = CDIO_EXTENT_BLOCKS(p_stat->extent_size[0]);
+  }
+#endif /* DO_NOT_WANT_COMPATIBILITY */
 
-    int  i_rr_fname =
+  /* Only resolve the full filename when we're not dealing with extent */
+  if ((p_iso9660_dir->file_flags & ISO_MULTIEXTENT) == 0)
+  {
+    /* Check if this is the last part of a multiextent file */
+    if (p_stat->num_extents != 0) {
+      if (strcmp(p_stat->filename, &p_iso9660_dir->filename.str[1]) != 0) {
+       cdio_warn("Non consecutive multiextent file parts for '%s'", 
p_stat->filename);
+       free(p_stat);
+       return NULL;
+      }
+    }
+    i_rr_fname =
 #ifdef HAVE_ROCK
       get_rock_ridge_filename(p_iso9660_dir, rr_fname, p_stat);
 #else
@@ -856,8 +876,17 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, 
bool_3way_t b_xa,
        strncpy (p_stat->filename, &p_iso9660_dir->filename.str[1], i_fname);
       }
     }
+  } else {
+      /* Use the plain ISO-9660 name when dealing with a multiextent file part 
*/
+      strncpy(p_stat->filename, &p_iso9660_dir->filename.str[1], i_fname);
   }
-
+  if (p_stat->num_extents >= ISO_MAX_MULTIEXTENT) {
+      cdio_warn("Warning: Too many multiextent file parts for '%s'", 
p_stat->filename);
+      free(p_stat->rr.psz_symlink);
+      free(p_stat);
+      return NULL;
+  }
+  p_stat->num_extents++;
 
   iso9660_get_dtime(&(p_iso9660_dir->recording_time), true, &(p_stat->tm));
 
@@ -979,8 +1008,8 @@ _fs_stat_root (CdIo_t *p_cdio)
     p_iso9660_dir = &(p_env->pvd.root_directory_record) ;
 #endif
 
-    p_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, b_xa,
-                                     p_env->u_joliet_level);
+    p_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, NULL,
+                                     b_xa, p_env->u_joliet_level);
     return p_stat;
   }
 
@@ -1000,7 +1029,8 @@ _ifs_stat_root (iso9660_t *p_iso)
   p_iso9660_dir = &(p_iso->pvd.root_directory_record) ;
 #endif
 
-  p_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, p_iso->b_xa,
+  p_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, NULL,
+                                   p_iso->b_xa,
                                    p_iso->u_joliet_level);
   return p_stat;
 }
@@ -1011,6 +1041,7 @@ _fs_stat_traverse (const CdIo_t *p_cdio, const 
iso9660_stat_t *_root,
 {
   unsigned offset = 0;
   uint8_t *_dirbuf = NULL;
+  uint32_t blocks;
   iso9660_stat_t *p_stat;
   generic_img_private_t *p_env = (generic_img_private_t *) p_cdio->env;
 
@@ -1031,19 +1062,20 @@ _fs_stat_traverse (const CdIo_t *p_cdio, const 
iso9660_stat_t *_root,
     return NULL;
 
   cdio_assert (_root->type == _STAT_DIR);
+  blocks = CDIO_EXTENT_BLOCKS(_root->extent_size[0]);
 
-  _dirbuf = calloc(1, _root->secsize * ISO_BLOCKSIZE);
+  _dirbuf = calloc(1, blocks * ISO_BLOCKSIZE);
   if (!_dirbuf)
     {
-    cdio_warn("Couldn't calloc(1, %d)", _root->secsize * ISO_BLOCKSIZE);
+    cdio_warn("Couldn't calloc(1, %d)", blocks * ISO_BLOCKSIZE);
     return NULL;
     }
 
-  if (cdio_read_data_sectors (p_cdio, _dirbuf, _root->lsn, ISO_BLOCKSIZE,
-                             _root->secsize))
+  if (cdio_read_data_sectors (p_cdio, _dirbuf, _root->extent_lsn[0], 
ISO_BLOCKSIZE,
+                             blocks))
       return NULL;
 
-  while (offset < (_root->secsize * ISO_BLOCKSIZE))
+  while (offset < (blocks * ISO_BLOCKSIZE))
     {
       iso9660_dir_t *p_iso9660_dir = (void *) &_dirbuf[offset];
       iso9660_stat_t *p_iso9660_stat;
@@ -1052,8 +1084,8 @@ _fs_stat_traverse (const CdIo_t *p_cdio, const 
iso9660_stat_t *_root,
       if (iso9660_check_dir_block_end(p_iso9660_dir, &offset))
        continue;
 
-      p_iso9660_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, dunno,
-                                       p_env->u_joliet_level);
+      p_iso9660_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, NULL,
+                                       dunno, p_env->u_joliet_level);
 
       cmp = strcmp(splitpath[0], p_iso9660_stat->filename);
 
@@ -1090,7 +1122,7 @@ _fs_stat_traverse (const CdIo_t *p_cdio, const 
iso9660_stat_t *_root,
       offset += iso9660_get_dir_len(p_iso9660_dir);
     }
 
-  cdio_assert (offset == (_root->secsize * ISO_BLOCKSIZE));
+  cdio_assert (offset == (blocks * ISO_BLOCKSIZE));
 
   /* not found */
   free (_dirbuf);
@@ -1103,11 +1135,13 @@ _fs_iso_stat_traverse (iso9660_t *p_iso, const 
iso9660_stat_t *_root,
 {
   unsigned offset = 0;
   uint8_t *_dirbuf = NULL;
-  int ret;
+  uint32_t blocks; 
+  int ret, cmp;
+  iso9660_stat_t *p_stat = NULL;
+  iso9660_dir_t *p_iso9660_dir = NULL;
 
   if (!splitpath[0])
     {
-      iso9660_stat_t *p_stat;
       unsigned int len=sizeof(iso9660_stat_t) + strlen(_root->filename)+1;
       p_stat = calloc(1, len);
       cdio_assert (p_stat != NULL);
@@ -1124,30 +1158,30 @@ _fs_iso_stat_traverse (iso9660_t *p_iso, const 
iso9660_stat_t *_root,
 
   cdio_assert (_root->type == _STAT_DIR);
 
-  _dirbuf = calloc(1, _root->secsize * ISO_BLOCKSIZE);
+  blocks = CDIO_EXTENT_BLOCKS(_root->extent_size[0]);
+  _dirbuf = calloc(1, blocks * ISO_BLOCKSIZE);
   if (!_dirbuf)
     {
-    cdio_warn("Couldn't calloc(1, %d)", _root->secsize * ISO_BLOCKSIZE);
+    cdio_warn("Couldn't calloc(1, %d)", blocks * ISO_BLOCKSIZE);
     return NULL;
     }
 
-  ret = iso9660_iso_seek_read (p_iso, _dirbuf, _root->lsn, _root->secsize);
-  if (ret!=ISO_BLOCKSIZE*_root->secsize) {
+  ret = iso9660_iso_seek_read (p_iso, _dirbuf, _root->extent_lsn[0], blocks);
+  if (ret != blocks * ISO_BLOCKSIZE) {
     free(_dirbuf);
     return NULL;
   }
 
-  while (offset < (_root->secsize * ISO_BLOCKSIZE))
+  for (offset = 0; offset < (blocks * ISO_BLOCKSIZE);
+       offset += iso9660_get_dir_len(p_iso9660_dir))
     {
-      iso9660_dir_t *p_iso9660_dir = (void *) &_dirbuf[offset];
-      iso9660_stat_t *p_stat;
-      int cmp;
+      p_iso9660_dir = (void *) &_dirbuf[offset];
 
       if (iso9660_check_dir_block_end(p_iso9660_dir, &offset))
        continue;
 
-      p_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, p_iso->b_xa,
-                                       p_iso->u_joliet_level);
+      p_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, p_stat,
+                                       p_iso->b_xa, p_iso->u_joliet_level);
 
       if (!p_stat) {
        cdio_warn("Bad directory information for %s", splitpath[0]);
@@ -1155,6 +1189,10 @@ _fs_iso_stat_traverse (iso9660_t *p_iso, const 
iso9660_stat_t *_root,
        return NULL;
       }
 
+      /* If we have multiextent file parts, loop until the last one */
+      if (p_iso9660_dir->file_flags & ISO_MULTIEXTENT)
+        continue;
+
       cmp = strcmp(splitpath[0], p_stat->filename);
 
       if ( 0 != cmp && 0 == p_iso->u_joliet_level
@@ -1185,11 +1223,10 @@ _fs_iso_stat_traverse (iso9660_t *p_iso, const 
iso9660_stat_t *_root,
        return ret_stat;
       }
       iso9660_stat_free(p_stat);
-
-      offset += iso9660_get_dir_len(p_iso9660_dir);
+      p_stat = NULL;
     }
 
-  cdio_assert (offset == (_root->secsize * ISO_BLOCKSIZE));
+  cdio_assert (offset == (blocks * ISO_BLOCKSIZE));
 
   /* not found */
   free (_dirbuf);
@@ -1354,6 +1391,8 @@ CdioISO9660FileList_t *
 iso9660_fs_readdir (CdIo_t *p_cdio, const char psz_path[])
 {
   generic_img_private_t *p_env;
+  iso9660_dir_t *p_iso9660_dir;
+  iso9660_stat_t *p_iso9660_stat = NULL;
   iso9660_stat_t *p_stat;
 
   if (!p_cdio)   return NULL;
@@ -1372,40 +1411,46 @@ iso9660_fs_readdir (CdIo_t *p_cdio, const char 
psz_path[])
   {
     unsigned offset = 0;
     uint8_t *_dirbuf = NULL;
+    uint32_t blocks = CDIO_EXTENT_BLOCKS(p_stat->extent_size[0]);
     CdioISO9660DirList_t *retval = _cdio_list_new ();
 
-    _dirbuf = calloc(1, p_stat->secsize * ISO_BLOCKSIZE);
+    _dirbuf = calloc(1, blocks * ISO_BLOCKSIZE);
     if (!_dirbuf)
       {
-      cdio_warn("Couldn't calloc(1, %d)", p_stat->secsize * ISO_BLOCKSIZE);
+      cdio_warn("Couldn't calloc(1, %d)", blocks * ISO_BLOCKSIZE);
       iso9660_stat_free(p_stat);
       iso9660_dirlist_free(retval);
       return NULL;
       }
 
-    if (cdio_read_data_sectors (p_cdio, _dirbuf, p_stat->lsn,
-                               ISO_BLOCKSIZE, p_stat->secsize)) {
+    if (cdio_read_data_sectors (p_cdio, _dirbuf, p_stat->extent_lsn[0],
+                               ISO_BLOCKSIZE, blocks)) {
       iso9660_stat_free(p_stat);
       iso9660_dirlist_free(retval);
       return NULL;
     }
 
-    while (offset < (p_stat->secsize * ISO_BLOCKSIZE))
+    while (offset < (blocks * ISO_BLOCKSIZE))
       {
-       iso9660_dir_t *p_iso9660_dir = (void *) &_dirbuf[offset];
-       iso9660_stat_t *p_iso9660_stat;
+       p_iso9660_dir = (void *) &_dirbuf[offset];
 
        if (iso9660_check_dir_block_end(p_iso9660_dir, &offset))
          continue;
 
-       p_iso9660_stat = _iso9660_dir_to_statbuf(p_iso9660_dir, dunno,
+       p_iso9660_stat = _iso9660_dir_to_statbuf(p_iso9660_dir,
+                                                p_iso9660_stat, dunno,
                                                 p_env->u_joliet_level);
-       _cdio_list_append (retval, p_iso9660_stat);
+       if ((p_iso9660_stat) &&
+           ((p_iso9660_dir->file_flags & ISO_MULTIEXTENT) == 0))
+         {
+           _cdio_list_append (retval, p_iso9660_stat);
+           p_iso9660_stat = NULL;
+         }
 
        offset += iso9660_get_dir_len(p_iso9660_dir);
       }
 
-    cdio_assert (offset == (p_stat->secsize * ISO_BLOCKSIZE));
+    cdio_assert (offset == (blocks * ISO_BLOCKSIZE));
 
     free(_dirbuf);
     iso9660_stat_free(p_stat);
@@ -1420,6 +1465,8 @@ iso9660_fs_readdir (CdIo_t *p_cdio, const char psz_path[])
 CdioISO9660FileList_t *
 iso9660_ifs_readdir (iso9660_t *p_iso, const char psz_path[])
 {
+  iso9660_dir_t *p_iso9660_dir;
+  iso9660_stat_t *p_iso9660_stat = NULL;
   iso9660_stat_t *p_stat;
 
   if (!p_iso)    return NULL;
@@ -1437,13 +1484,14 @@ iso9660_ifs_readdir (iso9660_t *p_iso, const char 
psz_path[])
     long int ret;
     unsigned offset = 0;
     uint8_t *_dirbuf = NULL;
+    uint32_t blocks = CDIO_EXTENT_BLOCKS(p_stat->extent_size[0]);
     CdioList_t *retval = _cdio_list_new ();
-    const size_t dirbuf_len = p_stat->secsize * ISO_BLOCKSIZE;
+    const size_t dirbuf_len = blocks * ISO_BLOCKSIZE;
 
 
     if (!dirbuf_len)
       {
-        cdio_warn("Invalid directory buffer sector size %u", p_stat->secsize);
+        cdio_warn("Invalid directory buffer sector size %u", blocks);
        iso9660_stat_free(p_stat);
        _cdio_list_free (retval, true, NULL);
         return NULL;
@@ -1458,7 +1506,7 @@ iso9660_ifs_readdir (iso9660_t *p_iso, const char 
psz_path[])
         return NULL;
       }
 
-    ret = iso9660_iso_seek_read (p_iso, _dirbuf, p_stat->lsn, p_stat->secsize);
+    ret = iso9660_iso_seek_read (p_iso, _dirbuf, p_stat->extent_lsn[0], 
blocks);
     if (ret != dirbuf_len)       {
       _cdio_list_free (retval, true, NULL);
       iso9660_stat_free(p_stat);
@@ -1468,21 +1516,21 @@ iso9660_ifs_readdir (iso9660_t *p_iso, const char 
psz_path[])
 
     while (offset < (dirbuf_len))
       {
-       iso9660_dir_t *p_iso9660_dir = (void *) &_dirbuf[offset];
-       iso9660_stat_t *p_iso9660_stat;
+       p_iso9660_dir = (void *) &_dirbuf[offset];
 
        if (iso9660_check_dir_block_end(p_iso9660_dir, &offset))
          continue;
 
-       p_iso9660_stat = _iso9660_dir_to_statbuf(p_iso9660_dir, p_iso->b_xa,
+       p_iso9660_stat = _iso9660_dir_to_statbuf(p_iso9660_dir,
+                                                p_iso9660_stat,
+                                                p_iso->b_xa,
                                                 p_iso->u_joliet_level);
-
-       if (p_iso9660_stat)
-         _cdio_list_append (retval, p_iso9660_stat);
-       else {
-         cdio_warn("Invalid directory stat at offset %lu", (unsigned 
long)offset);
-         break;
-       }
+       if ((p_iso9660_stat) &&
+           ((p_iso9660_dir->file_flags & ISO_MULTIEXTENT) == 0))
+         {
+           _cdio_list_append(retval, p_iso9660_stat);
+           p_iso9660_stat = NULL;
+         }
 
        offset += iso9660_get_dir_len(p_iso9660_dir);
       }
@@ -1530,6 +1578,7 @@ find_lsn_recurse (void *p_image, iso9660_readdir_t 
iso9660_readdir,
       iso9660_stat_t *statbuf = _cdio_list_node_data (entnode);
       const char *psz_filename  = (char *) statbuf->filename;
       unsigned int len = strlen(psz_path) + strlen(psz_filename)+2;
+      size_t extent;
 
       if (*ppsz_full_filename != NULL) free(*ppsz_full_filename);
       *ppsz_full_filename = calloc(1, len);
@@ -1538,25 +1587,26 @@ find_lsn_recurse (void *p_image, iso9660_readdir_t 
iso9660_readdir,
       if (statbuf->type == _STAT_DIR
           && strcmp ((char *) statbuf->filename, ".")
           && strcmp ((char *) statbuf->filename, "..")) {
-       snprintf (*ppsz_full_filename, len, "%s%s/", psz_path, psz_filename);
+        snprintf (*ppsz_full_filename, len, "%s%s/", psz_path, psz_filename);
         _cdio_list_append (dirlist, strdup(*ppsz_full_filename));
       }
 
-      if (statbuf->lsn == lsn) {
-       const unsigned int len2 = 
sizeof(iso9660_stat_t)+strlen(statbuf->filename)+1;
-       iso9660_stat_t *ret_stat = calloc(1, len2);
-       if (!ret_stat)
-         {
-           iso9660_dirlist_free(dirlist);
-           cdio_warn("Couldn't calloc(1, %d)", len2);
-           free(*ppsz_full_filename);
-           *ppsz_full_filename = NULL;
-           return NULL;
-         }
-       memcpy(ret_stat, statbuf, len2);
-        iso9660_filelist_free (entlist);
-       iso9660_dirlist_free(dirlist);
-        return ret_stat;
+      for (extent = 0; extent < statbuf->num_extents; extent++) {
+        if (statbuf->extent_lsn[extent] == lsn) {
+          const unsigned int len2 = sizeof(iso9660_stat_t) + 
strlen(statbuf->filename) + 1;
+          iso9660_stat_t *ret_stat = calloc(1, len2);
+          if (!ret_stat) {
+            iso9660_dirlist_free(dirlist);
+            cdio_warn("Couldn't calloc(1, %d)", len2);
+            free(*ppsz_full_filename);
+            *ppsz_full_filename = NULL;
+            return NULL;
+          }
+          memcpy(ret_stat, statbuf, len2);
+          iso9660_filelist_free (entlist);
+          iso9660_dirlist_free(dirlist);
+          return ret_stat;
+        }
       }
 
     }
@@ -1576,7 +1626,7 @@ find_lsn_recurse (void *p_image, iso9660_readdir_t 
iso9660_readdir,
                                   ppsz_full_filename);
 
       if (NULL != ret_stat) {
-       iso9660_dirlist_free(dirlist);
+        iso9660_dirlist_free(dirlist);
         return ret_stat;
       }
     }
@@ -1726,6 +1776,7 @@ iso_have_rr_traverse (iso9660_t *p_iso, const 
iso9660_stat_t *_root,
 {
   unsigned offset = 0;
   uint8_t *_dirbuf = NULL;
+  uint32_t blocks;
   int ret;
   bool_3way_t have_rr = nope;
 
@@ -1736,53 +1787,54 @@ iso_have_rr_traverse (iso9660_t *p_iso, const 
iso9660_stat_t *_root,
 
   cdio_assert (_root->type == _STAT_DIR);
 
-  _dirbuf = calloc(1, _root->secsize * ISO_BLOCKSIZE);
+   blocks = CDIO_EXTENT_BLOCKS(_root->extent_size[0]);
+  _dirbuf = calloc(1, blocks * ISO_BLOCKSIZE);
   if (!_dirbuf)
     {
-    cdio_warn("Couldn't calloc(1, %d)", _root->secsize * ISO_BLOCKSIZE);
+    cdio_warn("Couldn't calloc(1, %d)", blocks * ISO_BLOCKSIZE);
     return dunno;
     }
 
-  ret = iso9660_iso_seek_read (p_iso, _dirbuf, _root->lsn, _root->secsize);
-  if (ret!=ISO_BLOCKSIZE*_root->secsize) {
+  ret = iso9660_iso_seek_read (p_iso, _dirbuf, _root->extent_lsn[0], blocks);
+  if (ret != blocks * ISO_BLOCKSIZE) {
     free(_dirbuf);
     return false;
   }
 
-  while (offset < (_root->secsize * ISO_BLOCKSIZE))
+  while (offset < (blocks * ISO_BLOCKSIZE))
     {
       iso9660_dir_t *p_iso9660_dir = (void *) &_dirbuf[offset];
       iso9660_stat_t *p_stat;
       unsigned int i_last_component = 1;
 
       if (iso9660_check_dir_block_end(p_iso9660_dir, &offset))
-       continue;
+        continue;
 
-      p_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, p_iso->b_xa,
+      p_stat = _iso9660_dir_to_statbuf (p_iso9660_dir, NULL, p_iso->b_xa,
                                        p_iso->u_joliet_level);
       have_rr = p_stat->rr.b3_rock;
       if ( have_rr != yep) {
-       if (strlen(splitpath[0]) == 0)
-         have_rr = false;
-       else
-         have_rr = iso_have_rr_traverse (p_iso, p_stat, 
&splitpath[i_last_component],
+        if (strlen(splitpath[0]) == 0)
+          have_rr = false;
+        else
+          have_rr = iso_have_rr_traverse (p_iso, p_stat, 
&splitpath[i_last_component],
                                          pu_file_limit);
       }
       free(p_stat);
       if (have_rr != nope) {
-       free (_dirbuf);
-       return have_rr;
+        free (_dirbuf);
+        return have_rr;
       }
 
       offset += iso9660_get_dir_len(p_iso9660_dir);
       *pu_file_limit = (*pu_file_limit)-1;
       if ((*pu_file_limit) == 0) {
-       free (_dirbuf);
-       return dunno;
+        free (_dirbuf);
+        return dunno;
       }
     }
 
-  cdio_assert (offset == (_root->secsize * ISO_BLOCKSIZE));
+  cdio_assert (offset == (blocks * ISO_BLOCKSIZE));
 
   /* not found */
   free (_dirbuf);
diff --git a/src/iso-read.c b/src/iso-read.c
index 86474859..c1eb05bb 100644
--- a/src/iso-read.c
+++ b/src/iso-read.c
@@ -211,7 +211,7 @@ static int read_iso_file(const char *iso_name, const char 
*src,
                          FILE *outfd, size_t *bytes_written)
 {
   iso9660_stat_t *statbuf;
-  int i;
+  int i, j;
   iso9660_t *iso;
 
   iso = iso9660_open (iso_name);
@@ -239,22 +239,21 @@ static int read_iso_file(const char *iso_name, const char 
*src,
 
 
   /* Copy the blocks from the ISO-9660 filesystem to the local filesystem. */
-  for (i = 0; i < statbuf->size; i += ISO_BLOCKSIZE)
-    {
+  for (j = 0; j < statbuf->num_extents; j++) {
+    for (i = 0; i < statbuf->extent_size[j]; i += ISO_BLOCKSIZE) {
       char buf[ISO_BLOCKSIZE];
 
       memset (buf, 0, ISO_BLOCKSIZE);
 
-      if ( ISO_BLOCKSIZE != iso9660_iso_seek_read (iso, buf, statbuf->lsn
+      if ( ISO_BLOCKSIZE != iso9660_iso_seek_read (iso, buf, 
statbuf->extent_lsn[j]
                                                    + (i / ISO_BLOCKSIZE),
                                                    1) )
       {
         report(stderr, "Error reading ISO 9660 file at lsn %lu\n",
-               (long unsigned int) statbuf->lsn + (i / ISO_BLOCKSIZE));
+               (long unsigned int) statbuf->extent_lsn[j] + (i / 
ISO_BLOCKSIZE));
         if (!opts.ignore) return 4;
       }
 
-
       fwrite (buf, ISO_BLOCKSIZE, 1, outfd);
 
       if (ferror (outfd))
@@ -263,6 +262,7 @@ static int read_iso_file(const char *iso_name, const char 
*src,
           return 5;
         }
     }
+  }
   iso9660_close(iso);
 
   *bytes_written = statbuf->size;
diff --git a/src/util.c b/src/util.c
index dde2f40f..fda59564 100644
--- a/src/util.c
+++ b/src/util.c
@@ -488,10 +488,18 @@ print_fs_attrs(iso9660_stat_t *p_statbuf, bool b_rock, 
bool b_xa,
             p_statbuf->rr.st_nlinks,
             p_statbuf->rr.st_uid,
             p_statbuf->rr.st_gid,
+#ifndef DO_NOT_WANT_COMPATIBILITY
             (long unsigned int) p_statbuf->lsn,
+#else
+            (long unsigned int) p_statbuf->extent_lsn[0],
+#endif
             S_ISLNK(p_statbuf->rr.st_mode)
             ? strlen(p_statbuf->rr.psz_symlink)
+#ifndef DO_NOT_WANT_COMPATIBILITY
             : (unsigned int) p_statbuf->size );
+#else
+            : (unsigned int) p_statbuf->total_size );
+#endif
 
   } else
 #endif
@@ -501,19 +509,37 @@ print_fs_attrs(iso9660_stat_t *p_statbuf, bool b_rock, 
bool b_xa,
             uint16_from_be (p_statbuf->xa.user_id),
             uint16_from_be (p_statbuf->xa.group_id),
             p_statbuf->xa.filenum,
+#ifndef DO_NOT_WANT_COMPATIBILITY
             (long unsigned int) p_statbuf->lsn );
+#else
+            (long unsigned int) p_statbuf->extent_lsn[0] );
+#endif
 
     if (uint16_from_be(p_statbuf->xa.attributes) & XA_ATTR_MODE2FORM2) {
       report ( stdout, "%9u (%9u)",
+#ifndef DO_NOT_WANT_COMPATIBILITY
               (unsigned int) p_statbuf->secsize * M2F2_SECTOR_SIZE,
               (unsigned int) p_statbuf->size );
+#else
+              (unsigned int) CDIO_EXTENT_BLOCKS(p_statbuf->extent_size[0])* 
M2F2_SECTOR_SIZE,
+              (unsigned int) p_statbuf->total_size );
+#endif
     } else
+#ifndef DO_NOT_WANT_COMPATIBILITY
       report (stdout, "%9u", (unsigned int) p_statbuf->size);
+#else
+      report (stdout, "%9u", (unsigned int) p_statbuf->total_size);
+#endif
   } else {
     report ( stdout,"  %c [LSN %6lu] %9u",
             (p_statbuf->type == _STAT_DIR) ? 'd' : '-',
+#ifndef DO_NOT_WANT_COMPATIBILITY
             (long unsigned int) p_statbuf->lsn,
             (unsigned int) p_statbuf->size );
+#else
+            (long unsigned int) p_statbuf->extent_lsn[0],
+            (unsigned int) p_statbuf->total_size );
+#endif
   }
 
   if (yep == p_statbuf->rr.b3_rock && b_rock) {
diff --git a/test/testisocd.c b/test/testisocd.c
index 6b1f60b6..f1fac826 100644
--- a/test/testisocd.c
+++ b/test/testisocd.c
@@ -99,7 +99,7 @@ main(int argc, const char *argv[])
 
       char buf[ISO_BLOCKSIZE];
       char *psz_path = NULL;
-      const lsn_t i_lsn = p_statbuf->lsn;
+      const lsn_t i_lsn = p_statbuf->extent_lsn[0];
       iso9660_stat_t *p_statbuf2 = iso9660_fs_find_lsn (p_cdio, i_lsn);
       iso9660_stat_t *p_statbuf3 =
        iso9660_fs_find_lsn_with_path (p_cdio, i_lsn, &psz_path);
@@ -107,7 +107,7 @@ main(int argc, const char *argv[])
       const unsigned int statbuf_test_size = 100;
 
       /* Compare the two statbufs. */
-      if (p_statbuf->lsn != p_statbuf2->lsn ||
+      if (p_statbuf->extent_lsn[0] != p_statbuf2->extent_lsn[0] ||
          p_statbuf->size != p_statbuf2->size ||
          p_statbuf->type != p_statbuf2->type) {
          fprintf(stderr, "File stat information between fs_stat and "
@@ -143,7 +143,7 @@ main(int argc, const char *argv[])
       if ( 0 != cdio_read_data_sectors (p_cdio, buf, i_lsn, ISO_BLOCKSIZE, 1) )
        {
          fprintf(stderr, "Error reading ISO 9660 file at lsn %lu\n",
-                 (long unsigned int) p_statbuf->lsn);
+                 (long unsigned int) p_statbuf->extent_lsn[0]);
          rc=7;
        }
     exit:
diff --git a/test/testisocd2.c b/test/testisocd2.c
index a1187764..e104a9da 100644
--- a/test/testisocd2.c
+++ b/test/testisocd2.c
@@ -105,13 +105,13 @@ main(int argc, const char *argv[])
       /* Now try getting the statbuf another way */
       char buf[ISO_BLOCKSIZE];
       char *psz_path = NULL;
-      const lsn_t i_lsn = p_statbuf->lsn;
+      const lsn_t i_lsn = p_statbuf->extent_lsn[0];
       iso9660_stat_t *p_statbuf2 = iso9660_ifs_find_lsn (p_iso, i_lsn);
       iso9660_stat_t *p_statbuf3 =
        iso9660_ifs_find_lsn_with_path (p_iso, i_lsn, &psz_path);
 
       /* Compare the two statbufs. */
-      if (p_statbuf->lsn != p_statbuf2->lsn ||
+      if (p_statbuf->extent_lsn[0] != p_statbuf2->extent_lsn[0] ||
          p_statbuf->size != p_statbuf2->size ||
          p_statbuf->type != p_statbuf2->type) {
 
@@ -121,7 +121,7 @@ main(int argc, const char *argv[])
          goto exit;
       }
 
-      if (p_statbuf3->lsn != p_statbuf2->lsn ||
+      if (p_statbuf3->extent_lsn[0] != p_statbuf2->extent_lsn[0] ||
          p_statbuf3->size != p_statbuf2->size ||
          p_statbuf3->type != p_statbuf2->type) {
        rc = 4;
@@ -147,7 +147,7 @@ main(int argc, const char *argv[])
       if ( ISO_BLOCKSIZE != iso9660_iso_seek_read (p_iso, buf, i_lsn, 1) )
        {
          fprintf(stderr, "Error reading ISO 9660 file at lsn %lu\n",
-                 (long unsigned int) p_statbuf->lsn);
+                 (long unsigned int) p_statbuf->extent_lsn[0]);
          rc = 7;
          goto exit;
        }
diff --git a/test/testisocd_joliet.c b/test/testisocd_joliet.c
index 8eedc2f2..347d17ea 100644
--- a/test/testisocd_joliet.c
+++ b/test/testisocd_joliet.c
@@ -106,7 +106,7 @@ main(int argc, const char *argv[])
       /* Now try getting the statbuf another way */
       char buf[ISO_BLOCKSIZE];
       char *psz_path = NULL;
-      const lsn_t i_lsn = p_statbuf->lsn;
+      const lsn_t i_lsn = p_statbuf->extent_lsn[0];
       iso9660_stat_t *p_statbuf2 = iso9660_ifs_find_lsn (p_iso, i_lsn);
       iso9660_stat_t *p_statbuf3 =
        iso9660_ifs_find_lsn_with_path (p_iso, i_lsn, &psz_path);
@@ -114,16 +114,16 @@ main(int argc, const char *argv[])
       const unsigned int statbuf_test_size = 100;
 
       /* Compare the two statbufs. */
-      if (p_statbuf->lsn != p_statbuf2->lsn ||
+      if (p_statbuf->extent_lsn[0] != p_statbuf2->extent_lsn[0] ||
          p_statbuf->size != p_statbuf2->size ||
          p_statbuf->type != p_statbuf2->type) {
 
          fprintf(stderr, "File stat information between fs_stat and "
                  "iso9660_ifs_find_lsn isn't the same\n");
          printf("statbuf  lsn: %d, size: %d, type: %d\n",
-                p_statbuf->lsn, p_statbuf->size, p_statbuf->type);
+                p_statbuf->extent_lsn[0], p_statbuf->extent_size[0], 
p_statbuf->type);
          printf("statbuf2 lsn: %d, size: %d, type: %d\n",
-                p_statbuf2->lsn, p_statbuf2->size, p_statbuf2->type);
+                p_statbuf2->extent_lsn[0], p_statbuf2->extent_size[0], 
p_statbuf2->type);
          rc=3;
          goto exit;
       }
@@ -157,7 +157,7 @@ main(int argc, const char *argv[])
       if ( ISO_BLOCKSIZE != iso9660_iso_seek_read (p_iso, buf, i_lsn, 1) )
        {
          fprintf(stderr, "Error reading ISO 9660 file at lsn %lu\n",
-                 (long unsigned int) p_statbuf->lsn);
+                 (long unsigned int) p_statbuf->extent_lsn[0]);
          rc=7;
        }
     exit:
-- 
2.17.0.windows.1


reply via email to

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