From 4a3b7efb91a7f945cbb8f1d4580011f9ced7abb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 14 Mar 2005 15:32:12 +0000 Subject: [PATCH] Some unfinished work-in-progress. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11727 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../boot/loader/file_systems/hfs_plus/Jamfile | 12 ++++ .../loader/file_systems/hfs_plus/hfs_plus.cpp | 60 ++++++++++++++++ .../loader/file_systems/hfs_plus/hfs_plus.h | 69 +++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 src/kernel/boot/loader/file_systems/hfs_plus/Jamfile create mode 100644 src/kernel/boot/loader/file_systems/hfs_plus/hfs_plus.cpp create mode 100644 src/kernel/boot/loader/file_systems/hfs_plus/hfs_plus.h diff --git a/src/kernel/boot/loader/file_systems/hfs_plus/Jamfile b/src/kernel/boot/loader/file_systems/hfs_plus/Jamfile new file mode 100644 index 0000000000..1e538c2c8a --- /dev/null +++ b/src/kernel/boot/loader/file_systems/hfs_plus/Jamfile @@ -0,0 +1,12 @@ +SubDir OBOS_TOP src kernel boot loader file_systems hfs_plus ; + +UsePrivateHeaders [ FDirName kernel boot platform $(OBOS_BOOT_PLATFORM) ] ; +UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; +UsePrivateHeaders [ FDirName storage ] ; + +SubDirC++Flags -fno-rtti ; + +KernelStaticLibrary boot_hfs_plus : + hfs_plus.cpp + : -fno-pic + ; diff --git a/src/kernel/boot/loader/file_systems/hfs_plus/hfs_plus.cpp b/src/kernel/boot/loader/file_systems/hfs_plus/hfs_plus.cpp new file mode 100644 index 0000000000..0d547d8ee6 --- /dev/null +++ b/src/kernel/boot/loader/file_systems/hfs_plus/hfs_plus.cpp @@ -0,0 +1,60 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include "hfs_plus.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + + +using namespace HFSPlus; + +#if 0 +status_t +HFSPlus::get_root_block(int fDevice, char *buffer, int32 blockSize, off_t partitionSize) +{ + hfs_volume_header header; + if (read_pos(fDevice, 1024, &header, sizeof(header)) < B_OK) + return B_ERROR; + + + return B_OK; +} +#endif + +// #pragma mark - + + +static status_t +hfs_plus_get_file_system(boot::Partition *partition, ::Directory **_root) +{ +/* Volume *volume = new Volume(partition); + if (volume == NULL) + return B_NO_MEMORY; + + if (volume->InitCheck() < B_OK) { + delete volume; + return B_ERROR; + } + + *_root = volume->Root(); +*/ return B_OK; +} + + +file_system_module_info gAmigaFFSFileSystemModule = { + "file_systems/hfs_plus/v1", + kPartitionTypeHFSPlus, + hfs_plus_get_file_system +}; + diff --git a/src/kernel/boot/loader/file_systems/hfs_plus/hfs_plus.h b/src/kernel/boot/loader/file_systems/hfs_plus/hfs_plus.h new file mode 100644 index 0000000000..fd5843697d --- /dev/null +++ b/src/kernel/boot/loader/file_systems/hfs_plus/hfs_plus.h @@ -0,0 +1,69 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef HFS_PLUS_H +#define HFS_PLUS_H + + +#include + + +namespace HFSPlus { + +struct hfs_extent_descriptor { + uint32 start_block; + uint32 block_count; +}; + +typedef hfs_extent_descriptor hfs_extent_record[8]; + +struct hfs_fork_data { + uint64 logical_size; + uint32 clump_size; + uint32 total_blocks; + hfs_extent_record extents; +}; + + +#define HFS_VOLUME_SIGNATURE 'H+' + +struct hfs_volume_header { + uint16 signature; + uint16 version; + uint32 attributes; + uint32 last_mounted_version; + uint32 journal_info_block; + + uint32 creation_date; + uint32 modification_date; + uint32 backup_date; + uint32 checked_date; + + uint32 file_count; + uint32 folder_count; + + uint32 block_size; + uint32 total_blocks; + uint32 free_blocks; + + uint32 next_allocation; + uint32 resource_clump_size; + uint32 data_clump_size; + uint32 next_catalog_id; + + uint32 write_count; + uint64 encodings_bitmap; + + uint32 finder_info[8]; + + hfs_fork_data allocation_file; + hfs_fork_data extents_file; + hfs_fork_data catalog_file; + hfs_fork_data attributes_file; + hfs_fork_data startup_file; +}; + +} // namespace HFSPlus + +#endif /* HFS_PLUS_H */