Removed "udf_" prefix from udf on-disk data structures, as they already

live in the Udf:: namespace, and I'll be referencing them fully qualified in
makeudfimage and don't feel like typing udf twice each time.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5474 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Tyler Dauwalder
2003-11-25 00:12:50 +00:00
parent 65a98eb199
commit 1379caca11
14 changed files with 409 additions and 399 deletions
@@ -61,7 +61,7 @@ public:
\param isEmpty If set to true, indicates that the given extent is unrecorded
and thus its contents should be interpreted as all zeros.
*/
status_t FindExtent(off_t start, udf_long_address *extent, bool *isEmpty) {
status_t FindExtent(off_t start, long_address *extent, bool *isEmpty) {
DEBUG_INIT_ETC(CF_PUBLIC | CF_FILE_OPS | CF_HIGH_VOLUME, "AllocationDescriptorList<>",
("start: %Ld, extent: %p, isEmpty: %p", start, extent, isEmpty));
off_t startBlock = start >> fVolume->BlockShift();
@@ -213,7 +213,7 @@ public:
{
}
typedef udf_short_address DescriptorType;
typedef short_address DescriptorType;
inline uint8 GetType(DescriptorType &descriptor) const {
return descriptor.type();
@@ -236,7 +236,7 @@ private:
class LongDescriptorAccessor {
public:
typedef udf_long_address DescriptorType;
typedef long_address DescriptorType;
inline uint8 GetType(DescriptorType &descriptor) const {
return descriptor.type();
@@ -43,7 +43,7 @@ class CachedBlock {
inline void Keep();
inline void Unset();
inline uint8 *SetTo(off_t block, bool empty = false);
inline uint8 *SetTo(udf_long_address address, bool empty = false);
inline uint8 *SetTo(long_address address, bool empty = false);
template <class Accessor, class Descriptor>
inline uint8* SetTo(Accessor &accessor, Descriptor &descriptor,
bool empty = false);
@@ -126,7 +126,7 @@ CachedBlock::SetTo(off_t block, bool empty = false)
}
inline uint8 *
CachedBlock::SetTo(udf_long_address address, bool empty = false)
CachedBlock::SetTo(long_address address, bool empty = false)
{
off_t block;
if (fVolume->MapBlock(address, &block) == B_OK)
@@ -139,8 +139,8 @@ template <class Accessor, class Descriptor>
inline uint8*
CachedBlock::SetTo(Accessor &accessor, Descriptor &descriptor, bool empty = false)
{
// Make a udf_long_address out of the descriptor and call it a day
udf_long_address address;
// Make a long_address out of the descriptor and call it a day
long_address address;
address.set_to(accessor.GetBlock(descriptor),
accessor.GetPartition(descriptor));
return SetTo(address, empty);
@@ -41,7 +41,7 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, vnode_id *id)
return B_ENTRY_NOT_FOUND;
uint8 data[kMaxFileIdSize];
udf_file_id_descriptor *entry = reinterpret_cast<udf_file_id_descriptor*>(data);
file_id_descriptor *entry = reinterpret_cast<file_id_descriptor*>(data);
uint32 block = 0;
off_t offset = fPosition;
@@ -51,7 +51,7 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, vnode_id *id)
// then, based on the information therein, read in the variable
// length tail portion as well.
error = Parent()->Read(offset, entry, &entryLength, &block);
if (!error && entryLength >= sizeof(udf_file_id_descriptor) && entry->tag().init_check(block) == B_OK) {
if (!error && entryLength >= sizeof(file_id_descriptor) && entry->tag().init_check(block) == B_OK) {
PDUMP(entry);
offset += entry->total_length();
@@ -37,16 +37,16 @@ const char* Udf::kVSDID_ECMA167_2 = "NSR02";
const char* Udf::kVSDID_ECMA167_3 = "NSR03";
const char* Udf::kVSDID_ECMA168 = "CDW02";
// udf_entity_ids
const udf_entity_id Udf::kMetadataPartitionMapId(0, "*UDF Metadata Partition");
const udf_entity_id Udf::kSparablePartitionMapId(0, "*UDF Sparable Partition");
const udf_entity_id Udf::kVirtualPartitionMapId(0, "*UDF Virtual Partition");
// 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");
//----------------------------------------------------------------------
// Helper functions
//----------------------------------------------------------------------
const char *Udf::udf_tag_id_to_string(udf_tag_id id)
const char *Udf::tag_id_to_string(tag_id id)
{
switch (id) {
case TAGID_UNDEFINED:
@@ -103,39 +103,39 @@ const char *Udf::udf_tag_id_to_string(udf_tag_id id)
//----------------------------------------------------------------------
// udf_volume_structure_descriptor_header
// volume_structure_descriptor_header
//----------------------------------------------------------------------
/*! \brief Returns true if the given \a id matches the header's id.
*/
bool
udf_volume_structure_descriptor_header::id_matches(const char *id)
volume_structure_descriptor_header::id_matches(const char *id)
{
return strncmp(this->id, id, 5) == 0;
}
//----------------------------------------------------------------------
// udf_charspec
// charspec
//----------------------------------------------------------------------
void
udf_charspec::dump() const
charspec::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_charspec");
DUMP_INIT(CF_PUBLIC | CF_DUMP, "charspec");
PRINT(("character_set_type: %d\n", character_set_type()));
PRINT(("character_set_info: `%s'\n", character_set_info()));
}
//----------------------------------------------------------------------
// udf_timestamp
// timestamp
//----------------------------------------------------------------------
void
udf_timestamp::dump() const
timestamp::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_timestamp");
DUMP_INIT(CF_PUBLIC | CF_DUMP, "timestamp");
PRINT(("type: %d\n", type()));
PRINT(("timezone: %d\n", timezone()));
PRINT(("year: %d\n", year()));
@@ -150,10 +150,10 @@ udf_timestamp::dump() const
}
//----------------------------------------------------------------------
// udf_entity_id
// entity_id
//----------------------------------------------------------------------
udf_entity_id::udf_entity_id(uint8 flags, char *identifier, char *identifier_suffix)
entity_id::entity_id(uint8 flags, char *identifier, char *identifier_suffix)
: _flags(flags)
{
if (identifier)
@@ -167,19 +167,19 @@ udf_entity_id::udf_entity_id(uint8 flags, char *identifier, char *identifier_suf
}
void
udf_entity_id::dump() const
entity_id::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_entity_id");
DUMP_INIT(CF_PUBLIC | CF_DUMP, "entity_id");
PRINT(("flags: %d\n", flags()));
PRINT(("identifier: `%.23s'\n", identifier()));
PRINT(("identifier_suffix: `%s'\n", identifier_suffix()));
}
bool
udf_entity_id::matches(const udf_entity_id &id) const
entity_id::matches(const entity_id &id) const
{
bool result = true;
for (int i = 0; i < udf_entity_id::kIdentifierLength; i++) {
for (int i = 0; i < entity_id::kIdentifierLength; i++) {
if (identifier()[i] != id.identifier()[i]) {
result = false;
break;
@@ -189,29 +189,29 @@ udf_entity_id::matches(const udf_entity_id &id) const
}
//----------------------------------------------------------------------
// udf_extent_address
// extent_address
//----------------------------------------------------------------------
void
udf_extent_address::dump() const
extent_address::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_extent_address");
DUMP_INIT(CF_PUBLIC | CF_DUMP, "extent_address");
PRINT(("length: %ld\n", length()));
PRINT(("location: %ld\n", location()));
}
void
udf_logical_block_address::dump() const
logical_block_address::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_logical_block_address");
DUMP_INIT(CF_PUBLIC | CF_DUMP, "logical_block_address");
PRINT(("block: %ld\n", block()));
PRINT(("partition: %d\n", partition()));
}
void
udf_long_address::dump() const
long_address::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_long_address");
DUMP_INIT(CF_PUBLIC | CF_DUMP, "long_address");
PRINT(("length: %ld\n", length()));
PRINT(("block: %ld\n", block()));
PRINT(("partiton: %d\n", partition()));
@@ -220,14 +220,14 @@ udf_long_address::dump() const
}
//----------------------------------------------------------------------
// udf_tag
// descriptor_tag
//----------------------------------------------------------------------
void
udf_tag::dump() const
descriptor_tag ::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_descriptor_tag");
PRINT(("id: %d (%s)\n", id(), udf_tag_id_to_string(udf_tag_id(id()))));
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "descriptor_tag");
PRINT(("id: %d (%s)\n", id(), tag_id_to_string(tag_id(id()))));
PRINT(("version: %d\n", version()));
PRINT(("checksum: %d\n", checksum()));
PRINT(("serial_number: %d\n", serial_number()));
@@ -243,9 +243,9 @@ udf_tag::dump() const
\todo Calc the CRC.
*/
status_t
udf_tag::init_check(uint32 diskBlock)
descriptor_tag ::init_check(uint32 diskBlock)
{
DEBUG_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_HIGH_VOLUME, "udf_descriptor_tag");
DEBUG_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_HIGH_VOLUME, "descriptor_tag");
PRINT(("location (paramater) == %ld\n", diskBlock));
PRINT(("location (in structure) == %ld\n", location()));
status_t error = (diskBlock == location()) ? B_OK : B_NO_INIT;
@@ -265,13 +265,13 @@ udf_tag::init_check(uint32 diskBlock)
//----------------------------------------------------------------------
// udf_primary_descriptor
// primary_descriptor
//----------------------------------------------------------------------
void
udf_primary_descriptor::dump() const
primary_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_primary_descriptor");
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "primary_descriptor");
CS0String string;
@@ -309,13 +309,13 @@ udf_primary_descriptor::dump() const
//----------------------------------------------------------------------
// udf_anchor_volume_descriptor_pointer
// anchor_volume_descriptor_pointer
//----------------------------------------------------------------------
void
udf_anchor_descriptor::dump() const
anchor_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_anchor_descriptor");
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "anchor_descriptor");
PRINT(("tag:\n"));
DUMP(tag());
PRINT(("main_vds:\n"));
@@ -326,13 +326,13 @@ udf_anchor_descriptor::dump() const
//----------------------------------------------------------------------
// udf_implementation_use_descriptor
// implementation_use_descriptor
//----------------------------------------------------------------------
void
udf_implementation_use_descriptor::dump() const
implementation_use_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_implementation_use_descriptor");
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "implementation_use_descriptor");
PRINT(("tag:\n"));
DUMP(tag());
PRINT(("vds_number: %ld\n", vds_number()));
@@ -343,15 +343,15 @@ udf_implementation_use_descriptor::dump() const
}
//----------------------------------------------------------------------
// udf_partition_descriptor
// partition_descriptor
//----------------------------------------------------------------------
const uint8 Udf::kMaxPartitionDescriptors = 2;
void
udf_partition_descriptor::dump() const
partition_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_partition_descriptor");
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "partition_descriptor");
PRINT(("tag:\n"));
DUMP(tag());
PRINT(("vds_number: %ld\n", vds_number()));
@@ -372,13 +372,13 @@ udf_partition_descriptor::dump() const
}
//----------------------------------------------------------------------
// udf_logical_descriptor
// logical_descriptor
//----------------------------------------------------------------------
void
udf_logical_descriptor::dump() const
logical_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_logical_descriptor");
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "logical_descriptor");
PRINT(("tag:\n"));
DUMP(tag());
PRINT(("vds_number: %ld\n", vds_number()));
@@ -418,7 +418,7 @@ udf_logical_descriptor::dump() const
case 2: {
PRINT((" partition_number: %d\n", *reinterpret_cast<const uint16*>(&(maps[offset+38]))));
PRINT((" entity_id:\n"));
const udf_entity_id *id = reinterpret_cast<const udf_entity_id*>(&(maps[offset+4]));
const entity_id *id = reinterpret_cast<const entity_id*>(&(maps[offset+4]));
if (id) // To kill warning when DEBUG==0
PDUMP(id);
break;
@@ -430,8 +430,8 @@ udf_logical_descriptor::dump() const
}
udf_logical_descriptor&
udf_logical_descriptor::operator=(const udf_logical_descriptor &rhs)
logical_descriptor&
logical_descriptor::operator=(const logical_descriptor &rhs)
{
_tag = rhs._tag;
_vds_number = rhs._vds_number;
@@ -459,13 +459,13 @@ udf_logical_descriptor::operator=(const udf_logical_descriptor &rhs)
//----------------------------------------------------------------------
// udf_physical_partition_map
// physical_partition_map
//----------------------------------------------------------------------
void
udf_physical_partition_map::dump()
physical_partition_map::dump()
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_physical_partition_map");
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "physical_partition_map");
PRINT(("type: %d\n", type()));
PRINT(("length: %d\n", length()));
PRINT(("volume_sequence_number: %d\n", volume_sequence_number()));
@@ -473,13 +473,13 @@ udf_physical_partition_map::dump()
}
//----------------------------------------------------------------------
// udf_sparable_partition_map
// sparable_partition_map
//----------------------------------------------------------------------
void
udf_sparable_partition_map::dump()
sparable_partition_map::dump()
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_sparable_partition_map");
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "sparable_partition_map");
PRINT(("type: %d\n", type()));
PRINT(("length: %d\n", length()));
PRINT(("partition_type_id:"));
@@ -494,13 +494,13 @@ udf_sparable_partition_map::dump()
}
//----------------------------------------------------------------------
// udf_unallocated_space_descriptor
// unallocated_space_descriptor
//----------------------------------------------------------------------
void
udf_unallocated_space_descriptor::dump() const
unallocated_space_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_unallocated_space_descriptor");
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "unallocated_space_descriptor");
PRINT(("tag:\n"));
DUMP(tag());
PRINT(("vds_number: %ld\n", vds_number()));
@@ -510,25 +510,25 @@ udf_unallocated_space_descriptor::dump() const
//----------------------------------------------------------------------
// udf_terminating_descriptor
// terminating_descriptor
//----------------------------------------------------------------------
void
udf_terminating_descriptor::dump() const
terminating_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_terminating_descriptor");
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "terminating_descriptor");
PRINT(("tag:\n"));
DUMP(tag());
}
//----------------------------------------------------------------------
// udf_file_set_descriptor
// file_set_descriptor
//----------------------------------------------------------------------
void
udf_file_set_descriptor::dump() const
file_set_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_file_set_descriptor");
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "file_set_descriptor");
PRINT(("tag:\n"));
DUMP(tag());
PRINT(("recording_date_and_time:\n"));
@@ -562,9 +562,9 @@ udf_file_set_descriptor::dump() const
}
void
udf_file_id_descriptor::dump() const
file_id_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS, "udf_file_id_descriptor");
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS, "file_id_descriptor");
PRINT(("tag:\n"));
DUMP(tag());
PRINT(("version_number: %d\n", version_number()));
@@ -584,9 +584,9 @@ udf_file_id_descriptor::dump() const
}
void
udf_icb_entry_tag::dump() const
icb_entry_tag::dump() const
{
DUMP_INIT(CF_PUBLIC, "udf_icb_entry_tag");
DUMP_INIT(CF_PUBLIC, "icb_entry_tag");
PRINT(("prior_entries: %ld\n", prior_recorded_number_of_direct_entries()));
PRINT(("strategy_type: %d\n", strategy_type()));
PRINT(("strategy_parameters:\n"));
@@ -604,7 +604,7 @@ udf_icb_entry_tag::dump() const
uint16 entry_count;
uint8 reserved;
uint8 file_type;
udf_logical_block_address parent_icb_location;
logical_block_address parent_icb_location;
union {
uint16 all_flags;
struct {
@@ -629,9 +629,9 @@ udf_icb_entry_tag::dump() const
}
void
udf_icb_header::dump() const
icb_header::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_icb_header");
DUMP_INIT(CF_PUBLIC | CF_DUMP, "icb_header");
PRINT(("tag:\n"));
DUMP(tag());
File diff suppressed because it is too large Load Diff
+8 -2
View File
@@ -1,3 +1,9 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//
// Copyright (c) 2003 Tyler Dauwalder, [email protected]
//---------------------------------------------------------------------
#include "Icb.h"
#include "time.h"
@@ -9,7 +15,7 @@
using namespace Udf;
Icb::Icb(Volume *volume, udf_long_address address)
Icb::Icb(Volume *volume, long_address address)
: fVolume(volume)
, fData(volume)
, fInitStatus(B_NO_INIT)
@@ -25,7 +31,7 @@ Icb::Icb(Volume *volume, udf_long_address address)
off_t block;
error = fVolume->MapBlock(address, &block);
if (!error) {
udf_icb_header *header = reinterpret_cast<udf_icb_header*>(fData.SetTo(block));
icb_header *header = reinterpret_cast<icb_header*>(fData.SetTo(block));
PDUMP(header);
error = header->tag().init_check(address.block());
}
+11 -11
View File
@@ -31,7 +31,7 @@ class DirectoryIterator;
class Volume;
/*! \brief Abstract interface to file entry structure members
that are not commonly accessible through udf_file_icb_entry().
that are not commonly accessible through file_icb_entry().
This is necessary, since we can't use virtual functions in
the disk structure structs themselves, since we generally
@@ -62,7 +62,7 @@ private:
class Icb {
public:
Icb(Volume *volume, udf_long_address address);
Icb(Volume *volume, long_address address);
status_t InitCheck();
vnode_id Id() { return fId; }
@@ -94,18 +94,18 @@ public:
private:
Icb(); // unimplemented
udf_tag& Tag() { return (reinterpret_cast<udf_icb_header*>(fData.Block()))->tag(); }
udf_icb_entry_tag& IcbTag() { return (reinterpret_cast<udf_icb_header*>(fData.Block()))->icb_tag(); }
descriptor_tag & Tag() { return (reinterpret_cast<icb_header*>(fData.Block()))->tag(); }
icb_entry_tag& IcbTag() { return (reinterpret_cast<icb_header*>(fData.Block()))->icb_tag(); }
AbstractFileEntry* AbstractEntry() {
DEBUG_INIT(CF_PRIVATE | CF_HIGH_VOLUME, "Icb");
return (Tag().id() == TAGID_EXTENDED_FILE_ENTRY)
// ? reinterpret_cast<udf_extended_file_icb_entry*>(fData.Block())
// : reinterpret_cast<udf_file_icb_entry*>(fData.Block()));
// ? reinterpret_cast<extended_file_icb_entry*>(fData.Block())
// : reinterpret_cast<file_icb_entry*>(fData.Block()));
? &fExtendedEntry
: &fFileEntry;
}
udf_file_icb_entry* FileEntry() { return (reinterpret_cast<udf_file_icb_entry*>(fData.Block())); }
udf_extended_file_icb_entry& ExtendedEntry() { return *(reinterpret_cast<udf_extended_file_icb_entry*>(fData.Block())); }
file_icb_entry* FileEntry() { return (reinterpret_cast<file_icb_entry*>(fData.Block())); }
extended_file_icb_entry& ExtendedEntry() { return *(reinterpret_cast<extended_file_icb_entry*>(fData.Block())); }
template <class DescriptorList>
status_t _Read(DescriptorList &list, off_t pos, void *buffer, size_t *length, uint32 *block);
@@ -117,8 +117,8 @@ private:
status_t fInitStatus;
vnode_id fId;
SinglyLinkedList<DirectoryIterator*> fIteratorList;
FileEntry<udf_file_icb_entry> fFileEntry;
FileEntry<udf_extended_file_icb_entry> fExtendedEntry;
FileEntry<file_icb_entry> fFileEntry;
FileEntry<extended_file_icb_entry> fExtendedEntry;
};
/*! \brief Does the dirty work of reading using the given DescriptorList object
@@ -147,7 +147,7 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
PRINT(("pos: %Ld\n", pos));
PRINT(("bytesLeft: %ld\n", bytesLeft));
udf_long_address extent;
long_address extent;
bool isEmpty = false;
error = list.FindExtent(pos, &extent, &isEmpty);
if (!error) {
@@ -16,14 +16,14 @@ walk_volume_recognition_sequence(int device, off_t offset,
static status_t
walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length,
uint32 blockSize, uint32 blockShift,
udf_logical_descriptor &logicalVolumeDescriptor,
udf_partition_descriptor partitionDescriptors[],
logical_descriptor &logicalVolumeDescriptor,
partition_descriptor partitionDescriptors[],
uint8 &partitionDescriptorCount);
static status_t
walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
walk_volume_descriptor_sequence(extent_address descriptorSequence,
int device, uint32 blockSize, uint32 blockShift,
udf_logical_descriptor &logicalVolumeDescriptor,
udf_partition_descriptor partitionDescriptors[],
logical_descriptor &logicalVolumeDescriptor,
partition_descriptor partitionDescriptors[],
uint8 &partitionDescriptorCount);
//------------------------------------------------------------------------------
@@ -32,8 +32,8 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
status_t
Udf::udf_recognize(int device, off_t offset, off_t length, uint32 blockSize,
uint32 &blockShift, udf_logical_descriptor &logicalVolumeDescriptor,
udf_partition_descriptor partitionDescriptors[],
uint32 &blockShift, logical_descriptor &logicalVolumeDescriptor,
partition_descriptor partitionDescriptors[],
uint8 &partitionDescriptorCount)
{
DEBUG_INIT_ETC(CF_PRIVATE, NULL, ("device: %d, offset: %Ld, length: %Ld, "
@@ -78,8 +78,8 @@ Udf::udf_recognize(int device, off_t offset, off_t length, uint32 blockSize,
DEBUG_INIT_ETC(CF_PRIVATE, NULL, ("device: %d, offset: %Ld, length: %Ld, "
"blockSize: %ld, volumeName: %p", device, offset, length,
blockSize, volumeName));
udf_logical_descriptor logicalVolumeDescriptor;
udf_partition_descriptor partitionDescriptors[Udf::kMaxPartitionDescriptors];
logical_descriptor logicalVolumeDescriptor;
partition_descriptor partitionDescriptors[Udf::kMaxPartitionDescriptors];
uint8 partitionDescriptorCount;
uint32 blockShift;
status_t error = udf_recognize(device, offset, length, blockSize, blockShift,
@@ -118,8 +118,8 @@ walk_volume_recognition_sequence(int device, off_t offset, uint32 blockSize, uin
ssize_t bytesRead = read_pos(device, address, chunk.Data(), blockSize);
if (bytesRead == (ssize_t)blockSize)
{
udf_volume_structure_descriptor_header* descriptor =
reinterpret_cast<udf_volume_structure_descriptor_header*>(chunk.Data());
volume_structure_descriptor_header* descriptor =
reinterpret_cast<volume_structure_descriptor_header*>(chunk.Data());
if (descriptor->id_matches(kVSDID_ISO)) {
SIMPLE_PRINT(("found ISO9660 descriptor\n"));
foundISO = true;
@@ -166,8 +166,8 @@ static
status_t
walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length,
uint32 blockSize, uint32 blockShift,
udf_logical_descriptor &logicalVolumeDescriptor,
udf_partition_descriptor partitionDescriptors[],
logical_descriptor &logicalVolumeDescriptor,
partition_descriptor partitionDescriptors[],
uint8 &partitionDescriptorCount)
{
DEBUG_INIT(CF_PRIVATE, NULL);
@@ -183,7 +183,7 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length,
off_t block = avds_locations[i];
off_t address = (offset + block) << blockShift;
MemoryChunk chunk(blockSize);
udf_anchor_descriptor *anchor = NULL;
anchor_descriptor *anchor = NULL;
status_t anchorErr = chunk.InitCheck();
if (!anchorErr) {
@@ -195,7 +195,7 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length,
}
}
if (!anchorErr) {
anchor = reinterpret_cast<udf_anchor_descriptor*>(chunk.Data());
anchor = reinterpret_cast<anchor_descriptor*>(chunk.Data());
anchorErr = anchor->tag().init_check(block+offset);
if (anchorErr) {
PRINT(("block %Ld: invalid anchor\n", block));
@@ -235,10 +235,10 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length,
static
status_t
walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
walk_volume_descriptor_sequence(extent_address descriptorSequence,
int device, uint32 blockSize, uint32 blockShift,
udf_logical_descriptor &logicalVolumeDescriptor,
udf_partition_descriptor partitionDescriptors[],
logical_descriptor &logicalVolumeDescriptor,
partition_descriptor partitionDescriptors[],
uint8 &partitionDescriptorCount)
{
DEBUG_INIT_ETC(CF_PRIVATE, NULL, ("descriptorSequence.loc:%ld, descriptorSequence.len:%ld",
@@ -254,7 +254,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
off_t block = descriptorSequence.location()+i;
off_t address = block << blockShift;
MemoryChunk chunk(blockSize);
udf_tag *tag = NULL;
descriptor_tag *tag = NULL;
PRINT(("descriptor #%ld (block %Ld):\n", i, block));
@@ -268,7 +268,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
}
}
if (!loopErr) {
tag = reinterpret_cast<udf_tag*>(chunk.Data());
tag = reinterpret_cast<descriptor_tag *>(chunk.Data());
loopErr = tag->init_check(block);
}
if (!loopErr) {
@@ -279,7 +279,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
case TAGID_PRIMARY_VOLUME_DESCRIPTOR:
{
udf_primary_descriptor *primary = reinterpret_cast<udf_primary_descriptor*>(tag);
primary_descriptor *primary = reinterpret_cast<primary_descriptor*>(tag);
PDUMP(primary);
(void)primary; // kill the warning
break;
@@ -293,7 +293,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
case TAGID_IMPLEMENTATION_USE_VOLUME_DESCRIPTOR:
{
udf_implementation_use_descriptor *imp_use = reinterpret_cast<udf_implementation_use_descriptor*>(tag);
implementation_use_descriptor *imp_use = reinterpret_cast<implementation_use_descriptor*>(tag);
PDUMP(imp_use);
(void)imp_use; // kill the warning
break;
@@ -301,7 +301,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
case TAGID_PARTITION_DESCRIPTOR:
{
udf_partition_descriptor *partition = reinterpret_cast<udf_partition_descriptor*>(tag);
partition_descriptor *partition = reinterpret_cast<partition_descriptor*>(tag);
PDUMP(partition);
if (partition->tag().init_check(block) == B_OK) {
// Check for a previously discovered partition descriptor with
@@ -376,7 +376,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
case TAGID_LOGICAL_VOLUME_DESCRIPTOR:
{
udf_logical_descriptor *logical = reinterpret_cast<udf_logical_descriptor*>(tag);
logical_descriptor *logical = reinterpret_cast<logical_descriptor*>(tag);
PDUMP(logical);
if (foundLogicalVolumeDescriptor) {
// Keep the vd with the highest vds_number
@@ -392,7 +392,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
case TAGID_UNALLOCATED_SPACE_DESCRIPTOR:
{
udf_unallocated_space_descriptor *unallocated = reinterpret_cast<udf_unallocated_space_descriptor*>(tag);
unallocated_space_descriptor *unallocated = reinterpret_cast<unallocated_space_descriptor*>(tag);
PDUMP(unallocated);
(void)unallocated; // kill the warning
break;
@@ -400,7 +400,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
case TAGID_TERMINATING_DESCRIPTOR:
{
udf_terminating_descriptor *terminating = reinterpret_cast<udf_terminating_descriptor*>(tag);
terminating_descriptor *terminating = reinterpret_cast<terminating_descriptor*>(tag);
PDUMP(terminating);
(void)terminating; // kill the warning
break;
@@ -17,8 +17,8 @@ namespace Udf {
status_t udf_recognize(int device, off_t offset, off_t length,
uint32 blockSize, uint32 &blockShift,
udf_logical_descriptor &logicalVolumeDescriptor,
udf_partition_descriptor partitionDescriptors[],
logical_descriptor &logicalVolumeDescriptor,
partition_descriptor partitionDescriptors[],
uint8 &partitionDescriptorCount);
status_t udf_recognize(int device, off_t offset, off_t length,
uint32 blockSize, char *volumeName);
@@ -23,11 +23,11 @@ extern "C" {
namespace Udf {
udf_long_address
long_address
to_long_address(vnode_id id, uint32 length)
{
DEBUG_INIT_ETC(CF_PUBLIC | CF_HELPER, NULL, ("vnode_id: %Ld (0x%Lx), length: %ld", id, id, length));
udf_long_address result;
long_address result;
result.set_block((id >> 16) & 0xffffffff);
result.set_partition(id & 0xffff);
result.set_length(length);
@@ -36,7 +36,7 @@ to_long_address(vnode_id id, uint32 length)
}
vnode_id
to_vnode_id(udf_long_address address)
to_vnode_id(long_address address)
{
DEBUG_INIT(CF_PUBLIC | CF_HELPER, NULL);
vnode_id result = address.block();
@@ -50,7 +50,7 @@ to_vnode_id(udf_long_address address)
}
time_t
make_time(udf_timestamp &timestamp)
make_time(timestamp &timestamp)
{
DEBUG_INIT_ETC(CF_HELPER | CF_HIGH_VOLUME, NULL, ("timestamp: (tnt: 0x%x, type: %d, timezone: %d = 0x%x, year: %d, "
"month: %d, day: %d, hour: %d, minute: %d, second: %d)", timestamp.type_and_timezone(),
+3 -3
View File
@@ -24,11 +24,11 @@ extern "C" {
namespace Udf {
udf_long_address to_long_address(vnode_id id, uint32 length = 0);
long_address to_long_address(vnode_id id, uint32 length = 0);
vnode_id to_vnode_id(udf_long_address address);
vnode_id to_vnode_id(long_address address);
time_t make_time(udf_timestamp &timestamp);
time_t make_time(timestamp &timestamp);
} // namespace Udf
+23 -20
View File
@@ -72,11 +72,13 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length,
}
}
udf_logical_descriptor logicalVolumeDescriptor;
udf_partition_descriptor partitionDescriptors[Udf::kMaxPartitionDescriptors];
logical_descriptor logicalVolumeDescriptor;
partition_descriptor partitionDescriptors[Udf::kMaxPartitionDescriptors];
uint8 partitionDescriptorCount;
uint32 blockShift;
// Run through the volume recognition and descriptor sequences to
// see if we have a potentially valid UDF volume on our hands
error = udf_recognize(device, offset, length, blockSize, blockShift,
logicalVolumeDescriptor, partitionDescriptors,
partitionDescriptorCount);
@@ -98,15 +100,15 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length,
&& !error; i++)
{
uint8 *maps = logicalVolumeDescriptor.partition_maps();
udf_partition_map_header *header =
reinterpret_cast<udf_partition_map_header*>(maps+offset);
partition_map_header *header =
reinterpret_cast<partition_map_header*>(maps+offset);
PRINT(("partition map %d (type %d):\n", i, header->type()));
if (header->type() == 1) {
PRINT(("map type: physical\n"));
udf_physical_partition_map* map =
reinterpret_cast<udf_physical_partition_map*>(header);
physical_partition_map* map =
reinterpret_cast<physical_partition_map*>(header);
// Find the corresponding partition descriptor
udf_partition_descriptor *descriptor = NULL;
partition_descriptor *descriptor = NULL;
for (uint8 j = 0; j < partitionDescriptorCount; j++) {
if (map->partition_number() ==
partitionDescriptors[j].partition_number())
@@ -135,27 +137,27 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length,
error = B_ERROR;
}
} else if (header->type() == 2) {
// Figure out what kind of partition map we have based
// Figure out what kind of type 2 partition map we have based
// on the type identifier
const udf_entity_id &typeId = header->partition_type_id();
const entity_id &typeId = header->partition_type_id();
DUMP(typeId);
DUMP(kSparablePartitionMapId);
if (typeId.matches(kVirtualPartitionMapId)) {
PRINT(("map type: virtual\n"));
udf_virtual_partition_map* map =
reinterpret_cast<udf_virtual_partition_map*>(header);
virtual_partition_map* map =
reinterpret_cast<virtual_partition_map*>(header);
virtualCount++;
(void)map; // kill the warning for now
} else if (typeId.matches(kSparablePartitionMapId)) {
PRINT(("map type: sparable\n"));
udf_sparable_partition_map* map =
reinterpret_cast<udf_sparable_partition_map*>(header);
sparable_partition_map* map =
reinterpret_cast<sparable_partition_map*>(header);
sparableCount++;
(void)map; // kill the warning for now
} else if (typeId.matches(kMetadataPartitionMapId)) {
PRINT(("map type: metadata\n"));
udf_metadata_partition_map* map =
reinterpret_cast<udf_metadata_partition_map*>(header);
metadata_partition_map* map =
reinterpret_cast<metadata_partition_map*>(header);
metadataCount++;
(void)map; // kill the warning for now
} else {
@@ -224,8 +226,8 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length,
}
// See if it's valid, and if so, create the root icb
if (!error) {
udf_file_set_descriptor *fileSet =
reinterpret_cast<udf_file_set_descriptor*>(chunk.Data());
file_set_descriptor *fileSet =
reinterpret_cast<file_set_descriptor*>(chunk.Data());
fileSet->tag().init_check(0);
PDUMP(fileSet);
fRootIcb = new Icb(this, fileSet->root_directory_icb());
@@ -267,10 +269,11 @@ Volume::Name() const {
/*! \brief Maps the given logical block to a physical block.
*/
status_t
Volume::MapBlock(udf_long_address address, off_t *mappedBlock)
Volume::MapBlock(long_address address, off_t *mappedBlock)
{
DEBUG_INIT_ETC(CF_PRIVATE | CF_HIGH_VOLUME, "Volume", ("long_address(block: %ld, partition: %d), %p",
address.block(), address.partition(), mappedBlock));
DEBUG_INIT_ETC(CF_PRIVATE | CF_HIGH_VOLUME, "Volume",
("partition: %d, block: %ld, mappedBlock: %p",
address.partition(), address.block(), mappedBlock));
status_t error = mappedBlock ? B_OK : B_BAD_VALUE;
if (!error) {
Partition *partition = _GetPartition(address.partition());
+3 -3
View File
@@ -44,8 +44,8 @@ public:
status_t Unmount();
// Address mapping
status_t MapBlock(udf_long_address address, off_t *mappedBlock);
status_t MapExtent(udf_long_address logicalExtent, udf_extent_address &physicalExtent);
status_t MapBlock(long_address address, off_t *mappedBlock);
status_t MapExtent(long_address logicalExtent, extent_address &physicalExtent);
// Miscellaneous info
const char *Name() const;
@@ -77,7 +77,7 @@ private:
uint32 fBlockSize;
uint32 fBlockShift;
Partition *fPartitions[UDF_MAX_PARTITION_MAPS];
Icb *fRootIcb; // Destroyed by vfs via callback to udf_release_node()
Icb *fRootIcb; // Destroyed by vfs via callback to release_node()
CS0String fName;
};
+2 -1
View File
@@ -487,7 +487,8 @@ udf_walk(void *ns, void *_dir, const char *filename, char **resolvedPath, vnode_
int
udf_ioctl(void *ns, void *node, void *cookie, int cmd, void *buffer, size_t bufferLength)
{
DEBUG_INIT(CF_ENTRY | CF_VOLUME_OPS, NULL);
DEBUG_INIT_ETC(CF_ENTRY | CF_VOLUME_OPS, NULL, ("node: %p, cmd: 0x%x, "
"buf: %p, len: %ld\n", node, cmd, buffer, bufferLength));
// FUNCTION_START(("node: %p, cmd: %d, buf: %p, len: %ld\n", node, cmd, buffer, bufferLength));
RETURN(B_ERROR);
}