iso9660.h, iso9660_fs.c: Add iso9660_ifs_is_xa() a routine to

determine if an iso image has XA attributes.

bytesex.h and bytesex_asm.h are now public. (Down the line should use
glib though.) Package  has been revised to the move.

iso-info.c: shows XA attributes what that it is available.
This commit is contained in:
rocky
2004-10-22 01:13:38 +00:00
parent 454497f058
commit b80d83f07b
11 changed files with 70 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.12 2004/10/09 03:20:28 rocky Exp $ # $Id: Makefile.am,v 1.13 2004/10/22 01:13:38 rocky Exp $
# #
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> # Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
# #
@@ -23,7 +23,9 @@
libcdioincludedir=$(includedir)/cdio libcdioincludedir=$(includedir)/cdio
libcdioinclude_HEADERS = \ libcdioinclude_HEADERS = \
cdio.h \ bytesex.h \
bytesex_asm.h \
cdtext.h \
cdtext.h \ cdtext.h \
cd_types.h \ cd_types.h \
ds.h \ ds.h \

View File

@@ -1,7 +1,7 @@
/* /*
$Id: bytesex.h,v 1.3 2003/04/22 12:09:09 rocky Exp $ $Id: bytesex.h,v 1.1 2004/10/22 01:13:38 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000, 2004 Herbert Valerio Riedel <hvr@gnu.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -21,9 +21,9 @@
#ifndef __CDIO_BYTESEX_H__ #ifndef __CDIO_BYTESEX_H__
#define __CDIO_BYTESEX_H__ #define __CDIO_BYTESEX_H__
#include <cdio/logging.h>
#include <cdio/types.h> #include <cdio/types.h>
#include "bytesex_asm.h" #include <cdio/bytesex_asm.h>
#include <cdio/logging.h>
/* generic byteswap routines */ /* generic byteswap routines */

View File

@@ -1,8 +1,8 @@
/* /*
$Id: bytesex_asm.h,v 1.3 2003/04/22 12:09:09 rocky Exp $ $Id: bytesex_asm.h,v 1.1 2004/10/22 01:13:38 rocky Exp $
Copyright (C) 2001 Sven Ottemann <ac-logic@freenet.de> Copyright (C) 2001 Sven Ottemann <ac-logic@freenet.de>
2001 Herbert Valerio Riedel <hvr@gnu.org> 2001, 2004 Herbert Valerio Riedel <hvr@gnu.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660.h,v 1.49 2004/10/10 20:36:10 rocky Exp $ $Id: iso9660.h,v 1.50 2004/10/22 01:13:38 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -664,6 +664,12 @@ iso9660_set_pvd (void *pd, const char volume_id[], const char application_id[],
void void
iso9660_set_evd (void *pd); iso9660_set_evd (void *pd);
/*!
Return true if ISO 9660 image has extended attrributes (XA).
*/
bool iso9660_ifs_is_xa (const iso9660_t * p_iso);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.49 2004/10/09 03:20:28 rocky Exp $ # $Id: Makefile.am,v 1.50 2004/10/22 01:13:38 rocky Exp $
# #
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> # Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
# #
@@ -50,8 +50,7 @@ libiso9660_la_AGE := 0
EXTRA_DIST = image/Makefile FreeBSD/Makefile MSWindows/Makefile EXTRA_DIST = image/Makefile FreeBSD/Makefile MSWindows/Makefile
noinst_HEADERS = cdio_assert.h bytesex.h bytesex_asm.h \ noinst_HEADERS = cdio_assert.h cdio_private.h
cdio_private.h
libcdio_sources = \ libcdio_sources = \
_cdio_bsdi.c \ _cdio_bsdi.c \

View File

@@ -1,5 +1,5 @@
/* /*
$Id: nrg.c,v 1.41 2004/10/09 03:20:28 rocky Exp $ $Id: nrg.c,v 1.42 2004/10/22 01:13:38 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001, 2003 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001, 2003 Herbert Valerio Riedel <hvr@gnu.org>
@@ -37,16 +37,16 @@
#include <glob.h> #include <glob.h>
#endif #endif
#include <cdio/bytesex.h>
#include <cdio/ds.h> #include <cdio/ds.h>
#include <cdio/logging.h> #include <cdio/logging.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/version.h> #include <cdio/version.h>
#include "cdio_assert.h" #include "cdio_assert.h"
#include "bytesex.h"
#include "_cdio_stdio.h" #include "_cdio_stdio.h"
#include "nrg.h" #include "nrg.h"
static const char _rcsid[] = "$Id: nrg.c,v 1.41 2004/10/09 03:20:28 rocky Exp $"; static const char _rcsid[] = "$Id: nrg.c,v 1.42 2004/10/22 01:13:38 rocky Exp $";
/* reader */ /* reader */

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660.c,v 1.16 2004/06/18 23:00:06 rocky Exp $ $Id: iso9660.c,v 1.17 2004/10/22 01:13:38 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -22,9 +22,9 @@
/* Private headers */ /* Private headers */
#include "iso9660_private.h" #include "iso9660_private.h"
#include "cdio_assert.h" #include "cdio_assert.h"
#include "bytesex.h"
/* Public headers */ /* Public headers */
#include <cdio/bytesex.h>
#include <cdio/iso9660.h> #include <cdio/iso9660.h>
#include <cdio/util.h> #include <cdio/util.h>
@@ -37,7 +37,7 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
static const char _rcsid[] = "$Id: iso9660.c,v 1.16 2004/06/18 23:00:06 rocky Exp $"; static const char _rcsid[] = "$Id: iso9660.c,v 1.17 2004/10/22 01:13:38 rocky Exp $";
/* some parameters... */ /* some parameters... */
#define SYSTEM_ID "CD-RTOS CD-BRIDGE" #define SYSTEM_ID "CD-RTOS CD-BRIDGE"

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660_fs.c,v 1.25 2004/10/09 23:20:52 rocky Exp $ $Id: iso9660_fs.c,v 1.26 2004/10/22 01:13:38 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -28,23 +28,23 @@
#endif #endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/bytesex.h>
#include <cdio/iso9660.h> #include <cdio/iso9660.h>
#include <cdio/util.h> #include <cdio/util.h>
/* Private headers */ /* Private headers */
#include "cdio_assert.h" #include "cdio_assert.h"
#include "bytesex.h"
#include "_cdio_stdio.h" #include "_cdio_stdio.h"
#include "cdio_private.h" #include "cdio_private.h"
#include <stdio.h> #include <stdio.h>
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.25 2004/10/09 23:20:52 rocky Exp $"; static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.26 2004/10/22 01:13:38 rocky Exp $";
/* Implementation of iso9660_t type */ /* Implementation of iso9660_t type */
struct _iso9660 { struct _iso9660 {
CdioDataSource *stream; /* Stream pointer */ CdioDataSource *stream; /* Stream pointer */
void *env; /* environment. */ bool b_xa; /* true if has XA attributes. */
}; };
/*! /*!
@@ -54,19 +54,30 @@ struct _iso9660 {
iso9660_t * iso9660_t *
iso9660_open (const char *pathname /*flags, mode */) iso9660_open (const char *pathname /*flags, mode */)
{ {
iso9660_t *iso = (iso9660_t *) _cdio_malloc(sizeof(struct _iso9660)) ; iso9660_t *p_iso = (iso9660_t *) _cdio_malloc(sizeof(struct _iso9660)) ;
iso9660_pvd_t pvd;
if (NULL == iso) return NULL; if (NULL == p_iso) return NULL;
iso->stream = cdio_stdio_new( pathname ); p_iso->stream = cdio_stdio_new( pathname );
if (NULL == iso->stream) { if (NULL == p_iso->stream)
free(iso); goto error;
if (!iso9660_ifs_read_pvd(p_iso, &pvd))
goto error;
/* Determine if image has XA attributes. */
p_iso->b_xa = !strncmp ((char *) &pvd + ISO_XA_MARKER_OFFSET,
ISO_XA_MARKER_STRING,
strlen (ISO_XA_MARKER_STRING));
return p_iso;
error:
free(p_iso);
return NULL; return NULL;
} }
return iso;
}
/*! /*!
@@ -761,3 +772,14 @@ iso9660_find_fs_lsn(const CdIo *cdio, lsn_t lsn)
return find_fs_lsn_recurse (cdio, "/", lsn); return find_fs_lsn_recurse (cdio, "/", lsn);
} }
/*!
Return true if ISO 9660 image has extended attrributes (XA).
*/
bool
iso9660_ifs_is_xa (const iso9660_t * p_iso)
{
if (!p_iso) return false;
return p_iso->b_xa;
}

View File

@@ -1,5 +1,5 @@
/* /*
$Id: xa.c,v 1.4 2003/09/21 01:14:30 rocky Exp $ $Id: xa.c,v 1.5 2004/10/22 01:13:38 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -31,10 +31,10 @@
/* Public headers */ /* Public headers */
#include <cdio/iso9660.h> #include <cdio/iso9660.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/bytesex.h>
/* Private headers */ /* Private headers */
#include "cdio_assert.h" #include "cdio_assert.h"
#include "bytesex.h"
#define BUF_COUNT 16 #define BUF_COUNT 16
#define BUF_SIZE 80 #define BUF_SIZE 80

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cd-info.c,v 1.90 2004/10/09 03:20:28 rocky Exp $ $Id: cd-info.c,v 1.91 2004/10/22 01:13:38 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 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>
@@ -37,6 +37,7 @@
#include <libvcd/info.h> #include <libvcd/info.h>
#endif #endif
#include <cdio/bytesex.h>
#include <cdio/ds.h> #include <cdio/ds.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/cd_types.h> #include <cdio/cd_types.h>
@@ -45,7 +46,6 @@
#include <cdio/scsi_mmc.h> #include <cdio/scsi_mmc.h>
#include "cdio_assert.h" #include "cdio_assert.h"
#include "bytesex.h"
#include "iso9660_private.h" #include "iso9660_private.h"
#include <fcntl.h> #include <fcntl.h>

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso-info.c,v 1.10 2004/10/09 03:20:28 rocky Exp $ $Id: iso-info.c,v 1.11 2004/10/22 01:13:38 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -32,6 +32,7 @@
# include "config.h" # include "config.h"
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include <cdio/bytesex.h>
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/ds.h> #include <cdio/ds.h>
#include <cdio/iso9660.h> #include <cdio/iso9660.h>
@@ -151,13 +152,13 @@ _log_handler (cdio_log_level_t level, const char message[])
} }
static void static void
print_iso9660_recurse (iso9660_t *iso, const char pathname[]) print_iso9660_recurse (iso9660_t *p_iso, const char pathname[])
{ {
CdioList *entlist; CdioList *entlist;
CdioList *dirlist = _cdio_list_new (); CdioList *dirlist = _cdio_list_new ();
CdioListNode *entnode; CdioListNode *entnode;
entlist = iso9660_ifs_readdir (iso, pathname); entlist = iso9660_ifs_readdir (p_iso, pathname);
printf ("%s:\n", pathname); printf ("%s:\n", pathname);
@@ -189,8 +190,8 @@ print_iso9660_recurse (iso9660_t *iso, const char pathname[])
&& strcmp (iso_name, "..")) && strcmp (iso_name, ".."))
_cdio_list_append (dirlist, strdup (_fullname)); _cdio_list_append (dirlist, strdup (_fullname));
#if FINISHED #if 1
if (fs & CDIO_FS_ANAL_XA) { if (iso9660_ifs_is_xa(p_iso)) {
printf ( " %c %s %d %d [fn %.2d] [LSN %6lu] ", printf ( " %c %s %d %d [fn %.2d] [LSN %6lu] ",
(statbuf->type == _STAT_DIR) ? 'd' : '-', (statbuf->type == _STAT_DIR) ? 'd' : '-',
iso9660_get_xa_attr_str (statbuf->xa.attributes), iso9660_get_xa_attr_str (statbuf->xa.attributes),
@@ -222,7 +223,7 @@ print_iso9660_recurse (iso9660_t *iso, const char pathname[])
{ {
char *_fullname = _cdio_list_node_data (entnode); char *_fullname = _cdio_list_node_data (entnode);
print_iso9660_recurse (iso, _fullname); print_iso9660_recurse (p_iso, _fullname);
} }
_cdio_list_free (dirlist, true); _cdio_list_free (dirlist, true);