More ISO 9660 date cleanup. Hopefully cleaner structure definitions

and more function documentation.
This commit is contained in:
rocky
2003-09-21 01:14:30 +00:00
parent 5ec59c8a98
commit 0a8505d91a
8 changed files with 171 additions and 98 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: iso9660.h,v 1.23 2003/09/20 12:33:14 rocky Exp $
$Id: iso9660.h,v 1.24 2003/09/21 01:14:30 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -178,18 +178,22 @@ typedef struct iso9660_stat iso9660_stat_t;
/* Format of an ISO-9660 directory record */
struct iso9660_dir {
uint8_t length; /* 711 */
uint8_t ext_attr_length; /* 711 */
uint8_t xa_length; /* 711 */
uint64_t extent; /* 733 */
uint64_t size; /* 733 */
iso9660_dtime_t date; /* 7 by 711 */
uint8_t flags;
iso9660_dtime_t recording_time; /* 7 by 711 */
uint8_t file_flags;
uint8_t file_unit_size; /* 711 */
uint8_t interleave; /* 711 */
uint8_t interleave_gap; /* 711 */
uint32_t volume_sequence_number; /* 723 */
uint8_t name_len; /* 711 */
char name[EMPTY_ARRAY_SIZE];
uint8_t filename_len; /* 711 */
char filename[EMPTY_ARRAY_SIZE];
} GNUC_PACKED;
/* The following structure is not part of ISO 9660. We just use it
for our own purposes for communicating info back that's pulled out.
*/
struct iso9660_stat { /* big endian!! */
enum { _STAT_FILE = 1, _STAT_DIR = 2 } type;
lsn_t lsn; /* start logical sector number */
@@ -260,9 +264,12 @@ char *iso9660_strncpy_pad(char dst[], const char src[], size_t len,
Get time structure from structure in an ISO 9660 directory index
record. Even though tm_wday and tm_yday fields are not explicitly in
idr_date, the are calculated from the other fields.
If tm is to reflect the localtime set use_localtime true, otherwise
tm will reported in GMT.
*/
void iso9660_get_time (const iso9660_dtime_t *idr_date,
/*out*/ struct tm *tm);
void iso9660_get_dtime (const iso9660_dtime_t *idr_date, bool use_localtime,
/*out*/ struct tm *tm);
/*=====================================================================
@@ -319,8 +326,9 @@ iso9660_dir_init_new_su (void *dir, uint32_t self, uint32_t ssize,
const time_t *dir_time);
void
iso9660_dir_add_entry_su (void *dir, const char name[], uint32_t extent,
uint32_t size, uint8_t flags, const void *su_data,
iso9660_dir_add_entry_su (void *dir, const char filename[], uint32_t extent,
uint32_t size, uint8_t file_flags,
const void *su_data,
unsigned int su_size, const time_t *entry_time);
unsigned int
@@ -368,19 +376,22 @@ iso9660_get_pvd_space_size(const iso9660_pvd_t *pvd);
int
iso9660_get_pvd_block_size(const iso9660_pvd_t *pvd) ;
int
iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ;
/*! Return the primary volume id version number (of pvd).
If there is an error 0 is returned.
*/
int iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ;
lsn_t
iso9660_get_root_lsn(const iso9660_pvd_t *pvd);
/*! Return the LSN of the root directory for pvd.
If there is an error CDIO_INVALID_LSN is returned.
*/
lsn_t iso9660_get_root_lsn(const iso9660_pvd_t *pvd);
/* pathtable */
void
iso9660_pathtable_init (void *pt);
/*! Zero's out pathable. Do this first. */
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
iso9660_pathtable_l_add_entry (void *pt, const char name[], uint32_t extent,
@@ -388,7 +399,7 @@ iso9660_pathtable_l_add_entry (void *pt, const char name[], uint32_t extent,
uint16_t
iso9660_pathtable_m_add_entry (void *pt, const char name[], uint32_t extent,
uint16_t parent);
uint16_t parent);
/* volume descriptors */

View File

@@ -1,10 +1,11 @@
/*
$Id: xa.h,v 1.4 2003/09/01 02:08:59 rocky Exp $
$Id: xa.h,v 1.5 2003/09/21 01:14:30 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
See also iso9660.h by Eric Youngdale (1993).
See also iso9660.h by Eric Youngdale (1993) and in cdrtools. These
are
Copyright 1993 Yggdrasil Computing, Incorporated
Copyright (c) 1999,2000 J. Schilling
@@ -33,17 +34,17 @@
#define ISO_XA_MARKER_OFFSET 1024
/* XA attribute definitions */
#define XA_ATTR_G_READ 0x0001 /* System Group Read */
#define XA_ATTR_G_EXEC 0x0004 /* System Group Execute */
#define XA_PERM_RSYS 0x0001 /* System Group Read */
#define XA_PERM_XSYS 0x0004 /* System Group Execute */
#define XA_ATTR_U_READ 0x0010 /* Owner Read */
#define XA_ATTR_U_EXEC 0x0040 /* Owner Execute */
#define XA_PERM_RUSR 0x0010 /* User (owner) Read */
#define XA_PERM_XUSR 0x0040 /* User (owner) Execute */
#define XA_ATTR_O_READ 0x0100 /* Group Read */
#define XA_ATTR_O_EXEC 0x0400 /* Group Execute */
#define XA_PERM_RGRP 0x0100 /* Group Read */
#define XA_PERM_XGRP 0x0400 /* Group Execute */
#define XA_ATTR_W_READ 0x1000 /* World (other) Read */
#define XA_ATTR_W_EXEC 0x4000 /* World (other) Execute */
#define XA_PERM_ROTH 0x1000 /* Other (world) Read */
#define XA_PERM_XOTH 0x4000 /* Other (world) Execute */
#define XA_ATTR_MODE2FORM1 (1 << 11)
#define XA_ATTR_MODE2FORM2 (1 << 12)
@@ -52,8 +53,8 @@
#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_READ (XA_PERM_RUSR | XA_PERM_RSYS | XA_PERM_RGRP)
#define XA_PERM_ALL_EXEC (XA_PERM_XUSR | XA_PERM_XSYS | XA_PERM_XGRP)
#define XA_PERM_ALL_ALL (XA_PERM_ALL_READ | XA_PERM_ALL_EXEC)
#define XA_FORM1_DIR (XA_ATTR_DIRECTORY | XA_ATTR_MODE2FORM1 | XA_PERM_ALL_ALL)
@@ -92,9 +93,9 @@ typedef struct iso9660_xa /* big endian!! */
Note that an entry will either be in mode2 form1 or mode form2. That
is you will either see "2-" or "-1" in the 4th & 5th positions.
The 6th and 7th characters refer to permissions for everyone while the
The 6th and 7th characters refer to permissions for a user while the
the 8th and 9th characters refer to permissions for a group while, and
the 10th and 11th characters refer to permissions for a user.
the 10th and 11th characters refer to permissions for everyone.
In each of these pairs the first character (6, 8, 10) is "x" if the
entry is executable. For a directory this means the directory is