diff --git a/src/add-ons/kernel/file_systems/udf/UdfStructures.cpp b/src/add-ons/kernel/file_systems/udf/UdfStructures.cpp index bd4b22432e..051b6f8546 100644 --- a/src/add-ons/kernel/file_systems/udf/UdfStructures.cpp +++ b/src/add-ons/kernel/file_systems/udf/UdfStructures.cpp @@ -80,7 +80,12 @@ const uint16 Udf::kCrcTable[256] = { 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 -}; +}; + +const uint32 Udf::kLogicalVolumeDescriptorBaseSize = sizeof(logical_volume_descriptor) + - (UDF_MAX_PARTITION_MAPS + * UDF_MAX_PARTITION_MAP_SIZE); + //---------------------------------------------------------------------- // Helper functions @@ -320,6 +325,17 @@ implementation_id_suffix::implementation_id_suffix(uint8 os_class, memset(_implementation_use.data, 0, _implementation_use.size()); } +//---------------------------------------------------------------------- +// domain_id_suffix +//---------------------------------------------------------------------- + +domain_id_suffix::domain_id_suffix(uint16 udfRevision, uint8 domainFlags) + : _udf_revision(udfRevision) + , _domain_flags(domainFlags) +{ + memset(_reserved.data, 0, _reserved.size()); +} + //---------------------------------------------------------------------- // entity_id //---------------------------------------------------------------------- @@ -346,6 +362,16 @@ entity_id::entity_id(uint8 flags, char *identifier, memcpy(_identifier_suffix.data, &suffix, kIdentifierSuffixLength); } +entity_id::entity_id(uint8 flags, char *identifier, + const domain_id_suffix &suffix) + : _flags(flags) +{ + memset(_identifier, 0, kIdentifierLength); + if (identifier) + strncpy(_identifier, identifier, kIdentifierLength); + memcpy(_identifier_suffix.data, &suffix, kIdentifierSuffixLength); +} + void entity_id::dump() const { diff --git a/src/add-ons/kernel/file_systems/udf/UdfStructures.h b/src/add-ons/kernel/file_systems/udf/UdfStructures.h index 327b2001a7..752116e821 100644 --- a/src/add-ons/kernel/file_systems/udf/UdfStructures.h +++ b/src/add-ons/kernel/file_systems/udf/UdfStructures.h @@ -205,6 +205,35 @@ enum { BEOS_OPENBEOS = 1 // not part of the standard, but perhaps someday. :-) }; +/*! \brief Domain ID Identify Suffix + + See also: UDF 2.50 2.1.5.3 +*/ +struct domain_id_suffix { +public: + domain_id_suffix(uint16 udfRevision, uint8 domainFlags); + + //! Note that revision 2.50 is denoted by 0x0250. + uint16 udf_revision() const { return _udf_revision; } + uint8 domain_flags() const { return _domain_flags; } + + void set_udf_revision(uint16 revision) { _udf_revision = B_HOST_TO_LENDIAN_INT16(revision); } + void set_domain_flags(uint8 flags) { _domain_flags = flags; } +private: + uint8 _udf_revision; + uint8 _domain_flags; + array _reserved; +}; + +/*! \brief Domain flags + + See also: UDF 2.50 2.1.5.3 +*/ +enum { + DF_HARD_WRITE_PROTECT = 0x01, + DF_SOFT_WRITE_PROTECT = 0x02 +}; + /*! \brief Identifier used to designate the implementation responsible for writing associated data structures on the medium. @@ -219,6 +248,8 @@ public: uint8 *identifier_suffix = NULL); entity_id(uint8 flags, char *identifier, const implementation_id_suffix &suffix); + entity_id(uint8 flags, char *identifier, + const domain_id_suffix &suffix); void dump() const; bool matches(const entity_id &id) const; @@ -243,6 +274,7 @@ extern const entity_id kSparablePartitionMapId; extern const entity_id kVirtualPartitionMapId; extern const entity_id kImplementationId; extern const entity_id kPartitionContentsId; +extern const entity_id kUdfId; //---------------------------------------------------------------------- // ECMA-167 Part 2 @@ -1017,6 +1049,8 @@ private: uint8 _partition_maps[UDF_MAX_PARTITION_MAPS * UDF_MAX_PARTITION_MAP_SIZE]; } __attribute__((packed)); +//! Base size (excluding partition maps) of lvd +extern const uint32 kLogicalVolumeDescriptorBaseSize; /*! \brief (Mostly) common portion of various partition maps