From aec0abfd56528afe9a3fed757b75e26ab204ff2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 12 Sep 2003 02:28:14 +0000 Subject: [PATCH] Add a new Stream class that handles reading bytes from an inode (retrieved from the BFS Stream.h file) - it supports all data stream ranges (direct, indirect, & double indirect). Moved bfs_inode::InitCheck() to the new Stream class. The Directory class now has a Stream object instead of a bfs_inode directly. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4639 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../loader/file_systems/bfs/Directory.cpp | 36 +------------------ .../boot/loader/file_systems/bfs/Directory.h | 4 +-- .../boot/loader/file_systems/bfs/Jamfile | 1 + 3 files changed, 4 insertions(+), 37 deletions(-) diff --git a/src/kernel/boot/loader/file_systems/bfs/Directory.cpp b/src/kernel/boot/loader/file_systems/bfs/Directory.cpp index 77ffa8cd90..5048347cef 100644 --- a/src/kernel/boot/loader/file_systems/bfs/Directory.cpp +++ b/src/kernel/boot/loader/file_systems/bfs/Directory.cpp @@ -12,7 +12,7 @@ namespace BFS { Directory::Directory(Volume &volume, block_run run) : - fVolume(volume) + fStream(volume, run) { } @@ -63,38 +63,4 @@ Directory::Rewind(void *cookie) return B_ERROR; } - -// #pragma mark - - - -status_t -bfs_inode::InitCheck(Volume *volume) -{ - if (Flags() & INODE_NOT_READY) { - // the other fields may not yet contain valid values - return B_BUSY; - } - - if (Magic1() != INODE_MAGIC1 - || !(Flags() & INODE_IN_USE) - || inode_num.Length() != 1 - // matches inode size? - || (uint32)InodeSize() != volume->InodeSize() - // parent resides on disk? - || parent.AllocationGroup() > int32(volume->AllocationGroups()) - || parent.AllocationGroup() < 0 - || parent.Start() > (1L << volume->AllocationGroupShift()) - || parent.Length() != 1 - // attributes, too? - || attributes.AllocationGroup() > int32(volume->AllocationGroups()) - || attributes.AllocationGroup() < 0 - || attributes.Start() > (1L << volume->AllocationGroupShift())) - return B_BAD_DATA; - - // ToDo: Add some tests to check the integrity of the other stuff here, - // especially for the data_stream! - - return B_OK; -} - } // namespace BFS diff --git a/src/kernel/boot/loader/file_systems/bfs/Directory.h b/src/kernel/boot/loader/file_systems/bfs/Directory.h index 30f220c0d7..8047b76424 100644 --- a/src/kernel/boot/loader/file_systems/bfs/Directory.h +++ b/src/kernel/boot/loader/file_systems/bfs/Directory.h @@ -9,6 +9,7 @@ #include #include "Volume.h" +#include "Stream.h" namespace BFS { @@ -29,8 +30,7 @@ class Directory : public ::Directory { virtual status_t Rewind(void *cookie); private: - Volume &fVolume; - bfs_inode fNode; + Stream fStream; }; } // namespace BFS diff --git a/src/kernel/boot/loader/file_systems/bfs/Jamfile b/src/kernel/boot/loader/file_systems/bfs/Jamfile index be92e9a08b..95e3f19bad 100644 --- a/src/kernel/boot/loader/file_systems/bfs/Jamfile +++ b/src/kernel/boot/loader/file_systems/bfs/Jamfile @@ -9,4 +9,5 @@ SubDirHdrs $(OBOS_TOP) src add-ons kernel file_systems bfs ; KernelStaticLibrary boot_bfs : bfs.cpp Directory.cpp + Stream.cpp ;