Remove assumption that OS has POSIX file definitions (mode_t, nlink_t,

gid_t, uid_t, time_t, etc.)
This commit is contained in:
rocky
2005-02-14 02:18:58 +00:00
parent d37d48bc1c
commit 3f4397a6f5
2 changed files with 35 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660.h,v 1.65 2005/02/13 22:03:00 rocky Exp $ $Id: iso9660.h,v 1.66 2005/02/14 02:18:58 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>
@@ -511,6 +511,11 @@ typedef struct iso9660_svd_s iso9660_svd_t;
PRAGMA_END_PACKED PRAGMA_END_PACKED
typedef uint32_t posix_mode_t;
typedef uint32_t posix_nlink_t;
typedef uint32_t posix_uid_t;
typedef uint32_t posix_gid_t;
/*! \brief Unix stat-like version of iso9660_dir /*! \brief Unix stat-like version of iso9660_dir
The iso9660_stat structure is not part of the ISO-9660 The iso9660_stat structure is not part of the ISO-9660
@@ -521,24 +526,24 @@ PRAGMA_END_PACKED
@see iso9660_dir @see iso9660_dir
*/ */
struct iso9660_stat_s { /* big endian!! */ struct iso9660_stat_s { /* big endian!! */
bool b_rock; /**< has Rock Ridge extension. bool b_rock; /**< has Rock Ridge extension.
If not true then the next 7 feilds If not true then the next 9 fields
aren't used. aren't used.
*/ */
mode_t st_mode; /**< protection */ posix_mode_t st_mode; /**< protection */
nlink_t st_nlinks; /**< number of hard links */ posix_nlink_t st_nlinks; /**< number of hard links */
uid_t st_uid; /**< user ID of owner */ posix_uid_t st_uid; /**< user ID of owner */
gid_t st_gid; /**< group ID of owner */ posix_gid_t st_gid; /**< group ID of owner */
uint8_t s_rock_offset; uint8_t s_rock_offset;
int i_size; int i_size; /**< FIXME: Is this one of the
#if 0 size fields below? */
time_t st_atime; /**< time of last access */ struct tm atime; /**< time of last access */
time_t st_mtime; /**< time of last modification */ struct tm mtime; /**< time of last modification */
time_t st_ctime; /**< time of last change */ struct tm ctime; /**< create time */
#endif
/* Non Ridge-specific fields */ /* Non Ridge-specific fields */
struct tm tm; /**< time on entry */ struct tm tm; /**< time on entry - FIXME merge with
one of entries above, like ctime? */
lsn_t lsn; /**< start logical sector number */ lsn_t lsn; /**< start logical sector number */
uint32_t size; /**< total size in bytes */ uint32_t size; /**< total size in bytes */
uint32_t secsize; /**< number of sectors allocated */ uint32_t secsize; /**< number of sectors allocated */

View File

@@ -1,5 +1,5 @@
/* /*
$Id: rock.c,v 1.1 2005/02/13 22:03:00 rocky Exp $ $Id: rock.c,v 1.2 2005/02/14 02:18:58 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
@@ -224,32 +224,33 @@ parse_rock_ridge_stat_internal(iso9660_dir_t *de,
} }
break; break;
#endif #endif
#if TIME_FINISHED #ifdef TIME_FIXED
case SIG('T','F'): case SIG('T','F'):
{ {
int cnt = 0; /* Rock ridge never appears on a High Sierra disk */ int cnt = 0; /* Rock ridge never appears on a High Sierra disk */
/* Some RRIP writers incorrectly place ctime in the /* Some RRIP writers incorrectly place ctime in the
ISO_ROCK_TF_CREATE field. Try to handle this correctly for ISO_ROCK_TF_CREATE field. Try to handle this correctly for
either case. */ either case. */
if(rr->u.TF.flags & ISO_ROCK_TF_CREATE) { /*** FIXME:
p_stat->i_ctime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); Test on long format or not and use
p_stat->i_ctime.tv_nsec = 0; iso9660_get_dtime or iso9660_get_ltime - which needs to be
written.
*/
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) { if(rr->u.TF.flags & ISO_ROCK_TF_MODIFY) {
p_stat->i_mtime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); p_stat->st_mtime = rr->u.TF.times[cnt++].time;
p_stat->i_mtime.tv_nsec = 0;
} }
if(rr->u.TF.flags & ISO_ROCK_TF_ACCESS) { if(rr->u.TF.flags & ISO_ROCK_TF_ACCESS) {
p_stat->i_atime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); p_stat->st_atime = rr->u.TF.times[cnt++].time;
p_stat->i_atime.tv_nsec = 0;
} }
if(rr->u.TF.flags & ISO_ROCK_TF_ATTRIBUTES) { if(rr->u.TF.flags & ISO_ROCK_TF_ATTRIBUTES) {
p_stat->i_ctime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); p_stat->st_ctime = rr->u.TF.times[cnt++].time;
p_stat->i_ctime.tv_nsec = 0;
} }
break; break;
} }
#endif /* TIME_FINISHED */ #endif
case SIG('S','L'): case SIG('S','L'):
{int slen; {int slen;
iso_rock_sl_part_t *slp; iso_rock_sl_part_t *slp;