First work towards adjusting the UserlandFS to the changed FS API. The

kernel module compiles again, though newer features like VM file support,
asynchronous I/O, and FS layers aren't supported yet. The userland code is
still completely out of sync and won't even compile.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29318 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-02-24 21:07:40 +00:00
parent c0b6b0dff6
commit 2bcdce290b
9 changed files with 724 additions and 572 deletions

View File

@ -1,5 +1,7 @@
// Requests.h
/*
* Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef USERLAND_FS_REQUESTS_H
#define USERLAND_FS_REQUESTS_H
@ -227,7 +229,7 @@ class VolumeRequest : public Request {
public:
VolumeRequest(uint32 type) : Request(type) {}
fs_volume volume;
void* volume;
};
// NodeRequest
@ -235,7 +237,7 @@ class NodeRequest : public VolumeRequest {
public:
NodeRequest(uint32 type) : VolumeRequest(type) {}
fs_vnode node;
void* node;
};
// FileRequest
@ -243,7 +245,7 @@ class FileRequest : public NodeRequest {
public:
FileRequest(uint32 type) : NodeRequest(type) {}
fs_cookie fileCookie;
void* fileCookie;
};
// DirRequest
@ -251,7 +253,7 @@ class DirRequest : public NodeRequest {
public:
DirRequest(uint32 type) : NodeRequest(type) {}
fs_cookie dirCookie;
void* dirCookie;
};
// AttrDirRequest
@ -259,7 +261,7 @@ class AttrDirRequest : public NodeRequest {
public:
AttrDirRequest(uint32 type) : NodeRequest(type) {}
fs_cookie attrDirCookie;
void* attrDirCookie;
};
// AttributeRequest
@ -267,7 +269,7 @@ class AttributeRequest : public NodeRequest {
public:
AttributeRequest(uint32 type) : NodeRequest(type) {}
fs_cookie attrCookie;
void* attrCookie;
};
// IndexDirRequest
@ -275,7 +277,7 @@ class IndexDirRequest : public VolumeRequest {
public:
IndexDirRequest(uint32 type) : VolumeRequest(type) {}
fs_cookie indexDirCookie;
void* indexDirCookie;
};
// QueryRequest
@ -283,7 +285,7 @@ class QueryRequest : public VolumeRequest {
public:
QueryRequest(uint32 type) : VolumeRequest(type) {}
fs_cookie queryCookie;
void* queryCookie;
};
@ -339,7 +341,7 @@ public:
MountVolumeReply() : ReplyRequest(MOUNT_VOLUME_REPLY) {}
ino_t rootID;
fs_volume volume;
void* volume;
};
// UnmountVolumeRequest
@ -431,7 +433,6 @@ public:
LookupReply() : ReplyRequest(LOOKUP_REPLY) {}
ino_t vnid;
int type;
};
// GetVNodeNameRequest
@ -465,7 +466,9 @@ class ReadVNodeReply : public ReplyRequest {
public:
ReadVNodeReply() : ReplyRequest(READ_VNODE_REPLY) {}
fs_vnode node;
void* node;
int type;
uint32 flags;
};
// WriteVNodeRequest
@ -625,7 +628,7 @@ public:
status_t GetAddressInfos(AddressInfo* infos, int32* count);
Address name;
fs_vnode target;
void* target;
};
// LinkReply
@ -655,9 +658,9 @@ public:
RenameRequest() : VolumeRequest(RENAME_REQUEST) {}
status_t GetAddressInfos(AddressInfo* infos, int32* count);
fs_vnode oldDir;
void* oldDir;
Address oldName;
fs_vnode newDir;
void* newDir;
Address newName;
};
@ -731,7 +734,7 @@ public:
CreateReply() : ReplyRequest(CREATE_REPLY) {}
ino_t vnid;
fs_cookie fileCookie;
void* fileCookie;
};
// OpenRequest
@ -747,7 +750,7 @@ class OpenReply : public ReplyRequest {
public:
OpenReply() : ReplyRequest(OPEN_REPLY) {}
fs_cookie fileCookie;
void* fileCookie;
};
// CloseRequest
@ -859,7 +862,7 @@ class OpenDirReply : public ReplyRequest {
public:
OpenDirReply() : ReplyRequest(OPEN_DIR_REPLY) {}
fs_cookie dirCookie;
void* dirCookie;
};
// CloseDirRequest
@ -932,7 +935,7 @@ class OpenAttrDirReply : public ReplyRequest {
public:
OpenAttrDirReply() : ReplyRequest(OPEN_ATTR_DIR_REPLY) {}
fs_cookie attrDirCookie;
void* attrDirCookie;
};
// CloseAttrDirRequest
@ -1010,7 +1013,7 @@ class CreateAttrReply : public ReplyRequest {
public:
CreateAttrReply() : ReplyRequest(CREATE_ATTR_REPLY) {}
fs_cookie attrCookie;
void* attrCookie;
};
// OpenAttrRequest
@ -1028,7 +1031,7 @@ class OpenAttrReply : public ReplyRequest {
public:
OpenAttrReply() : ReplyRequest(OPEN_ATTR_REPLY) {}
fs_cookie attrCookie;
void* attrCookie;
};
// CloseAttrRequest
@ -1128,8 +1131,8 @@ public:
RenameAttrRequest() : VolumeRequest(RENAME_ATTR_REQUEST) {}
status_t GetAddressInfos(AddressInfo* infos, int32* count);
fs_vnode oldNode;
fs_vnode newNode;
void* oldNode;
void* newNode;
Address oldName;
Address newName;
};
@ -1170,7 +1173,7 @@ class OpenIndexDirReply : public ReplyRequest {
public:
OpenIndexDirReply() : ReplyRequest(OPEN_INDEX_DIR_REPLY) {}
fs_cookie indexDirCookie;
void* indexDirCookie;
};
// CloseIndexDirRequest
@ -1299,7 +1302,7 @@ class OpenQueryReply : public ReplyRequest {
public:
OpenQueryReply() : ReplyRequest(OPEN_QUERY_REPLY) {}
fs_cookie queryCookie;
void* queryCookie;
};
// CloseQueryRequest
@ -1442,7 +1445,7 @@ class GetVNodeReply : public ReplyRequest {
public:
GetVNodeReply() : ReplyRequest(GET_VNODE_REPLY) {}
fs_vnode node;
void* node;
};
// PutVNodeRequest
@ -1467,7 +1470,7 @@ public:
dev_t nsid;
ino_t vnid;
fs_vnode node;
void* node;
};
// NewVNodeReply
@ -1483,7 +1486,9 @@ public:
dev_t nsid;
ino_t vnid;
fs_vnode node;
void* node;
int type;
uint32 flags;
};
// PublishVNodeReply

View File

@ -1,4 +1,7 @@
// FileSystem.cpp
/*
* Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "AutoLocker.h"
#include "Compatibility.h"
@ -179,7 +182,7 @@ FileSystem::GetPortPool()
// Mount
status_t
FileSystem::Mount(dev_t id, const char* device, uint32 flags,
FileSystem::Mount(fs_volume* fsVolume, const char* device, uint32 flags,
const char* parameters, Volume** _volume)
{
// check initialization and parameters
@ -187,7 +190,7 @@ FileSystem::Mount(dev_t id, const char* device, uint32 flags,
return B_BAD_VALUE;
// create volume
Volume* volume = new(nothrow) Volume(this, id);
Volume* volume = new(nothrow) Volume(this, fsVolume);
if (!volume)
return B_NO_MEMORY;

View File

@ -1,5 +1,7 @@
// FileSystem.h
/*
* Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef USERLAND_FS_FILE_SYSTEM_H
#define USERLAND_FS_FILE_SYSTEM_H
@ -35,7 +37,7 @@ public:
RequestPortPool* GetPortPool();
status_t Mount(dev_t id, const char* device,
status_t Mount(fs_volume* fsVolume, const char* device,
ulong flags, const char* parameters,
Volume** volume);
// status_t Initialize(const char* deviceName,

View File

@ -1,4 +1,7 @@
// KernelRequestHandler.cpp
/*
* Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "Compatibility.h"
#include "Debug.h"
@ -121,7 +124,7 @@ KernelRequestHandler::_HandleRequest(NotifyListenerRequest* request)
if (!oldName) {
ERROR(("NotifyListenerRequest: NULL oldName for "
"B_ENTRY_MOVED\n"));
result = B_BAD_VALUE;
result = B_BAD_VALUE;
break;
}
// fall through...
@ -131,7 +134,7 @@ KernelRequestHandler::_HandleRequest(NotifyListenerRequest* request)
if (!name) {
ERROR(("NotifyListenerRequest: NULL name for opcode: %ld\n",
request->operation));
result = B_BAD_VALUE;
result = B_BAD_VALUE;
}
break;
case B_STAT_CHANGED:
@ -183,7 +186,7 @@ KernelRequestHandler::_HandleRequest(NotifyListenerRequest* request)
default:
ERROR(("NotifyQueryRequest: unsupported operation: %ld\n",
request->operation));
result = B_BAD_VALUE;
result = B_BAD_VALUE;
break;
}
}
@ -249,7 +252,7 @@ KernelRequestHandler::_HandleRequest(NotifyQueryRequest* request)
int32 nameLen = request->name.GetSize();
if (!name || nameLen <= 0) {
ERROR(("NotifyQueryRequest: NULL name!\n"));
result = B_BAD_VALUE;
result = B_BAD_VALUE;
} else
name[nameLen - 1] = '\0'; // NULL-terminate to be safe
@ -278,7 +281,7 @@ KernelRequestHandler::_HandleRequest(NotifyQueryRequest* request)
default:
ERROR(("NotifyQueryRequest: unsupported operation: %ld\n",
request->operation));
result = B_BAD_VALUE;
result = B_BAD_VALUE;
break;
}
}
@ -372,8 +375,10 @@ KernelRequestHandler::_HandleRequest(PublishVNodeRequest* request)
Volume* volume = NULL;
status_t result = _GetVolume(request->nsid, &volume);
VolumePutter _(volume);
if (result == B_OK)
result = volume->PublishVNode(request->vnid, request->node);
if (result == B_OK) {
result = volume->PublishVNode(request->vnid, request->node,
request->type, request->flags);
}
// prepare the reply
RequestAllocator allocator(fPort->GetPort());

View File

@ -1,4 +1,7 @@
// KernelRequestHandler.h
/*
* Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef USERLAND_FS_KERNEL_REQUEST_HANDLER_H
#define USERLAND_FS_KERNEL_REQUEST_HANDLER_H

View File

@ -1,4 +1,7 @@
// Volume.cpp
/*
* Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "Volume.h"
@ -13,6 +16,7 @@
#include "FileSystem.h"
#include "HashMap.h"
#include "IOCtlInfo.h"
#include "kernel_interface.h"
#include "KernelRequestHandler.h"
#include "PortReleaser.h"
#include "RequestAllocator.h"
@ -66,10 +70,10 @@ private:
};
// constructor
Volume::Volume(FileSystem* fileSystem, dev_t id)
Volume::Volume(FileSystem* fileSystem, fs_volume* fsVolume)
: Referencable(true),
fFileSystem(fileSystem),
fID(id),
fFSVolume(fsVolume),
fUserlandVolume(NULL),
fRootID(0),
fRootNode(NULL),
@ -97,13 +101,6 @@ Volume::GetFileSystem() const
return fFileSystem;
}
// GetID
dev_t
Volume::GetID() const
{
return fID;
}
// GetUserlandVolume
void*
Volume::GetUserlandVolume() const
@ -130,14 +127,14 @@ Volume::IsMounting() const
// GetVNode
status_t
Volume::GetVNode(ino_t vnid, fs_vnode* node)
Volume::GetVNode(ino_t vnid, void** node)
{
PRINT(("get_vnode(%ld, %lld)\n", fID, vnid));
PRINT(("get_vnode(%ld, %lld)\n", GetID(), vnid));
if (IsMounting() && !fMountVNodes->ContainsKey(vnid)) {
ERROR(("Volume::GetVNode(): get_vnode() invoked for unknown vnode "
"while mounting!\n"));
}
status_t error = get_vnode(fID, vnid, node);
status_t error = get_vnode(fFSVolume, vnid, node);
if (error == B_OK)
_IncrementVNodeCount(vnid);
return error;
@ -147,8 +144,8 @@ PRINT(("get_vnode(%ld, %lld)\n", fID, vnid));
status_t
Volume::PutVNode(ino_t vnid)
{
PRINT(("put_vnode(%ld, %lld)\n", fID, vnid));
status_t error = put_vnode(fID, vnid);
PRINT(("put_vnode(%ld, %lld)\n", GetID(), vnid));
status_t error = put_vnode(fFSVolume, vnid);
if (error == B_OK)
_DecrementVNodeCount(vnid);
return error;
@ -156,18 +153,19 @@ PRINT(("put_vnode(%ld, %lld)\n", fID, vnid));
// NewVNode
status_t
Volume::NewVNode(ino_t vnid, fs_vnode node)
Volume::NewVNode(ino_t vnid, void* node)
{
PRINT(("new_vnode(%ld, %lld)\n", fID, vnid));
status_t error = new_vnode(fID, vnid, node);
PRINT(("new_vnode(%ld, %lld)\n", GetID(), vnid));
status_t error = new_vnode(fFSVolume, vnid, node, &gUserlandFSVnodeOps);
if (error == B_OK) {
if (IsMounting()) {
error = fMountVNodes->Put(vnid, node);
if (error != B_OK) {
ERROR(("Volume::NewVNode(): Failed to add vnode to mount "
"vnode map!\n"));
publish_vnode(fID, vnid, node);
put_vnode(fID, vnid);
publish_vnode(fFSVolume, vnid, node, &gUserlandFSVnodeOps,
S_IFDIR, 0); // dummy type and flags
put_vnode(fFSVolume, vnid);
return error;
}
}
@ -179,17 +177,18 @@ PRINT(("new_vnode(%ld, %lld)\n", fID, vnid));
// PublishVNode
status_t
Volume::PublishVNode(ino_t vnid, fs_vnode node)
Volume::PublishVNode(ino_t vnid, void* node, int type, uint32 flags)
{
PRINT(("publish_vnode(%ld, %lld, %p)\n", fID, vnid, node));
status_t error = publish_vnode(fID, vnid, node);
PRINT(("publish_vnode(%ld, %lld, %p)\n", GetID(), vnid, node));
status_t error = publish_vnode(fFSVolume, vnid, node, &gUserlandFSVnodeOps,
type, flags);
if (error == B_OK) {
if (IsMounting()) {
error = fMountVNodes->Put(vnid, node);
if (error != B_OK) {
ERROR(("Volume::PublishVNode(): Failed to add vnode to mount "
"vnode map!\n"));
put_vnode(fID, vnid);
put_vnode(fFSVolume, vnid);
return error;
}
}
@ -202,24 +201,24 @@ PRINT(("publish_vnode(%ld, %lld, %p)\n", fID, vnid, node));
status_t
Volume::RemoveVNode(ino_t vnid)
{
PRINT(("remove_vnode(%ld, %lld)\n", fID, vnid));
return remove_vnode(fID, vnid);
PRINT(("remove_vnode(%ld, %lld)\n", GetID(), vnid));
return remove_vnode(fFSVolume, vnid);
}
// UnremoveVNode
status_t
Volume::UnremoveVNode(ino_t vnid)
{
PRINT(("unremove_vnode(%ld, %lld)\n", fID, vnid));
return unremove_vnode(fID, vnid);
PRINT(("unremove_vnode(%ld, %lld)\n", GetID(), vnid));
return unremove_vnode(fFSVolume, vnid);
}
// GetVNodeRemoved
status_t
Volume::GetVNodeRemoved(ino_t vnid, bool* removed)
{
PRINT(("get_vnode_removed(%ld, %lld, %p)\n", fID, vnid, removed));
return get_vnode_removed(fID, vnid, removed);
PRINT(("get_vnode_removed(%ld, %lld, %p)\n", GetID(), vnid, removed));
return get_vnode_removed(fFSVolume, vnid, removed);
}
@ -323,7 +322,7 @@ Volume::ReadFSInfo(fs_info* info)
// read_fs_info() requests manually.
status_t error = _ReadFSInfo(info);
if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) {
WARN(("Volume::Lookup(): connection lost, emulating lookup `.'\n"));
WARN(("Volume::ReadFSInfo(): connection lost, emulating lookup `.'\n"));
info->flags = B_FS_IS_PERSISTENT | B_FS_IS_READONLY;
info->block_size = 512;
@ -384,11 +383,11 @@ Volume::WriteFSInfo(const struct fs_info *info, uint32 mask)
// Lookup
status_t
Volume::Lookup(fs_vnode dir, const char* entryName, ino_t* vnid, int* type)
Volume::Lookup(void* dir, const char* entryName, ino_t* vnid)
{
// When the connection to the userland server is lost, we serve
// lookup(fRootNode, `.') requests manually to allow clean unmounting.
status_t error = _Lookup(dir, entryName, vnid, type);
status_t error = _Lookup(dir, entryName, vnid);
if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()
&& dir == fRootNode && strcmp(entryName, ".") == 0) {
WARN(("Volume::Lookup(): connection lost, emulating lookup `.'\n"));
@ -396,7 +395,6 @@ Volume::Lookup(fs_vnode dir, const char* entryName, ino_t* vnid, int* type)
if (GetVNode(fRootID, &entryNode) != B_OK)
RETURN_ERROR(B_BAD_VALUE);
*vnid = fRootID;
*type = S_IFDIR;
// The VFS will balance the get_vnode() call for the FS.
_DecrementVNodeCount(*vnid);
return B_OK;
@ -406,7 +404,7 @@ Volume::Lookup(fs_vnode dir, const char* entryName, ino_t* vnid, int* type)
// GetVNodeName
status_t
Volume::GetVNodeName(fs_vnode node, char* buffer, size_t bufferSize)
Volume::GetVNodeName(void* node, char* buffer, size_t bufferSize)
{
// We don't check the capability -- if not implemented by the client FS,
// the functionality is emulated in userland.
@ -455,7 +453,8 @@ Volume::GetVNodeName(fs_vnode node, char* buffer, size_t bufferSize)
// ReadVNode
status_t
Volume::ReadVNode(ino_t vnid, bool reenter, fs_vnode* node)
Volume::ReadVNode(ino_t vnid, bool reenter, void** node, int* type,
uint32* flags)
{
// get a free port
RequestPort* port = fFileSystem->GetPortPool()->AcquirePort();
@ -486,12 +485,14 @@ Volume::ReadVNode(ino_t vnid, bool reenter, fs_vnode* node)
if (reply->error != B_OK)
return reply->error;
*node = reply->node;
*type = reply->type;
*flags = reply->flags;
return error;
}
// WriteVNode
status_t
Volume::WriteVNode(fs_vnode node, bool reenter)
Volume::WriteVNode(void* node, bool reenter)
{
status_t error = _WriteVNode(node, reenter);
if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) {
@ -506,7 +507,7 @@ Volume::WriteVNode(fs_vnode node, bool reenter)
// RemoveVNode
status_t
Volume::RemoveVNode(fs_vnode node, bool reenter)
Volume::RemoveVNode(void* node, bool reenter)
{
// get a free port
RequestPort* port = fFileSystem->GetPortPool()->AcquirePort();
@ -545,7 +546,7 @@ Volume::RemoveVNode(fs_vnode node, bool reenter)
// IOCtl
status_t
Volume::IOCtl(fs_vnode node, fs_cookie cookie, uint32 command, void *buffer,
Volume::IOCtl(void* node, void* cookie, uint32 command, void *buffer,
size_t len)
{
// check the command and its parameters
@ -691,7 +692,7 @@ Volume::IOCtl(fs_vnode node, fs_cookie cookie, uint32 command, void *buffer,
// SetFlags
status_t
Volume::SetFlags(fs_vnode node, fs_cookie cookie, int flags)
Volume::SetFlags(void* node, void* cookie, int flags)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_SET_FLAGS))
@ -731,8 +732,7 @@ Volume::SetFlags(fs_vnode node, fs_cookie cookie, int flags)
// Select
status_t
Volume::Select(fs_vnode node, fs_cookie cookie, uint8 event, uint32 ref,
selectsync* sync)
Volume::Select(void* node, void* cookie, uint8 event, selectsync* sync)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_SELECT)) {
@ -784,7 +784,7 @@ Volume::Select(fs_vnode node, fs_cookie cookie, uint8 event, uint32 ref,
// Deselect
status_t
Volume::Deselect(fs_vnode node, fs_cookie cookie, uint8 event, selectsync* sync)
Volume::Deselect(void* node, void* cookie, uint8 event, selectsync* sync)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_DESELECT))
@ -834,7 +834,7 @@ Volume::Deselect(fs_vnode node, fs_cookie cookie, uint8 event, selectsync* sync)
// FSync
status_t
Volume::FSync(fs_vnode node)
Volume::FSync(void* node)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_FSYNC))
@ -872,7 +872,7 @@ Volume::FSync(fs_vnode node)
// ReadSymlink
status_t
Volume::ReadSymlink(fs_vnode node, char* buffer, size_t bufferSize,
Volume::ReadSymlink(void* node, char* buffer, size_t bufferSize,
size_t* bytesRead)
{
*bytesRead = 0;
@ -923,7 +923,7 @@ Volume::ReadSymlink(fs_vnode node, char* buffer, size_t bufferSize,
// CreateSymlink
status_t
Volume::CreateSymlink(fs_vnode dir, const char* name, const char* target,
Volume::CreateSymlink(void* dir, const char* name, const char* target,
int mode)
{
// check capability
@ -968,7 +968,7 @@ Volume::CreateSymlink(fs_vnode dir, const char* name, const char* target,
// Link
status_t
Volume::Link(fs_vnode dir, const char* name, fs_vnode node)
Volume::Link(void* dir, const char* name, void* node)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_LINK))
@ -1010,7 +1010,7 @@ Volume::Link(fs_vnode dir, const char* name, fs_vnode node)
// Unlink
status_t
Volume::Unlink(fs_vnode dir, const char* name)
Volume::Unlink(void* dir, const char* name)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_UNLINK))
@ -1051,7 +1051,7 @@ Volume::Unlink(fs_vnode dir, const char* name)
// Rename
status_t
Volume::Rename(fs_vnode oldDir, const char* oldName, fs_vnode newDir,
Volume::Rename(void* oldDir, const char* oldName, void* newDir,
const char* newName)
{
// check capability
@ -1096,7 +1096,7 @@ Volume::Rename(fs_vnode oldDir, const char* oldName, fs_vnode newDir,
// Access
status_t
Volume::Access(fs_vnode node, int mode)
Volume::Access(void* node, int mode)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_ACCESS))
@ -1135,7 +1135,7 @@ Volume::Access(fs_vnode node, int mode)
// ReadStat
status_t
Volume::ReadStat(fs_vnode node, struct stat* st)
Volume::ReadStat(void* node, struct stat* st)
{
// When the connection to the userland server is lost, we serve
// read_stat(fRootNode) requests manually to allow clean unmounting.
@ -1145,7 +1145,7 @@ Volume::ReadStat(fs_vnode node, struct stat* st)
WARN(("Volume::ReadStat(): connection lost, emulating stat for the "
"root node\n"));
st->st_dev = fID;
st->st_dev = GetID();
st->st_ino = fRootID;
st->st_mode = ACCESSPERMS;
st->st_nlink = 1;
@ -1165,7 +1165,7 @@ Volume::ReadStat(fs_vnode node, struct stat* st)
// WriteStat
status_t
Volume::WriteStat(fs_vnode node, const struct stat* st, uint32 mask)
Volume::WriteStat(void* node, const struct stat* st, uint32 mask)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_WRITE_STAT))
@ -1208,7 +1208,7 @@ Volume::WriteStat(fs_vnode node, const struct stat* st, uint32 mask)
// Create
status_t
Volume::Create(fs_vnode dir, const char* name, int openMode, int mode,
Volume::Create(void* dir, const char* name, int openMode, int mode,
void** cookie, ino_t* vnid)
{
// check capability
@ -1259,7 +1259,7 @@ Volume::Create(fs_vnode dir, const char* name, int openMode, int mode,
// Open
status_t
Volume::Open(fs_vnode node, int openMode, fs_cookie* cookie)
Volume::Open(void* node, int openMode, void** cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN))
@ -1300,7 +1300,7 @@ Volume::Open(fs_vnode node, int openMode, fs_cookie* cookie)
// Close
status_t
Volume::Close(fs_vnode node, fs_cookie cookie)
Volume::Close(void* node, void* cookie)
{
status_t error = _Close(node, cookie);
if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) {
@ -1315,7 +1315,7 @@ Volume::Close(fs_vnode node, fs_cookie cookie)
// FreeCookie
status_t
Volume::FreeCookie(fs_vnode node, fs_cookie cookie)
Volume::FreeCookie(void* node, void* cookie)
{
status_t error = _FreeCookie(node, cookie);
bool disconnected = false;
@ -1335,7 +1335,7 @@ Volume::FreeCookie(fs_vnode node, fs_cookie cookie)
// Read
status_t
Volume::Read(fs_vnode node, fs_cookie cookie, off_t pos, void* buffer,
Volume::Read(void* node, void* cookie, off_t pos, void* buffer,
size_t bufferSize, size_t* bytesRead)
{
*bytesRead = 0;
@ -1388,7 +1388,7 @@ Volume::Read(fs_vnode node, fs_cookie cookie, off_t pos, void* buffer,
// Write
status_t
Volume::Write(fs_vnode node, fs_cookie cookie, off_t pos, const void* buffer,
Volume::Write(void* node, void* cookie, off_t pos, const void* buffer,
size_t size, size_t* bytesWritten)
{
*bytesWritten = 0;
@ -1438,7 +1438,7 @@ Volume::Write(fs_vnode node, fs_cookie cookie, off_t pos, const void* buffer,
// CreateDir
status_t
Volume::CreateDir(fs_vnode dir, const char* name, int mode, ino_t *newDir)
Volume::CreateDir(void* dir, const char* name, int mode, ino_t *newDir)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE_DIR))
@ -1481,7 +1481,7 @@ Volume::CreateDir(fs_vnode dir, const char* name, int mode, ino_t *newDir)
// RemoveDir
status_t
Volume::RemoveDir(fs_vnode dir, const char* name)
Volume::RemoveDir(void* dir, const char* name)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_REMOVE_DIR))
@ -1522,7 +1522,7 @@ Volume::RemoveDir(fs_vnode dir, const char* name)
// OpenDir
status_t
Volume::OpenDir(fs_vnode node, fs_cookie* cookie)
Volume::OpenDir(void* node, void** cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_DIR))
@ -1563,7 +1563,7 @@ Volume::OpenDir(fs_vnode node, fs_cookie* cookie)
// CloseDir
status_t
Volume::CloseDir(fs_vnode node, fs_vnode cookie)
Volume::CloseDir(void* node, void* cookie)
{
status_t error = _CloseDir(node, cookie);
if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) {
@ -1598,7 +1598,7 @@ Volume::FreeDirCookie(void* node, void* cookie)
// ReadDir
status_t
Volume::ReadDir(fs_vnode node, fs_vnode cookie, void* buffer, size_t bufferSize,
Volume::ReadDir(void* node, void* cookie, void* buffer, size_t bufferSize,
uint32 count, uint32* countRead)
{
*countRead = 0;
@ -1660,7 +1660,7 @@ reply->buffer.GetSize()));
// RewindDir
status_t
Volume::RewindDir(fs_vnode node, fs_vnode cookie)
Volume::RewindDir(void* node, void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_REWIND_DIR))
@ -1703,7 +1703,7 @@ Volume::RewindDir(fs_vnode node, fs_vnode cookie)
// OpenAttrDir
status_t
Volume::OpenAttrDir(fs_vnode node, fs_cookie *cookie)
Volume::OpenAttrDir(void* node, void** cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_ATTR_DIR))
@ -1744,7 +1744,7 @@ Volume::OpenAttrDir(fs_vnode node, fs_cookie *cookie)
// CloseAttrDir
status_t
Volume::CloseAttrDir(fs_vnode node, fs_cookie cookie)
Volume::CloseAttrDir(void* node, void* cookie)
{
status_t error = _CloseAttrDir(node, cookie);
if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) {
@ -1781,7 +1781,7 @@ Volume::FreeAttrDirCookie(void* node, void* cookie)
// ReadAttrDir
status_t
Volume::ReadAttrDir(fs_vnode node, fs_cookie cookie, void* buffer,
Volume::ReadAttrDir(void* node, void* cookie, void* buffer,
size_t bufferSize, uint32 count, uint32* countRead)
{
// check capability
@ -1840,7 +1840,7 @@ Volume::ReadAttrDir(fs_vnode node, fs_cookie cookie, void* buffer,
// RewindAttrDir
status_t
Volume::RewindAttrDir(fs_vnode node, fs_cookie cookie)
Volume::RewindAttrDir(void* node, void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_REWIND_ATTR_DIR))
@ -1882,8 +1882,8 @@ Volume::RewindAttrDir(fs_vnode node, fs_cookie cookie)
// CreateAttr
status_t
Volume::CreateAttr(fs_vnode node, const char* name, uint32 type, int openMode,
fs_cookie* cookie)
Volume::CreateAttr(void* node, const char* name, uint32 type, int openMode,
void** cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE_ATTR))
@ -1929,8 +1929,8 @@ Volume::CreateAttr(fs_vnode node, const char* name, uint32 type, int openMode,
// OpenAttr
status_t
Volume::OpenAttr(fs_vnode node, const char* name, int openMode,
fs_cookie* cookie)
Volume::OpenAttr(void* node, const char* name, int openMode,
void** cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_ATTR))
@ -1975,7 +1975,7 @@ Volume::OpenAttr(fs_vnode node, const char* name, int openMode,
// CloseAttr
status_t
Volume::CloseAttr(fs_vnode node, fs_cookie cookie)
Volume::CloseAttr(void* node, void* cookie)
{
status_t error = _CloseAttr(node, cookie);
if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) {
@ -1990,7 +1990,7 @@ Volume::CloseAttr(fs_vnode node, fs_cookie cookie)
// FreeAttrCookie
status_t
Volume::FreeAttrCookie(fs_vnode node, fs_cookie cookie)
Volume::FreeAttrCookie(void* node, void* cookie)
{
status_t error = _FreeAttrCookie(node, cookie);
bool disconnected = false;
@ -2011,7 +2011,7 @@ Volume::FreeAttrCookie(fs_vnode node, fs_cookie cookie)
// ReadAttr
status_t
Volume::ReadAttr(fs_vnode node, fs_cookie cookie, off_t pos,
Volume::ReadAttr(void* node, void* cookie, off_t pos,
void* buffer, size_t bufferSize, size_t* bytesRead)
{
*bytesRead = 0;
@ -2064,7 +2064,7 @@ Volume::ReadAttr(fs_vnode node, fs_cookie cookie, off_t pos,
// WriteAttr
status_t
Volume::WriteAttr(fs_vnode node, fs_cookie cookie, off_t pos,
Volume::WriteAttr(void* node, void* cookie, off_t pos,
const void* buffer, size_t bufferSize, size_t* bytesWritten)
{
*bytesWritten = 0;
@ -2111,7 +2111,7 @@ Volume::WriteAttr(fs_vnode node, fs_cookie cookie, off_t pos,
// ReadAttrStat
status_t
Volume::ReadAttrStat(fs_vnode node, fs_cookie cookie, struct stat *st)
Volume::ReadAttrStat(void* node, void* cookie, struct stat *st)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_ATTR_STAT))
@ -2151,7 +2151,7 @@ Volume::ReadAttrStat(fs_vnode node, fs_cookie cookie, struct stat *st)
// WriteAttrStat
status_t
Volume::WriteAttrStat(fs_vnode node, fs_cookie cookie, const struct stat *st,
Volume::WriteAttrStat(void* node, void* cookie, const struct stat *st,
int statMask)
{
// check capability
@ -2193,7 +2193,7 @@ Volume::WriteAttrStat(fs_vnode node, fs_cookie cookie, const struct stat *st,
// RenameAttr
status_t
Volume::RenameAttr(fs_vnode oldNode, const char* oldName, fs_vnode newNode,
Volume::RenameAttr(void* oldNode, const char* oldName, void* newNode,
const char* newName)
{
// check capability
@ -2238,7 +2238,7 @@ Volume::RenameAttr(fs_vnode oldNode, const char* oldName, fs_vnode newNode,
// RemoveAttr
status_t
Volume::RemoveAttr(fs_vnode node, const char* name)
Volume::RemoveAttr(void* node, const char* name)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_REMOVE_ATTR))
@ -2283,7 +2283,7 @@ Volume::RemoveAttr(fs_vnode node, const char* name)
// OpenIndexDir
status_t
Volume::OpenIndexDir(fs_cookie *cookie)
Volume::OpenIndexDir(void** cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_INDEX_DIR))
@ -2323,7 +2323,7 @@ Volume::OpenIndexDir(fs_cookie *cookie)
// CloseIndexDir
status_t
Volume::CloseIndexDir(fs_cookie cookie)
Volume::CloseIndexDir(void* cookie)
{
status_t error = _CloseIndexDir(cookie);
if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) {
@ -2339,7 +2339,7 @@ Volume::CloseIndexDir(fs_cookie cookie)
// FreeIndexDirCookie
status_t
Volume::FreeIndexDirCookie(fs_cookie cookie)
Volume::FreeIndexDirCookie(void* cookie)
{
status_t error = _FreeIndexDirCookie(cookie);
bool disconnected = false;
@ -2360,7 +2360,7 @@ Volume::FreeIndexDirCookie(fs_cookie cookie)
// ReadIndexDir
status_t
Volume::ReadIndexDir(fs_cookie cookie, void* buffer, size_t bufferSize,
Volume::ReadIndexDir(void* cookie, void* buffer, size_t bufferSize,
uint32 count, uint32* countRead)
{
*countRead = 0;
@ -2419,7 +2419,7 @@ Volume::ReadIndexDir(fs_cookie cookie, void* buffer, size_t bufferSize,
// RewindIndexDir
status_t
Volume::RewindIndexDir(fs_cookie cookie)
Volume::RewindIndexDir(void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_REWIND_INDEX_DIR))
@ -2585,7 +2585,7 @@ Volume::ReadIndexStat(const char* name, struct stat *st)
// OpenQuery
status_t
Volume::OpenQuery(const char* queryString, uint32 flags, port_id targetPort,
uint32 token, fs_cookie *cookie)
uint32 token, void** cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_QUERY))
@ -2631,7 +2631,7 @@ Volume::OpenQuery(const char* queryString, uint32 flags, port_id targetPort,
// CloseQuery
status_t
Volume::CloseQuery(fs_cookie cookie)
Volume::CloseQuery(void* cookie)
{
status_t error = _CloseQuery(cookie);
if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) {
@ -2646,7 +2646,7 @@ Volume::CloseQuery(fs_cookie cookie)
// FreeQueryCookie
status_t
Volume::FreeQueryCookie(fs_cookie cookie)
Volume::FreeQueryCookie(void* cookie)
{
status_t error = _FreeQueryCookie(cookie);
bool disconnected = false;
@ -2667,7 +2667,7 @@ Volume::FreeQueryCookie(fs_cookie cookie)
// ReadQuery
status_t
Volume::ReadQuery(fs_cookie cookie, void* buffer, size_t bufferSize,
Volume::ReadQuery(void* cookie, void* buffer, size_t bufferSize,
uint32 count, uint32* countRead)
{
*countRead = 0;
@ -2726,7 +2726,7 @@ Volume::ReadQuery(fs_cookie cookie, void* buffer, size_t bufferSize,
// RewindQuery
status_t
Volume::RewindQuery(fs_cookie cookie)
Volume::RewindQuery(void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_REWIND_QUERY))
@ -2787,7 +2787,7 @@ Volume::_Mount(const char* device, uint32 flags, const char* parameters)
if (error != B_OK)
return error;
request->nsid = fID;
request->nsid = GetID();
error = allocator.AllocateString(request->cwd, cwd);
if (error == B_OK)
error = allocator.AllocateString(request->device, device);
@ -2893,7 +2893,7 @@ Volume::_ReadFSInfo(fs_info* info)
// _Lookup
status_t
Volume::_Lookup(fs_vnode dir, const char* entryName, ino_t* vnid, int* type)
Volume::_Lookup(void* dir, const char* entryName, ino_t* vnid)
{
// get a free port
RequestPort* port = fFileSystem->GetPortPool()->AcquirePort();
@ -2925,7 +2925,6 @@ Volume::_Lookup(fs_vnode dir, const char* entryName, ino_t* vnid, int* type)
if (reply->error != B_OK)
return reply->error;
*vnid = reply->vnid;
*type = reply->type;
// The VFS will balance the get_vnode() call for the FS.
_DecrementVNodeCount(*vnid);
@ -2934,7 +2933,7 @@ Volume::_Lookup(fs_vnode dir, const char* entryName, ino_t* vnid, int* type)
// _WriteVNode
status_t
Volume::_WriteVNode(fs_vnode node, bool reenter)
Volume::_WriteVNode(void* node, bool reenter)
{
// get a free port
RequestPort* port = fFileSystem->GetPortPool()->AcquirePort();
@ -2968,7 +2967,7 @@ Volume::_WriteVNode(fs_vnode node, bool reenter)
// _ReadStat
status_t
Volume::_ReadStat(fs_vnode node, struct stat* st)
Volume::_ReadStat(void* node, struct stat* st)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_STAT))
@ -3007,7 +3006,7 @@ Volume::_ReadStat(fs_vnode node, struct stat* st)
// _Close
status_t
Volume::_Close(fs_vnode node, fs_cookie cookie)
Volume::_Close(void* node, void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE))
@ -3046,7 +3045,7 @@ Volume::_Close(fs_vnode node, fs_cookie cookie)
// _FreeCookie
status_t
Volume::_FreeCookie(fs_vnode node, fs_cookie cookie)
Volume::_FreeCookie(void* node, void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_COOKIE))
@ -3085,7 +3084,7 @@ Volume::_FreeCookie(fs_vnode node, fs_cookie cookie)
// _CloseDir
status_t
Volume::_CloseDir(fs_vnode node, fs_vnode cookie)
Volume::_CloseDir(void* node, void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE_DIR))
@ -3124,7 +3123,7 @@ Volume::_CloseDir(fs_vnode node, fs_vnode cookie)
// _FreeDirCookie
status_t
Volume::_FreeDirCookie(fs_vnode node, fs_vnode cookie)
Volume::_FreeDirCookie(void* node, void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_DIR_COOKIE))
@ -3163,7 +3162,7 @@ Volume::_FreeDirCookie(fs_vnode node, fs_vnode cookie)
// _CloseAttrDir
status_t
Volume::_CloseAttrDir(fs_vnode node, fs_cookie cookie)
Volume::_CloseAttrDir(void* node, void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE_ATTR_DIR))
@ -3202,7 +3201,7 @@ Volume::_CloseAttrDir(fs_vnode node, fs_cookie cookie)
// _FreeAttrDirCookie
status_t
Volume::_FreeAttrDirCookie(fs_vnode node, fs_cookie cookie)
Volume::_FreeAttrDirCookie(void* node, void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_ATTR_DIR_COOKIE))
@ -3241,7 +3240,7 @@ Volume::_FreeAttrDirCookie(fs_vnode node, fs_cookie cookie)
// _CloseAttr
status_t
Volume::_CloseAttr(fs_vnode node, fs_cookie cookie)
Volume::_CloseAttr(void* node, void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE_ATTR))
@ -3280,7 +3279,7 @@ Volume::_CloseAttr(fs_vnode node, fs_cookie cookie)
// _FreeAttrCookie
status_t
Volume::_FreeAttrCookie(fs_vnode node, fs_cookie cookie)
Volume::_FreeAttrCookie(void* node, void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_ATTR_COOKIE))
@ -3319,7 +3318,7 @@ Volume::_FreeAttrCookie(fs_vnode node, fs_cookie cookie)
// _CloseIndexDir
status_t
Volume::_CloseIndexDir(fs_cookie cookie)
Volume::_CloseIndexDir(void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE_INDEX_DIR))
@ -3357,7 +3356,7 @@ Volume::_CloseIndexDir(fs_cookie cookie)
// _FreeIndexDirCookie
status_t
Volume::_FreeIndexDirCookie(fs_cookie cookie)
Volume::_FreeIndexDirCookie(void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_INDEX_DIR_COOKIE))
@ -3395,7 +3394,7 @@ Volume::_FreeIndexDirCookie(fs_cookie cookie)
// _CloseQuery
status_t
Volume::_CloseQuery(fs_cookie cookie)
Volume::_CloseQuery(void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE_QUERY))
@ -3433,7 +3432,7 @@ Volume::_CloseQuery(fs_cookie cookie)
// _FreeQueryCookie
status_t
Volume::_FreeQueryCookie(fs_cookie cookie)
Volume::_FreeQueryCookie(void* cookie)
{
// check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_QUERY_COOKIE))

View File

@ -1,5 +1,7 @@
// Volume.h
/*
* Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef USERLAND_FS_VOLUME_H
#define USERLAND_FS_VOLUME_H
@ -27,21 +29,23 @@ class FileSystem;
class Volume : public Referencable {
public:
Volume(FileSystem* fileSystem, dev_t id);
Volume(FileSystem* fileSystem,
fs_volume* fsVolume);
~Volume();
FileSystem* GetFileSystem() const;
dev_t GetID() const;
inline dev_t GetID() const;
void* GetUserlandVolume() const;
ino_t GetRootID() const;
bool IsMounting() const;
// client methods
status_t GetVNode(ino_t vnid, fs_vnode* node);
status_t GetVNode(ino_t vnid, void** node);
status_t PutVNode(ino_t vnid);
status_t NewVNode(ino_t vnid, fs_vnode node);
status_t PublishVNode(ino_t vnid, fs_vnode node);
status_t NewVNode(ino_t vnid, void* node);
status_t PublishVNode(ino_t vnid, void* node,
int type, uint32 flags);
status_t RemoveVNode(ino_t vnid);
status_t UnremoveVNode(ino_t vnid);
status_t GetVNodeRemoved(ino_t vnid, bool* removed);
@ -56,111 +60,111 @@ public:
uint32 mask);
// vnodes
status_t Lookup(fs_vnode dir, const char* entryName,
ino_t* vnid, int* type);
status_t GetVNodeName(fs_vnode node, char* buffer,
status_t Lookup(void* dir, const char* entryName,
ino_t* vnid);
status_t GetVNodeName(void* node, char* buffer,
size_t bufferSize);
status_t ReadVNode(ino_t vnid, bool reenter,
fs_vnode* node);
status_t WriteVNode(fs_vnode node, bool reenter);
status_t RemoveVNode(fs_vnode node, bool reenter);
void** node, int* type, uint32* flags);
status_t WriteVNode(void* node, bool reenter);
status_t RemoveVNode(void* node, bool reenter);
// nodes
status_t IOCtl(fs_vnode node, fs_cookie cookie,
status_t IOCtl(void* node, void* cookie,
uint32 command, void *buffer, size_t size);
status_t SetFlags(fs_vnode node, fs_cookie cookie,
status_t SetFlags(void* node, void* cookie,
int flags);
status_t Select(fs_vnode node, fs_cookie cookie,
uint8 event, uint32 ref, selectsync* sync);
status_t Deselect(fs_vnode node, fs_cookie cookie,
uint8 event, selectsync* sync);
status_t Select(void* node, void* cookie, uint8 event,
selectsync* sync);
status_t Deselect(void* node, void* cookie, uint8 event,
selectsync* sync);
status_t FSync(fs_vnode node);
status_t FSync(void* node);
status_t ReadSymlink(fs_vnode node, char* buffer,
status_t ReadSymlink(void* node, char* buffer,
size_t bufferSize, size_t* bytesRead);
status_t CreateSymlink(fs_vnode dir, const char* name,
status_t CreateSymlink(void* dir, const char* name,
const char* target, int mode);
status_t Link(fs_vnode dir, const char* name,
fs_vnode node);
status_t Unlink(fs_vnode dir, const char* name);
status_t Rename(fs_vnode oldDir, const char* oldName,
fs_vnode newDir, const char* newName);
status_t Link(void* dir, const char* name,
void* node);
status_t Unlink(void* dir, const char* name);
status_t Rename(void* oldDir, const char* oldName,
void* newDir, const char* newName);
status_t Access(fs_vnode node, int mode);
status_t ReadStat(fs_vnode node, struct stat* st);
status_t WriteStat(fs_vnode node, const struct stat *st,
status_t Access(void* node, int mode);
status_t ReadStat(void* node, struct stat* st);
status_t WriteStat(void* node, const struct stat *st,
uint32 mask);
// files
status_t Create(fs_vnode dir, const char* name,
int openMode, int mode, fs_cookie* cookie,
status_t Create(void* dir, const char* name,
int openMode, int mode, void** cookie,
ino_t* vnid);
status_t Open(fs_vnode node, int openMode,
fs_cookie* cookie);
status_t Close(fs_vnode node, fs_cookie cookie);
status_t FreeCookie(fs_vnode node, fs_cookie cookie);
status_t Read(fs_vnode node, fs_cookie cookie, off_t pos,
status_t Open(void* node, int openMode,
void** cookie);
status_t Close(void* node, void* cookie);
status_t FreeCookie(void* node, void* cookie);
status_t Read(void* node, void* cookie, off_t pos,
void* buffer, size_t bufferSize,
size_t* bytesRead);
status_t Write(fs_vnode node, fs_cookie cookie,
status_t Write(void* node, void* cookie,
off_t pos, const void* buffer,
size_t bufferSize, size_t* bytesWritten);
// directories
status_t CreateDir(fs_vnode dir, const char* name,
status_t CreateDir(void* dir, const char* name,
int mode, ino_t *newDir);
status_t RemoveDir(fs_vnode dir, const char* name);
status_t OpenDir(fs_vnode node, fs_cookie* cookie);
status_t CloseDir(fs_vnode node, fs_vnode cookie);
status_t FreeDirCookie(fs_vnode node, fs_vnode cookie);
status_t ReadDir(fs_vnode node, fs_vnode cookie,
status_t RemoveDir(void* dir, const char* name);
status_t OpenDir(void* node, void** cookie);
status_t CloseDir(void* node, void* cookie);
status_t FreeDirCookie(void* node, void* cookie);
status_t ReadDir(void* node, void* cookie,
void* buffer, size_t bufferSize,
uint32 count, uint32* countRead);
status_t RewindDir(fs_vnode node, fs_vnode cookie);
status_t RewindDir(void* node, void* cookie);
// attribute directories
status_t OpenAttrDir(fs_vnode node, fs_cookie *cookie);
status_t CloseAttrDir(fs_vnode node, fs_cookie cookie);
status_t FreeAttrDirCookie(fs_vnode node,
fs_cookie cookie);
status_t ReadAttrDir(fs_vnode node, fs_cookie cookie,
status_t OpenAttrDir(void* node, void** cookie);
status_t CloseAttrDir(void* node, void* cookie);
status_t FreeAttrDirCookie(void* node,
void* cookie);
status_t ReadAttrDir(void* node, void* cookie,
void* buffer, size_t bufferSize,
uint32 count, uint32* countRead);
status_t RewindAttrDir(fs_vnode node, fs_cookie cookie);
status_t RewindAttrDir(void* node, void* cookie);
// attributes
status_t CreateAttr(fs_vnode node, const char* name,
status_t CreateAttr(void* node, const char* name,
uint32 type, int openMode,
fs_cookie* cookie);
status_t OpenAttr(fs_vnode node, const char* name,
int openMode, fs_cookie* cookie);
status_t CloseAttr(fs_vnode node, fs_cookie cookie);
status_t FreeAttrCookie(fs_vnode node, fs_cookie cookie);
status_t ReadAttr(fs_vnode node, fs_cookie cookie,
void** cookie);
status_t OpenAttr(void* node, const char* name,
int openMode, void** cookie);
status_t CloseAttr(void* node, void* cookie);
status_t FreeAttrCookie(void* node, void* cookie);
status_t ReadAttr(void* node, void* cookie,
off_t pos, void* buffer, size_t bufferSize,
size_t* bytesRead);
status_t WriteAttr(fs_vnode node, fs_cookie cookie,
status_t WriteAttr(void* node, void* cookie,
off_t pos, const void* buffer,
size_t bufferSize, size_t* bytesWritten);
status_t ReadAttrStat(fs_vnode node, fs_cookie cookie,
status_t ReadAttrStat(void* node, void* cookie,
struct stat *st);
status_t WriteAttrStat(fs_vnode node, fs_cookie cookie,
status_t WriteAttrStat(void* node, void* cookie,
const struct stat *st, int statMask);
status_t RenameAttr(fs_vnode oldNode,
const char* oldName, fs_vnode newNode,
status_t RenameAttr(void* oldNode,
const char* oldName, void* newNode,
const char* newName);
status_t RemoveAttr(fs_vnode node, const char* name);
status_t RemoveAttr(void* node, const char* name);
// indices
status_t OpenIndexDir(fs_cookie *cookie);
status_t CloseIndexDir(fs_cookie cookie);
status_t FreeIndexDirCookie(fs_cookie cookie);
status_t ReadIndexDir(fs_cookie cookie, void* buffer,
status_t OpenIndexDir(void** cookie);
status_t CloseIndexDir(void* cookie);
status_t FreeIndexDirCookie(void* cookie);
status_t ReadIndexDir(void* cookie, void* buffer,
size_t bufferSize, uint32 count,
uint32* countRead);
status_t RewindIndexDir(fs_cookie cookie);
status_t RewindIndexDir(void* cookie);
status_t CreateIndex(const char* name, uint32 type,
uint32 flags);
status_t RemoveIndex(const char* name);
@ -170,37 +174,37 @@ public:
// queries
status_t OpenQuery(const char* queryString,
uint32 flags, port_id port, uint32 token,
fs_cookie *cookie);
status_t CloseQuery(fs_cookie cookie);
status_t FreeQueryCookie(fs_cookie cookie);
status_t ReadQuery(fs_cookie cookie, void* buffer,
void** cookie);
status_t CloseQuery(void* cookie);
status_t FreeQueryCookie(void* cookie);
status_t ReadQuery(void* cookie, void* buffer,
size_t bufferSize, uint32 count,
uint32* countRead);
status_t RewindQuery(fs_cookie cookie);
status_t RewindQuery(void* cookie);
private:
status_t _Mount(const char* device, uint32 flags,
const char* parameters);
status_t _Unmount();
status_t _ReadFSInfo(fs_info* info);
status_t _Lookup(fs_vnode dir, const char* entryName,
ino_t* vnid, int* type);
status_t _WriteVNode(fs_vnode node, bool reenter);
status_t _ReadStat(fs_vnode node, struct stat* st);
status_t _Close(fs_vnode node, fs_cookie cookie);
status_t _FreeCookie(fs_vnode node, fs_cookie cookie);
status_t _CloseDir(fs_vnode node, fs_vnode cookie);
status_t _FreeDirCookie(fs_vnode node, fs_vnode cookie);
status_t _CloseAttrDir(fs_vnode node, fs_cookie cookie);
status_t _FreeAttrDirCookie(fs_vnode node,
fs_cookie cookie);
status_t _CloseAttr(fs_vnode node, fs_cookie cookie);
status_t _FreeAttrCookie(fs_vnode node,
fs_cookie cookie);
status_t _CloseIndexDir(fs_cookie cookie);
status_t _FreeIndexDirCookie(fs_cookie cookie);
status_t _CloseQuery(fs_cookie cookie);
status_t _FreeQueryCookie(fs_cookie cookie);
status_t _Lookup(void* dir, const char* entryName,
ino_t* vnid);
status_t _WriteVNode(void* node, bool reenter);
status_t _ReadStat(void* node, struct stat* st);
status_t _Close(void* node, void* cookie);
status_t _FreeCookie(void* node, void* cookie);
status_t _CloseDir(void* node, void* cookie);
status_t _FreeDirCookie(void* node, void* cookie);
status_t _CloseAttrDir(void* node, void* cookie);
status_t _FreeAttrDirCookie(void* node,
void* cookie);
status_t _CloseAttr(void* node, void* cookie);
status_t _FreeAttrCookie(void* node,
void* cookie);
status_t _CloseIndexDir(void* cookie);
status_t _FreeIndexDirCookie(void* cookie);
status_t _CloseQuery(void* cookie);
status_t _FreeQueryCookie(void* cookie);
status_t _SendRequest(RequestPort* port,
RequestAllocator* allocator,
@ -221,10 +225,10 @@ private:
class AutoIncrementer;
FileSystem* fFileSystem;
dev_t fID;
fs_volume* fFSVolume;
void* fUserlandVolume;
ino_t fRootID;
fs_vnode fRootNode;
void* fRootNode;
MountVNodeMap* fMountVNodes;
vint32 fOpenFiles;
vint32 fOpenDirectories;
@ -239,4 +243,13 @@ private:
volatile bool fVNodeCountingEnabled;
};
// GetID
inline dev_t
Volume::GetID() const
{
return fFSVolume->id;
}
#endif // USERLAND_FS_VOLUME_H

View File

@ -0,0 +1,15 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_INTERFACE_H
#define KERNEL_INTERFACE_H
#include <fs_interface.h>
extern fs_volume_ops gUserlandFSVolumeOps;
extern fs_vnode_ops gUserlandFSVnodeOps;
#endif // KERNEL_INTERFACE_H