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
This commit is contained in:
Axel Dörfler 2003-09-12 02:28:14 +00:00
parent 7df7a4cc01
commit aec0abfd56
3 changed files with 4 additions and 37 deletions

View File

@ -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

View File

@ -9,6 +9,7 @@
#include <boot/vfs.h>
#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

View File

@ -9,4 +9,5 @@ SubDirHdrs $(OBOS_TOP) src add-ons kernel file_systems bfs ;
KernelStaticLibrary boot_bfs :
bfs.cpp
Directory.cpp
Stream.cpp
;