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:
@@ -12,7 +12,7 @@ namespace BFS {
|
|||||||
|
|
||||||
Directory::Directory(Volume &volume, block_run run)
|
Directory::Directory(Volume &volume, block_run run)
|
||||||
:
|
:
|
||||||
fVolume(volume)
|
fStream(volume, run)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,38 +63,4 @@ Directory::Rewind(void *cookie)
|
|||||||
return B_ERROR;
|
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
|
} // namespace BFS
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <boot/vfs.h>
|
#include <boot/vfs.h>
|
||||||
|
|
||||||
#include "Volume.h"
|
#include "Volume.h"
|
||||||
|
#include "Stream.h"
|
||||||
|
|
||||||
|
|
||||||
namespace BFS {
|
namespace BFS {
|
||||||
@@ -29,8 +30,7 @@ class Directory : public ::Directory {
|
|||||||
virtual status_t Rewind(void *cookie);
|
virtual status_t Rewind(void *cookie);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Volume &fVolume;
|
Stream fStream;
|
||||||
bfs_inode fNode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace BFS
|
} // namespace BFS
|
||||||
|
|||||||
@@ -9,4 +9,5 @@ SubDirHdrs $(OBOS_TOP) src add-ons kernel file_systems bfs ;
|
|||||||
KernelStaticLibrary boot_bfs :
|
KernelStaticLibrary boot_bfs :
|
||||||
bfs.cpp
|
bfs.cpp
|
||||||
Directory.cpp
|
Directory.cpp
|
||||||
|
Stream.cpp
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user