Break out POSIX-like definitions to posix.h

Add ISO9660 routines to convert to mode_t
Record whether XA or not in iso9660_stat_t.
And other definition shifting around.
This commit is contained in:
rocky
2005-11-06 00:39:37 +00:00
parent 7c6b8742c3
commit 6e4743c734
15 changed files with 279 additions and 154 deletions

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.27 2005/10/30 07:35:36 rocky Exp $ # $Id: Makefile.am,v 1.28 2005/11/06 00:39:37 rocky Exp $
# #
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> # Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
# #
@@ -41,6 +41,7 @@ libcdioinclude_HEADERS = \
iso9660.h \ iso9660.h \
logging.h \ logging.h \
mmc.h \ mmc.h \
posix.h \
read.h \ read.h \
rock.h \ rock.h \
sector.h \ sector.h \

View File

@@ -211,12 +211,14 @@ extern const char VSD_STD_ID_CDW01[sizeof("CDW02")-1];
extern const char VSD_STD_ID_NSR03[sizeof("NSR03")-1]; extern const char VSD_STD_ID_NSR03[sizeof("NSR03")-1];
extern const char VSD_STD_ID_TEA01[sizeof("TEA01")-1]; extern const char VSD_STD_ID_TEA01[sizeof("TEA01")-1];
#define VSD_STD_ID_BEA01 "BEA01" /**< (2/9.2) */ #define VSD_STD_ID_BEA01 "BEA01" /**< ECMA-167 2/9.2 */
#define VSD_STD_ID_BOOT2 "BOOT2" /**< (2/9.4) */ #define VSD_STD_ID_BOOT2 "BOOT2" /**< ECMA-167 2/9.4 */
#define VSD_STD_ID_CD001 "CD001" /**< (ECMA-119) */ #define VSD_STD_ID_CD001 "CD001" /**< ECMA-119 */
#define VSD_STD_ID_CDW02 "CDW02" /**< (ECMA-168) */ #define VSD_STD_ID_CDW02 "CDW02" /**< ECMA-168 */
#define VSD_STD_ID_NSR03 "NSR03" /**< (3/9.1) */ #define VSD_STD_ID_NSR02 "NSR02" /**< ECMA-167, 3/9.1
#define VSD_STD_ID_TEA01 "TEA01" /**< (2/9.3) */ NOTE: ECMA-167, 2nd edition */
#define VSD_STD_ID_NSR03 "NSR03" /**< ECMA-167 3/9.1 */
#define VSD_STD_ID_TEA01 "TEA01" /**< ECMA-168 2/9.3 */
/** Beginning Extended Area Descriptor (ECMA 167r3 2/9.2) */ /** Beginning Extended Area Descriptor (ECMA 167r3 2/9.2) */
struct beginning_extended_area_desc_s struct beginning_extended_area_desc_s

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660.h,v 1.77 2005/10/21 11:51:42 rocky Exp $ $Id: iso9660.h,v 1.78 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -41,6 +41,7 @@
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/ds.h> #include <cdio/ds.h>
#include <cdio/posix.h>
/** \brief ISO 9660 Integer and Character types /** \brief ISO 9660 Integer and Character types
@@ -225,11 +226,6 @@ typedef struct iso9660_ltime_s iso9660_ltime_t;
typedef struct iso9660_dir_s iso9660_dir_t; typedef struct iso9660_dir_s iso9660_dir_t;
typedef struct iso9660_stat_s iso9660_stat_t; typedef struct iso9660_stat_s iso9660_stat_t;
typedef uint32_t posix_mode_t;
typedef uint32_t posix_nlink_t;
typedef uint32_t posix_uid_t;
typedef uint32_t posix_gid_t;
#include <cdio/rock.h> #include <cdio/rock.h>
/*! \brief Format of an ISO-9660 directory record /*! \brief Format of an ISO-9660 directory record
@@ -503,6 +499,7 @@ struct iso9660_stat_s { /* big endian!! */
uint32_t secsize; /**< number of sectors allocated */ uint32_t secsize; /**< number of sectors allocated */
iso9660_xa_t xa; /**< XA attributes */ iso9660_xa_t xa; /**< XA attributes */
enum { _STAT_FILE = 1, _STAT_DIR = 2 } type; enum { _STAT_FILE = 1, _STAT_DIR = 2 } type;
bool b_xa;
char filename[EMPTY_ARRAY_SIZE]; /**< filename */ char filename[EMPTY_ARRAY_SIZE]; /**< filename */
}; };
@@ -864,129 +861,132 @@ uint8_t iso9660_get_dir_size(const iso9660_dir_t *p_idr);
lsn_t iso9660_get_dir_extent(const iso9660_dir_t *p_idr); lsn_t iso9660_get_dir_extent(const iso9660_dir_t *p_idr);
#endif #endif
/*! /*!
Return the directory name stored in the iso9660_dir_t Return the directory name stored in the iso9660_dir_t
A string is allocated: the caller must deallocate. A string is allocated: the caller must deallocate.
*/ */
char * iso9660_dir_to_name (const iso9660_dir_t *p_iso9660_dir); char * iso9660_dir_to_name (const iso9660_dir_t *p_iso9660_dir);
/*! /*!
Return a string containing the preparer id with trailing Returns a POSIX mode for a given p_udf_dirent.
blanks removed. */
*/ posix_mode_t iso9660_get_posix_filemode(const iso9660_stat_t *p_iso_dirent);
char *iso9660_get_preparer_id(const iso9660_pvd_t *p_pvd);
/*!
Return a string containing the preparer id with trailing
blanks removed.
*/
char *iso9660_get_preparer_id(const iso9660_pvd_t *p_pvd);
/*! /*!
Get the preparer ID. psz_preparer_id is set to NULL if there Get the preparer ID. psz_preparer_id is set to NULL if there
is some problem in getting this and false is returned. is some problem in getting this and false is returned.
*/ */
bool iso9660_ifs_get_preparer_id(iso9660_t *p_iso, bool iso9660_ifs_get_preparer_id(iso9660_t *p_iso,
/*out*/ char **p_psz_preparer_id); /*out*/ char **p_psz_preparer_id);
/*! /*!
Return a string containing the PVD's publisher id with trailing Return a string containing the PVD's publisher id with trailing
blanks removed. blanks removed.
*/ */
char *iso9660_get_publisher_id(const iso9660_pvd_t *p_pvd); char *iso9660_get_publisher_id(const iso9660_pvd_t *p_pvd);
/*! /*!
Get the publisher ID. psz_publisher_id is set to NULL if there Get the publisher ID. psz_publisher_id is set to NULL if there
is some problem in getting this and false is returned. is some problem in getting this and false is returned.
*/ */
bool iso9660_ifs_get_publisher_id(iso9660_t *p_iso, bool iso9660_ifs_get_publisher_id(iso9660_t *p_iso,
/*out*/ char **p_psz_publisher_id); /*out*/ char **p_psz_publisher_id);
uint8_t iso9660_get_pvd_type(const iso9660_pvd_t *p_pvd); uint8_t iso9660_get_pvd_type(const iso9660_pvd_t *p_pvd);
const char * iso9660_get_pvd_id(const iso9660_pvd_t *p_pvd); const char * iso9660_get_pvd_id(const iso9660_pvd_t *p_pvd);
int iso9660_get_pvd_space_size(const iso9660_pvd_t *p_pvd); int iso9660_get_pvd_space_size(const iso9660_pvd_t *p_pvd);
int iso9660_get_pvd_block_size(const iso9660_pvd_t *p_pvd) ; int iso9660_get_pvd_block_size(const iso9660_pvd_t *p_pvd) ;
/*! Return the primary volume id version number (of pvd). /*! Return the primary volume id version number (of pvd).
If there is an error 0 is returned. If there is an error 0 is returned.
*/ */
int iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ; int iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ;
/*!
Return a string containing the PVD's system id with trailing
blanks removed.
*/
char *iso9660_get_system_id(const iso9660_pvd_t *p_pvd);
/*! /*!
Get the system ID. psz_system_id is set to NULL if there Return a string containing the PVD's system id with trailing
is some problem in getting this and false is returned. blanks removed.
*/ */
bool iso9660_ifs_get_system_id(iso9660_t *p_iso, char *iso9660_get_system_id(const iso9660_pvd_t *p_pvd);
/*out*/ char **p_psz_system_id);
/*!
Get the system ID. psz_system_id is set to NULL if there
/*! Return the LSN of the root directory for pvd. is some problem in getting this and false is returned.
*/
bool iso9660_ifs_get_system_id(iso9660_t *p_iso,
/*out*/ char **p_psz_system_id);
/*! Return the LSN of the root directory for pvd.
If there is an error CDIO_INVALID_LSN is returned. If there is an error CDIO_INVALID_LSN is returned.
*/ */
lsn_t iso9660_get_root_lsn(const iso9660_pvd_t *p_pvd); lsn_t iso9660_get_root_lsn(const iso9660_pvd_t *p_pvd);
/*! /*!
Return the PVD's volume ID. Return the PVD's volume ID.
*/ */
char *iso9660_get_volume_id(const iso9660_pvd_t *p_pvd); char *iso9660_get_volume_id(const iso9660_pvd_t *p_pvd);
/*! /*!
Get the system ID. psz_system_id is set to NULL if there Get the system ID. psz_system_id is set to NULL if there
is some problem in getting this and false is returned. is some problem in getting this and false is returned.
*/ */
bool iso9660_ifs_get_volume_id(iso9660_t *p_iso, bool iso9660_ifs_get_volume_id(iso9660_t *p_iso,
/*out*/ char **p_psz_volume_id); /*out*/ char **p_psz_volume_id);
/*! /*!
Return the PVD's volumeset ID. Return the PVD's volumeset ID.
NULL is returned if there is some problem in getting this. NULL is returned if there is some problem in getting this.
*/ */
char *iso9660_get_volumeset_id(const iso9660_pvd_t *p_pvd); char *iso9660_get_volumeset_id(const iso9660_pvd_t *p_pvd);
/*! /*!
Get the systemset ID. psz_systemset_id is set to NULL if there Get the systemset ID. psz_systemset_id is set to NULL if there
is some problem in getting this and false is returned. is some problem in getting this and false is returned.
*/ */
bool iso9660_ifs_get_volumeset_id(iso9660_t *p_iso, bool iso9660_ifs_get_volumeset_id(iso9660_t *p_iso,
/*out*/ char **p_psz_volumeset_id); /*out*/ char **p_psz_volumeset_id);
/* pathtable */ /* pathtable */
/*! Zero's out pathable. Do this first. */ /*! Zero's out pathable. Do this first. */
void iso9660_pathtable_init (void *pt); void iso9660_pathtable_init (void *pt);
unsigned int iso9660_pathtable_get_size (const void *pt); unsigned int iso9660_pathtable_get_size (const void *pt);
uint16_t uint16_t iso9660_pathtable_l_add_entry (void *pt, const char name[],
iso9660_pathtable_l_add_entry (void *pt, const char name[], uint32_t extent, uint32_t extent, uint16_t parent);
uint16_t parent);
uint16_t iso9660_pathtable_m_add_entry (void *pt, const char name[],
uint16_t uint32_t extent, uint16_t parent);
iso9660_pathtable_m_add_entry (void *pt, const char name[], uint32_t extent,
uint16_t parent);
/**===================================================================== /**=====================================================================
Volume Descriptors Volume Descriptors
======================================================================*/ ======================================================================*/
void void iso9660_set_pvd (void *pd, const char volume_id[],
iso9660_set_pvd (void *pd, const char volume_id[], const char application_id[], const char application_id[],
const char publisher_id[], const char preparer_id[], const char publisher_id[], const char preparer_id[],
uint32_t iso_size, const void *root_dir, uint32_t iso_size, const void *root_dir,
uint32_t path_table_l_extent, uint32_t path_table_m_extent, uint32_t path_table_l_extent,
uint32_t path_table_size, const time_t *pvd_time); uint32_t path_table_m_extent,
uint32_t path_table_size, const time_t *pvd_time);
void void iso9660_set_evd (void *pd);
iso9660_set_evd (void *pd);
/*! /*!
Return true if ISO 9660 image has extended attrributes (XA). Return true if ISO 9660 image has extended attrributes (XA).
*/ */
bool iso9660_ifs_is_xa (const iso9660_t * p_iso); bool iso9660_ifs_is_xa (const iso9660_t * p_iso);
#ifdef __cplusplus #ifdef __cplusplus

44
include/cdio/posix.h Normal file
View File

@@ -0,0 +1,44 @@
/*
$Id: posix.h,v 1.1 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
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
*/
/*!
* \file posix.h
*
* \brief various POSIX definitions.
*/
#ifndef __CDIO_POSIX_H__
#define __CDIO_POSIX_H__
typedef uint32_t posix_mode_t;
typedef uint32_t posix_nlink_t;
typedef uint32_t posix_uid_t;
typedef uint32_t posix_gid_t;
typedef uint16_t unicode16_t;
#endif /* __CDIO_POSIX_H__ */
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/

View File

@@ -1,5 +1,5 @@
/* /*
$Id: rock.h,v 1.11 2005/10/04 09:59:46 rocky Exp $ $Id: rock.h,v 1.12 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -330,7 +330,13 @@ PRAGMA_END_PACKED
int get_rock_ridge_filename(iso9660_dir_t * de, /*out*/ char * retname, int get_rock_ridge_filename(iso9660_dir_t * de, /*out*/ char * retname,
/*out*/ iso9660_stat_t *p_stat); /*out*/ iso9660_stat_t *p_stat);
int parse_rock_ridge_stat(iso9660_dir_t *de, /*out*/ iso9660_stat_t *p_stat); int parse_rock_ridge_stat(iso9660_dir_t *de, /*out*/ iso9660_stat_t *p_stat);
/*!
Returns POSIX mode bitstring for a given file.
*/
posix_mode_t
iso9660_get_posix_filemode_from_rock(const iso_rock_statbuf_t *rr);
/*! /*!
Returns a string which interpreting the POSIX mode st_mode. Returns a string which interpreting the POSIX mode st_mode.

View File

@@ -1,5 +1,5 @@
/* /*
$Id: types.h,v 1.32 2005/09/17 20:57:19 rocky Exp $ $Id: types.h,v 1.33 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -55,6 +55,8 @@ extern "C" {
/* fixme */ /* fixme */
#endif /* HAVE_STDINT_H */ #endif /* HAVE_STDINT_H */
typedef uint8_t ubyte;
/* default HP/UX macros are broken */ /* default HP/UX macros are broken */
#if defined(__hpux__) #if defined(__hpux__)
# undef UINT16_C # undef UINT16_C

View File

@@ -1,5 +1,5 @@
/* /*
$Id: udf.h,v 1.17 2005/11/01 13:07:01 rocky Exp $ $Id: udf.h,v 1.18 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@@ -30,16 +30,10 @@
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/ecma_167.h> #include <cdio/ecma_167.h>
#include <cdio/posix.h>
#include <sys/stat.h>
typedef uint16_t partition_num_t; typedef uint16_t partition_num_t;
/* FIXME: these probably don't go here. */
typedef uint16_t unicode16_t;
typedef uint8_t ubyte;
/** Opaque structures. */ /** Opaque structures. */
typedef struct udf_s udf_t; typedef struct udf_s udf_t;
typedef struct udf_file_s udf_file_t; typedef struct udf_file_s udf_file_t;
@@ -165,7 +159,7 @@ extern "C" {
otherwise. otherwise.
'T' if the file is sticky but not executable. */ 'T' if the file is sticky but not executable. */
char *udf_mode_string (mode_t i_mode, char *psz_str); char *udf_mode_string (posix_mode_t i_mode, char *psz_str);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: udf_file.h,v 1.5 2005/11/02 03:49:15 rocky Exp $ $Id: udf_file.h,v 1.6 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@@ -61,13 +61,23 @@ extern "C" {
/*! /*!
Returns a POSIX mode for a given p_udf_dirent. Returns a POSIX mode for a given p_udf_dirent.
*/ */
mode_t udf_get_posix_filemode(const udf_dirent_t *p_udf_dirent); posix_mode_t udf_get_posix_filemode(const udf_dirent_t *p_udf_dirent);
/*! /*!
Return the next subdirectory. Return the next subdirectory.
*/ */
udf_dirent_t *udf_opendir(const udf_dirent_t *p_udf_dirent); udf_dirent_t *udf_opendir(const udf_dirent_t *p_udf_dirent);
/*!
Attempts to read up to count bytes from file descriptor fd into
the buffer starting at buf.
If count is zero, read() returns zero and has no other results. If
count is greater than SSIZE_MAX, the result is unspecified.
*/
driver_return_code_t udf_read_block(const udf_dirent_t *p_udf_dirent,
void * buf, size_t count);
/*! /*!
Advances p_udf_direct to the the next directory entry in the Advances p_udf_direct to the the next directory entry in the
pointed to by p_udf_dir. It also returns this as the value. NULL pointed to by p_udf_dir. It also returns this as the value. NULL

View File

@@ -1,5 +1,5 @@
/* /*
$Id: xa.h,v 1.16 2005/08/27 14:25:58 rocky Exp $ $Id: xa.h,v 1.17 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -140,7 +140,12 @@ typedef struct iso9660_xa_s
uint8_t filenum; /**< file number, see also XA subheader */ uint8_t filenum; /**< file number, see also XA subheader */
uint8_t reserved[5]; /**< zero */ uint8_t reserved[5]; /**< zero */
} GNUC_PACKED iso9660_xa_t; } GNUC_PACKED iso9660_xa_t;
/*!
Returns POSIX mode bitstring for a given file.
*/
posix_mode_t iso9660_get_posix_filemode_from_xa(uint16_t i_perms);
/*! /*!
Returns a string interpreting the extended attribute xa_attr. Returns a string interpreting the extended attribute xa_attr.

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660.c,v 1.14 2005/09/20 00:42:14 rocky Exp $ $Id: iso9660.c,v 1.15 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -43,12 +43,15 @@ const char ISO_STANDARD_ID[] = {'C', 'D', '0', '0', '1'};
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
static const char _rcsid[] = "$Id: iso9660.c,v 1.14 2005/09/20 00:42:14 rocky Exp $"; static const char _rcsid[] = "$Id: iso9660.c,v 1.15 2005/11/06 00:39:37 rocky Exp $";
/* Variables to hold debugger-helping enumerations */ /* Variables to hold debugger-helping enumerations */
enum iso_enum1_s iso_enums1; enum iso_enum1_s iso_enums1;
@@ -684,6 +687,22 @@ iso9660_pathtable_init (void *pt)
memset (pt, 0, ISO_BLOCKSIZE); /* fixme */ memset (pt, 0, ISO_BLOCKSIZE); /* fixme */
} }
/*!
Returns POSIX mode bitstring for a given file.
*/
posix_mode_t
iso9660_get_posix_filemode(const iso9660_stat_t *p_iso_dirent)
{
posix_mode_t mode = 0;
if (yep == p_iso_dirent->rr.b3_rock) {
return iso9660_get_posix_filemode_from_rock(&p_iso_dirent->rr);
} else if (p_iso_dirent->b_xa) {
return iso9660_get_posix_filemode_from_xa(p_iso_dirent->xa.attributes);
}
return mode;
}
static const iso_path_table_t * static const iso_path_table_t *
pathtable_get_entry (const void *pt, unsigned int entrynum) pathtable_get_entry (const void *pt, unsigned int entrynum)
{ {

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660_fs.c,v 1.31 2005/10/12 11:25:17 rocky Exp $ $Id: iso9660_fs.c,v 1.32 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -52,7 +52,7 @@
#include <stdio.h> #include <stdio.h>
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.31 2005/10/12 11:25:17 rocky Exp $"; static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.32 2005/11/06 00:39:37 rocky Exp $";
/* Implementation of iso9660_t type */ /* Implementation of iso9660_t type */
struct _iso9660_s { struct _iso9660_s {
@@ -812,6 +812,7 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, bool_3way_t b_xa,
p_stat->size = from_733 (p_iso9660_dir->size); p_stat->size = from_733 (p_iso9660_dir->size);
p_stat->secsize = _cdio_len2blocks (p_stat->size, ISO_BLOCKSIZE); p_stat->secsize = _cdio_len2blocks (p_stat->size, ISO_BLOCKSIZE);
p_stat->rr.b3_rock = dunno; /*FIXME should do based on mask */ p_stat->rr.b3_rock = dunno; /*FIXME should do based on mask */
p_stat->b_xa = false;
{ {
char rr_fname[256] = ""; char rr_fname[256] = "";
@@ -899,7 +900,8 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, bool_3way_t b_xa,
xa_data->signature[0], xa_data->signature[1]); xa_data->signature[0], xa_data->signature[1]);
return p_stat; return p_stat;
} }
p_stat->xa = *xa_data; p_stat->b_xa = true;
p_stat->xa = *xa_data;
} }
} }
return p_stat; return p_stat;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660_private.h,v 1.3 2005/02/12 10:23:18 rocky Exp $ $Id: iso9660_private.h,v 1.4 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -57,13 +57,12 @@ typedef struct iso_volume_descriptor_s {
* See mkisofs.h * See mkisofs.h
*/ */
/* We use this to help us look up the parent inode numbers. */ /** We use this to help us look up the parent inode numbers. */
typedef struct iso_path_table_s { typedef struct iso_path_table_s {
uint8_t name_len; /* 7.1.1 */ uint8_t name_len; /**< 7.1.1 */
uint8_t xa_len; /* 7.1.1 */ uint8_t xa_len; /**< 7.1.1 */
uint32_t extent; /* 7.3.1/7.3.2 */ uint32_t extent; /**< 7.3.1/7.3.2 */
uint16_t parent; /* 7.2.1/7.2.2 */ uint16_t parent; /**< 7.2.1/7.2.2 */
char name[EMPTY_ARRAY_SIZE]; char name[EMPTY_ARRAY_SIZE];
} GNUC_PACKED iso_path_table_t; } GNUC_PACKED iso_path_table_t;

View File

@@ -23,6 +23,9 @@ iso9660_get_application_id
iso9660_get_dir_len iso9660_get_dir_len
iso9660_get_dtime iso9660_get_dtime
iso9660_get_ltime iso9660_get_ltime
iso9660_get_posix_filemode
iso9660_get_posix_filemode_from_rock
iso9660_get_posix_filemode_from_xa
iso9660_get_preparer_id iso9660_get_preparer_id
iso9660_get_publisher_id iso9660_get_publisher_id
iso9660_get_pvd_block_size iso9660_get_pvd_block_size

View File

@@ -1,5 +1,5 @@
/* /*
$Id: rock.c,v 1.14 2005/10/04 09:59:46 rocky Exp $ $Id: rock.c,v 1.15 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
Adapted from GNU/Linux fs/isofs/rock.c (C) 1992, 1993 Eric Youngdale Adapted from GNU/Linux fs/isofs/rock.c (C) 1992, 1993 Eric Youngdale
@@ -608,3 +608,14 @@ iso9660_get_rock_attr_str(posix_mode_t st_mode)
return result; return result;
} }
/*!
Returns POSIX mode bitstring for a given file.
*/
posix_mode_t
iso9660_get_posix_filemode_from_rock(const iso_rock_statbuf_t *rr)
{
return rr->st_mode;
}

View File

@@ -1,5 +1,5 @@
/* /*
$Id: xa.c,v 1.4 2005/02/20 10:21:01 rocky Exp $ $Id: xa.c,v 1.5 2005/11/06 00:39:37 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2005 Rocky Bernstein <rocky@panix.com>
@@ -28,6 +28,10 @@
#include <string.h> #include <string.h>
#endif #endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
/*! String inside frame which identifies XA attributes. Note should /*! String inside frame which identifies XA attributes. Note should
come *before* public headers which does a #define of come *before* public headers which does a #define of
this name. this name.
@@ -143,3 +147,26 @@ iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr,
return _xa; return _xa;
} }
/*!
Returns POSIX mode bitstring for a given file.
*/
posix_mode_t
iso9660_get_posix_filemode_from_xa(uint16_t i_perms)
{
posix_mode_t mode = 0;
if (i_perms & XA_PERM_RUSR) mode |= S_IRUSR;
if (i_perms & XA_PERM_XUSR) mode |= S_IXUSR;
if (i_perms & XA_PERM_RGRP) mode |= S_IRGRP;
if (i_perms & XA_PERM_XGRP) mode |= S_IXGRP;
if (i_perms & XA_PERM_ROTH) mode |= S_IROTH;
if (i_perms & XA_PERM_XOTH) mode |= S_IXOTH;
if (i_perms & XA_ATTR_DIRECTORY) mode |= S_IFDIR;
return mode;
}