diff --git a/include/cdio/iso9660.h b/include/cdio/iso9660.h index aee51dd2..da25e1d1 100644 --- a/include/cdio/iso9660.h +++ b/include/cdio/iso9660.h @@ -1,5 +1,5 @@ /* - $Id: iso9660.h,v 1.7 2003/08/31 05:00:44 rocky Exp $ + $Id: iso9660.h,v 1.8 2003/08/31 06:59:23 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2003 Rocky Bernstein @@ -25,6 +25,8 @@ /* Will eventually need/use glib.h */ #include +#include + #define MIN_TRACK_SIZE 4*75 #define MIN_ISO_SIZE MIN_TRACK_SIZE @@ -111,6 +113,8 @@ typedef struct iso9660_dir iso9660_dir_t; PRAGMA_END_PACKED +typedef struct iso9660_stat iso9660_stat_t; + char * iso9660_strncpy_pad(char dst[], const char src[], size_t len, enum strncpy_pad_check _check); @@ -163,21 +167,11 @@ iso9660_dir_add_entry_su (void *dir, const char name[], uint32_t extent, unsigned iso9660_dir_calc_record_size (unsigned namelen, unsigned int su_len); -/* pathtable */ +int +iso9660_fs_stat (CdIo *obj,const char pathname[], iso9660_stat_t *buf); -void -iso9660_pathtable_init (void *pt); - -unsigned int -iso9660_pathtable_get_size (const void *pt); - -uint16_t -iso9660_pathtable_l_add_entry (void *pt, const char name[], uint32_t extent, - uint16_t parent); - -uint16_t -iso9660_pathtable_m_add_entry (void *pt, const char name[], uint32_t extent, - uint16_t parent); +void * /* list of char* -- caller must free it */ +iso9660_fs_readdir (CdIo *obj, const char pathname[]); uint8_t iso9660_get_dir_len(const iso9660_dir_t *idr); @@ -208,7 +202,54 @@ iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ; lsn_t iso9660_get_root_lsn(const iso9660_pvd_t *pvd); +/* pathtable */ +void +iso9660_pathtable_init (void *pt); + +unsigned int +iso9660_pathtable_get_size (const void *pt); + +uint16_t +iso9660_pathtable_l_add_entry (void *pt, const char name[], uint32_t extent, + uint16_t parent); + +uint16_t +iso9660_pathtable_m_add_entry (void *pt, const char name[], uint32_t extent, + uint16_t parent); + + +/*! + Returns a string which interpreting the extended attribute xa_attr. + For example: + \verbatim + d---1xrxrxr + ---2--r-r-r + -a--1xrxrxr + \endverbatim + + A description of the characters in the string follows + The 1st character is either "d" if the entry is a directory, or "-" if not + The 2nd character is either "a" if the entry is CDDA (audio), or "-" if not + The 3rd character is either "i" if the entry is interleaved, or "-" if not + The 4th character is either "2" if the entry is mode2 form2 or "-" if not + The 5th character is either "1" if the entry is mode2 form1 or "-" if not + Note that an entry will either be in mode2 form1 or mode form2. That + is you will either see "2-" or "-1" in the 4th & 5th positions. + + The 6th and 7th characters refer to permissions for everyone while the + the 8th and 9th characters refer to permissions for a group while, and + the 10th and 11th characters refer to permissions for a user. + + In each of these pairs the first character (6, 8, 10) is "x" if the + entry is executable. For a directory this means the directory is + allowed to be listed or "searched". + The second character of a pair (7, 9, 11) is "r" if the entry is allowed + to be read. +*/ +const char * +iso9660_get_xa_attr_str (uint16_t xa_attr); + #endif /* __CDIO_ISO9660_H__ */ diff --git a/lib/Makefile.am b/lib/Makefile.am index 7ecee9d5..ad1b19a8 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.9 2003/08/17 05:31:19 rocky Exp $ +# $Id: Makefile.am,v 1.10 2003/08/31 06:59:23 rocky Exp $ # # Copyright (C) 2003 Rocky Bernstein # @@ -50,6 +50,9 @@ lib_LTLIBRARIES = libcdio.la libiso9660.la libcdio_la_SOURCES = $(libcdio_sources) libiso9660_la_SOURCES = \ iso9660.c \ - iso9660_private.h + iso9660_private.h \ + iso9660_fs.c \ + iso9660_fs.h \ + xa.h INCLUDES = -I$(LIBCDIO_CFLAGS) diff --git a/lib/iso9660_fs.c b/lib/iso9660_fs.c new file mode 100644 index 00000000..23d2dec7 --- /dev/null +++ b/lib/iso9660_fs.c @@ -0,0 +1,331 @@ +/* + $Id: iso9660_fs.c,v 1.1 2003/08/31 06:59:23 rocky Exp $ + + Copyright (C) 2001 Herbert Valerio Riedel + Copyright (C) 2003 Rocky Bernstein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include +#include + +/* Private headers */ +#include "iso9660_fs.h" + +static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.1 2003/08/31 06:59:23 rocky Exp $"; + +#define BUF_COUNT 16 +#define BUF_SIZE 80 + +/* Return a pointer to a internal free buffer */ +static char * +_getbuf (void) +{ + static char _buf[BUF_COUNT][BUF_SIZE]; + static int _num = -1; + + _num++; + _num %= BUF_COUNT; + + memset (_buf[_num], 0, BUF_SIZE); + + return _buf[_num]; +} + +static void +_idr2statbuf (const iso9660_dir_t *idr, iso9660_stat_t *buf) +{ + iso9660_xa_t *xa_data = NULL; + int su_length = 0; + + memset ((void *) buf, 0, sizeof (iso9660_stat_t)); + + if (!iso9660_get_dir_len(idr)) + return; + + cdio_assert (iso9660_get_dir_len(idr) >= sizeof (iso9660_dir_t)); + + buf->type = (idr->flags & ISO_DIRECTORY) ? _STAT_DIR : _STAT_FILE; + buf->lsn = from_733 (idr->extent); + buf->size = from_733 (idr->size); + buf->secsize = _cdio_len2blocks (buf->size, ISO_BLOCKSIZE); + + su_length = iso9660_get_dir_len(idr) - sizeof (iso9660_dir_t); + su_length -= idr->name_len; + + if (su_length % 2) + su_length--; + + if (su_length < 0 || su_length < sizeof (iso9660_xa_t)) + return; + + xa_data = (void *) (((char *) idr) + (iso9660_get_dir_len(idr) - su_length)); + + if (xa_data->signature[0] != 'X' + || xa_data->signature[1] != 'A') + { + cdio_warn ("XA signature not found in ISO9660's system use area;" + " ignoring XA attributes for this file entry."); + cdio_debug ("%d %d %d, '%c%c' (%d, %d)", iso9660_get_dir_len(idr), + idr->name_len, + su_length, + xa_data->signature[0], xa_data->signature[1], + xa_data->signature[0], xa_data->signature[1]); + return; + } + + buf->xa = *xa_data; +} + +static char * +_idr2name (const iso9660_dir_t *idr) +{ + char namebuf[256] = { 0, }; + + if (!iso9660_get_dir_len(idr)) + return NULL; + + cdio_assert (iso9660_get_dir_len(idr) >= sizeof (iso9660_dir_t)); + + /* (idr->flags & ISO_DIRECTORY) */ + + if (idr->name[0] == '\0') + strcpy (namebuf, "."); + else if (idr->name[0] == '\1') + strcpy (namebuf, ".."); + else + strncpy (namebuf, idr->name, idr->name_len); + + return strdup (namebuf); +} + + +static void +_fs_stat_root (CdIo *obj, iso9660_stat_t *buf) +{ + char block[ISO_BLOCKSIZE] = { 0, }; + const iso9660_pvd_t *pvd = (void *) █ + const iso9660_dir_t *idr = (void *) pvd->root_directory_record; + + if (cdio_read_mode2_sector (obj, &block, ISO_PVD_SECTOR, false)) + cdio_assert_not_reached (); + + _idr2statbuf (idr, buf); +} + +static int +_fs_stat_traverse (CdIo *obj, const iso9660_stat_t *_root, char **splitpath, + iso9660_stat_t *buf) +{ + unsigned offset = 0; + uint8_t *_dirbuf = NULL; + + if (!splitpath[0]) + { + *buf = *_root; + return 0; + } + + if (_root->type == _STAT_FILE) + return -1; + + cdio_assert (_root->type == _STAT_DIR); + + if (_root->size != ISO_BLOCKSIZE * _root->secsize) + { + cdio_warn ("bad size for ISO9660 directory (%ud) should be (%d)!", + (unsigned) _root->size, ISO_BLOCKSIZE * _root->secsize); + } + + _dirbuf = _cdio_malloc (_root->secsize * ISO_BLOCKSIZE); + + if (cdio_read_mode2_sectors (obj, _dirbuf, _root->lsn, false, + _root->secsize)) + cdio_assert_not_reached (); + + while (offset < (_root->secsize * ISO_BLOCKSIZE)) + { + const iso9660_dir_t *idr + = (void *) &_dirbuf[offset]; + iso9660_stat_t _stat; + + char *_name; + + if (!iso9660_get_dir_len(idr)) + { + offset++; + continue; + } + + _name = _idr2name (idr); + _idr2statbuf (idr, &_stat); + + if (!strcmp (splitpath[0], _name)) + { + int retval = _fs_stat_traverse (obj, &_stat, &splitpath[1], buf); + free (_name); + free (_dirbuf); + return retval; + } + + free (_name); + + offset += iso9660_get_dir_len(idr); + } + + cdio_assert (offset == (_root->secsize * ISO_BLOCKSIZE)); + + /* not found */ + free (_dirbuf); + return -1; +} + +int +iso9660_fs_stat (CdIo *obj, const char pathname[], + iso9660_stat_t *buf) +{ + iso9660_stat_t _root; + int retval; + char **splitpath; + + cdio_assert (obj != NULL); + cdio_assert (pathname != NULL); + cdio_assert (buf != NULL); + + _fs_stat_root (obj, &_root); + + splitpath = _cdio_strsplit (pathname, '/'); + retval = _fs_stat_traverse (obj, &_root, splitpath, buf); + _cdio_strfreev (splitpath); + + return retval; +} + +void * /* list of char* -- caller must free it */ +iso9660_fs_readdir (CdIo *obj, const char pathname[]) +{ + iso9660_stat_t _stat; + + cdio_assert (obj != NULL); + cdio_assert (pathname != NULL); + + if (iso9660_fs_stat (obj, pathname, &_stat)) + return NULL; + + if (_stat.type != _STAT_DIR) + return NULL; + + { + unsigned offset = 0; + uint8_t *_dirbuf = NULL; + CdioList *retval = _cdio_list_new (); + + if (_stat.size != ISO_BLOCKSIZE * _stat.secsize) + { + cdio_warn ("bad size for ISO9660 directory (%ud) should be (%d)!", + (unsigned) _stat.size, ISO_BLOCKSIZE * _stat.secsize); + } + + _dirbuf = _cdio_malloc (_stat.secsize * ISO_BLOCKSIZE); + + if (cdio_read_mode2_sectors (obj, _dirbuf, _stat.lsn, false, + _stat.secsize)) + cdio_assert_not_reached (); + + while (offset < (_stat.secsize * ISO_BLOCKSIZE)) + { + const iso9660_dir_t *idr = (void *) &_dirbuf[offset]; + + if (!iso9660_get_dir_len(idr)) + { + offset++; + continue; + } + + _cdio_list_append (retval, _idr2name (idr)); + + offset += iso9660_get_dir_len(idr); + } + + cdio_assert (offset == (_stat.secsize * ISO_BLOCKSIZE)); + + free (_dirbuf); + return retval; + } +} + +/*! + Returns a string which interpreting the extended attribute xa_attr. + For example: + \verbatim + d---1xrxrxr + ---2--r-r-r + -a--1xrxrxr + \endverbatim + + A description of the characters in the string follows + The 1st character is either "d" if the entry is a directory, or "-" if not. + The 2nd character is either "a" if the entry is CDDA (audio), or "-" if not. + The 3rd character is either "i" if the entry is interleaved, or "-" if not. + The 4th character is either "2" if the entry is mode2 form2 or "-" if not. + The 5th character is either "1" if the entry is mode2 form1 or "-" if not. + Note that an entry will either be in mode2 form1 or mode form2. That + is you will either see "2-" or "-1" in the 4th & 5th positions. + + The 6th and 7th characters refer to permissions for everyone while the + the 8th and 9th characters refer to permissions for a group while, and + the 10th and 11th characters refer to permissions for a user. + + In each of these pairs the first character (6, 8, 10) is "x" if the + entry is executable. For a directory this means the directory is + allowed to be listed or "searched". + The second character of a pair (7, 9, 11) is "r" if the entry is allowed + to be read. +*/ + +const char * +iso9660_get_xa_attr_str (uint16_t xa_attr) +{ + char *result = _getbuf(); + + xa_attr = uint16_from_be (xa_attr); + + result[0] = (xa_attr & XA_ATTR_DIRECTORY) ? 'd' : '-'; + result[1] = (xa_attr & XA_ATTR_CDDA) ? 'a' : '-'; + result[2] = (xa_attr & XA_ATTR_INTERLEAVED) ? 'i' : '-'; + result[3] = (xa_attr & XA_ATTR_MODE2FORM2) ? '2' : '-'; + result[4] = (xa_attr & XA_ATTR_MODE2FORM1) ? '1' : '-'; + + result[5] = (xa_attr & XA_ATTR_O_EXEC) ? 'x' : '-'; + result[6] = (xa_attr & XA_ATTR_O_READ) ? 'r' : '-'; + + result[7] = (xa_attr & XA_ATTR_G_EXEC) ? 'x' : '-'; + result[8] = (xa_attr & XA_ATTR_G_READ) ? 'r' : '-'; + + result[9] = (xa_attr & XA_ATTR_U_EXEC) ? 'x' : '-'; + result[10] = (xa_attr & XA_ATTR_U_READ) ? 'r' : '-'; + + result[11] = '\0'; + + return result; +} + diff --git a/lib/iso9660_fs.h b/lib/iso9660_fs.h new file mode 100644 index 00000000..5c288da0 --- /dev/null +++ b/lib/iso9660_fs.h @@ -0,0 +1,31 @@ +/* + $Id: iso9660_fs.h,v 1.1 2003/08/31 06:59:23 rocky Exp $ + + Copyright (C) 2001 Herbert Valerio Riedel + Copyright (C) 2003 Rocky Bernstein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __ISO9660_IMAGE_FS_H__ +#define __ISO9660_IMAGE_FS_H__ + +#include + +/* Private includes */ +#include "ds.h" +#include "xa.h" + +#endif /* __ISO9660_IMAGE_FS_H__ */ diff --git a/lib/xa.h b/lib/xa.h new file mode 100644 index 00000000..2dcf3787 --- /dev/null +++ b/lib/xa.h @@ -0,0 +1,114 @@ +/* + $Id: xa.h,v 1.1 2003/08/31 06:59:23 rocky Exp $ + + Copyright (C) 2000 Herbert Valerio Riedel + Copyright (C) 2003 Rocky Bernstein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __CDIO_XA_H__ +#define __CDIO_XA_H__ + +/* Public headers */ +#include +#include +#include + +/* Private headers */ +#include "cdio_assert.h" +#include "bytesex.h" + +/* XA attribute definitions */ +#define XA_ATTR_U_READ (1 << 0) +/* reserved */ +#define XA_ATTR_U_EXEC (1 << 2) +/* reserved */ +#define XA_ATTR_G_READ (1 << 4) +/* reserved */ +#define XA_ATTR_G_EXEC (1 << 6) +/* reserved */ +#define XA_ATTR_O_READ (1 << 8) +/* reserved */ +#define XA_ATTR_O_EXEC (1 << 10) + +#define XA_ATTR_MODE2FORM1 (1 << 11) +#define XA_ATTR_MODE2FORM2 (1 << 12) +#define XA_ATTR_INTERLEAVED (1 << 13) +#define XA_ATTR_CDDA (1 << 14) +#define XA_ATTR_DIRECTORY (1 << 15) + +/* some aggregations */ +#define XA_PERM_ALL_READ (XA_ATTR_U_READ | XA_ATTR_G_READ | XA_ATTR_O_READ) +#define XA_PERM_ALL_EXEC (XA_ATTR_U_EXEC | XA_ATTR_G_EXEC | XA_ATTR_O_EXEC) +#define XA_PERM_ALL_ALL (XA_PERM_ALL_READ | XA_PERM_ALL_EXEC) + +/* the struct */ + +PRAGMA_BEGIN_PACKED +typedef struct /* big endian!! */ +{ + uint16_t user_id; /* 0 */ + uint16_t group_id; /* 0 */ + uint16_t attributes; /* XA_ATTR_ */ + uint8_t signature[2]; /* { 'X', 'A' } */ + uint8_t filenum; /* file number, see also XA subheader */ + uint8_t reserved[5]; /* zero */ +} GNUC_PACKED iso9660_xa_t; + +PRAGMA_END_PACKED + +struct iso9660_stat { + enum { _STAT_FILE = 1, _STAT_DIR = 2 } type; + lsn_t lsn; /* start logical sector number */ + uint32_t size; /* total size in bytes */ + uint32_t secsize; /* number of sectors allocated */ + iso9660_xa_t xa; /* XA attributes */ +}; + +#define iso9660_xa_t_SIZEOF 14 + +static inline iso9660_xa_t * +iso9660_xa_new (void) +{ + return _cdio_malloc (sizeof (iso9660_xa_t)); +} + +static inline iso9660_xa_t * +iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr, + uint8_t filenum) +{ + cdio_assert (_xa != NULL); + + + _xa->user_id = uint16_to_be (uid); + _xa->group_id = uint16_to_be (gid); + _xa->attributes = uint16_to_be (attr); + + _xa->signature[0] = 'X'; + _xa->signature[1] = 'A'; + + _xa->filenum = filenum; + + _xa->reserved[0] + = _xa->reserved[1] + = _xa->reserved[2] + = _xa->reserved[3] + = _xa->reserved[4] = 0x00; + + return _xa; +} + +#endif /* __VCD_XA_H__ */ diff --git a/src/Makefile.am b/src/Makefile.am index 2394fcff..0ef88402 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.13 2003/08/16 15:34:58 rocky Exp $ +# $Id: Makefile.am,v 1.14 2003/08/31 06:59:23 rocky Exp $ # # Copyright (C) 2003 Rocky Bernstein # @@ -23,7 +23,7 @@ CDDB_LIBS=@CDDB_LIBS@ if BUILD_CDINFO cd_info_SOURCES = cd-info.c -cd_info_LDADD = $(LIBCDIO_LIBS) $(LIBPOPT_LIBS) $(CDDB_LIBS) $(VCDINFO_LIBS) +cd_info_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LIBPOPT_LIBS) $(CDDB_LIBS) $(VCDINFO_LIBS) if BUILD_CDINFO_LINUX cdinfo_linux_SOURCES = cdinfo-linux.c diff --git a/src/cd-info.c b/src/cd-info.c index 666055c5..4bc29f39 100644 --- a/src/cd-info.c +++ b/src/cd-info.c @@ -1,5 +1,5 @@ /* - $Id: cd-info.c,v 1.24 2003/08/31 04:02:05 rocky Exp $ + $Id: cd-info.c,v 1.25 2003/08/31 06:59:23 rocky Exp $ Copyright (C) 2003 Rocky Bernstein Copyright (C) 1996,1997,1998 Gerd Knorr @@ -53,8 +53,10 @@ #include #include #include +#include #include "ds.h" +#include "xa.h" #include "iso9660_private.h" #include @@ -157,6 +159,7 @@ struct arguments int silent; int version_only; int no_header; + int print_iso9660; source_image_t source_image; } opts; @@ -242,6 +245,9 @@ struct poptOption optionsTable[] = { OP_SOURCE_AUTO, "set source and determine if \"bin\" image or device", "FILE"}, + {"iso9660", '\0', POPT_ARG_NONE, &opts.print_iso9660, 0, + "print directory contents of any ISO-9660 filesystems"}, + {"cdrom-device", 'C', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, OP_SOURCE_DEVICE, "set CD-ROM device as source", "DEVICE"}, @@ -590,15 +596,14 @@ print_vcd_info(void) { } #endif -#if ISO9600_FINISHED static void -print_iso9660_recurse (const CdIo *cdio, const char pathname[]) +print_iso9660_recurse (CdIo *cdio, const char pathname[], cdio_fs_anal_t fs) { CdioList *entlist; CdioList *dirlist = _cdio_list_new (); CdioListNode *entnode; - entlist = vcd_image_source_fs_readdir (cdio, pathname); + entlist = iso9660_fs_readdir (cdio, pathname); printf ("%s:\n", pathname); @@ -610,11 +615,11 @@ print_iso9660_recurse (const CdIo *cdio, const char pathname[]) { char *_name = _cdio_list_node_data (entnode); char _fullname[4096] = { 0, }; - vcd_image_stat_t statbuf; + iso9660_stat_t statbuf; snprintf (_fullname, sizeof (_fullname), "%s%s", pathname, _name); - if (vcd_image_source_fs_stat (cdio, _fullname, &statbuf)) + if (iso9660_fs_stat (cdio, _fullname, &statbuf)) cdio_assert_not_reached (); strncat (_fullname, "/", sizeof (_fullname)); @@ -624,23 +629,24 @@ print_iso9660_recurse (const CdIo *cdio, const char pathname[]) && strcmp (_name, "..")) _cdio_list_append (dirlist, strdup (_fullname)); - printf ( " %c %s %d %d [fn %.2d] [LSN %6d] ", - (statbuf.type == _STAT_DIR) ? 'd' : '-', - vcdinfo_get_xa_attr_str (statbuf.xa.attributes), - uint16_from_be (statbuf.xa.user_id), - uint16_from_be (statbuf.xa.group_id), - statbuf.xa.filenum, - statbuf.lsn); - - if (uint16_from_be(statbuf.xa.attributes) & XA_ATTR_MODE2FORM2) { - printf ("%9d (%9d)", - statbuf.secsize * M2F2_SECTOR_SIZE, - statbuf.size); - } else { - printf ("%9d", statbuf.size); + if (fs & CDIO_FS_ANAL_XA) { + printf ( " %c %s %d %d [fn %.2d] [LSN %6d] ", + (statbuf.type == _STAT_DIR) ? 'd' : '-', + iso9660_get_xa_attr_str (statbuf.xa.attributes), + uint16_from_be (statbuf.xa.user_id), + uint16_from_be (statbuf.xa.group_id), + statbuf.xa.filenum, + statbuf.lsn); + + if (uint16_from_be(statbuf.xa.attributes) & XA_ATTR_MODE2FORM2) { + printf ("%9d (%9d)", + statbuf.secsize * M2F2_SECTOR_SIZE, + statbuf.size); + } else { + printf ("%9d", statbuf.size); + } } printf (" %s\n", _name); - } _cdio_list_free (entlist, true); @@ -653,14 +659,14 @@ print_iso9660_recurse (const CdIo *cdio, const char pathname[]) { char *_fullname = _cdio_list_node_data (entnode); - print_iso9660_recurse (cdio, _fullname); + print_iso9660_recurse (cdio, _fullname, fs); } _cdio_list_free (dirlist, true); } static void -print_iso9660_fs (CdIo *cdio) +print_iso9660_fs (CdIo *cdio, cdio_fs_anal_t fs) { iso9660_pvd_t pvd; @@ -672,10 +678,9 @@ print_iso9660_fs (CdIo *cdio) printf ("ISO9660 filesystem\n"); printf (" root dir in PVD set to lsn %d\n\n", extent); - print_iso9660_recurse (cdio, "/"); + print_iso9660_recurse (cdio, "/", fs); } } -#endif /*ISO9600_FINISHED*/ static void print_analysis(int ms_offset, cdio_analysis_t cdio_analysis, @@ -737,6 +742,8 @@ print_analysis(int ms_offset, cdio_analysis_t cdio_analysis, case CDIO_FS_ISO_HFS: printf("ISO 9660: %i blocks, label `%.32s'\n", cdio_analysis.isofs_size, cdio_analysis.iso_label); + if (opts.print_iso9660) + print_iso9660_fs(cdio, fs); break; } need_lf = 0; @@ -813,6 +820,7 @@ main(int argc, const char *argv[]) opts.no_header = false; opts.debug_level = 0; opts.no_tracks = 0; + opts.print_iso9660 = 0; #ifdef HAVE_CDDB opts.no_cddb = 0; opts.cddb_port = 8880; diff --git a/test/check_cue.sh.in b/test/check_cue.sh.in index 8fb98ca3..c7bca4d6 100644 --- a/test/check_cue.sh.in +++ b/test/check_cue.sh.in @@ -1,11 +1,13 @@ #!/bin/sh -#$Id: check_cue.sh.in,v 1.4 2003/08/29 11:10:01 rocky Exp $ +#$Id: check_cue.sh.in,v 1.5 2003/08/31 06:59:23 rocky Exp $ if test -n "@CDDB_LIB@" ; then cddb_opt='--no-cddb' fi if test -n "@VCDINFO_LIBS@" ; then vcd_opt='--no-vcd' +else + vcd_opt='--iso9660' fi if test -z $srcdir ; then diff --git a/test/check_nrg.sh.in b/test/check_nrg.sh.in index 1ee84c87..596e6012 100755 --- a/test/check_nrg.sh.in +++ b/test/check_nrg.sh.in @@ -1,8 +1,10 @@ #!/bin/sh -#$Id: check_nrg.sh.in,v 1.3 2003/08/29 11:10:01 rocky Exp $ +#$Id: check_nrg.sh.in,v 1.4 2003/08/31 06:59:23 rocky Exp $ if test -n "@VCDINFO_LIBS@" ; then vcd_opt='--no-vcd' +else + vcd_opt='--iso9660' fi if test -z $srcdir ; then @@ -30,7 +32,7 @@ if test -f $nrg_file ; then test_cdinfo "--nrg-file $nrg_file $vcd_opt " \ monvoisin.dump ${srcdir}/monvoisin.right RC=$? - check_result $RC 'cd-info NRG test 1' + check_result $RC 'cd-info NRG test 2' else echo "Don't see NRG file ${nrg_file}. Test skipped." exit 0 @@ -38,10 +40,10 @@ fi nrg_file=${srcdir}/svcdgs.nrg if test -f $nrg_file ; then - test_cdinfo "--nrg-file $nrg_file" \ + test_cdinfo "--nrg-file $nrg_file $vcd_opt " \ svcdgs.dump ${srcdir}/svcdgs.right RC=$? - check_result $RC 'cd-info NRG test 2' + check_result $RC 'cd-info NRG test 3' exit $RC else diff --git a/test/monvoisin.right b/test/monvoisin.right index f6485eb1..a9015f0e 100644 --- a/test/monvoisin.right +++ b/test/monvoisin.right @@ -11,6 +11,50 @@ __________________________________ CD Analysis Report CD-ROM with CD-RTOS and ISO 9660 filesystem ISO 9660: 1101 blocks, label `MONVOISIN ' +ISO9660 filesystem + root dir in PVD set to lsn 18 + +/: + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 CDI + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 EXT + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 MPEGAV + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 SEGMENT + d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 VCD + +/CDI/: + d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ---2-xrxrxr 0 0 [fn 01] [LSN 211] 1494332 ( 1315168) CDI_IMAG.RTF;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 854] 13616 CDI_TEXT.FNT;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 861] 102400 CDI_VCD.APP;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 911] 279 CDI_VCD.CFG;1 + +/EXT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ----1xrxrxr 0 0 [fn 01] [LSN 912] 65536 LOT_X.VCD;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 944] 24 PSD_X.VCD;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 945] 114 SCANDATA.DAT;1 + +/MPEGAV/: + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ---2-xrxrxr 0 0 [fn 01] [LSN 1251] 3655652 ( 3221504) AVSEQ01.DAT;1 + +/SEGMENT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + +/VCD/: + d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ----1xrxrxr 0 0 [fn 00] [LSN 151] 2048 ENTRIES.VCD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 150] 2048 INFO.VCD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 152] 65536 LOT.VCD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 184] 24 PSD.VCD;1 + XA sectors Video CD session #2 starts at track 2, LSN: 1251, ISO 9660 blocks: 1101 ISO 9660: 1101 blocks, label `MONVOISIN ' diff --git a/test/svcd_ogt_test_ntsc.right b/test/svcd_ogt_test_ntsc.right index 5acb6e20..0b03123c 100644 --- a/test/svcd_ogt_test_ntsc.right +++ b/test/svcd_ogt_test_ntsc.right @@ -11,6 +11,42 @@ __________________________________ CD Analysis Report CD-ROM with CD-RTOS and ISO 9660 filesystem ISO 9660: 376 blocks, label `SVCD_OGT_TEST_NTSC ' +ISO9660 filesystem + root dir in PVD set to lsn 18 + +/: + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 EXT + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 MPEG2 + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 SEGMENT + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 SVCD + +/EXT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ----1xrxrxr 0 0 [fn 00] [LSN 375] 201 SCANDATA.DAT;1 + +/MPEG2/: + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ---2-xrxrxr 0 0 [fn 00] [LSN 526] 7971320 ( 7024640) AVSEQ01.MPG;1 + +/SEGMENT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ---2-xrxrxr 0 0 [fn 00] [LSN 225] 183596 ( 161792) ITEM0001.MPG;1 + +/SVCD/: + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ----1xrxrxr 0 0 [fn 00] [LSN 151] 2048 ENTRIES.SVD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 150] 2048 INFO.SVD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 152] 65536 LOT.SVD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 184] 40 PSD.SVD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 186] 190 SEARCH.DAT;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 185] 2048 TRACKS.SVD;1 + XA sectors Super Video CD (SVCD) or Chaoji Video CD (CVD) session #2 starts at track 2, LSN: 526, ISO 9660 blocks: 376 ISO 9660: 376 blocks, label `SVCD_OGT_TEST_NTSC ' diff --git a/test/svcdgs.right b/test/svcdgs.right index 7ad97bab..763d1204 100644 --- a/test/svcdgs.right +++ b/test/svcdgs.right @@ -11,4 +11,64 @@ __________________________________ CD Analysis Report CD-ROM with ISO 9660 filesystem ISO 9660: 6610 blocks, label `SVCD ' +ISO9660 filesystem + root dir in PVD set to lsn 20 + +/: + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 .. + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 AUTORUN + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 DATA + d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 EXT + d d---1xrxrxr 0 0 [fn 00] [LSN 24] 2048 MPEGAV + d d---1xrxrxr 0 0 [fn 00] [LSN 25] 2048 SEGMENT + d d---1xrxrxr 0 0 [fn 00] [LSN 26] 2048 SVCD + d d---1xrxrxr 0 0 [fn 00] [LSN 27] 2048 VMP + +/AUTORUN/: + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 .. + +/DATA/: + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 .. + d d---1xrxrxr 0 0 [fn 00] [LSN 300] 2048 SVCDDATA + +/DATA/SVCDDATA/: + d d---1xrxrxr 0 0 [fn 00] [LSN 300] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 .. + +/EXT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 .. + +/MPEGAV/: + d d---1xrxrxr 0 0 [fn 00] [LSN 24] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 .. + - ---2--r-r-r 0 0 [fn 01] [LSN 463] 13909140 ( 12257280) AVSEQ01.MPG;1 + +/SEGMENT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 25] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 .. + +/SVCD/: + d d---1xrxrxr 0 0 [fn 00] [LSN 26] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 .. + - ----1-rxrxr 0 0 [fn 00] [LSN 151] 2048 ENTRIES.SVD;1 + - ----1-rxrxr 0 0 [fn 00] [LSN 150] 2048 INFO.SVD;1 + - ----1-rxrxr 0 0 [fn 00] [LSN 152] 65536 LOT.SVD;1 + - ----1-rxrxr 0 0 [fn 00] [LSN 184] 16 PSD.SVD;1 + - ----1-rxrxr 0 0 [fn 00] [LSN 188] 427 SEARCH.DAT;1 + - ----1-rxrxr 0 0 [fn 00] [LSN 186] 4096 SPICONTX.SVD;1 + - ----1-rxrxr 0 0 [fn 00] [LSN 185] 2048 TRACKS.SVD;1 + +/VMP/: + d d---1xrxrxr 0 0 [fn 00] [LSN 27] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 .. + d d---1xrxrxr 0 0 [fn 00] [LSN 28] 2048 SVCDJ + +/VMP/SVCDJ/: + d d---1xrxrxr 0 0 [fn 00] [LSN 28] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 27] 2048 .. + XA sectors Chaoji Video CD (CVD) diff --git a/test/vcd_demo.right b/test/vcd_demo.right index de72e6c9..587e7ffa 100644 --- a/test/vcd_demo.right +++ b/test/vcd_demo.right @@ -12,6 +12,74 @@ __________________________________ CD Analysis Report CD-ROM with CD-RTOS and ISO 9660 filesystem ISO 9660: 1032 blocks, label `V0469 ' +ISO9660 filesystem + root dir in PVD set to lsn 18 + +/: + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 EXT + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 MPEGAV + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 SEGMENT + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 Sources + d d---1xrxrxr 0 0 [fn 00] [LSN 25] 2048 VCD + +/EXT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ----1xrxrxr 0 0 [fn 01] [LSN 375] 65536 LOT_X.VCD;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 407] 144 PSD_X.VCD;1 + +/MPEGAV/: + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ---2-xrxrxr 0 0 [fn 01] [LSN 1182] 904036 ( 796672) AVSEQ01.DAT;1 + - ---2-xrxrxr 0 0 [fn 02] [LSN 1721] 904036 ( 796672) AVSEQ02.DAT;1 + +/SEGMENT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ---2-xrxrxr 0 0 [fn 01] [LSN 225] 220780 ( 194560) ITEM0001.DAT;1 + +/Sources/: + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 HTML + - ----1xrxrxr 0 0 [fn 01] [LSN 434] 842 index.htm;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 435] 1216557 menu.ppm;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 1030] 2793 source.xml;1 + +/Sources/HTML/: + d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 .. + - ----1xrxrxr 0 0 [fn 01] [LSN 425] 1067 0.xml;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 426] 1067 1.xml;1 + d d---1xrxrxr 0 0 [fn 00] [LSN 24] 2048 img + - ----1xrxrxr 0 0 [fn 01] [LSN 427] 1327 movies.css;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 428] 12024 toc.xsl;1 + +/Sources/HTML/img/: + d d---1xrxrxr 0 0 [fn 00] [LSN 24] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 .. + - ----1xrxrxr 0 0 [fn 01] [LSN 408] 1999 AL.gif;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 409] 7626 Loeki_Groep_01.gif;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 413] 9986 Loeki_Groep_02.gif;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 418] 207 a_left.gif;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 419] 207 a_right.gif;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 420] 441 animatie.gif;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 421] 250 face_up2.gif;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 422] 259 familie.gif;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 423] 1010 goldstar2.gif;1 + - ----1xrxrxr 0 0 [fn 01] [LSN 424] 1783 vcd.gif;1 + +/VCD/: + d d---1xrxrxr 0 0 [fn 00] [LSN 25] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ----1xrxrxr 0 0 [fn 00] [LSN 151] 2048 ENTRIES.VCD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 150] 2048 INFO.VCD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 152] 65536 LOT.VCD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 184] 72 PSD.VCD;1 + XA sectors Video CD session #2 starts at track 2, LSN: 1182, ISO 9660 blocks: 1032 ISO 9660: 1032 blocks, label `V0469 ' diff --git a/test/videocd.right b/test/videocd.right index 5dfa0b52..93fabc20 100644 --- a/test/videocd.right +++ b/test/videocd.right @@ -14,6 +14,47 @@ __________________________________ CD Analysis Report CD-ROM with CD-RTOS and ISO 9660 filesystem ISO 9660: 676 blocks, label `SVIDEOCD ' +ISO9660 filesystem + root dir in PVD set to lsn 18 + +/: + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 EXT + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 MPEG2 + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 SEGMENT + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 SVCD + +/EXT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ----1xrxrxr 0 0 [fn 00] [LSN 675] 78 SCANDATA.DAT;1 + +/MPEG2/: + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ---2-xrxrxr 0 0 [fn 00] [LSN 826] 174300 ( 153600) AVSEQ01.MPG;1 + - ---2-xrxrxr 0 0 [fn 00] [LSN 1051] 174300 ( 153600) AVSEQ02.MPG;1 + - ---2-xrxrxr 0 0 [fn 00] [LSN 1276] 174300 ( 153600) AVSEQ03.MPG;1 + - ---2-xrxrxr 0 0 [fn 00] [LSN 1501] 174300 ( 153600) AVSEQ04.MPG;1 + +/SEGMENT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ---2-xrxrxr 0 0 [fn 00] [LSN 225] 65072 ( 57344) ITEM0001.MPG;1 + - ---2-xrxrxr 0 0 [fn 00] [LSN 375] 65072 ( 57344) ITEM0002.MPG;1 + - ---2-xrxrxr 0 0 [fn 00] [LSN 525] 65072 ( 57344) ITEM0003.MPG;1 + +/SVCD/: + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 .. + - ----1xrxrxr 0 0 [fn 00] [LSN 151] 2048 ENTRIES.SVD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 150] 2048 INFO.SVD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 152] 65536 LOT.SVD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 184] 112 PSD.SVD;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 186] 40 SEARCH.DAT;1 + - ----1xrxrxr 0 0 [fn 00] [LSN 185] 2048 TRACKS.SVD;1 + XA sectors Super Video CD (SVCD) or Chaoji Video CD (CVD) session #2 starts at track 2, LSN: 826, ISO 9660 blocks: 676 ISO 9660: 676 blocks, label `SVIDEOCD '