Make mode1 format filesystem print work.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: iso9660_fs.c,v 1.4 2003/08/31 14:26:06 rocky Exp $
|
$Id: iso9660_fs.c,v 1.5 2003/08/31 15:52:56 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -36,42 +36,42 @@
|
|||||||
#include "bytesex.h"
|
#include "bytesex.h"
|
||||||
#include "ds.h"
|
#include "ds.h"
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.4 2003/08/31 14:26:06 rocky Exp $";
|
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.5 2003/08/31 15:52:56 rocky Exp $";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_idr2statbuf (const iso9660_dir_t *idr, iso9660_stat_t *buf)
|
_idr2statbuf (const iso9660_dir_t *idr, iso9660_stat_t *buf, bool is_mode2)
|
||||||
{
|
{
|
||||||
iso9660_xa_t *xa_data = NULL;
|
iso9660_xa_t *xa_data = NULL;
|
||||||
int su_length = 0;
|
uint8_t dir_len= iso9660_get_dir_len(idr);
|
||||||
|
|
||||||
memset ((void *) buf, 0, sizeof (iso9660_stat_t));
|
memset ((void *) buf, 0, sizeof (iso9660_stat_t));
|
||||||
|
|
||||||
if (!iso9660_get_dir_len(idr))
|
if (!dir_len) return;
|
||||||
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->type = (idr->flags & ISO_DIRECTORY) ? _STAT_DIR : _STAT_FILE;
|
buf->size = from_733 (idr->size);
|
||||||
buf->lsn = from_733 (idr->extent);
|
|
||||||
buf->size = from_733 (idr->size);
|
|
||||||
buf->secsize = _cdio_len2blocks (buf->size, ISO_BLOCKSIZE);
|
buf->secsize = _cdio_len2blocks (buf->size, ISO_BLOCKSIZE);
|
||||||
|
|
||||||
su_length = iso9660_get_dir_len(idr) - sizeof (iso9660_dir_t);
|
cdio_assert (dir_len >= sizeof (iso9660_dir_t));
|
||||||
su_length -= idr->name_len;
|
|
||||||
|
|
||||||
if (su_length % 2)
|
if (is_mode2) {
|
||||||
su_length--;
|
int su_length = iso9660_get_dir_len(idr) - sizeof (iso9660_dir_t);
|
||||||
|
su_length -= idr->name_len;
|
||||||
if (su_length < 0 || su_length < sizeof (iso9660_xa_t))
|
|
||||||
return;
|
if (su_length % 2)
|
||||||
|
su_length--;
|
||||||
xa_data = (void *) (((char *) idr) + (iso9660_get_dir_len(idr) - su_length));
|
|
||||||
|
if (su_length < 0 || su_length < sizeof (iso9660_xa_t))
|
||||||
if (xa_data->signature[0] != 'X'
|
return;
|
||||||
|| xa_data->signature[1] != 'A')
|
|
||||||
|
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;"
|
cdio_warn ("XA signature not found in ISO9660's system use area;"
|
||||||
" ignoring XA attributes for this file entry.");
|
" ignoring XA attributes for this file entry.");
|
||||||
cdio_debug ("%d %d %d, '%c%c' (%d, %d)", iso9660_get_dir_len(idr),
|
cdio_debug ("%d %d %d, '%c%c' (%d, %d)", iso9660_get_dir_len(idr),
|
||||||
idr->name_len,
|
idr->name_len,
|
||||||
su_length,
|
su_length,
|
||||||
@@ -79,8 +79,9 @@ _idr2statbuf (const iso9660_dir_t *idr, iso9660_stat_t *buf)
|
|||||||
xa_data->signature[0], xa_data->signature[1]);
|
xa_data->signature[0], xa_data->signature[1]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
buf->xa = *xa_data;
|
||||||
buf->xa = *xa_data;
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@@ -121,12 +122,12 @@ _fs_stat_root (CdIo *obj, iso9660_stat_t *buf, bool is_mode2)
|
|||||||
cdio_assert_not_reached ();
|
cdio_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
_idr2statbuf (idr, buf);
|
_idr2statbuf (idr, buf, is_mode2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_fs_stat_traverse (CdIo *obj, const iso9660_stat_t *_root, char **splitpath,
|
_fs_stat_traverse (CdIo *obj, const iso9660_stat_t *_root, char **splitpath,
|
||||||
iso9660_stat_t *buf)
|
iso9660_stat_t *buf, bool is_mode2)
|
||||||
{
|
{
|
||||||
unsigned offset = 0;
|
unsigned offset = 0;
|
||||||
uint8_t *_dirbuf = NULL;
|
uint8_t *_dirbuf = NULL;
|
||||||
@@ -150,10 +151,16 @@ _fs_stat_traverse (CdIo *obj, const iso9660_stat_t *_root, char **splitpath,
|
|||||||
|
|
||||||
_dirbuf = _cdio_malloc (_root->secsize * ISO_BLOCKSIZE);
|
_dirbuf = _cdio_malloc (_root->secsize * ISO_BLOCKSIZE);
|
||||||
|
|
||||||
if (cdio_read_mode2_sectors (obj, _dirbuf, _root->lsn, false,
|
if (is_mode2) {
|
||||||
_root->secsize))
|
if (cdio_read_mode2_sectors (obj, _dirbuf, _root->lsn, false,
|
||||||
cdio_assert_not_reached ();
|
_root->secsize))
|
||||||
|
cdio_assert_not_reached ();
|
||||||
|
} else {
|
||||||
|
if (cdio_read_mode1_sectors (obj, _dirbuf, _root->lsn, false,
|
||||||
|
_root->secsize))
|
||||||
|
cdio_assert_not_reached ();
|
||||||
|
}
|
||||||
|
|
||||||
while (offset < (_root->secsize * ISO_BLOCKSIZE))
|
while (offset < (_root->secsize * ISO_BLOCKSIZE))
|
||||||
{
|
{
|
||||||
const iso9660_dir_t *idr
|
const iso9660_dir_t *idr
|
||||||
@@ -169,11 +176,12 @@ _fs_stat_traverse (CdIo *obj, const iso9660_stat_t *_root, char **splitpath,
|
|||||||
}
|
}
|
||||||
|
|
||||||
_name = _idr2name (idr);
|
_name = _idr2name (idr);
|
||||||
_idr2statbuf (idr, &_stat);
|
_idr2statbuf (idr, &_stat, is_mode2);
|
||||||
|
|
||||||
if (!strcmp (splitpath[0], _name))
|
if (!strcmp (splitpath[0], _name))
|
||||||
{
|
{
|
||||||
int retval = _fs_stat_traverse (obj, &_stat, &splitpath[1], buf);
|
int retval = _fs_stat_traverse (obj, &_stat, &splitpath[1], buf,
|
||||||
|
is_mode2);
|
||||||
free (_name);
|
free (_name);
|
||||||
free (_dirbuf);
|
free (_dirbuf);
|
||||||
return retval;
|
return retval;
|
||||||
@@ -206,7 +214,7 @@ iso9660_fs_stat (CdIo *obj, const char pathname[], iso9660_stat_t *buf,
|
|||||||
_fs_stat_root (obj, &_root, is_mode2);
|
_fs_stat_root (obj, &_root, is_mode2);
|
||||||
|
|
||||||
splitpath = _cdio_strsplit (pathname, '/');
|
splitpath = _cdio_strsplit (pathname, '/');
|
||||||
retval = _fs_stat_traverse (obj, &_root, splitpath, buf);
|
retval = _fs_stat_traverse (obj, &_root, splitpath, buf, is_mode2);
|
||||||
_cdio_strfreev (splitpath);
|
_cdio_strfreev (splitpath);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd-info.c,v 1.27 2003/08/31 14:26:06 rocky Exp $
|
$Id: cd-info.c,v 1.28 2003/08/31 15:52:56 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org>
|
Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org>
|
||||||
@@ -671,6 +671,7 @@ static void
|
|||||||
print_iso9660_fs (CdIo *cdio, cdio_fs_anal_t fs, track_format_t track_format)
|
print_iso9660_fs (CdIo *cdio, cdio_fs_anal_t fs, track_format_t track_format)
|
||||||
{
|
{
|
||||||
iso9660_pvd_t pvd;
|
iso9660_pvd_t pvd;
|
||||||
|
bool is_mode2;
|
||||||
|
|
||||||
switch (track_format) {
|
switch (track_format) {
|
||||||
case TRACK_FORMAT_AUDIO:
|
case TRACK_FORMAT_AUDIO:
|
||||||
@@ -681,10 +682,12 @@ print_iso9660_fs (CdIo *cdio, cdio_fs_anal_t fs, track_format_t track_format)
|
|||||||
case TRACK_FORMAT_XA:
|
case TRACK_FORMAT_XA:
|
||||||
if (cdio_read_mode2_sector (cdio, &pvd, ISO_PVD_SECTOR, false))
|
if (cdio_read_mode2_sector (cdio, &pvd, ISO_PVD_SECTOR, false))
|
||||||
return;
|
return;
|
||||||
|
is_mode2 = true;
|
||||||
break;
|
break;
|
||||||
case TRACK_FORMAT_DATA:
|
case TRACK_FORMAT_DATA:
|
||||||
if (cdio_read_mode1_sector (cdio, &pvd, ISO_PVD_SECTOR, true))
|
if (cdio_read_mode1_sector (cdio, &pvd, ISO_PVD_SECTOR, false))
|
||||||
return;
|
return;
|
||||||
|
is_mode2 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -693,7 +696,7 @@ print_iso9660_fs (CdIo *cdio, cdio_fs_anal_t fs, track_format_t track_format)
|
|||||||
printf ("ISO9660 filesystem\n");
|
printf ("ISO9660 filesystem\n");
|
||||||
printf (" root dir in PVD set to lsn %d\n\n", extent);
|
printf (" root dir in PVD set to lsn %d\n\n", extent);
|
||||||
|
|
||||||
print_iso9660_recurse (cdio, "/", fs, track_format);
|
print_iso9660_recurse (cdio, "/", fs, is_mode2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id: check_cue.sh.in,v 1.6 2003/08/31 08:32:40 rocky Exp $
|
#$Id: check_cue.sh.in,v 1.7 2003/08/31 15:52:56 rocky Exp $
|
||||||
if test -z "@CDDB_LIB@" ; then
|
if test -z "@CDDB_LIB@" ; then
|
||||||
cddb_opt='--no-cddb'
|
cddb_opt='--no-cddb'
|
||||||
fi
|
fi
|
||||||
@@ -37,7 +37,7 @@ check_result $RC "cdinfo BIN test $testnum"
|
|||||||
fname=isofs-m1
|
fname=isofs-m1
|
||||||
testnum='ISO 9660 mode1'
|
testnum='ISO 9660 mode1'
|
||||||
if test -f ${srcdir}/${fname}.bin ; then
|
if test -f ${srcdir}/${fname}.bin ; then
|
||||||
test_cdinfo "--cue-file ${srcdir}/${fname}.cue" \
|
test_cdinfo "--cue-file ${srcdir}/${fname}.cue --iso9660 " \
|
||||||
${fname}.dump ${srcdir}/${fname}.right
|
${fname}.dump ${srcdir}/${fname}.right
|
||||||
RC=$?
|
RC=$?
|
||||||
check_result $RC "cdinfo CUE test $testnum"
|
check_result $RC "cdinfo CUE test $testnum"
|
||||||
|
|||||||
@@ -10,3 +10,17 @@ __________________________________
|
|||||||
CD Analysis Report
|
CD Analysis Report
|
||||||
CD-ROM with ISO 9660 filesystem
|
CD-ROM with ISO 9660 filesystem
|
||||||
ISO 9660: 64 blocks, label `CDROM '
|
ISO 9660: 64 blocks, label `CDROM '
|
||||||
|
ISO9660 filesystem
|
||||||
|
root dir in PVD set to lsn 23
|
||||||
|
|
||||||
|
/:
|
||||||
|
.
|
||||||
|
..
|
||||||
|
COPYING.;1
|
||||||
|
DOC
|
||||||
|
|
||||||
|
/DOC/:
|
||||||
|
.
|
||||||
|
..
|
||||||
|
README.TXT;1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user