From 5583cbccd737eb3018ade94668743d5e32741374 Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 27 Oct 2005 11:18:56 +0000 Subject: [PATCH] More documentation of ecma 167. Some fields changed names. More #defines removed/replaced by enum type and variables. --- include/cdio/ecma_167.h | 98 ++++++++++++++++++++++++++--------------- include/cdio/udf.h | 10 ++++- include/cdio/udf_time.h | 12 ++--- lib/udf/libudf.sym | 1 + lib/udf/udf.c | 19 +++++--- lib/udf/udf_fs.c | 12 +---- lib/udf/udf_time.c | 21 +++++++++ 7 files changed, 114 insertions(+), 59 deletions(-) diff --git a/include/cdio/ecma_167.h b/include/cdio/ecma_167.h index d92f7b55..d09cf4fc 100644 --- a/include/cdio/ecma_167.h +++ b/include/cdio/ecma_167.h @@ -55,8 +55,8 @@ #include /** - Imagine the below #define'd values rather than distinct values of - an enum. + Imagine the below enum values as #define'd values rather than + distinct values of an enum. */ typedef enum { VSD_STD_ID_SIZE = 5, /** Volume Structure Descriptor (ECMA 167r3 @@ -67,7 +67,7 @@ typedef enum { UDF_VOLSET_ID_SIZE = 128 } ecma_167_enum1_t ; -/** This variable is trickery to force the above enum symbol value to +/** This variable is trickery to force the above enum symbol values to be recorded in debug symbol tables. It is used to allow one refer to above enumeration values in a debugger and debugger expressions */ @@ -148,7 +148,26 @@ struct udf_timestamp_s typedef struct udf_timestamp_s udf_timestamp_t; -/** Type and Time Zone (ECMA 167r3 1/7.3.1) */ +/** Type and Time Zone (ECMA 167r3 1/7.3.1) + + Imagine the below enum values as #define'd values rather than + distinct values of an enum. +*/ +typedef enum { + TIMESTAMP_TYPE_CUT = 0x0000, + TIMESTAMP_TYPE_LOCAL = 0x1000, + TIMESTAMP_TYPE_AGREEMENT = 0x2000, + TIMESTAMP_TYPE_MASK = 0xF000, + TIMESTAMP_TIMEZONE_MASK = 0x0FFF, +} ecma_167_timezone_enum_t ; + +/** This variable is trickery to force the above enum symbol values to + be recorded in debug symbol tables. It is used to allow one refer + to above enumeration values in a debugger and debugger + expressions */ +extern ecma_167_timezone_enum_t debug_ecma_167_timezone_enum; + + #define TIMESTAMP_TYPE_MASK 0xF000 #define TIMESTAMP_TYPE_CUT 0x0000 #define TIMESTAMP_TYPE_LOCAL 0x1000 @@ -658,20 +677,24 @@ struct terminal_entry_s /** File Entry (ECMA 167r3 4/14.9) */ struct udf_file_entry_s { - udf_tag_t tag; - udf_icbtag_t icb_tag; - udf_Uint32_t uid; - udf_Uint32_t gid; - udf_Uint32_t permissions; - udf_Uint16_t link_count; - udf_Uint8_t rec_format; - udf_Uint8_t rec_disp_attr; - udf_Uint32_t rec_len; - udf_Uint64_t info_len; - udf_Uint64_t logblks_recorded; - udf_timestamp_t access_time; - udf_timestamp_t modification_time; - udf_timestamp_t attr_time; + udf_tag_t tag; + udf_icbtag_t icb_tag; /**< 4/14.9.2 */ + udf_Uint32_t uid; /**< 4/14.9.3 */ + udf_Uint32_t gid; /**< 4/14.9.4 */ + udf_Uint32_t permissions; /**< 4/14.9.5 */ + udf_Uint16_t link_count; /**< 4/14.9.6 */ + udf_Uint8_t rec_format; /**< 4/14.9.7 */ + udf_Uint8_t rec_disp_attr; /**< 4/14.9.8 */ + udf_Uint32_t rec_len; /**< 4/14.9.9 */ + udf_Uint64_t info_len; /**< 4/14.9.10 */ + udf_Uint64_t logblks_recorded; /**< 4/14.9.11 */ + udf_timestamp_t access_time; /**< 4/14.9.12 - last access to + any stream of file prior to + recording file entry */ + udf_timestamp_t modification_time; /**< 4/14.9.13 - last access to + modification to any stream of + file */ + udf_timestamp_t attribute_time; udf_Uint32_t checkpoint; udf_long_ad_t ext_attr_ICB; udf_regid_t imp_id; @@ -907,24 +930,29 @@ struct pathComponent /** File Entry (ECMA 167r3 4/14.17) */ struct extended_file_entry { - udf_tag_t tag; - udf_icbtag_t icb_tag; - udf_Uint32_t uid; - udf_Uint32_t gid; - udf_Uint32_t permissions; - udf_Uint16_t link_count; - udf_Uint8_t rec_format; - udf_Uint8_t rec_display_attr; - udf_Uint32_t record_len; - udf_Uint64_t info_len; - udf_Uint64_t object_size; - udf_Uint64_t logblks_recorded; - udf_timestamp_t access_time; - udf_timestamp_t modification_time; - udf_timestamp_t create_time; - udf_timestamp_t attr_time; + udf_tag_t tag; /**< 4/14.17.1 - id = 266 */ + udf_icbtag_t icb_tag; /**< 4/14.17.2 & 4/14.9.2 */ + udf_Uint32_t uid; /**< 4/14.17.3 & 4/14.9.3 */ + udf_Uint32_t gid; /**< 4/14.17.4 & 4/14.9.4 */ + udf_Uint32_t permissions; /**< 4/14.17.5 & 4/14.9.5 */ + udf_Uint16_t link_count; /**< 4/14.17.6 & 4/14.9.6 */ + udf_Uint8_t rec_format; /**< 4/14.17.7 & 4/14.9.7 */ + udf_Uint8_t rec_display_attr; /**< 4/14.17.8 & 4/14.9.8 */ + udf_Uint32_t record_len; /**< 4/14.17.9 & 4/14.9.9 */ + udf_Uint64_t info_len; /**< 4/14.17.10 & 4/14.9.10 */ + udf_Uint64_t object_size; /**< 4/14.17.11 */ + udf_Uint64_t logblks_recorded; /**< 4/14.17.12 & 4/14.9.11 */ + udf_timestamp_t access_time; /**< 4/14.17.13 & 4/14.9.12 - last + access to any stream of file */ + udf_timestamp_t modification_time; /**< 4/14.17.14 & 4/14.9.13 - last + modification to any stream of + file*/ + udf_timestamp_t create_time; /**< 4/14.17.15 */ + udf_timestamp_t attribute_time; /**< 4/14.17.16 & 4/14.9.14 - + most recent create or modify + time */ udf_Uint32_t checkpoint; - udf_Uint32_t reserved; + udf_Uint32_t reserved; /**< #00 bytes */ udf_long_ad_t ext_attr_ICB; udf_long_ad_t stream_directory_ICB; udf_regid_t imp_id; diff --git a/include/cdio/udf.h b/include/cdio/udf.h index 7013b8f6..ee1dfa94 100644 --- a/include/cdio/udf.h +++ b/include/cdio/udf.h @@ -1,5 +1,5 @@ /* - $Id: udf.h,v 1.11 2005/10/27 01:23:48 rocky Exp $ + $Id: udf.h,v 1.12 2005/10/27 11:18:56 rocky Exp $ Copyright (C) 2005 Rocky Bernstein This program is free software; you can redistribute it and/or modify @@ -116,10 +116,16 @@ int udf_get_volume_id(udf_t *p_udf, /*out*/ char *psz_volid, partition_num_t i_partition); /*! - Returns a string which interpreting the extended attribute permissions + Returns a string which interprets the extended attribute permissions */ const char *udf_get_attr_str(udf_Uint32_t permissions, char perms[]); + /*! + Returns a POSIX filemode string for a given p_udf_file. + */ + const char *udf_get_posix_filemode_str(const udf_file_t *p_udf_file, + char perms[]); + /*! Return the name of the file */ diff --git a/include/cdio/udf_time.h b/include/cdio/udf_time.h index 1be6ab5e..dbf5e93b 100644 --- a/include/cdio/udf_time.h +++ b/include/cdio/udf_time.h @@ -1,5 +1,5 @@ /* - $Id: udf_time.h,v 1.1 2005/10/26 02:05:54 rocky Exp $ + $Id: udf_time.h,v 1.2 2005/10/27 11:18:56 rocky Exp $ Copyright (C) 2005 Rocky Bernstein This program is free software; you can redistribute it and/or modify @@ -34,19 +34,19 @@ extern "C" { #endif /* __cplusplus */ /*! - Return the access time of the file + Return the access time of the file. */ time_t udf_get_access_time(const udf_file_t *p_udf_file); /*! - Return the modification time of the file + Return the attribute (most recent create or access) time of the file */ -time_t udf_get_modification_time(const udf_file_t *p_udf_file); +time_t udf_get_attribute_time(const udf_file_t *p_udf_file); /*! - Return the attr time of the file + Return the modification time of the file. */ -time_t udf_get_attr_time(const udf_file_t *p_udf_file); +time_t udf_get_modification_time(const udf_file_t *p_udf_file); /*! Return the access timestamp of the file diff --git a/lib/udf/libudf.sym b/lib/udf/libudf.sym index b6dbc40a..485f8cc6 100644 --- a/lib/udf/libudf.sym +++ b/lib/udf/libudf.sym @@ -1,4 +1,5 @@ debug_ecma_167_enums1 +debug_ecma_167_timezone_enum debug_file_characteristics debug_tagid debug_udf_enums1 diff --git a/lib/udf/udf.c b/lib/udf/udf.c index 23890f31..21cfab53 100644 --- a/lib/udf/udf.c +++ b/lib/udf/udf.c @@ -1,5 +1,5 @@ /* - $Id: udf.c,v 1.2 2005/10/27 01:23:48 rocky Exp $ + $Id: udf.c,v 1.3 2005/10/27 11:18:57 rocky Exp $ Copyright (C) 2005 Rocky Bernstein @@ -26,6 +26,17 @@ # include #endif +/** The below variables are trickery to force enum symbol values to be + recorded in debug symbol tables. They are used to allow one to refer + to the enumeration value names in the typedefs above in a debugger + and debugger expressions +*/ +tag_id_t debug_tagid; +file_characteristics_t debug_file_characteristics; +udf_enum1_t debug_udf_enum1; +ecma_167_enum1_t ecma167_enum1; +ecma_167_timezone_enum_t debug_ecma_167_timezone_enum; + /*! Returns a string which interpreting the extended attribute permissions */ @@ -38,9 +49,9 @@ udf_get_attr_str(udf_Uint32_t permissions, char *result) result[ 1] = (i_perms & FE_PERM_U_WRITE) ? 'w' : '-'; result[ 2] = (i_perms & FE_PERM_U_EXEC) ? 'x' : '-'; - result[ 3] = (i_perms & FE_PERM_G_READ) ? 'r' : '-'; + result[ 3] = (i_perms & FE_PERM_G_READ) ? 'r' : '-'; result[ 4] = (i_perms & FE_PERM_G_WRITE) ? 'w' : '-'; - result[ 5] = (i_perms & FE_PERM_G_EXEC) ? 'x' : '-'; + result[ 5] = (i_perms & FE_PERM_G_EXEC) ? 'x' : '-'; result[ 6] = (i_perms & FE_PERM_O_READ) ? 'r' : '-'; result[ 7] = (i_perms & FE_PERM_O_WRITE) ? 'w' : '-'; @@ -71,5 +82,3 @@ udf_is_dir(const udf_file_t *p_udf_file) { return p_udf_file->b_dir; } - - diff --git a/lib/udf/udf_fs.c b/lib/udf/udf_fs.c index 1162018b..5daa7a09 100644 --- a/lib/udf/udf_fs.c +++ b/lib/udf/udf_fs.c @@ -1,5 +1,5 @@ /* - $Id: udf_fs.c,v 1.8 2005/10/27 01:23:48 rocky Exp $ + $Id: udf_fs.c,v 1.9 2005/10/27 11:18:57 rocky Exp $ Copyright (C) 2005 Rocky Bernstein @@ -70,16 +70,6 @@ const char VSD_STD_ID_TEA01[] = {'T', 'E', 'A', '0', '1'}; #include #include "udf_private.h" -/** The below variables are trickery to force enum symbol values to be - recorded in debug symbol tables. They are used to allow one to refer - to the enumeration value names in the typedefs above in a debugger - and debugger expressions -*/ -tag_id_t debug_tagid; -file_characteristics_t debug_file_characteristics; -udf_enum1_t debug_udf_enum1; -ecma_167_enum1_t ecma167_enum1; - /* * The UDF specs are pretty clear on how each data structure is made * up, but not very clear on how they relate to each other. Here is diff --git a/lib/udf/udf_time.c b/lib/udf/udf_time.c index 2e09bd68..53144e4b 100644 --- a/lib/udf/udf_time.c +++ b/lib/udf/udf_time.c @@ -192,6 +192,9 @@ udf_time_to_stamp(udf_timestamp_t *dest, struct timespec ts) return dest; } +/*! + Return the modification time of the file. + */ time_t udf_get_modification_time(const udf_file_t *p_udf_file) { @@ -204,6 +207,9 @@ udf_get_modification_time(const udf_file_t *p_udf_file) return 0; } +/*! + Return the access time of the file. + */ time_t udf_get_access_time(const udf_file_t *p_udf_file) { @@ -216,3 +222,18 @@ udf_get_access_time(const udf_file_t *p_udf_file) return 0; } +/*! + Return the attribute (most recent create or access) time of the file + */ +time_t +udf_get_attribute_time(const udf_file_t *p_udf_file) +{ + if (p_udf_file) { + time_t ret_time; + long int usec; + udf_stamp_to_time(&ret_time, &usec, p_udf_file->fe.attribute_time); + return ret_time; + } + return 0; +} +