|
|
|
@@ -17,13 +17,12 @@
|
|
|
|
|
#include "UdfString.h"
|
|
|
|
|
#include "Utils.h"
|
|
|
|
|
|
|
|
|
|
using namespace Udf;
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
// Constants
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
const charspec Udf::kCs0CharacterSet(0, "OSTA Compressed Unicode");
|
|
|
|
|
const charspec kCs0CharacterSet(0, "OSTA Compressed Unicode");
|
|
|
|
|
//const charspec kCs0Charspec = { _character_set_type: 0,
|
|
|
|
|
// _character_set_info: "OSTA Compressed Unicode"
|
|
|
|
|
// "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
|
|
|
@@ -31,30 +30,30 @@ const charspec Udf::kCs0CharacterSet(0, "OSTA Compressed Unicode");
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// Volume structure descriptor ids
|
|
|
|
|
const char* Udf::kVSDID_BEA = "BEA01";
|
|
|
|
|
const char* Udf::kVSDID_TEA = "TEA01";
|
|
|
|
|
const char* Udf::kVSDID_BOOT = "BOOT2";
|
|
|
|
|
const char* Udf::kVSDID_ISO = "CD001";
|
|
|
|
|
const char* Udf::kVSDID_ECMA167_2 = "NSR02";
|
|
|
|
|
const char* Udf::kVSDID_ECMA167_3 = "NSR03";
|
|
|
|
|
const char* Udf::kVSDID_ECMA168 = "CDW02";
|
|
|
|
|
const char* kVSDID_BEA = "BEA01";
|
|
|
|
|
const char* kVSDID_TEA = "TEA01";
|
|
|
|
|
const char* kVSDID_BOOT = "BOOT2";
|
|
|
|
|
const char* kVSDID_ISO = "CD001";
|
|
|
|
|
const char* kVSDID_ECMA167_2 = "NSR02";
|
|
|
|
|
const char* kVSDID_ECMA167_3 = "NSR03";
|
|
|
|
|
const char* kVSDID_ECMA168 = "CDW02";
|
|
|
|
|
|
|
|
|
|
// entity_ids
|
|
|
|
|
const entity_id Udf::kMetadataPartitionMapId(0, "*UDF Metadata Partition");
|
|
|
|
|
const entity_id Udf::kSparablePartitionMapId(0, "*UDF Sparable Partition");
|
|
|
|
|
const entity_id Udf::kVirtualPartitionMapId(0, "*UDF Virtual Partition");
|
|
|
|
|
const entity_id Udf::kImplementationId(0, "*OpenBeOS UDF", implementation_id_suffix(OS_BEOS, BEOS_GENERIC));
|
|
|
|
|
const entity_id Udf::kPartitionContentsId1xx(0, "+NSR02");
|
|
|
|
|
const entity_id Udf::kPartitionContentsId2xx(0, "+NSR03");
|
|
|
|
|
const entity_id Udf::kLogicalVolumeInfoId150(0, "*UDF LV Info", udf_id_suffix(0x0150, OS_BEOS, BEOS_GENERIC));
|
|
|
|
|
const entity_id Udf::kLogicalVolumeInfoId201(0, "*UDF LV Info", udf_id_suffix(0x0201, OS_BEOS, BEOS_GENERIC));
|
|
|
|
|
const entity_id Udf::kDomainId150(0, "*OSTA UDF Compliant", domain_id_suffix(0x0150,
|
|
|
|
|
const entity_id kMetadataPartitionMapId(0, "*UDF Metadata Partition");
|
|
|
|
|
const entity_id kSparablePartitionMapId(0, "*UDF Sparable Partition");
|
|
|
|
|
const entity_id kVirtualPartitionMapId(0, "*UDF Virtual Partition");
|
|
|
|
|
const entity_id kImplementationId(0, "*OpenBeOS UDF", implementation_id_suffix(OS_BEOS, BEOS_GENERIC));
|
|
|
|
|
const entity_id kPartitionContentsId1xx(0, "+NSR02");
|
|
|
|
|
const entity_id kPartitionContentsId2xx(0, "+NSR03");
|
|
|
|
|
const entity_id kLogicalVolumeInfoId150(0, "*UDF LV Info", udf_id_suffix(0x0150, OS_BEOS, BEOS_GENERIC));
|
|
|
|
|
const entity_id kLogicalVolumeInfoId201(0, "*UDF LV Info", udf_id_suffix(0x0201, OS_BEOS, BEOS_GENERIC));
|
|
|
|
|
const entity_id kDomainId150(0, "*OSTA UDF Compliant", domain_id_suffix(0x0150,
|
|
|
|
|
DF_HARD_WRITE_PROTECT));
|
|
|
|
|
const entity_id Udf::kDomainId201(0, "*OSTA UDF Compliant", domain_id_suffix(0x0201,
|
|
|
|
|
const entity_id kDomainId201(0, "*OSTA UDF Compliant", domain_id_suffix(0x0201,
|
|
|
|
|
DF_HARD_WRITE_PROTECT));
|
|
|
|
|
|
|
|
|
|
//! crc 010041 table, as generated by crc_table.cpp
|
|
|
|
|
const uint16 Udf::kCrcTable[256] = {
|
|
|
|
|
const uint16 kCrcTable[256] = {
|
|
|
|
|
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
|
|
|
|
|
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
|
|
|
|
|
0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
|
|
|
|
@@ -89,7 +88,7 @@ const uint16 Udf::kCrcTable[256] = {
|
|
|
|
|
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const uint32 Udf::kLogicalVolumeDescriptorBaseSize = sizeof(logical_volume_descriptor)
|
|
|
|
|
const uint32 kLogicalVolumeDescriptorBaseSize = sizeof(logical_volume_descriptor)
|
|
|
|
|
- (UDF_MAX_PARTITION_MAPS
|
|
|
|
|
* UDF_MAX_PARTITION_MAP_SIZE);
|
|
|
|
|
|
|
|
|
@@ -98,7 +97,7 @@ const uint32 Udf::kLogicalVolumeDescriptorBaseSize = sizeof(logical_volume_descr
|
|
|
|
|
// Helper functions
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
const char *Udf::tag_id_to_string(tag_id id)
|
|
|
|
|
const char *tag_id_to_string(tag_id id)
|
|
|
|
|
{
|
|
|
|
|
switch (id) {
|
|
|
|
|
case TAGID_UNDEFINED:
|
|
|
|
@@ -532,7 +531,7 @@ descriptor_tag::init_check(uint32 block, bool calculateCrc)
|
|
|
|
|
PRINT(("location (in structure) == %ld\n", location()));
|
|
|
|
|
if (calculateCrc) {
|
|
|
|
|
PRINT(("crc (calculated) == %d\n",
|
|
|
|
|
Udf::calculate_crc(reinterpret_cast<uint8*>(this)+sizeof(descriptor_tag),
|
|
|
|
|
calculate_crc(reinterpret_cast<uint8*>(this)+sizeof(descriptor_tag),
|
|
|
|
|
crc_length())))
|
|
|
|
|
} else {
|
|
|
|
|
PRINT(("crc (calculated) == (not calculated)\n"));
|
|
|
|
@@ -552,7 +551,7 @@ descriptor_tag::init_check(uint32 block, bool calculateCrc)
|
|
|
|
|
}
|
|
|
|
|
// crc
|
|
|
|
|
if (!error && calculateCrc) {
|
|
|
|
|
uint16 _crc = Udf::calculate_crc(reinterpret_cast<uint8*>(this)
|
|
|
|
|
uint16 _crc = calculate_crc(reinterpret_cast<uint8*>(this)
|
|
|
|
|
+ sizeof(descriptor_tag), crc_length());
|
|
|
|
|
error = _crc == crc() ? B_OK : B_NO_INIT;
|
|
|
|
|
}
|
|
|
|
@@ -568,7 +567,7 @@ primary_volume_descriptor::dump() const
|
|
|
|
|
{
|
|
|
|
|
DUMP_INIT("primary_volume_descriptor");
|
|
|
|
|
|
|
|
|
|
String string;
|
|
|
|
|
UdfString string;
|
|
|
|
|
|
|
|
|
|
PRINT(("tag:\n"));
|
|
|
|
|
DUMP(tag());
|
|
|
|
@@ -629,7 +628,7 @@ anchor_volume_descriptor::dump() const
|
|
|
|
|
void
|
|
|
|
|
logical_volume_info::dump() const
|
|
|
|
|
{
|
|
|
|
|
String string;
|
|
|
|
|
UdfString string;
|
|
|
|
|
DUMP_INIT("logical_volume_information");
|
|
|
|
|
PRINT(("character_set:\n"));
|
|
|
|
|
DUMP(character_set());
|
|
|
|
@@ -666,7 +665,7 @@ implementation_use_descriptor::dump() const
|
|
|
|
|
// partition_descriptor
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
const uint8 Udf::kMaxPartitionDescriptors = 2;
|
|
|
|
|
const uint8 kMaxPartitionDescriptors = 2;
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
partition_descriptor::dump() const
|
|
|
|
@@ -704,7 +703,7 @@ logical_volume_descriptor::dump() const
|
|
|
|
|
PRINT(("vds_number: %ld\n", vds_number()));
|
|
|
|
|
PRINT(("character_set:\n"));
|
|
|
|
|
DUMP(character_set());
|
|
|
|
|
String string(logical_volume_identifier());
|
|
|
|
|
UdfString string(logical_volume_identifier());
|
|
|
|
|
PRINT(("logical_volume_identifier: `%s'\n", string.Utf8()));
|
|
|
|
|
PRINT(("logical_block_size: %ld\n", logical_block_size()));
|
|
|
|
|
PRINT(("domain_id:\n"));
|
|
|
|
@@ -957,7 +956,7 @@ file_id_descriptor::dump() const
|
|
|
|
|
PRINT(("icb:\n"));
|
|
|
|
|
DUMP(icb());
|
|
|
|
|
PRINT(("implementation_use_length: %d\n", is_parent()));
|
|
|
|
|
String fileId(id());
|
|
|
|
|
UdfString fileId(id());
|
|
|
|
|
PRINT(("id: `%s'", fileId.Utf8()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|