The Volume now stores the type of the file system (as Type()).
Improved constructor. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4706 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
101bb5d182
commit
479e4ab5cf
@ -27,16 +27,12 @@ Volume::Volume(boot::Partition *partition)
|
||||
if ((fDevice = open_node(partition, O_RDONLY)) < B_OK)
|
||||
return;
|
||||
|
||||
char *buffer = (char *)malloc(4096);
|
||||
if (buffer == NULL)
|
||||
if (read_pos(fDevice, 0, &fType, sizeof(int32)) < B_OK)
|
||||
return;
|
||||
|
||||
if (read_pos(fDevice, 0, buffer, sizeof(uint32)) < B_OK) {
|
||||
free(buffer);
|
||||
return;
|
||||
}
|
||||
fType = B_BENDIAN_TO_HOST_INT32(fType);
|
||||
|
||||
switch (B_BENDIAN_TO_HOST_INT32(*(uint32 *)buffer)) {
|
||||
switch (fType) {
|
||||
case DT_AMIGA_FFS:
|
||||
case DT_AMIGA_FFS_INTL:
|
||||
case DT_AMIGA_FFS_DCACHE:
|
||||
@ -46,10 +42,13 @@ Volume::Volume(boot::Partition *partition)
|
||||
printf("The Amiga OFS is not yet supported.\n");
|
||||
default:
|
||||
// unsupported file system
|
||||
free(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
char *buffer = (char *)malloc(4096);
|
||||
if (buffer == NULL)
|
||||
return;
|
||||
|
||||
int32 blockSize = partition->block_size;
|
||||
if (get_root_block(fDevice, buffer, blockSize, partition->size) != B_OK) {
|
||||
// try to get the root block at different sizes, if the
|
||||
|
@ -28,10 +28,12 @@ class Volume {
|
||||
|
||||
int Device() const { return fDevice; }
|
||||
Directory *Root() { return fRoot; }
|
||||
int32 Type() const { return fType; }
|
||||
int32 BlockSize() const { return fRootNode.BlockSize(); }
|
||||
|
||||
protected:
|
||||
int fDevice;
|
||||
int32 fType;
|
||||
RootBlock fRootNode;
|
||||
Directory *fRoot;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user