diff --git a/src/kernel/boot/loader/file_systems/amiga_ffs/Volume.cpp b/src/kernel/boot/loader/file_systems/amiga_ffs/Volume.cpp index b505c38c6b..5befdc679a 100644 --- a/src/kernel/boot/loader/file_systems/amiga_ffs/Volume.cpp +++ b/src/kernel/boot/loader/file_systems/amiga_ffs/Volume.cpp @@ -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 diff --git a/src/kernel/boot/loader/file_systems/amiga_ffs/Volume.h b/src/kernel/boot/loader/file_systems/amiga_ffs/Volume.h index 48cc573d99..7f71189e0a 100644 --- a/src/kernel/boot/loader/file_systems/amiga_ffs/Volume.h +++ b/src/kernel/boot/loader/file_systems/amiga_ffs/Volume.h @@ -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; };