From d1a0387efb0f49eca7af9e5e7846d7769aed001b Mon Sep 17 00:00:00 2001 From: Tyler Dauwalder Date: Fri, 12 Dec 2003 06:36:27 +0000 Subject: [PATCH] - Added long_address constructor. - Polished up file_set_descriptor a bit. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5655 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/udf/UdfStructures.cpp | 13 ++++++-- .../kernel/file_systems/udf/UdfStructures.h | 31 ++++++++++--------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/add-ons/kernel/file_systems/udf/UdfStructures.cpp b/src/add-ons/kernel/file_systems/udf/UdfStructures.cpp index 051b6f8546..c72b2fbf3a 100644 --- a/src/add-ons/kernel/file_systems/udf/UdfStructures.cpp +++ b/src/add-ons/kernel/file_systems/udf/UdfStructures.cpp @@ -421,6 +421,15 @@ logical_block_address::dump() const PRINT(("partition: %d\n", partition())); } +long_address::long_address(uint16 partition, uint32 block, uint32 length, + uint8 type) +{ + set_partition(partition); + set_block(block); + set_length(length); + set_type(type); +} + void long_address::dump() const { @@ -787,8 +796,8 @@ file_set_descriptor::dump() const DUMP(logical_volume_id_character_set()); PRINT(("logical_volume_id:\n")); DUMP(logical_volume_id()); - PRINT(("file_set_charspec:\n")); - DUMP(file_set_charspec()); + PRINT(("file_set_id_character_set:\n")); + DUMP(file_set_id_character_set()); PRINT(("file_set_id:\n")); DUMP(file_set_id()); PRINT(("copyright_file_id:\n")); diff --git a/src/add-ons/kernel/file_systems/udf/UdfStructures.h b/src/add-ons/kernel/file_systems/udf/UdfStructures.h index 752116e821..9e8ad30874 100644 --- a/src/add-ons/kernel/file_systems/udf/UdfStructures.h +++ b/src/add-ons/kernel/file_systems/udf/UdfStructures.h @@ -454,6 +454,9 @@ private: }; public: + long_address(uint16 partition = 0, uint32 block = 0, uint32 length = 0, + uint8 type = 0); + void dump() const; uint8 type() const { @@ -969,8 +972,8 @@ struct logical_volume_descriptor { const array& logical_volume_contents_use() const { return _logical_volume_contents_use; } array& logical_volume_contents_use() { return _logical_volume_contents_use; } - const long_address& file_set_address() const { return _file_set_address; } - long_address& file_set_address() { return _file_set_address; } + const long_address& file_set_address() const { return *reinterpret_cast(&_logical_volume_contents_use); } + long_address& file_set_address() { return *reinterpret_cast(&_logical_volume_contents_use); } uint32 map_table_length() const { return B_LENDIAN_TO_HOST_INT32(_map_table_length); } uint32 partition_map_count() const { return B_LENDIAN_TO_HOST_INT32(_partition_map_count); } @@ -1014,13 +1017,10 @@ private: */ entity_id _domain_id; - union { - /*! \brief For UDF, shall contain a \c long_address which identifies - the location of the logical volume's first file set. - */ - array _logical_volume_contents_use; - long_address _file_set_address; - }; + /*! \brief For UDF, shall contain a \c long_address which identifies + the location of the logical volume's first file set. + */ + array _logical_volume_contents_use; uint32 _map_table_length; uint32 _partition_map_count; @@ -1346,6 +1346,9 @@ struct file_set_descriptor { const array& logical_volume_id() const { return _logical_volume_id; } array& logical_volume_id() { return _logical_volume_id; } + const charspec& file_set_id_character_set() const { return _file_set_id_character_set; } + charspec& file_set_id_character_set() { return _file_set_id_character_set; } + const array& file_set_id() const { return _file_set_id; } array& file_set_id() { return _file_set_id; } @@ -1355,9 +1358,6 @@ struct file_set_descriptor { const array& abstract_file_id() const { return _abstract_file_id; } array& abstract_file_id() { return _abstract_file_id; } - const charspec& file_set_charspec() const { return _file_set_charspec; } - charspec& file_set_charspec() { return _file_set_charspec; } - const long_address& root_directory_icb() const { return _root_directory_icb; } long_address& root_directory_icb() { return _root_directory_icb; } @@ -1370,6 +1370,9 @@ struct file_set_descriptor { const long_address& system_stream_directory_icb() const { return _system_stream_directory_icb; } long_address& system_stream_directory_icb() { return _system_stream_directory_icb; } + const array& reserved() const { return _reserved; } + array& reserved() { return _reserved; } + // Set functions void set_interchange_level(uint16 level) { _interchange_level = B_HOST_TO_LENDIAN_INT16(level); } void set_max_interchange_level(uint16 level) { _max_interchange_level = B_HOST_TO_LENDIAN_INT16(level); } @@ -1388,7 +1391,7 @@ private: uint32 _file_set_descriptor_number; charspec _logical_volume_id_character_set; //!< To be set to kCSOCharspec array _logical_volume_id; - charspec _file_set_charspec; + charspec _file_set_id_character_set; array _file_set_id; array _copyright_file_id; array _abstract_file_id; @@ -1396,7 +1399,7 @@ private: entity_id _domain_id; long_address _next_extent; long_address _system_stream_directory_icb; - uint8 _reserved[32]; + array _reserved; } __attribute__((packed));