Process Rock-Ridge time fields. Not tested or shown yet.

Break out Rock Ridge fields of our ISO9660 stat.
This commit is contained in:
rocky
2005-02-21 09:00:53 +00:00
parent 5b029744c6
commit ec0564dfee
8 changed files with 213 additions and 169 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660.h,v 1.70 2005/02/21 02:02:12 rocky Exp $ $Id: iso9660.h,v 1.71 2005/02/21 09:00:53 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>
@@ -526,25 +526,9 @@ PRAGMA_END_PACKED
@see iso9660_dir @see iso9660_dir
*/ */
struct iso9660_stat_s { /* big endian!! */ struct iso9660_stat_s { /* big endian!! */
bool_3way_t b3_rock; /**< has Rock Ridge extension.
If not true then the next 9 fields
aren't used.
*/
posix_mode_t st_mode; /**< protection */
posix_nlink_t st_nlinks; /**< number of hard links */
posix_uid_t st_uid; /**< user ID of owner */
posix_gid_t st_gid; /**< group ID of owner */
uint8_t s_rock_offset;
int i_symlink; /**< size of psz_symlink */
int i_symlink_max; /**< max allocated to psz_symlink */
char *psz_symlink; /**< if symbolic link, name
of pointed to file.
*/
struct tm atime; /**< time of last access */
struct tm mtime; /**< time of last modification */
struct tm ctime; /**< create time */
/* Non Ridge-specific fields */ iso_rock_statbuf_t rr; /**< Rock Ridge-specific fields */
struct tm tm; /**< time on entry - FIXME merge with struct tm tm; /**< time on entry - FIXME merge with
one of entries above, like ctime? */ one of entries above, like ctime? */
lsn_t lsn; /**< start logical sector number */ lsn_t lsn; /**< start logical sector number */

View File

@@ -1,5 +1,5 @@
/* /*
$Id: rock.h,v 1.5 2005/02/21 02:02:12 rocky Exp $ $Id: rock.h,v 1.6 2005/02/21 09:00:53 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -115,7 +115,7 @@ typedef struct iso_su_ce_s {
char size[8]; char size[8];
} iso_su_ce_t; } iso_su_ce_t;
/*! POSIX file attributes, PX. See Section 4.1.2 */ /*! POSIX file attributes, PX. See Rock Ridge Section 4.1.2 */
typedef struct iso_rock_px_s { typedef struct iso_rock_px_s {
iso733_t st_mode; /*! file mode permissions; same as st_mode iso733_t st_mode; /*! file mode permissions; same as st_mode
of POSIX:5.6.1 */ of POSIX:5.6.1 */
@@ -134,11 +134,11 @@ typedef struct iso_rock_px_s {
file types. No more than one "PN" is recorded in the System Use Area file types. No more than one "PN" is recorded in the System Use Area
of a Directory Record. of a Directory Record.
See Section 4.1.2 */ See Rock Ridge Section 4.1.2 */
typedef struct iso_rock_pn_s { typedef struct iso_rock_pn_s {
iso733_t dev_high; /*! high-order 32 bits of the 64 bit device number. iso733_t dev_high; /**< high-order 32 bits of the 64 bit device number.
7.2.3 encoded */ 7.2.3 encoded */
iso733_t dev_low; /*! low-order 32 bits of the 64 bit device number. iso733_t dev_low; /**< low-order 32 bits of the 64 bit device number.
7.2.3 encoded */ 7.2.3 encoded */
} GNUC_PACKED iso_rock_pn_t ; } GNUC_PACKED iso_rock_pn_t ;
@@ -161,13 +161,13 @@ typedef struct iso_rock_sl_part_s {
char text[EMPTY_ARRAY_SIZE]; char text[EMPTY_ARRAY_SIZE];
} GNUC_PACKED iso_rock_sl_part_t ; } GNUC_PACKED iso_rock_sl_part_t ;
/*! Symbolic link. See Section 4.1.3 */ /*! Symbolic link. See Rock Ridge Section 4.1.3 */
typedef struct iso_rock_sl_s { typedef struct iso_rock_sl_s {
unsigned char flags; unsigned char flags;
iso_rock_sl_part_t link; iso_rock_sl_part_t link;
} GNUC_PACKED iso_rock_sl_t ; } GNUC_PACKED iso_rock_sl_t ;
/*! Alternate name. See Section 4.1.4 */ /*! Alternate name. See Rock Ridge Section 4.1.4 */
/*! These are the bits and their meanings for flags in the NM structure. */ /*! These are the bits and their meanings for flags in the NM structure. */
typedef enum { typedef enum {
@@ -218,13 +218,23 @@ typedef enum {
#define ISO_ROCK_TF_EFFECTIVE 64 #define ISO_ROCK_TF_EFFECTIVE 64
#define ISO_ROCK_TF_LONG_FORM 128 #define ISO_ROCK_TF_LONG_FORM 128
/*! Time stamp(s) for a file. See Section 4.1.6 */ /*! Time stamp(s) for a file. See Rock Ridge Section 4.1.6 */
typedef struct iso_rock_tf_s { typedef struct iso_rock_tf_s {
uint8_t flags; uint8_t flags; /**< See ISO_ROCK_TF_* bits above. */
iso9660_ltime_t times[EMPTY_ARRAY_SIZE]; uint8_t time_bytes[EMPTY_ARRAY_SIZE]; /**< A homogenious array of
iso9660_ltime_t or
iso9660_dtime_t entries
depending on flags &
ISO_ROCK_TF_LONG_FORM. Lacking
a better method, we store
this as an array of bytes
and a cast to the
appropriate type will have
to be made before
extraction. */
} GNUC_PACKED iso_rock_tf_t ; } GNUC_PACKED iso_rock_tf_t ;
/*! File data in sparse format. See Section 4.1.7 */ /*! File data in sparse format. See Rock Ridge Section 4.1.7 */
typedef struct iso_rock_sf_s { typedef struct iso_rock_sf_s {
iso733_t virtual_size_high; /**< high-order 32 bits of virtual size */ iso733_t virtual_size_high; /**< high-order 32 bits of virtual size */
iso733_t virtual_size_low; /**< low-order 32 bits of virtual size */ iso733_t virtual_size_low; /**< low-order 32 bits of virtual size */
@@ -255,6 +265,48 @@ typedef struct iso_extension_record_s {
} u; } u;
} GNUC_PACKED iso_extension_record_t; } GNUC_PACKED iso_extension_record_t;
typedef struct iso_rock_time_s {
bool b_used; /**< If true, field has been set and is valid.
Otherwise remaning fields are meaningless. */
bool b_longdate; /**< If true date format is a iso9660_ltime_t.
Otherwise date is iso9660_dtime_t */
union
{
iso9660_ltime_t ltime;
iso9660_dtime_t dtime;
} t;
} iso_rock_time_t;
typedef struct iso_rock_statbuf_s {
bool_3way_t b3_rock; /**< has Rock Ridge extension.
If "yep", then the fields
are used.
*/
posix_mode_t st_mode; /**< protection */
posix_nlink_t st_nlinks; /**< number of hard links */
posix_uid_t st_uid; /**< user ID of owner */
posix_gid_t st_gid; /**< group ID of owner */
uint8_t s_rock_offset;
int i_symlink; /**< size of psz_symlink */
int i_symlink_max; /**< max allocated to psz_symlink */
char *psz_symlink; /**< if symbolic link, name
of pointed to file. */
iso_rock_time_t create; /**< create time See ISO 9660:9.5.4. */
iso_rock_time_t modify; /**< time of last modification
ISO 9660:9.5.5. st_mtime field of
POSIX:5.6.1. */
iso_rock_time_t access; /**< time of last file access st_atime
field of POSIX:5.6.1. */
iso_rock_time_t attributes; /**< time of last attribute change.
st_ctime field of POSIX:5.6.1. */
iso_rock_time_t backup; /**< time of last backup. */
iso_rock_time_t expiration; /**< time of expiration; See ISO
9660:9.5.6. */
iso_rock_time_t effective; /**< Effective time; See ISO 9660:9.5.7.
*/
} iso_rock_statbuf_t;
PRAGMA_END_PACKED PRAGMA_END_PACKED
/*! return length of name field; 0: not found, -1: to be ignored */ /*! return length of name field; 0: not found, -1: to be ignored */

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660_fs.c,v 1.23 2005/02/21 02:02:12 rocky Exp $ $Id: iso9660_fs.c,v 1.24 2005/02/21 09:00:53 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.23 2005/02/21 02:02:12 rocky Exp $"; static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.24 2005/02/21 09:00:53 rocky Exp $";
/* Implementation of iso9660_t type */ /* Implementation of iso9660_t type */
struct _iso9660_s { struct _iso9660_s {
@@ -811,7 +811,7 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, bool_3way_t b_xa,
p_stat->lsn = from_733 (p_iso9660_dir->extent); p_stat->lsn = from_733 (p_iso9660_dir->extent);
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->b3_rock = dunno; /*FIXME should do based on mask */ p_stat->rr.b3_rock = dunno; /*FIXME should do based on mask */
{ {
char rr_fname[256] = ""; char rr_fname[256] = "";
@@ -852,7 +852,7 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, bool_3way_t b_xa,
iso9660_get_dtime(&(p_iso9660_dir->recording_time), true, &(p_stat->tm)); iso9660_get_dtime(&(p_iso9660_dir->recording_time), true, &(p_stat->tm));
if (dir_len < sizeof (iso9660_dir_t)) { if (dir_len < sizeof (iso9660_dir_t)) {
free(p_stat->psz_symlink); free(p_stat->rr.psz_symlink);
free(p_stat); free(p_stat);
return NULL; return NULL;
} }
@@ -1048,7 +1048,7 @@ _fs_stat_traverse (const CdIo_t *p_cdio, const iso9660_stat_t *_root,
cmp = strcmp(splitpath[0], p_stat->filename); cmp = strcmp(splitpath[0], p_stat->filename);
if ( 0 != cmp && 0 == p_env->i_joliet_level && yep != p_stat->b3_rock ) { if ( 0 != cmp && 0 == p_env->i_joliet_level && yep != p_stat->rr.b3_rock ) {
char *trans_fname = NULL; char *trans_fname = NULL;
unsigned int i_trans_fname=strlen(p_stat->filename); unsigned int i_trans_fname=strlen(p_stat->filename);
int trans_len; int trans_len;
@@ -1070,13 +1070,13 @@ _fs_stat_traverse (const CdIo_t *p_cdio, const iso9660_stat_t *_root,
if (!cmp) { if (!cmp) {
iso9660_stat_t *ret_stat iso9660_stat_t *ret_stat
= _fs_stat_traverse (p_cdio, p_stat, &splitpath[1]); = _fs_stat_traverse (p_cdio, p_stat, &splitpath[1]);
free(p_stat->psz_symlink); free(p_stat->rr.psz_symlink);
free(p_stat); free(p_stat);
free (_dirbuf); free (_dirbuf);
return ret_stat; return ret_stat;
} }
free(p_stat->psz_symlink); free(p_stat->rr.psz_symlink);
free(p_stat); free(p_stat);
offset += iso9660_get_dir_len(p_iso9660_dir); offset += iso9660_get_dir_len(p_iso9660_dir);
@@ -1140,7 +1140,8 @@ _fs_iso_stat_traverse (iso9660_t *p_iso, const iso9660_stat_t *_root,
cmp = strcmp(splitpath[0], p_stat->filename); cmp = strcmp(splitpath[0], p_stat->filename);
if ( 0 != cmp && 0 == p_iso->i_joliet_level && yep != p_stat->b3_rock ) { if ( 0 != cmp && 0 == p_iso->i_joliet_level
&& yep != p_stat->rr.b3_rock ) {
char *trans_fname = malloc(strlen(p_stat->filename)+1); char *trans_fname = malloc(strlen(p_stat->filename)+1);
int trans_len; int trans_len;
@@ -1158,13 +1159,13 @@ _fs_iso_stat_traverse (iso9660_t *p_iso, const iso9660_stat_t *_root,
if (!cmp) { if (!cmp) {
iso9660_stat_t *ret_stat iso9660_stat_t *ret_stat
= _fs_iso_stat_traverse (p_iso, p_stat, &splitpath[1]); = _fs_iso_stat_traverse (p_iso, p_stat, &splitpath[1]);
free(p_stat->psz_symlink); free(p_stat->rr.psz_symlink);
free(p_stat); free(p_stat);
free (_dirbuf); free (_dirbuf);
return ret_stat; return ret_stat;
} }
free(p_stat->psz_symlink); free(p_stat->rr.psz_symlink);
free(p_stat); free(p_stat);
offset += iso9660_get_dir_len(p_iso9660_dir); offset += iso9660_get_dir_len(p_iso9660_dir);
@@ -1298,7 +1299,7 @@ iso9660_fs_readdir (CdIo_t *p_cdio, const char psz_path[], bool b_mode2)
if (!p_stat) return NULL; if (!p_stat) return NULL;
if (p_stat->type != _STAT_DIR) { if (p_stat->type != _STAT_DIR) {
free(p_stat->psz_symlink); free(p_stat->rr.psz_symlink);
free(p_stat); free(p_stat);
return NULL; return NULL;
} }
@@ -1363,7 +1364,7 @@ iso9660_ifs_readdir (iso9660_t *p_iso, const char psz_path[])
if (!p_stat) return NULL; if (!p_stat) return NULL;
if (p_stat->type != _STAT_DIR) { if (p_stat->type != _STAT_DIR) {
free(p_stat->psz_symlink); free(p_stat->rr.psz_symlink);
free(p_stat); free(p_stat);
return NULL; return NULL;
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: rock.c,v 1.8 2005/02/21 02:02:12 rocky Exp $ $Id: rock.c,v 1.9 2005/02/21 09:00:53 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
@@ -49,20 +49,20 @@
static bool static bool
realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t i_grow) realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t i_grow)
{ {
if (!p_stat->i_symlink) { if (!p_stat->rr.i_symlink) {
p_stat->psz_symlink = (char *) calloc(1, 2*i_grow+1); p_stat->rr.psz_symlink = (char *) calloc(1, 2*i_grow+1);
return (NULL != p_stat->psz_symlink); return (NULL != p_stat->rr.psz_symlink);
} else { } else {
unsigned int i_needed = p_stat->i_symlink + i_grow ; unsigned int i_needed = p_stat->rr.i_symlink + i_grow ;
if ( i_needed <= p_stat->i_symlink_max) if ( i_needed <= p_stat->rr.i_symlink_max)
return true; return true;
else { else {
char * psz_newsymlink = (char *) calloc(1, 2*i_needed); char * psz_newsymlink = (char *) calloc(1, 2*i_needed);
if (!psz_newsymlink) return false; if (!psz_newsymlink) return false;
p_stat->i_symlink_max = 2*i_needed; p_stat->rr.i_symlink_max = 2*i_needed;
memcpy(psz_newsymlink, p_stat->psz_symlink, p_stat->i_symlink); memcpy(psz_newsymlink, p_stat->rr.psz_symlink, p_stat->rr.i_symlink);
free(p_stat->psz_symlink); free(p_stat->rr.psz_symlink);
p_stat->psz_symlink = psz_newsymlink; p_stat->rr.psz_symlink = psz_newsymlink;
return true; return true;
} }
} }
@@ -83,7 +83,7 @@ realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t i_grow)
#define CHECK_SP(FAIL) \ #define CHECK_SP(FAIL) \
if(rr->u.SP.magic[0] != 0xbe) FAIL; \ if(rr->u.SP.magic[0] != 0xbe) FAIL; \
if(rr->u.SP.magic[1] != 0xef) FAIL; \ if(rr->u.SP.magic[1] != 0xef) FAIL; \
p_stat->s_rock_offset = rr->u.SP.skip; p_stat->rr.s_rock_offset = rr->u.SP.skip;
/* We define a series of macros because each function must do exactly the /* We define a series of macros because each function must do exactly the
same thing in certain places. We use the macros to ensure that everything same thing in certain places. We use the macros to ensure that everything
is done correctly */ is done correctly */
@@ -103,14 +103,35 @@ realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t i_grow)
if(LEN & 1) LEN++; \ if(LEN & 1) LEN++; \
CHR = ((unsigned char *) DE) + LEN; \ CHR = ((unsigned char *) DE) + LEN; \
LEN = *((unsigned char *) DE) - LEN; \ LEN = *((unsigned char *) DE) - LEN; \
if (0xff != p_stat->s_rock_offset) \ if (0xff != p_stat->rr.s_rock_offset) \
{ \ { \
LEN -= p_stat->s_rock_offset; \ LEN -= p_stat->rr.s_rock_offset; \
CHR += p_stat->s_rock_offset; \ CHR += p_stat->rr.s_rock_offset; \
if (LEN<0) LEN=0; \ if (LEN<0) LEN=0; \
} \ } \
} }
/* Copy a long or short time from the iso_rock_tf_t into
the specified field of a iso_rock_statbuf_t.
non-paramater variables are p_stat, rr, and cnt.
*/
#define add_time(FLAG, TIME_FIELD) \
if (rr->u.TF.flags & FLAG) { \
p_stat->rr.TIME_FIELD.b_longdate = \
(0 != (rr->u.TF.flags & ISO_ROCK_TF_LONG_FORM)); \
if (p_stat->rr.TIME_FIELD.b_longdate) { \
memcpy(&(p_stat->rr.TIME_FIELD.t.ltime), \
&(rr->u.TF.time_bytes[cnt]), \
sizeof(iso9660_ltime_t)); \
cnt += sizeof(iso9660_ltime_t); \
} else { \
memcpy(&(p_stat->rr.TIME_FIELD.t.dtime), \
&(rr->u.TF.time_bytes[cnt]), \
sizeof(iso9660_dtime_t)); \
cnt += sizeof(iso9660_dtime_t); \
} \
}
/*! /*!
Get Get
@return length of name field; 0: not found, -1: to be ignored @return length of name field; 0: not found, -1: to be ignored
@@ -127,7 +148,7 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir,
int i_namelen = 0; int i_namelen = 0;
int truncate=0; int truncate=0;
if (!p_stat || nope == p_stat->b3_rock) return 0; if (!p_stat || nope == p_stat->rr.b3_rock) return 0;
*psz_name = 0; *psz_name = 0;
SETUP_ROCK_RIDGE(p_iso9660_dir, chr, len); SETUP_ROCK_RIDGE(p_iso9660_dir, chr, len);
@@ -159,7 +180,7 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir,
CHECK_CE; CHECK_CE;
break; break;
case SIG('E','R'): case SIG('E','R'):
p_stat->b3_rock = yep; p_stat->rr.b3_rock = yep;
cdio_debug("ISO 9660 Extensions: "); cdio_debug("ISO 9660 Extensions: ");
{ {
int p; int p;
@@ -168,7 +189,7 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir,
break; break;
case SIG('N','M'): case SIG('N','M'):
/* Alternate name */ /* Alternate name */
p_stat->b3_rock = yep; p_stat->rr.b3_rock = yep;
if (truncate) break; if (truncate) break;
if (rr->u.NM.flags & ISO_ROCK_NM_PARENT) { if (rr->u.NM.flags & ISO_ROCK_NM_PARENT) {
i_namelen = sizeof(".."); i_namelen = sizeof("..");
@@ -193,11 +214,11 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir,
break; break;
case SIG('P','X'): case SIG('P','X'):
/* POSIX file attributes */ /* POSIX file attributes */
p_stat->st_mode = from_733(rr->u.PX.st_mode); p_stat->rr.st_mode = from_733(rr->u.PX.st_mode);
p_stat->st_nlinks = from_733(rr->u.PX.st_nlinks); p_stat->rr.st_nlinks = from_733(rr->u.PX.st_nlinks);
p_stat->st_uid = from_733(rr->u.PX.st_uid); p_stat->rr.st_uid = from_733(rr->u.PX.st_uid);
p_stat->st_gid = from_733(rr->u.PX.st_gid); p_stat->rr.st_gid = from_733(rr->u.PX.st_gid);
p_stat->b3_rock = yep; p_stat->rr.b3_rock = yep;
break; break;
case SIG('S','L'): case SIG('S','L'):
{ {
@@ -207,32 +228,32 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir,
iso_rock_sl_part_t * p_oldsl; iso_rock_sl_part_t * p_oldsl;
slen = rr->len - 5; slen = rr->len - 5;
p_sl = &rr->u.SL.link; p_sl = &rr->u.SL.link;
p_stat->i_symlink = symlink_len; p_stat->rr.i_symlink = symlink_len;
while (slen > 1){ while (slen > 1){
rootflag = 0; rootflag = 0;
switch(p_sl->flags &~1){ switch(p_sl->flags &~1){
case 0: case 0:
realloc_symlink(p_stat, p_sl->len); realloc_symlink(p_stat, p_sl->len);
memcpy(&(p_stat->psz_symlink[p_stat->i_symlink]), memcpy(&(p_stat->rr.psz_symlink[p_stat->rr.i_symlink]),
p_sl->text, p_sl->len); p_sl->text, p_sl->len);
p_stat->i_symlink += p_sl->len; p_stat->rr.i_symlink += p_sl->len;
break; break;
case 4: case 4:
realloc_symlink(p_stat, 1); realloc_symlink(p_stat, 1);
p_stat->psz_symlink[p_stat->i_symlink++] = '.'; p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '.';
p_stat->i_symlink++; p_stat->rr.i_symlink++;
/* continue into next case. */ /* continue into next case. */
break; break;
case 2: case 2:
realloc_symlink(p_stat, 1); realloc_symlink(p_stat, 1);
p_stat->psz_symlink[p_stat->i_symlink++] = '.'; p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '.';
p_stat->i_symlink++; p_stat->rr.i_symlink++;
break; break;
case 8: case 8:
rootflag = 1; rootflag = 1;
realloc_symlink(p_stat, 1); realloc_symlink(p_stat, 1);
p_stat->psz_symlink[p_stat->i_symlink++] = '/'; p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '/';
p_stat->i_symlink++; p_stat->rr.i_symlink++;
break; break;
default: default:
cdio_warn("Symlink component flag not implemented"); cdio_warn("Symlink component flag not implemented");
@@ -243,7 +264,7 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir,
if(slen < 2) { if(slen < 2) {
if (((rr->u.SL.flags & 1) != 0) if (((rr->u.SL.flags & 1) != 0)
&& ((p_oldsl->flags & 1) == 0) ) p_stat->i_symlink += 1; && ((p_oldsl->flags & 1) == 0) ) p_stat->rr.i_symlink += 1;
break; break;
} }
@@ -252,14 +273,14 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir,
*/ */
if (!rootflag && (p_oldsl->flags & 1) == 0) { if (!rootflag && (p_oldsl->flags & 1) == 0) {
realloc_symlink(p_stat, 1); realloc_symlink(p_stat, 1);
p_stat->psz_symlink[p_stat->i_symlink++] = '/'; p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '/';
p_stat->i_symlink++; p_stat->rr.i_symlink++;
} }
} }
} }
symlink_len = p_stat->i_symlink; symlink_len = p_stat->rr.i_symlink;
realloc_symlink(p_stat, 1); realloc_symlink(p_stat, 1);
p_stat->psz_symlink[symlink_len]='\0'; p_stat->rr.psz_symlink[symlink_len]='\0';
break; break;
case SIG('R','E'): case SIG('R','E'):
free(buffer); free(buffer);
@@ -267,30 +288,15 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir,
case SIG('T','F'): case SIG('T','F'):
/* Time stamp(s) for a file */ /* Time stamp(s) for a file */
{ {
#ifdef TIME_FIXED int cnt = 0;
int cnt = 0; /* Rock ridge never appears on a High Sierra disk */ add_time(ISO_ROCK_TF_CREATE, create);
/* Some RRIP writers incorrectly place ctime in the add_time(ISO_ROCK_TF_MODIFY, modify);
ISO_ROCK_TF_CREATE field. Try to handle this correctly for add_time(ISO_ROCK_TF_ACCESS, access);
either case. */ add_time(ISO_ROCK_TF_ATTRIBUTES, attributes);
/*** FIXME: add_time(ISO_ROCK_TF_BACKUP, backup);
Test on long format or not and use add_time(ISO_ROCK_TF_EXPIRATION, expiration);
iso9660_get_dtime or iso9660_get_ltime - which needs to be add_time(ISO_ROCK_TF_EFFECTIVE, effective);
written. p_stat->rr.b3_rock = yep;
*/
if (rr->u.TF.flags & ISO_ROCK_TF_CREATE) {
p_stat->st_ctime = rr->u.TF.times[cnt++].time;
}
if(rr->u.TF.flags & ISO_ROCK_TF_MODIFY) {
p_stat->st_mtime = rr->u.TF.times[cnt++].time;
}
if(rr->u.TF.flags & ISO_ROCK_TF_ACCESS) {
p_stat->st_atime = rr->u.TF.times[cnt++].time;
}
if(rr->u.TF.flags & ISO_ROCK_TF_ATTRIBUTES) {
p_stat->st_ctime = rr->u.TF.times[cnt++].time;
}
#endif
p_stat->b3_rock = yep;
break; break;
} }
default: default:
@@ -314,7 +320,7 @@ parse_rock_ridge_stat_internal(iso9660_dir_t *p_iso9660_dir,
int symlink_len = 0; int symlink_len = 0;
CONTINUE_DECLS; CONTINUE_DECLS;
if (nope == p_stat->b3_rock) return 0; if (nope == p_stat->rr.b3_rock) return 0;
SETUP_ROCK_RIDGE(p_iso9660_dir, chr, len); SETUP_ROCK_RIDGE(p_iso9660_dir, chr, len);
if (regard_xa) if (regard_xa)
@@ -345,17 +351,17 @@ parse_rock_ridge_stat_internal(iso9660_dir_t *p_iso9660_dir,
CHECK_CE; CHECK_CE;
break; break;
case SIG('E','R'): case SIG('E','R'):
p_stat->b3_rock = yep; p_stat->rr.b3_rock = yep;
cdio_debug("ISO 9660 Extensions: "); cdio_debug("ISO 9660 Extensions: ");
{ int p; { int p;
for(p=0;p<rr->u.ER.len_id;p++) cdio_debug("%c",rr->u.ER.data[p]); for(p=0;p<rr->u.ER.len_id;p++) cdio_debug("%c",rr->u.ER.data[p]);
} }
break; break;
case SIG('P','X'): case SIG('P','X'):
p_stat->st_mode = from_733(rr->u.PX.st_mode); p_stat->rr.st_mode = from_733(rr->u.PX.st_mode);
p_stat->st_nlinks = from_733(rr->u.PX.st_nlinks); p_stat->rr.st_nlinks = from_733(rr->u.PX.st_nlinks);
p_stat->st_uid = from_733(rr->u.PX.st_uid); p_stat->rr.st_uid = from_733(rr->u.PX.st_uid);
p_stat->st_gid = from_733(rr->u.PX.st_gid); p_stat->rr.st_gid = from_733(rr->u.PX.st_gid);
break; break;
#ifdef DEV_FINISHED #ifdef DEV_FINISHED
case SIG('P','N'): case SIG('P','N'):
@@ -370,9 +376,9 @@ parse_rock_ridge_stat_internal(iso9660_dir_t *p_iso9660_dir,
* stored in the low field, and use that. * stored in the low field, and use that.
*/ */
if((low & ~0xff) && high == 0) { if((low & ~0xff) && high == 0) {
p_stat->i_rdev = MKDEV(low >> 8, low & 0xff); p_stat->rr.i_rdev = MKDEV(low >> 8, low & 0xff);
} else { } else {
p_stat->i_rdev = MKDEV(high, low); p_stat->rr.i_rdev = MKDEV(high, low);
} }
} }
break; break;
@@ -390,16 +396,16 @@ parse_rock_ridge_stat_internal(iso9660_dir_t *p_iso9660_dir,
written. written.
*/ */
if (rr->u.TF.flags & ISO_ROCK_TF_CREATE) { if (rr->u.TF.flags & ISO_ROCK_TF_CREATE) {
p_stat->st_ctime = rr->u.TF.times[cnt++].time; p_stat->rr.st_ctime = rr->u.TF.times[cnt++].time;
} }
if(rr->u.TF.flags & ISO_ROCK_TF_MODIFY) { if(rr->u.TF.flags & ISO_ROCK_TF_MODIFY) {
p_stat->st_mtime = rr->u.TF.times[cnt++].time; p_stat->rr.st_mtime = rr->u.TF.times[cnt++].time;
} }
if(rr->u.TF.flags & ISO_ROCK_TF_ACCESS) { if(rr->u.TF.flags & ISO_ROCK_TF_ACCESS) {
p_stat->st_atime = rr->u.TF.times[cnt++].time; p_stat->rr.st_atime = rr->u.TF.times[cnt++].time;
} }
if(rr->u.TF.flags & ISO_ROCK_TF_ATTRIBUTES) { if(rr->u.TF.flags & ISO_ROCK_TF_ATTRIBUTES) {
p_stat->st_ctime = rr->u.TF.times[cnt++].time; p_stat->rr.st_ctime = rr->u.TF.times[cnt++].time;
} }
break; break;
} }
@@ -412,28 +418,28 @@ parse_rock_ridge_stat_internal(iso9660_dir_t *p_iso9660_dir,
iso_rock_sl_part_t *p_oldsl; iso_rock_sl_part_t *p_oldsl;
slen = rr->len - 5; slen = rr->len - 5;
p_sl = &rr->u.SL.link; p_sl = &rr->u.SL.link;
p_stat->i_symlink = symlink_len; p_stat->rr.i_symlink = symlink_len;
while (slen > 1){ while (slen > 1){
rootflag = 0; rootflag = 0;
switch(p_sl->flags &~1){ switch(p_sl->flags &~1){
case 0: case 0:
p_stat->i_symlink += p_sl->len; p_stat->rr.i_symlink += p_sl->len;
/*memcpy(psz_rsymlink, p_sl->text, p_sl->len); /*memcpy(psz_rsymlink, p_sl->text, p_sl->len);
psz_rsymlink+=p_sl->len;*/ psz_rsymlink+=p_sl->len;*/
break; break;
case 4: case 4:
/**psz_rsymlink++='.';*/ /**psz_rsymlink++='.';*/
p_stat->i_symlink++; p_stat->rr.i_symlink++;
/* continue into next case. */ /* continue into next case. */
break; break;
case 2: case 2:
/**psz_rsymlink++='.';*/ /**psz_rsymlink++='.';*/
p_stat->i_symlink++; p_stat->rr.i_symlink++;
break; break;
case 8: case 8:
rootflag = 1; rootflag = 1;
/**rootflag = 1;*/ /**rootflag = 1;*/
p_stat->i_symlink += 1; p_stat->rr.i_symlink += 1;
break; break;
default: default:
cdio_info("Symlink component flag not implemented"); cdio_info("Symlink component flag not implemented");
@@ -444,7 +450,7 @@ parse_rock_ridge_stat_internal(iso9660_dir_t *p_iso9660_dir,
if(slen < 2) { if(slen < 2) {
if( ((rr->u.SL.flags & 1) != 0) if( ((rr->u.SL.flags & 1) != 0)
&& ((p_oldsl->flags & 1) == 0) ) p_stat->i_symlink += 1; && ((p_oldsl->flags & 1) == 0) ) p_stat->rr.i_symlink += 1;
break; break;
} }
@@ -452,10 +458,10 @@ parse_rock_ridge_stat_internal(iso9660_dir_t *p_iso9660_dir,
* If this component record isn't continued, then append a '/'. * If this component record isn't continued, then append a '/'.
*/ */
if (!rootflag && (p_oldsl->flags & 1) == 0) if (!rootflag && (p_oldsl->flags & 1) == 0)
p_stat->i_symlink += 1; p_stat->rr.i_symlink += 1;
} }
} }
symlink_len = p_stat->i_symlink; symlink_len = p_stat->rr.i_symlink;
break; break;
case SIG('R','E'): case SIG('R','E'):
cdio_warn("Attempt to read p_stat for relocated directory"); cdio_warn("Attempt to read p_stat for relocated directory");
@@ -465,19 +471,19 @@ parse_rock_ridge_stat_internal(iso9660_dir_t *p_iso9660_dir,
{ {
iso9660_stat_t * reloc; iso9660_stat_t * reloc;
ISOFS_I(p_stat)->i_first_extent = from_733(rr->u.CL.location); ISOFS_I(p_stat)->i_first_extent = from_733(rr->u.CL.location);
reloc = isofs_iget(p_stat->i_sb, p_stat->i_first_extent, 0); reloc = isofs_iget(p_stat->rr.i_sb, p_stat->rr.i_first_extent, 0);
if (!reloc) if (!reloc)
goto out; goto out;
p_stat->st_mode = reloc->st_mode; p_stat->rr.st_mode = reloc->st_mode;
p_stat->st_nlinks = reloc->st_nlinks; p_stat->rr.st_nlinks = reloc->st_nlinks;
p_stat->st_uid = reloc->st_uid; p_stat->rr.st_uid = reloc->st_uid;
p_stat->st_gid = reloc->st_gid; p_stat->rr.st_gid = reloc->st_gid;
p_stat->i_rdev = reloc->i_rdev; p_stat->rr.i_rdev = reloc->i_rdev;
p_stat->i_symlink = reloc->i_symlink; p_stat->rr.i_symlink = reloc->i_symlink;
p_stat->i_blocks = reloc->i_blocks; p_stat->rr.i_blocks = reloc->i_blocks;
p_stat->i_atime = reloc->i_atime; p_stat->rr.i_atime = reloc->i_atime;
p_stat->i_ctime = reloc->i_ctime; p_stat->rr.i_ctime = reloc->i_ctime;
p_stat->i_mtime = reloc->i_mtime; p_stat->rr.i_mtime = reloc->i_mtime;
iput(reloc); iput(reloc);
} }
break; break;
@@ -503,7 +509,7 @@ parse_rock_ridge_stat(iso9660_dir_t *p_iso9660_dir,
result = parse_rock_ridge_stat_internal(p_iso9660_dir, p_stat, 0); result = parse_rock_ridge_stat_internal(p_iso9660_dir, p_stat, 0);
/* if Rock-Ridge flag was reset and we didn't look for attributes /* if Rock-Ridge flag was reset and we didn't look for attributes
* behind eventual XA attributes, have a look there */ * behind eventual XA attributes, have a look there */
if (0xFF == p_stat->s_rock_offset && nope != p_stat->b3_rock) { if (0xFF == p_stat->rr.s_rock_offset && nope != p_stat->rr.b3_rock) {
result = parse_rock_ridge_stat_internal(p_iso9660_dir, p_stat, 14); result = parse_rock_ridge_stat_internal(p_iso9660_dir, p_stat, 14);
} }
return result; return result;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cd-info.c,v 1.118 2005/02/21 02:02:12 rocky Exp $ $Id: cd-info.c,v 1.119 2005/02/21 09:00:53 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 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>
@@ -600,7 +600,7 @@ print_iso9660_recurse (CdIo_t *p_cdio, const char pathname[],
char _fullname[4096] = { 0, }; char _fullname[4096] = { 0, };
char translated_name[MAX_ISONAME+1]; char translated_name[MAX_ISONAME+1];
if (yep != p_statbuf->b3_rock || 1 == opts.no_rock_ridge) { if (yep != p_statbuf->rr.b3_rock || 1 == opts.no_rock_ridge) {
iso9660_name_translate_ext(psz_iso_name, translated_name, iso9660_name_translate_ext(psz_iso_name, translated_name,
i_joliet_level); i_joliet_level);
} }
@@ -618,9 +618,9 @@ print_iso9660_recurse (CdIo_t *p_cdio, const char pathname[],
print_fs_attrs(p_statbuf, 0 == opts.no_rock_ridge, fs & CDIO_FS_ANAL_XA, print_fs_attrs(p_statbuf, 0 == opts.no_rock_ridge, fs & CDIO_FS_ANAL_XA,
psz_iso_name, translated_name); psz_iso_name, translated_name);
if (p_statbuf->i_symlink) { if (p_statbuf->rr.i_symlink) {
free(p_statbuf->psz_symlink); free(p_statbuf->rr.psz_symlink);
p_statbuf->i_symlink = 0; p_statbuf->rr.i_symlink = 0;
} }
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso-info.c,v 1.27 2005/02/21 02:02:12 rocky Exp $ $Id: iso-info.c,v 1.28 2005/02/21 09:00:53 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -203,7 +203,7 @@ print_iso9660_recurse (iso9660_t *p_iso, const char pathname[])
char _fullname[4096] = { 0, }; char _fullname[4096] = { 0, };
char translated_name[MAX_ISONAME+1]; char translated_name[MAX_ISONAME+1];
if (yep != p_statbuf->b3_rock || 1 == opts.no_rock_ridge) { if (yep != p_statbuf->rr.b3_rock || 1 == opts.no_rock_ridge) {
iso9660_name_translate_ext(psz_iso_name, translated_name, iso9660_name_translate_ext(psz_iso_name, translated_name,
i_joliet_level); i_joliet_level);
snprintf (_fullname, sizeof (_fullname), "%s%s", pathname, snprintf (_fullname, sizeof (_fullname), "%s%s", pathname,
@@ -228,10 +228,11 @@ print_iso9660_recurse (iso9660_t *p_iso, const char pathname[])
} else } else
if ( strcmp (psz_iso_name, ".") && strcmp (psz_iso_name, "..")) if ( strcmp (psz_iso_name, ".") && strcmp (psz_iso_name, ".."))
printf("%9u %s%s\n", p_statbuf->size, pathname, printf("%9u %s%s\n", p_statbuf->size, pathname,
yep == p_statbuf->b3_rock ? psz_iso_name : translated_name); yep == p_statbuf->rr.b3_rock
if (p_statbuf->i_symlink) { ? psz_iso_name : translated_name);
free(p_statbuf->psz_symlink); if (p_statbuf->rr.i_symlink) {
p_statbuf->i_symlink = 0; free(p_statbuf->rr.psz_symlink);
p_statbuf->rr.i_symlink = 0;
} }
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: util.c,v 1.41 2005/02/21 02:02:12 rocky Exp $ $Id: util.c,v 1.42 2005/02/21 09:00:53 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -463,12 +463,12 @@ print_fs_attrs(iso9660_stat_t *p_statbuf, bool b_rock, bool b_xa,
{ {
char date_str[30]; char date_str[30];
if (yep == p_statbuf->b3_rock && b_rock) { if (yep == p_statbuf->rr.b3_rock && b_rock) {
report (stdout, " %s %d %d %d [LSN %6lu] %9u", report (stdout, " %s %d %d %d [LSN %6lu] %9u",
iso9660_get_rock_attr_str (p_statbuf->st_mode), iso9660_get_rock_attr_str (p_statbuf->rr.st_mode),
p_statbuf->st_nlinks, p_statbuf->rr.st_nlinks,
p_statbuf->st_uid, p_statbuf->rr.st_uid,
p_statbuf->st_gid, p_statbuf->rr.st_gid,
(long unsigned int) p_statbuf->lsn, (long unsigned int) p_statbuf->lsn,
(unsigned int) p_statbuf->size); (unsigned int) p_statbuf->size);
@@ -494,14 +494,14 @@ print_fs_attrs(iso9660_stat_t *p_statbuf, bool b_rock, bool b_xa,
} }
strftime(date_str, sizeof(date_str), "%b %d %Y %H:%M ", &p_statbuf->tm); strftime(date_str, sizeof(date_str), "%b %d %Y %H:%M ", &p_statbuf->tm);
report (stdout," %s %s", date_str, report (stdout," %s %s", date_str,
yep == p_statbuf->b3_rock && b_rock yep == p_statbuf->rr.b3_rock && b_rock
? psz_name_untranslated : psz_name_translated); ? psz_name_untranslated : psz_name_translated);
if (yep == p_statbuf->b3_rock && b_rock && S_ISLNK(p_statbuf->st_mode)) { if (yep == p_statbuf->rr.b3_rock && b_rock
report(stdout, " -> %s", p_statbuf->psz_symlink); && S_ISLNK(p_statbuf->rr.st_mode)) {
report(stdout, " -> %s", p_statbuf->rr.psz_symlink);
} }
report(stdout, "\n"); report(stdout, "\n");
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: util.h,v 1.11 2005/02/20 10:21:01 rocky Exp $ $Id: util.h,v 1.12 2005/02/21 09:00:53 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>