From 164b5d4bb48f4a3edd5b87732ee20f12e2cef39d Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 31 Aug 2003 07:39:45 +0000 Subject: [PATCH] Separate and make XA information public. --- include/cdio/Makefile.am | 5 ++-- include/cdio/iso9660.h | 20 +++++++++----- include/cdio/xa.h | 57 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 include/cdio/xa.h diff --git a/include/cdio/Makefile.am b/include/cdio/Makefile.am index 467165d2..8e620b20 100644 --- a/include/cdio/Makefile.am +++ b/include/cdio/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.7 2003/08/17 05:31:19 rocky Exp $ +# $Id: Makefile.am,v 1.8 2003/08/31 07:39:45 rocky Exp $ # # Copyright (C) 2003 Rocky Bernstein # @@ -30,7 +30,8 @@ libcdioinclude_HEADERS = \ sector.h \ types.h \ util.h \ - version.h + version.h \ + xa.h EXTRA_DIST = version.h.in BUILT_SOURCES = version.h diff --git a/include/cdio/iso9660.h b/include/cdio/iso9660.h index da25e1d1..a8e470ce 100644 --- a/include/cdio/iso9660.h +++ b/include/cdio/iso9660.h @@ -1,5 +1,5 @@ /* - $Id: iso9660.h,v 1.8 2003/08/31 06:59:23 rocky Exp $ + $Id: iso9660.h,v 1.9 2003/08/31 07:39:45 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2003 Rocky Bernstein @@ -26,6 +26,7 @@ #include #include +#include #define MIN_TRACK_SIZE 4*75 @@ -55,6 +56,10 @@ enum strncpy_pad_check { ISO9660_DCHARS }; +typedef struct iso9660_pvd iso9660_pvd_t; +typedef struct iso9660_dir iso9660_dir_t; +typedef struct iso9660_stat iso9660_stat_t; + PRAGMA_BEGIN_PACKED struct iso9660_pvd { @@ -93,8 +98,6 @@ struct iso9660_pvd { char unused5[653]; } GNUC_PACKED; -typedef struct iso9660_pvd iso9660_pvd_t; - struct iso9660_dir { uint8_t length; /* 711 */ uint8_t ext_attr_length; /* 711 */ @@ -109,12 +112,16 @@ struct iso9660_dir { char name[EMPTY_ARRAY_SIZE]; } GNUC_PACKED; -typedef struct iso9660_dir iso9660_dir_t; +struct iso9660_stat { /* big endian!! */ + 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 */ +}; 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); @@ -218,7 +225,6 @@ 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: diff --git a/include/cdio/xa.h b/include/cdio/xa.h new file mode 100644 index 00000000..d885f08f --- /dev/null +++ b/include/cdio/xa.h @@ -0,0 +1,57 @@ +/* + $Id: xa.h,v 1.1 2003/08/31 07:39:45 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 +*/ + +/* 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) + +typedef struct iso9660_xa iso9660_xa_t; + +struct iso9660_xa /* 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; +