From 50ad6d7559c84e53b5a7945dcc4f32f53df42d61 Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 21 Oct 2005 12:33:46 +0000 Subject: [PATCH] udf.h: Mostly add a couple more routines and more fields in udf_file_t ecma_167.h: more udf_ prefixes, add extern debugger symbols. --- include/cdio/ecma_167.h | 37 ++++++++++++++++++++++++------------- include/cdio/udf.h | 26 ++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/include/cdio/ecma_167.h b/include/cdio/ecma_167.h index bd7b1f08..50b74ce9 100644 --- a/include/cdio/ecma_167.h +++ b/include/cdio/ecma_167.h @@ -55,6 +55,7 @@ #include /** Tag Identifier (ECMA 167r3 3/7.2.1) */ + typedef enum { TAGID_PRI_VOL = 0x0001, TAGID_ANCHOR = 0x0002, @@ -76,7 +77,7 @@ typedef enum { TAGID_SBD = 0x0108, TAGID_PIE = 0x0109, TAGID_EFE = 0x010A, -} tag_id_enum_t ; +} tag_id_t ; /** Character Set Type (ECMA 167r3 1/7.2.1.1) */ typedef enum { @@ -542,23 +543,24 @@ struct udf_fileid_desc_s typedef struct udf_fileid_desc_s udf_fileid_desc_t; #define UDF_FID_SIZE 38 -#define UDF_FILE_CHAR_VIS (1 << 0) /* Visible */ -#define UDF_FILE_CHAR_DIR (1 << 1) /* Directory */ -#define UDF_FILE_CHAR_DEL (1 << 2) /* Deleted */ -#define UDF_FILE_CHAR_PAR (1 << 3) /* Parent Directory */ -#define UDF_FILE_CHAR_META (1 << 4) /* Stream metadata */ -/** File Characteristics (ECMA 167r3 4/14.4.3) */ -#define FID_FILE_CHAR_HIDDEN 0x01 -#define FID_FILE_CHAR_DIRECTORY 0x02 -#define FID_FILE_CHAR_DELETED 0x04 -#define FID_FILE_CHAR_PARENT 0x08 -#define FID_FILE_CHAR_METADATA 0x10 +/** File Characteristics (ECMA 167r3 4/14.4.3) + + Imagine the below enumeration values are #defines to be used in a + bitmask rather than distinct values of an enum. +*/ +typedef enum { + UDF_FILE_HIDDEN = (1 << 0), + UDF_FILE_DIRECTORY = (1 << 1), + UDF_FILE_DELETED = (1 << 2), + UDF_FILE_PARENT = (1 << 3), + UDF_FILE_METADATA = (1 << 4) +} file_characteristics_t; /** Allocation Ext Descriptor (ECMA 167r3 4/14.5) */ struct allocExtDesc { - udf_tag_t tag; + udf_tag_t tag; udf_Uint32_t previous_alloc_ext_loc; udf_Uint32_t i_alloc_descs; } GNUC_PACKED; @@ -920,4 +922,13 @@ struct extended_file_entry PRAGMA_END_PACKED +/** The below variables are trickery to force the above enum symbol + values to be recorded in debug symbol tables. They are used to + allow one refer to the enumeration value names in the typedefs + above in a debugger and debugger expressions +*/ +extern file_characteristics_t debug_file_characteristics; +extern tag_id_t debug_tagid; + + #endif /* _ECMA_167_H */ diff --git a/include/cdio/udf.h b/include/cdio/udf.h index 0d8d1d93..e6abb60a 100644 --- a/include/cdio/udf.h +++ b/include/cdio/udf.h @@ -1,5 +1,5 @@ /* - $Id: udf.h,v 1.4 2005/10/19 07:06:35 rocky Exp $ + $Id: udf.h,v 1.5 2005/10/21 12:33:46 rocky Exp $ Copyright (C) 2005 Rocky Bernstein This program is free software; you can redistribute it and/or modify @@ -37,21 +37,35 @@ typedef uint8_t ubyte; typedef struct { char *psz_name; - bool b_dir; /* true if this entry is a directory. */ - bool b_root; /* True if root directory, so b_dir should be - true if this is true. */ + bool b_dir; /* true if this entry is a directory. */ + bool b_parent; /* True if has parent directory (e.g. not root + directory). If not set b_dir will probably + be true. */ uint32_t i_part_start; uint32_t dir_lba, dir_end_lba; + uint64_t dir_left; + uint8_t *sector; + udf_fileid_desc_t *fid; } udf_file_t; /** This is an opaque structure. */ typedef struct udf_s udf_t; +/** + Imagine the below a #define'd value rather than distinct values of + an enum. +*/ typedef enum { UDF_BLOCKSIZE = 2048 } udf_enum1_t; +/** This variable is trickery to force the above enum symbol value 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 udf_enum1_t debug_udf_enums1; + /*! Seek to a position i_start and then read i_blocks. Number of blocks read is returned. One normally expects the return to be equal to i_blocks. @@ -67,6 +81,10 @@ long int udf_read_sectors (const udf_t *p_udf, void *ptr, lsn_t i_start, */ udf_t *udf_open (const char *psz_path); +udf_file_t *udf_get_sub(udf_t *p_udf, udf_file_t *p_file); + +udf_file_t *udf_get_next(udf_t *p_udf, udf_file_t * p_file); + /*! Close UDF and free resources associated with p_udf. */