- Added domain_id_suffix struct.

- Added domain flags enum.
- Added domain_id_suffix constructor for entity_id
- Added kLogicalVolumeDescriptorBaseSize


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5645 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Tyler Dauwalder 2003-12-11 06:08:31 +00:00
parent b68d3ebe4a
commit 730ba00a62
2 changed files with 61 additions and 1 deletions

View File

@ -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
{

View File

@ -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<uint8, 5> _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