Added partial allocation descriptor dumps in icbs.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5859 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Tyler Dauwalder 2004-01-02 02:51:16 +00:00
parent 5198a15dbc
commit 4f0e6a75b3
2 changed files with 66 additions and 14 deletions

View File

@ -118,7 +118,7 @@ const char *Udf::tag_id_to_string(tag_id id)
case TAGID_FILE_SET_DESCRIPTOR:
return "file set descriptor";
case TAGID_FILE_IDENTIFIER_DESCRIPTOR:
case TAGID_FILE_ID_DESCRIPTOR:
return "file identifier descriptor";
case TAGID_ALLOCATION_EXTENT_DESCRIPTOR:
return "allocation extent descriptor";
@ -836,10 +836,8 @@ file_id_descriptor::dump() const
PRINT(("icb:\n"));
DUMP(icb());
PRINT(("implementation_use_length: %d\n", is_parent()));
PRINT(("id: `"));
for (int i = 0; i < id_length(); i++)
SIMPLE_PRINT(("%c", id()[i]));
SIMPLE_PRINT(("'\n"));
String fileId(id());
PRINT(("id: `%s'", fileId.Utf8()));
}
void
@ -934,6 +932,33 @@ file_icb_entry::dump() const
PRINT(("unique_id: %Ld\n", unique_id()));
PRINT(("extended_attributes_length: %ld\n", extended_attributes_length()));
PRINT(("allocation_descriptors_length: %ld\n", allocation_descriptors_length()));
PRINT(("allocation_descriptors:\n"));
switch (icb_tag().descriptor_flags()) {
case ICB_DESCRIPTOR_TYPE_SHORT:
PRINT((" short descriptors...\n"));
break;
case ICB_DESCRIPTOR_TYPE_LONG:
{
const long_address *address = reinterpret_cast<const long_address*>(allocation_descriptors());
for (uint32 length = allocation_descriptors_length();
length >= sizeof(long_address);
length -= sizeof(long_address), address++)
{
PDUMP(address);
}
break;
}
case ICB_DESCRIPTOR_TYPE_EXTENDED:
PRINT((" extended descriptors...\n"));
break;
case ICB_DESCRIPTOR_TYPE_EMBEDDED:
PRINT((" embedded descriptors...\n"));
break;
default:
PRINT((" invalid descriptors type\n"));
break;
}
}
void
@ -975,4 +1000,31 @@ extended_file_icb_entry::dump() const
PRINT(("unique_id: %Ld\n", unique_id()));
PRINT(("extended_attributes_length: %ld\n", extended_attributes_length()));
PRINT(("allocation_descriptors_length: %ld\n", allocation_descriptors_length()));
PRINT(("allocation_descriptors:\n"));
switch (icb_tag().descriptor_flags()) {
case ICB_DESCRIPTOR_TYPE_SHORT:
PRINT((" short descriptors...\n"));
break;
case ICB_DESCRIPTOR_TYPE_LONG:
{
const long_address *address = reinterpret_cast<const long_address*>(allocation_descriptors());
for (uint32 length = allocation_descriptors_length();
length >= sizeof(long_address);
length -= sizeof(long_address), address++)
{
PDUMP(address);
}
break;
}
case ICB_DESCRIPTOR_TYPE_EXTENDED:
PRINT((" extended descriptors...\n"));
break;
case ICB_DESCRIPTOR_TYPE_EMBEDDED:
PRINT((" embedded descriptors...\n"));
break;
default:
PRINT((" invalid descriptors type\n"));
break;
}
}

View File

@ -627,7 +627,7 @@ enum tag_id {
// ECMA 167, PART 4
TAGID_FILE_SET_DESCRIPTOR = 256,
TAGID_FILE_IDENTIFIER_DESCRIPTOR,
TAGID_FILE_ID_DESCRIPTOR,
TAGID_ALLOCATION_EXTENT_DESCRIPTOR,
TAGID_INDIRECT_ENTRY,
TAGID_TERMINAL_ENTRY,
@ -1494,11 +1494,11 @@ public:
the implementation that generated the rest of the data in the
implementation_use() field.
*/
uint8* implementation_use() { return ((uint8*)this)+38; }
char* id() { return ((char*)this)+38+implementation_use_length(); }
const char* id() const { return ((const char*)this)+38+implementation_use_length(); }
uint8* implementation_use() { return ((uint8*)this)+(38); }
char* id() { return ((char*)this)+(38)+implementation_use_length(); }
const char* id() const { return ((const char*)this)+(38)+implementation_use_length(); }
uint16 structure_length() const { return 38 + id_length() + implementation_use_length(); }
uint16 structure_length() const { return (38) + id_length() + implementation_use_length(); }
uint16 padding_length() const { return ((structure_length()+3)/4)*4 - structure_length(); }
uint16 total_length() const { return structure_length() + padding_length(); }
@ -1817,8 +1817,8 @@ struct file_icb_entry {
uint32 extended_attributes_length() const { return B_LENDIAN_TO_HOST_INT32(_extended_attributes_length); }
uint32 allocation_descriptors_length() const { return B_LENDIAN_TO_HOST_INT32(_allocation_descriptors_length); }
uint8* extended_attributes() { return ((uint8*)(this))+sizeof(file_icb_entry); }
uint8* allocation_descriptors() { return ((uint8*)(this))+sizeof(file_icb_entry)+extended_attributes_length(); }
uint8* extended_attributes() const { return ((uint8*)(this))+sizeof(file_icb_entry); }
uint8* allocation_descriptors() const { return ((uint8*)(this))+sizeof(file_icb_entry)+extended_attributes_length(); }
// set functions
void set_uid(uint32 uid) { _uid = B_HOST_TO_LENDIAN_INT32(uid); }
@ -1933,8 +1933,8 @@ struct extended_file_icb_entry {
uint32 extended_attributes_length() const { return B_LENDIAN_TO_HOST_INT32(_extended_attributes_length); }
uint32 allocation_descriptors_length() const { return B_LENDIAN_TO_HOST_INT32(_allocation_descriptors_length); }
uint8* extended_attributes() { return (uint8*)(this+sizeof(*this)); }
uint8* allocation_descriptors() { return (uint8*)(this+sizeof(*this)+extended_attributes_length()); }
uint8* extended_attributes() const { return (uint8*)(this+sizeof(extended_file_icb_entry)); }
uint8* allocation_descriptors() const { return (uint8*)(this+sizeof(sizeof(extended_file_icb_entry))+extended_attributes_length()); }
// set functions
void set_uid(uint32 uid) { _uid = B_HOST_TO_LENDIAN_INT32(uid); }