diff --git a/include/cdio/iso9660.h b/include/cdio/iso9660.h index 2ac75824..557e3734 100644 --- a/include/cdio/iso9660.h +++ b/include/cdio/iso9660.h @@ -1,5 +1,5 @@ /* - $Id: iso9660.h,v 1.4 2003/08/31 01:40:00 rocky Exp $ + $Id: iso9660.h,v 1.5 2003/08/31 02:51:41 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2003 Rocky Bernstein @@ -56,7 +56,7 @@ enum strncpy_pad_check { /* Defined fully in iso9660_private.h */ typedef struct iso_primary_descriptor iso9660_pvd_t; - typedef struct iso_directory_record iso_directory_record_t; + typedef struct iso_directory_record iso9660_dir_t; char * iso9660_strncpy_pad(char dst[], const char src[], size_t len, @@ -127,14 +127,14 @@ iso9660_pathtable_m_add_entry (void *pt, const char name[], uint32_t extent, uint16_t parent); uint8_t -iso9660_get_dir_len(const iso_directory_record_t *idr); +iso9660_get_dir_len(const iso9660_dir_t *idr); #if FIXME uint8_t -iso9660_get_dir_size(const iso_directory_record_t *idr); +iso9660_get_dir_size(const iso9660_dir_t *idr); lsn_t -iso9660_get_dir_extent(const iso_directory_record_t *idr);# +iso9660_get_dir_extent(const iso9660_dir_t *idr);# #endif uint8_t diff --git a/lib/iso9660.c b/lib/iso9660.c index ffa9dd4b..64cacd9c 100644 --- a/lib/iso9660.c +++ b/lib/iso9660.c @@ -1,5 +1,5 @@ /* - $Id: iso9660.c,v 1.4 2003/08/31 01:40:00 rocky Exp $ + $Id: iso9660.c,v 1.5 2003/08/31 02:51:41 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2003 Rocky Bernstein @@ -37,7 +37,7 @@ #include "cdio_assert.h" #include "bytesex.h" -static const char _rcsid[] = "$Id: iso9660.c,v 1.4 2003/08/31 01:40:00 rocky Exp $"; +static const char _rcsid[] = "$Id: iso9660.c,v 1.5 2003/08/31 02:51:41 rocky Exp $"; /* some parameters... */ #define SYSTEM_ID "CD-RTOS CD-BRIDGE" @@ -648,7 +648,7 @@ iso9660_pathname_isofy (const char pathname[], uint16_t version) #if FIXME lsn_t -iso9660_get_dir_extent(const iso_directory_record_t *idr) +iso9660_get_dir_extent(const iso9660_dir_t *idr) { if (NULL == idr) return 0; return from_733(idr->extent); @@ -656,7 +656,7 @@ iso9660_get_dir_extent(const iso_directory_record_t *idr) #endif uint8_t -iso9660_get_dir_len(const iso_directory_record_t *idr) +iso9660_get_dir_len(const iso9660_dir_t *idr) { if (NULL == idr) return 0; return idr->length; @@ -664,7 +664,7 @@ iso9660_get_dir_len(const iso_directory_record_t *idr) #if FIXME uint8_t -iso9660_get_dir_size(const iso_directory_record_t *idr) +iso9660_get_dir_size(const iso9660_dir_t *idr) { if (NULL == idr) return 0; return from_733(idr->size); @@ -712,7 +712,7 @@ iso9660_get_root_lsn(const iso9660_pvd_t *pvd) if (NULL == pvd) return CDIO_INVALID_LSN; else { - iso_directory_record_t *idr = (void *) pvd->root_directory_record; + iso9660_dir_t *idr = (void *) pvd->root_directory_record; if (NULL == idr) return CDIO_INVALID_LSN; return(from_733 (idr->extent)); } diff --git a/src/cd-info.c b/src/cd-info.c index 47f674fe..6f1ff236 100644 --- a/src/cd-info.c +++ b/src/cd-info.c @@ -1,5 +1,5 @@ /* - $Id: cd-info.c,v 1.22 2003/08/29 03:03:07 rocky Exp $ + $Id: cd-info.c,v 1.23 2003/08/31 02:51:41 rocky Exp $ Copyright (C) 2003 Rocky Bernstein Copyright (C) 1996,1997,1998 Gerd Knorr @@ -54,6 +54,8 @@ #include #include +#include "ds.h" + #include #ifdef __linux__ # include @@ -587,6 +589,88 @@ print_vcd_info(void) { } #endif +#if ISO9600_FINISHED +static void +print_iso9660_recurse (const CdIo *cdio, const char pathname[]) +{ + CdioList *entlist; + CdioList *dirlist = _cdio_list_new (); + CdioListNode *entnode; + + entlist = vcd_image_source_fs_readdir (cdio, pathname); + + printf ("%s:\n", pathname); + + cdio_assert (entlist != NULL); + + /* just iterate */ + + _CDIO_LIST_FOREACH (entnode, entlist) + { + char *_name = _cdio_list_node_data (entnode); + char _fullname[4096] = { 0, }; + vcd_image_stat_t statbuf; + + snprintf (_fullname, sizeof (_fullname), "%s%s", pathname, _name); + + if (vcd_image_source_fs_stat (cdio, _fullname, &statbuf)) + cdio_assert_not_reached (); + + strncat (_fullname, "/", sizeof (_fullname)); + + if (statbuf.type == _STAT_DIR + && strcmp (_name, ".") + && 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); + } + printf (" %s\n", _name); + + } + + _cdio_list_free (entlist, true); + + printf ("\n"); + + /* now recurse */ + + _CDIO_LIST_FOREACH (entnode, dirlist) + { + char *_fullname = _cdio_list_node_data (entnode); + + print_iso9660_recurse (cdio, _fullname); + } + + _cdio_list_free (dirlist, true); +} + +static void +print_iso9660_fs (const CdIo *cdio) +{ + const iso9660_pvd_t *pvd = vcdinfo_get_pvd(cdio); + lsn_t extent = iso9660_get_root_lsn(pvd); + + printf ("ISO9660 filesystem\n"); + printf (" root dir in PVD set to lsn %d\n\n", extent); + + print_iso9660_recurse (cdio, "/"); +} +#endif + static void print_analysis(int ms_offset, cdio_analysis_t cdio_analysis, cdio_fs_anal_t fs, int first_data, unsigned int num_audio,