ramfs: Adapt to current kernel FS APIs and fully fix the build.
This commit is contained in:
@@ -18,6 +18,7 @@ KernelAddon ramfs
|
||||
BlockAllocatorAreaBucket.cpp
|
||||
BlockReferenceManager.cpp
|
||||
DataContainer.cpp
|
||||
DebugSupport.cpp
|
||||
Directory.cpp
|
||||
Entry.cpp
|
||||
EntryIterator.cpp
|
||||
@@ -36,3 +37,6 @@ KernelAddon ramfs
|
||||
SymLink.cpp
|
||||
Volume.cpp
|
||||
;
|
||||
|
||||
SEARCH on [ FGristFiles DebugSupport.cpp ]
|
||||
+= [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems shared ] ;
|
||||
|
||||
@@ -61,22 +61,6 @@ private:
|
||||
char *fString;
|
||||
};
|
||||
|
||||
// strnlen
|
||||
size_t
|
||||
strnlen(const char *str, size_t maxLen)
|
||||
{
|
||||
if (str) {
|
||||
size_t origMaxLen = maxLen;
|
||||
while (maxLen > 0 && *str != '\0') {
|
||||
maxLen--;
|
||||
str++;
|
||||
}
|
||||
return origMaxLen - maxLen;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\class String
|
||||
\brief A very simple string class.
|
||||
|
||||
@@ -133,7 +133,6 @@ class EntryListenerTree : public _EntryListenerTree {};
|
||||
Volume::Volume(fs_volume* volume)
|
||||
:
|
||||
fVolume(volume),
|
||||
fID(0),
|
||||
fNextNodeID(kRootParentID + 1),
|
||||
fNodeTable(NULL),
|
||||
fDirectoryEntryTable(NULL),
|
||||
@@ -170,16 +169,15 @@ Volume::Mount(uint32 flags)
|
||||
{
|
||||
Unmount();
|
||||
|
||||
// check the locker's semaphores
|
||||
if (fLocker.Sem() < 0)
|
||||
return fLocker.Sem();
|
||||
if (fIteratorLocker.Sem() < 0)
|
||||
return fIteratorLocker.Sem();
|
||||
if (fQueryLocker.Sem() < 0)
|
||||
return fQueryLocker.Sem();
|
||||
// check the lockers
|
||||
if (fLocker.InitCheck() < 0)
|
||||
return fLocker.InitCheck();
|
||||
if (fIteratorLocker.InitCheck() < 0)
|
||||
return fIteratorLocker.InitCheck();
|
||||
if (fQueryLocker.InitCheck() < 0)
|
||||
return fQueryLocker.InitCheck();
|
||||
|
||||
status_t error = B_OK;
|
||||
fID = id;
|
||||
// create a block allocator
|
||||
if (error == B_OK) {
|
||||
fBlockAllocator = new(nothrow) BlockAllocator(kDefaultAreaSize);
|
||||
@@ -291,7 +289,6 @@ Volume::Unmount()
|
||||
delete fBlockAllocator;
|
||||
fBlockAllocator = NULL;
|
||||
}
|
||||
fID = 0;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -349,7 +346,7 @@ Volume::NewVNode(Node *node)
|
||||
{
|
||||
status_t error = NodeAdded(node);
|
||||
if (error == B_OK) {
|
||||
error = new_vnode(GetID(), node->GetID(), node);
|
||||
error = new_vnode(FSVolume(), node->GetID(), node, &gRamFSVnodeOps);
|
||||
if (error != B_OK)
|
||||
NodeRemoved(node);
|
||||
}
|
||||
@@ -362,7 +359,8 @@ Volume::PublishVNode(Node *node)
|
||||
{
|
||||
status_t error = NodeAdded(node);
|
||||
if (error == B_OK) {
|
||||
error = publish_vnode(GetID(), node->GetID(), node);
|
||||
error = publish_vnode(FSVolume(), node->GetID(), node, &gRamFSVnodeOps,
|
||||
node->GetMode(), 0);
|
||||
if (error != B_OK)
|
||||
NodeRemoved(node);
|
||||
}
|
||||
@@ -373,7 +371,7 @@ Volume::PublishVNode(Node *node)
|
||||
status_t
|
||||
Volume::GetVNode(ino_t id, Node **node)
|
||||
{
|
||||
return (fMounted ? get_vnode(GetID(), id, (void**)node) : B_BAD_VALUE);
|
||||
return (fMounted ? get_vnode(FSVolume(), id, (void**)node) : B_BAD_VALUE);
|
||||
}
|
||||
|
||||
// GetVNode
|
||||
@@ -384,7 +382,7 @@ Volume::GetVNode(Node *node)
|
||||
status_t error = (fMounted ? GetVNode(node->GetID(), &dummy)
|
||||
: B_BAD_VALUE );
|
||||
if (error == B_OK && dummy != node) {
|
||||
FATAL(("Two Nodes have the same ID: %Ld!\n", node->GetID()));
|
||||
FATAL("Two Nodes have the same ID: %Ld!\n", node->GetID());
|
||||
PutVNode(dummy);
|
||||
error = B_ERROR;
|
||||
}
|
||||
@@ -395,14 +393,14 @@ Volume::GetVNode(Node *node)
|
||||
status_t
|
||||
Volume::PutVNode(ino_t id)
|
||||
{
|
||||
return (fMounted ? put_vnode(GetID(), id) : B_BAD_VALUE);
|
||||
return (fMounted ? put_vnode(FSVolume(), id) : B_BAD_VALUE);
|
||||
}
|
||||
|
||||
// PutVNode
|
||||
status_t
|
||||
Volume::PutVNode(Node *node)
|
||||
{
|
||||
return (fMounted ? put_vnode(GetID(), node->GetID()) : B_BAD_VALUE);
|
||||
return (fMounted ? put_vnode(FSVolume(), node->GetID()) : B_BAD_VALUE);
|
||||
}
|
||||
|
||||
// RemoveVNode
|
||||
@@ -410,7 +408,7 @@ status_t
|
||||
Volume::RemoveVNode(Node *node)
|
||||
{
|
||||
if (fMounted)
|
||||
return remove_vnode(GetID(), node->GetID());
|
||||
return remove_vnode(FSVolume(), node->GetID());
|
||||
status_t error = NodeRemoved(node);
|
||||
if (error == B_OK)
|
||||
delete node;
|
||||
@@ -421,7 +419,7 @@ Volume::RemoveVNode(Node *node)
|
||||
status_t
|
||||
Volume::UnremoveVNode(Node *node)
|
||||
{
|
||||
return (fMounted ? unremove_vnode(GetID(), node->GetID()) : B_BAD_VALUE);
|
||||
return (fMounted ? unremove_vnode(FSVolume(), node->GetID()) : B_BAD_VALUE);
|
||||
}
|
||||
|
||||
// NodeAdded
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
status_t Mount(uint32 flags);
|
||||
status_t Unmount();
|
||||
|
||||
dev_t GetID() const { return fID; }
|
||||
dev_t GetID() const { return fVolume != NULL ? fVolume->id : -1; }
|
||||
fs_volume* FSVolume() const { return fVolume; }
|
||||
|
||||
off_t GetBlockSize() const;
|
||||
@@ -183,7 +183,6 @@ protected:
|
||||
private:
|
||||
typedef DoublyLinkedList<Query> QueryList;
|
||||
|
||||
dev_t fID;
|
||||
ino_t fNextNodeID;
|
||||
NodeTable *fNodeTable;
|
||||
DirectoryEntryTable *fDirectoryEntryTable;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
extern struct fs_vnode_ops gRamFSVnodeOps;
|
||||
const size_t kMaxIndexKeyLength = 256;
|
||||
|
||||
#endif // RAM_FS_H
|
||||
|
||||
Reference in New Issue
Block a user