Got rid of vnode_id and mount_id, replaced with ino_t and dev_t.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21485 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-06-21 19:50:57 +00:00
parent 29cb39c4ff
commit 245aecda8a
91 changed files with 884 additions and 875 deletions
+7 -7
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2005, Axel Dörfler, [email protected]. * Copyright 2004-2007, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _KERNEL_FILE_CACHE_H #ifndef _KERNEL_FILE_CACHE_H
@@ -26,9 +26,9 @@
struct cache_module_info { struct cache_module_info {
module_info info; module_info info;
void (*node_opened)(void *vnode, int32 fdType, mount_id mountID, vnode_id parentID, void (*node_opened)(void *vnode, int32 fdType, dev_t mountID, ino_t parentID,
vnode_id vnodeID, const char *name, off_t size); ino_t vnodeID, const char *name, off_t size);
void (*node_closed)(void *vnode, int32 fdType, mount_id mountID, vnode_id vnodeID, void (*node_closed)(void *vnode, int32 fdType, dev_t mountID, ino_t vnodeID,
int32 accessType); int32 accessType);
void (*node_launched)(size_t argCount, char * const *args); void (*node_launched)(size_t argCount, char * const *args);
}; };
@@ -38,12 +38,12 @@ extern "C" {
#endif #endif
extern void cache_node_opened(void *vnode, int32 fdType, vm_cache_ref *cache, extern void cache_node_opened(void *vnode, int32 fdType, vm_cache_ref *cache,
mount_id mountID, vnode_id parentID, vnode_id vnodeID, const char *name); dev_t mountID, ino_t parentID, ino_t vnodeID, const char *name);
extern void cache_node_closed(void *vnode, int32 fdType, vm_cache_ref *cache, extern void cache_node_closed(void *vnode, int32 fdType, vm_cache_ref *cache,
mount_id mountID, vnode_id vnodeID); dev_t mountID, ino_t vnodeID);
extern void cache_node_launched(size_t argCount, char * const *args); extern void cache_node_launched(size_t argCount, char * const *args);
extern void cache_prefetch_vnode(void *vnode, off_t offset, size_t size); extern void cache_prefetch_vnode(void *vnode, off_t offset, size_t size);
extern void cache_prefetch(mount_id mountID, vnode_id vnodeID, off_t offset, size_t size); extern void cache_prefetch(dev_t mountID, ino_t vnodeID, off_t offset, size_t size);
extern status_t file_cache_init_post_boot_device(void); extern status_t file_cache_init_post_boot_device(void);
extern status_t file_cache_init(void); extern status_t file_cache_init(void);
+4 -4
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2006, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2007, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _KERNEL_NODE_MONITOR_H #ifndef _KERNEL_NODE_MONITOR_H
@@ -18,9 +18,9 @@ extern "C" {
// private kernel API // private kernel API
extern status_t remove_node_monitors(struct io_context *context); extern status_t remove_node_monitors(struct io_context *context);
extern status_t node_monitor_init(void); extern status_t node_monitor_init(void);
extern status_t notify_unmount(mount_id device); extern status_t notify_unmount(dev_t device);
extern status_t notify_mount(mount_id device, mount_id parentDevice, extern status_t notify_mount(dev_t device, dev_t parentDevice,
vnode_id parentDirectory); ino_t parentDirectory);
// user-space exported calls // user-space exported calls
extern status_t _user_stop_notifying(port_id port, uint32 token); extern status_t _user_stop_notifying(port_id port, uint32 token);
+11 -12
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2006, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2002-2007, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -21,8 +21,7 @@
#include <sys/select.h> #include <sys/select.h>
/* R5 figures, but we don't use a table for monitors anyway */ #define DEFAULT_FD_TABLE_SIZE 256
#define DEFAULT_FD_TABLE_SIZE 128
#define MAX_FD_TABLE_SIZE 8192 #define MAX_FD_TABLE_SIZE 8192
#define DEFAULT_NODE_MONITORS 4096 #define DEFAULT_NODE_MONITORS 4096
#define MAX_NODE_MONITORS 65536 #define MAX_NODE_MONITORS 65536
@@ -78,12 +77,12 @@ int vfs_setrlimit(int resource, const struct rlimit * rlp);
/* calls needed by the VM for paging and by the file cache */ /* calls needed by the VM for paging and by the file cache */
int vfs_get_vnode_from_fd(int fd, bool kernel, void **vnode); int vfs_get_vnode_from_fd(int fd, bool kernel, void **vnode);
status_t vfs_get_vnode_from_path(const char *path, bool kernel, void **vnode); status_t vfs_get_vnode_from_path(const char *path, bool kernel, void **vnode);
status_t vfs_get_vnode(mount_id mountID, vnode_id vnodeID, void **_vnode); status_t vfs_get_vnode(dev_t mountID, ino_t vnodeID, void **_vnode);
status_t vfs_entry_ref_to_vnode(mount_id mountID, vnode_id directoryID, status_t vfs_entry_ref_to_vnode(dev_t mountID, ino_t directoryID,
const char *name, void **_vnode); const char *name, void **_vnode);
void vfs_vnode_to_node_ref(void *_vnode, mount_id *_mountID, vnode_id *_vnodeID); void vfs_vnode_to_node_ref(void *_vnode, dev_t *_mountID, ino_t *_vnodeID);
status_t vfs_lookup_vnode(mount_id mountID, vnode_id vnodeID, void **_vnode); status_t vfs_lookup_vnode(dev_t mountID, ino_t vnodeID, void **_vnode);
void vfs_put_vnode(void *vnode); void vfs_put_vnode(void *vnode);
void vfs_acquire_vnode(void *vnode); void vfs_acquire_vnode(void *vnode);
status_t vfs_get_cookie_from_fd(int fd, void **_cookie); status_t vfs_get_cookie_from_fd(int fd, void **_cookie);
@@ -95,13 +94,13 @@ status_t vfs_write_pages(void *vnode, void *cookie, off_t pos,
status_t vfs_get_vnode_cache(void *vnode, struct vm_cache_ref **_cache, bool allocate); status_t vfs_get_vnode_cache(void *vnode, struct vm_cache_ref **_cache, bool allocate);
status_t vfs_get_file_map( void *_vnode, off_t offset, size_t size, status_t vfs_get_file_map( void *_vnode, off_t offset, size_t size,
struct file_io_vec *vecs, size_t *_count); struct file_io_vec *vecs, size_t *_count);
status_t vfs_get_fs_node_from_path(mount_id mountID, const char *path, status_t vfs_get_fs_node_from_path(dev_t mountID, const char *path,
bool kernel, void **_node); bool kernel, void **_node);
status_t vfs_stat_vnode(void *_vnode, struct stat *stat); status_t vfs_stat_vnode(void *_vnode, struct stat *stat);
status_t vfs_get_vnode_name(void *vnode, char *name, size_t nameSize); status_t vfs_get_vnode_name(void *vnode, char *name, size_t nameSize);
status_t vfs_get_cwd(mount_id *_mountID, vnode_id *_vnodeID); status_t vfs_get_cwd(dev_t *_mountID, ino_t *_vnodeID);
void vfs_unlock_vnode_if_locked(struct file_descriptor *descriptor); void vfs_unlock_vnode_if_locked(struct file_descriptor *descriptor);
status_t vfs_disconnect_vnode(mount_id mountID, vnode_id vnodeID); status_t vfs_disconnect_vnode(dev_t mountID, ino_t vnodeID);
void vfs_free_unused_vnodes(int32 level); void vfs_free_unused_vnodes(int32 level);
/* special module convenience call */ /* special module convenience call */
@@ -113,8 +112,8 @@ status_t vfs_normalize_path(const char *path, char *buffer, size_t bufferSize,
bool kernel); bool kernel);
/* service call for the node monitor */ /* service call for the node monitor */
status_t resolve_mount_point_to_volume_root(mount_id mountID, vnode_id nodeID, status_t resolve_mount_point_to_volume_root(dev_t mountID, ino_t nodeID,
mount_id *resolvedMountID, vnode_id *resolvedNodeID); dev_t *resolvedMountID, ino_t *resolvedNodeID);
/* calls the syscall dispatcher should use for user file I/O */ /* calls the syscall dispatcher should use for user file I/O */
dev_t _user_mount(const char *path, const char *device, const char *fs_name, dev_t _user_mount(const char *path, const char *device, const char *fs_name,
+27 -27
View File
@@ -326,7 +326,7 @@ public:
MountVolumeRequest() : Request(MOUNT_VOLUME_REQUEST) {} MountVolumeRequest() : Request(MOUNT_VOLUME_REQUEST) {}
status_t GetAddressInfos(AddressInfo* infos, int32* count); status_t GetAddressInfos(AddressInfo* infos, int32* count);
mount_id nsid; dev_t nsid;
Address cwd; // current working dir of the mount() caller Address cwd; // current working dir of the mount() caller
Address device; Address device;
uint32 flags; uint32 flags;
@@ -338,7 +338,7 @@ class MountVolumeReply : public ReplyRequest {
public: public:
MountVolumeReply() : ReplyRequest(MOUNT_VOLUME_REPLY) {} MountVolumeReply() : ReplyRequest(MOUNT_VOLUME_REPLY) {}
vnode_id rootID; ino_t rootID;
fs_volume volume; fs_volume volume;
}; };
@@ -430,7 +430,7 @@ class LookupReply : public ReplyRequest {
public: public:
LookupReply() : ReplyRequest(LOOKUP_REPLY) {} LookupReply() : ReplyRequest(LOOKUP_REPLY) {}
vnode_id vnid; ino_t vnid;
int type; int type;
}; };
@@ -456,7 +456,7 @@ class ReadVNodeRequest : public VolumeRequest {
public: public:
ReadVNodeRequest() : VolumeRequest(READ_VNODE_REQUEST) {} ReadVNodeRequest() : VolumeRequest(READ_VNODE_REQUEST) {}
vnode_id vnid; ino_t vnid;
bool reenter; bool reenter;
}; };
@@ -731,7 +731,7 @@ class CreateReply : public ReplyRequest {
public: public:
CreateReply() : ReplyRequest(CREATE_REPLY) {} CreateReply() : ReplyRequest(CREATE_REPLY) {}
vnode_id vnid; ino_t vnid;
fs_cookie fileCookie; fs_cookie fileCookie;
}; };
@@ -831,7 +831,7 @@ class CreateDirReply : public ReplyRequest {
public: public:
CreateDirReply() : ReplyRequest(CREATE_DIR_REPLY) {} CreateDirReply() : ReplyRequest(CREATE_DIR_REPLY) {}
vnode_id newDir; ino_t newDir;
}; };
// RemoveDirRequest // RemoveDirRequest
@@ -1374,10 +1374,10 @@ public:
int32 operation; int32 operation;
uint32 details; // for B_STAT_CHANGED:statFields uint32 details; // for B_STAT_CHANGED:statFields
// and B_ATTRIBUTE_CHANGED:cause // and B_ATTRIBUTE_CHANGED:cause
mount_id device; dev_t device;
vnode_id oldDirectory; ino_t oldDirectory;
vnode_id directory; ino_t directory;
vnode_id node; ino_t node;
Address oldName; Address oldName;
Address name; Address name;
}; };
@@ -1414,9 +1414,9 @@ public:
port_id port; port_id port;
int32 token; int32 token;
int32 operation; // B_ENTRY_{CREATED,REMOVED} int32 operation; // B_ENTRY_{CREATED,REMOVED}
mount_id device; dev_t device;
vnode_id directory; ino_t directory;
vnode_id node; ino_t node;
Address name; Address name;
}; };
@@ -1435,8 +1435,8 @@ class GetVNodeRequest : public Request {
public: public:
GetVNodeRequest() : Request(GET_VNODE_REQUEST) {} GetVNodeRequest() : Request(GET_VNODE_REQUEST) {}
mount_id nsid; dev_t nsid;
vnode_id vnid; ino_t vnid;
}; };
// GetVNodeReply // GetVNodeReply
@@ -1452,8 +1452,8 @@ class PutVNodeRequest : public Request {
public: public:
PutVNodeRequest() : Request(PUT_VNODE_REQUEST) {} PutVNodeRequest() : Request(PUT_VNODE_REQUEST) {}
mount_id nsid; dev_t nsid;
vnode_id vnid; ino_t vnid;
}; };
// PutVNodeReply // PutVNodeReply
@@ -1467,8 +1467,8 @@ class NewVNodeRequest : public Request {
public: public:
NewVNodeRequest() : Request(NEW_VNODE_REQUEST) {} NewVNodeRequest() : Request(NEW_VNODE_REQUEST) {}
mount_id nsid; dev_t nsid;
vnode_id vnid; ino_t vnid;
fs_vnode node; fs_vnode node;
}; };
@@ -1483,8 +1483,8 @@ class PublishVNodeRequest : public Request {
public: public:
PublishVNodeRequest() : Request(PUBLISH_VNODE_REQUEST) {} PublishVNodeRequest() : Request(PUBLISH_VNODE_REQUEST) {}
mount_id nsid; dev_t nsid;
vnode_id vnid; ino_t vnid;
fs_vnode node; fs_vnode node;
}; };
@@ -1499,8 +1499,8 @@ class RemoveVNodeRequest : public Request {
public: public:
RemoveVNodeRequest() : Request(REMOVE_VNODE_REQUEST) {} RemoveVNodeRequest() : Request(REMOVE_VNODE_REQUEST) {}
mount_id nsid; dev_t nsid;
vnode_id vnid; ino_t vnid;
}; };
// RemoveVNodeReply // RemoveVNodeReply
@@ -1514,8 +1514,8 @@ class UnremoveVNodeRequest : public Request {
public: public:
UnremoveVNodeRequest() : Request(UNREMOVE_VNODE_REQUEST) {} UnremoveVNodeRequest() : Request(UNREMOVE_VNODE_REQUEST) {}
mount_id nsid; dev_t nsid;
vnode_id vnid; ino_t vnid;
}; };
// UnremoveVNodeReply // UnremoveVNodeReply
@@ -1529,8 +1529,8 @@ class GetVNodeRemovedRequest : public Request {
public: public:
GetVNodeRemovedRequest() : Request(GET_VNODE_REMOVED_REQUEST) {} GetVNodeRemovedRequest() : Request(GET_VNODE_REMOVED_REQUEST) {}
mount_id nsid; dev_t nsid;
vnode_id vnid; ino_t vnid;
}; };
// GetVNodeRemovedReply // GetVNodeRemovedReply
@@ -977,7 +977,7 @@ BlockAllocator::CheckNextNode(check_control *control)
char name[B_FILE_NAME_LENGTH]; char name[B_FILE_NAME_LENGTH];
uint16 length; uint16 length;
vnode_id id; ino_t id;
status_t status = cookie->iterator->GetNextEntry(name, &length, B_FILE_NAME_LENGTH, &id); status_t status = cookie->iterator->GetNextEntry(name, &length, B_FILE_NAME_LENGTH, &id);
if (status == B_ENTRY_NOT_FOUND) { if (status == B_ENTRY_NOT_FOUND) {
@@ -79,7 +79,7 @@ Index::SetTo(const char *name)
if (indices->GetTree(&tree) != B_OK) if (indices->GetTree(&tree) != B_OK)
return B_BAD_VALUE; return B_BAD_VALUE;
vnode_id id; ino_t id;
status_t status = tree->Find((uint8 *)name, (uint16)strlen(name), &id); status_t status = tree->Find((uint8 *)name, (uint16)strlen(name), &id);
if (status != B_OK) if (status != B_OK)
return status; return status;
+13 -12
View File
@@ -165,7 +165,7 @@ bfs_inode::InitCheck(Volume *volume)
// #pragma mark - Inode // #pragma mark - Inode
Inode::Inode(Volume *volume, vnode_id id) Inode::Inode(Volume *volume, ino_t id)
: :
fVolume(volume), fVolume(volume),
fID(id), fID(id),
@@ -194,7 +194,8 @@ Inode::Inode(Volume *volume, vnode_id id)
} }
Inode::Inode(Volume *volume, Transaction &transaction, vnode_id id, mode_t mode, block_run &run) Inode::Inode(Volume *volume, Transaction &transaction, ino_t id, mode_t mode,
block_run &run)
: :
fVolume(volume), fVolume(volume),
fID(id), fID(id),
@@ -1002,7 +1003,7 @@ Inode::GetAttribute(const char *name, Inode **_attribute)
BPlusTree *tree; BPlusTree *tree;
status_t status = attributes->GetTree(&tree); status_t status = attributes->GetTree(&tree);
if (status == B_OK) { if (status == B_OK) {
vnode_id id; ino_t id;
status = tree->Find((uint8 *)name, (uint16)strlen(name), &id); status = tree->Find((uint8 *)name, (uint16)strlen(name), &id);
if (status == B_OK) { if (status == B_OK) {
Vnode vnode(fVolume, id); Vnode vnode(fVolume, id);
@@ -1090,7 +1091,7 @@ Inode::IsEmpty()
uint32 count = 0; uint32 count = 0;
char name[BPLUSTREE_MAX_KEY_LENGTH]; char name[BPLUSTREE_MAX_KEY_LENGTH];
uint16 length; uint16 length;
vnode_id id; ino_t id;
while (iterator.GetNextEntry(name, &length, B_FILE_NAME_LENGTH, while (iterator.GetNextEntry(name, &length, B_FILE_NAME_LENGTH,
&id) == B_OK) { &id) == B_OK) {
if (Mode() & (S_ATTR_DIR | S_INDEX_DIR)) if (Mode() & (S_ATTR_DIR | S_INDEX_DIR))
@@ -2011,7 +2012,7 @@ Inode::Free(Transaction &transaction)
char name[B_FILE_NAME_LENGTH]; char name[B_FILE_NAME_LENGTH];
uint32 type; uint32 type;
size_t length; size_t length;
vnode_id id; ino_t id;
while ((status = iterator.GetNext(name, &length, &type, &id)) == B_OK) { while ((status = iterator.GetNext(name, &length, &type, &id)) == B_OK) {
RemoveAttribute(transaction, name); RemoveAttribute(transaction, name);
} }
@@ -2123,7 +2124,7 @@ Inode::Sync()
status_t status_t
Inode::Remove(Transaction &transaction, const char *name, vnode_id *_id, Inode::Remove(Transaction &transaction, const char *name, ino_t *_id,
bool isDirectory) bool isDirectory)
{ {
BPlusTree *tree; BPlusTree *tree;
@@ -2220,7 +2221,7 @@ Inode::Remove(Transaction &transaction, const char *name, vnode_id *_id,
*/ */
status_t status_t
Inode::Create(Transaction &transaction, Inode *parent, const char *name, Inode::Create(Transaction &transaction, Inode *parent, const char *name,
int32 mode, int openMode, uint32 type, bool *_created, vnode_id *_id, int32 mode, int openMode, uint32 type, bool *_created, ino_t *_id,
Inode **_inode) Inode **_inode)
{ {
FUNCTION_START(("name = %s, mode = %ld\n", name, mode)); FUNCTION_START(("name = %s, mode = %ld\n", name, mode));
@@ -2456,7 +2457,7 @@ AttributeIterator::Rewind()
status_t status_t
AttributeIterator::GetNext(char *name, size_t *_length, uint32 *_type, AttributeIterator::GetNext(char *name, size_t *_length, uint32 *_type,
vnode_id *_id) ino_t *_id)
{ {
// read attributes out of the small data section // read attributes out of the small data section
@@ -2484,7 +2485,7 @@ AttributeIterator::GetNext(char *name, size_t *_length, uint32 *_type,
strncpy(name, item->Name(), B_FILE_NAME_LENGTH); strncpy(name, item->Name(), B_FILE_NAME_LENGTH);
*_type = item->Type(); *_type = item->Type();
*_length = item->NameSize(); *_length = item->NameSize();
*_id = (vnode_id)fCurrentSmallData; *_id = (ino_t)fCurrentSmallData;
fCurrentSmallData = i; fCurrentSmallData = i;
} }
@@ -2510,7 +2511,7 @@ AttributeIterator::GetNext(char *name, size_t *_length, uint32 *_type,
if (fAttributes == NULL) { if (fAttributes == NULL) {
if (get_vnode(volume->ID(), volume->ToVnode(fInode->Attributes()), if (get_vnode(volume->ID(), volume->ToVnode(fInode->Attributes()),
(void **)&fAttributes) != B_OK) { (void **)&fAttributes) != B_OK) {
FATAL(("get_vnode() failed in AttributeIterator::GetNext(vnode_id" FATAL(("get_vnode() failed in AttributeIterator::GetNext(ino_t"
" = %Ld,name = \"%s\")\n",fInode->ID(),name)); " = %Ld,name = \"%s\")\n",fInode->ID(),name));
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
} }
@@ -2518,14 +2519,14 @@ AttributeIterator::GetNext(char *name, size_t *_length, uint32 *_type,
BPlusTree *tree; BPlusTree *tree;
if (fAttributes->GetTree(&tree) < B_OK if (fAttributes->GetTree(&tree) < B_OK
|| (fIterator = new TreeIterator(tree)) == NULL) { || (fIterator = new TreeIterator(tree)) == NULL) {
FATAL(("could not get tree in AttributeIterator::GetNext(vnode_id" FATAL(("could not get tree in AttributeIterator::GetNext(ino_t"
" = %Ld,name = \"%s\")\n",fInode->ID(),name)); " = %Ld,name = \"%s\")\n",fInode->ID(),name));
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
} }
} }
uint16 length; uint16 length;
vnode_id id; ino_t id;
status_t status = fIterator->GetNextEntry(name, &length, status_t status = fIterator->GetNextEntry(name, &length,
B_FILE_NAME_LENGTH, &id); B_FILE_NAME_LENGTH, &id);
if (status < B_OK) if (status < B_OK)
+9 -9
View File
@@ -35,14 +35,14 @@ enum inode_type {
class Inode { class Inode {
public: public:
Inode(Volume *volume, vnode_id id); Inode(Volume *volume, ino_t id);
Inode(Volume *volume, Transaction &transaction, vnode_id id, Inode(Volume *volume, Transaction &transaction, ino_t id,
mode_t mode, block_run &run); mode_t mode, block_run &run);
//Inode(CachedBlock *cached); //Inode(CachedBlock *cached);
~Inode(); ~Inode();
//bfs_inode *Node() const { return (bfs_inode *)fBlock; } //bfs_inode *Node() const { return (bfs_inode *)fBlock; }
vnode_id ID() const { return fID; } ino_t ID() const { return fID; }
off_t BlockNumber() const { return fVolume->VnodeToBlock(fID); } off_t BlockNumber() const { return fVolume->VnodeToBlock(fID); }
ReadWriteLock &Lock() { return fLock; } ReadWriteLock &Lock() { return fLock; }
@@ -138,10 +138,10 @@ class Inode {
// create/remove inodes // create/remove inodes
status_t Remove(Transaction &transaction, const char *name, status_t Remove(Transaction &transaction, const char *name,
vnode_id *_id = NULL, bool isDirectory = false); ino_t *_id = NULL, bool isDirectory = false);
static status_t Create(Transaction &transaction, Inode *parent, static status_t Create(Transaction &transaction, Inode *parent,
const char *name, int32 mode, int openMode, uint32 type, const char *name, int32 mode, int openMode, uint32 type,
bool *_created = NULL, vnode_id *_id = NULL, Inode **_inode = NULL); bool *_created = NULL, ino_t *_id = NULL, Inode **_inode = NULL);
// index maintaining helper // index maintaining helper
void UpdateOldSize() void UpdateOldSize()
@@ -194,7 +194,7 @@ class Inode {
private: private:
ReadWriteLock fLock; ReadWriteLock fLock;
Volume *fVolume; Volume *fVolume;
vnode_id fID; ino_t fID;
BPlusTree *fTree; BPlusTree *fTree;
Inode *fAttributes; Inode *fAttributes;
void *fCache; void *fCache;
@@ -251,7 +251,7 @@ class NodeGetter : public CachedBlock {
class Vnode { class Vnode {
public: public:
Vnode(Volume *volume, vnode_id id) Vnode(Volume *volume, ino_t id)
: :
fVolume(volume), fVolume(volume),
fID(id) fID(id)
@@ -290,7 +290,7 @@ class Vnode {
private: private:
Volume *fVolume; Volume *fVolume;
vnode_id fID; ino_t fID;
}; };
@@ -300,7 +300,7 @@ class AttributeIterator {
~AttributeIterator(); ~AttributeIterator();
status_t Rewind(); status_t Rewind();
status_t GetNext(char *name, size_t *length, uint32 *type, vnode_id *id); status_t GetNext(char *name, size_t *length, uint32 *type, ino_t *id);
private: private:
friend class Chain<AttributeIterator>; friend class Chain<AttributeIterator>;
@@ -242,7 +242,7 @@ disk_super_block::Initialize(const char *diskName, off_t numBlocks, uint32 block
// #pragma mark - // #pragma mark -
Volume::Volume(mount_id id) Volume::Volume(dev_t id)
: :
fID(id), fID(id),
fBlockAllocator(this), fBlockAllocator(this),
+6 -7
View File
@@ -1,6 +1,5 @@
/* Volume - BFS super block, mounting, etc. /*
* * Copyright 2001-2007, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2001-2004, Axel Dörfler, axeld@pinc-software.de.
* This file may be used under the terms of the MIT License. * This file may be used under the terms of the MIT License.
*/ */
#ifndef VOLUME_H #ifndef VOLUME_H
@@ -27,7 +26,7 @@ enum volume_initialize_flags {
class Volume { class Volume {
public: public:
Volume(mount_id id); Volume(dev_t id);
~Volume(); ~Volume();
status_t Mount(const char *device, uint32 flags); status_t Mount(const char *device, uint32 flags);
@@ -49,7 +48,7 @@ class Volume {
vint32 &LogEnd() { return fLogEnd; } vint32 &LogEnd() { return fLogEnd; }
int Device() const { return fDevice; } int Device() const { return fDevice; }
mount_id ID() const { return fID; } dev_t ID() const { return fID; }
const char *Name() const { return fSuperBlock.name; } const char *Name() const { return fSuperBlock.name; }
off_t NumBlocks() const { return fSuperBlock.NumBlocks(); } off_t NumBlocks() const { return fSuperBlock.NumBlocks(); }
@@ -70,7 +69,7 @@ class Volume {
off_t ToVnode(block_run run) const { return ToBlock(run); } off_t ToVnode(block_run run) const { return ToBlock(run); }
off_t ToVnode(off_t block) const { return block; } off_t ToVnode(off_t block) const { return block; }
off_t VnodeToBlock(vnode_id id) const { return (off_t)id; } off_t VnodeToBlock(ino_t id) const { return (off_t)id; }
status_t CreateIndicesRoot(Transaction &transaction); status_t CreateIndicesRoot(Transaction &transaction);
@@ -106,7 +105,7 @@ class Volume {
static status_t Identify(int fd, disk_super_block *superBlock); static status_t Identify(int fd, disk_super_block *superBlock);
protected: protected:
mount_id fID; dev_t fID;
int fDevice; int fDevice;
disk_super_block fSuperBlock; disk_super_block fSuperBlock;
@@ -1,10 +1,11 @@
/*
* Copyright 2001-2007, Axel Dörfler, axeld@pinc-software.de
* This file may be used under the terms of the MIT License.
*/
#ifndef BFS_CONTROL_H #ifndef BFS_CONTROL_H
#define BFS_CONTROL_H #define BFS_CONTROL_H
/* bfs_control - additional functionality exported via ioctl()
** //! additional functionality exported via ioctl()
** Copyright 2001-2004, Axel Dörfler, axeld@pinc-software.de
** This file may be used under the terms of the OpenBeOS License.
*/
#include "system_dependencies.h" #include "system_dependencies.h"
@@ -29,7 +30,7 @@ struct check_control {
uint32 magic; uint32 magic;
uint32 flags; uint32 flags;
char name[B_FILE_NAME_LENGTH]; char name[B_FILE_NAME_LENGTH];
vnode_id inode; ino_t inode;
uint32 mode; uint32 mode;
uint32 errors; uint32 errors;
struct { struct {
@@ -104,8 +104,8 @@ bfs_free_identify_partition_cookie(partition_data *partition, void *_cookie)
static status_t static status_t
bfs_mount(mount_id mountID, const char *device, uint32 flags, const char *args, bfs_mount(dev_t mountID, const char *device, uint32 flags, const char *args,
void **_data, vnode_id *_rootID) void **_data, ino_t *_rootID)
{ {
FUNCTION(); FUNCTION();
@@ -229,9 +229,9 @@ bfs_sync(void *_ns)
*/ */
static status_t static status_t
bfs_read_vnode(void *_ns, vnode_id id, void **_node, bool reenter) bfs_read_vnode(void *_ns, ino_t id, void **_node, bool reenter)
{ {
//FUNCTION_START(("vnode_id = %Ld\n", id)); //FUNCTION_START(("ino_t = %Ld\n", id));
Volume *volume = (Volume *)_ns; Volume *volume = (Volume *)_ns;
// first inode may be after the log area, we don't go through // first inode may be after the log area, we don't go through
@@ -444,7 +444,7 @@ bfs_get_file_map(fs_volume _fs, fs_vnode _node, off_t offset, size_t size,
static status_t static status_t
bfs_lookup(void *_ns, void *_directory, const char *file, vnode_id *_vnodeID, int *_type) bfs_lookup(void *_ns, void *_directory, const char *file, ino_t *_vnodeID, int *_type)
{ {
//FUNCTION_START(("file = %s\n", file)); //FUNCTION_START(("file = %s\n", file));
if (_ns == NULL || _directory == NULL || file == NULL || _vnodeID == NULL) if (_ns == NULL || _directory == NULL || file == NULL || _vnodeID == NULL)
@@ -740,7 +740,7 @@ bfs_write_stat(void *_ns, void *_node, const struct stat *stat, uint32 mask)
status_t status_t
bfs_create(void *_ns, void *_directory, const char *name, int openMode, int mode, bfs_create(void *_ns, void *_directory, const char *name, int openMode, int mode,
void **_cookie, vnode_id *_vnodeID) void **_cookie, ino_t *_vnodeID)
{ {
FUNCTION_START(("name = \"%s\", perms = %d, openMode = %d\n", name, mode, openMode)); FUNCTION_START(("name = \"%s\", perms = %d, openMode = %d\n", name, mode, openMode));
@@ -942,8 +942,8 @@ bfs_rename(void *_ns, void *_oldDir, const char *oldName, void *_newDir, const c
// If we meet our inode on that way, we have to bail out. // If we meet our inode on that way, we have to bail out.
if (oldDirectory != newDirectory) { if (oldDirectory != newDirectory) {
vnode_id parent = volume->ToVnode(newDirectory->Parent()); ino_t parent = volume->ToVnode(newDirectory->Parent());
vnode_id root = volume->RootNode()->ID(); ino_t root = volume->RootNode()->ID();
while (true) { while (true) {
if (parent == id) if (parent == id)
@@ -1357,7 +1357,7 @@ bfs_read_link(void *_ns, void *_node, char *buffer, size_t *_bufferSize)
static status_t static status_t
bfs_create_dir(void *_ns, void *_directory, const char *name, int mode, bfs_create_dir(void *_ns, void *_directory, const char *name, int mode,
vnode_id *_newVnodeID) ino_t *_newVnodeID)
{ {
FUNCTION_START(("name = \"%s\", perms = %d\n", name, mode)); FUNCTION_START(("name = \"%s\", perms = %d\n", name, mode));
@@ -1466,7 +1466,7 @@ bfs_read_dir(void *_ns, void *_node, void *_cookie, struct dirent *dirent,
RETURN_ERROR(B_BAD_VALUE); RETURN_ERROR(B_BAD_VALUE);
uint16 length; uint16 length;
vnode_id id; ino_t id;
status_t status = iterator->GetNextEntry(dirent->d_name, &length, bufferSize, &id); status_t status = iterator->GetNextEntry(dirent->d_name, &length, bufferSize, &id);
if (status == B_ENTRY_NOT_FOUND) { if (status == B_ENTRY_NOT_FOUND) {
*_num = 0; *_num = 0;
@@ -76,24 +76,24 @@ enum attr_mode {
class Volume { class Volume {
public: public:
Volume(mount_id id); Volume(dev_t id);
~Volume(); ~Volume();
status_t InitCheck(); status_t InitCheck();
mount_id ID() const { return fID; } dev_t ID() const { return fID; }
uint32 DiscID() const { return fDiscID; } uint32 DiscID() const { return fDiscID; }
Inode &RootNode() const { return *fRootNode; } Inode &RootNode() const { return *fRootNode; }
status_t Mount(const char* device); status_t Mount(const char* device);
int Device() const { return fDevice; } int Device() const { return fDevice; }
vnode_id GetNextNodeID() { return fNextID++; } ino_t GetNextNodeID() { return fNextID++; }
const char *Name() const { return fName; } const char *Name() const { return fName; }
status_t SetName(const char *name); status_t SetName(const char *name);
Semaphore &Lock(); Semaphore &Lock();
Inode *Find(vnode_id id); Inode *Find(ino_t id);
Inode *Find(const char *name); Inode *Find(const char *name);
Inode *FirstEntry() const { return fFirstEntry; } Inode *FirstEntry() const { return fFirstEntry; }
@@ -116,10 +116,10 @@ class Volume {
Semaphore fLock; Semaphore fLock;
int fDevice; int fDevice;
mount_id fID; dev_t fID;
uint32 fDiscID; uint32 fDiscID;
Inode *fRootNode; Inode *fRootNode;
vnode_id fNextID; ino_t fNextID;
char *fName; char *fName;
off_t fNumBlocks; off_t fNumBlocks;
@@ -160,7 +160,7 @@ class Inode {
~Inode(); ~Inode();
status_t InitCheck(); status_t InitCheck();
vnode_id ID() const { return fID; } ino_t ID() const { return fID; }
const char *Name() const { return fName; } const char *Name() const { return fName; }
status_t SetName(const char* name); status_t SetName(const char* name);
@@ -206,7 +206,7 @@ class Inode {
private: private:
Inode *fNext; Inode *fNext;
vnode_id fID; ino_t fID;
int32 fType; int32 fType;
char *fName; char *fName;
gid_t fGroupID; gid_t fGroupID;
@@ -447,7 +447,7 @@ fill_stat_buffer(Volume *volume, Inode *inode, Attribute *attribute,
// #pragma mark - Volume class // #pragma mark - Volume class
Volume::Volume(mount_id id) Volume::Volume(dev_t id)
: :
fLock("cdda"), fLock("cdda"),
fDevice(-1), fDevice(-1),
@@ -655,7 +655,7 @@ Volume::_CreateNode(Inode *parent, const char *name, off_t start, off_t frames,
Inode * Inode *
Volume::Find(vnode_id id) Volume::Find(ino_t id)
{ {
for (Inode *inode = fFirstEntry; inode != NULL; inode = inode->Next()) { for (Inode *inode = fFirstEntry; inode != NULL; inode = inode->Next()) {
if (inode->ID() == id) if (inode->ID() == id)
@@ -1268,8 +1268,8 @@ cdda_free_identify_partition_cookie(partition_data *partition, void *_cookie)
static status_t static status_t
cdda_mount(mount_id id, const char *device, uint32 flags, const char *args, cdda_mount(dev_t id, const char *device, uint32 flags, const char *args,
fs_volume *_volume, vnode_id *_rootVnodeID) fs_volume *_volume, ino_t *_rootVnodeID)
{ {
TRACE(("cdda_mount: entry\n")); TRACE(("cdda_mount: entry\n"));
@@ -1355,7 +1355,7 @@ cdda_sync(fs_volume fs)
static status_t static status_t
cdda_lookup(fs_volume _volume, fs_vnode _dir, const char *name, vnode_id *_id, int *_type) cdda_lookup(fs_volume _volume, fs_vnode _dir, const char *name, ino_t *_id, int *_type)
{ {
Volume *volume = (Volume *)_volume; Volume *volume = (Volume *)_volume;
status_t status; status_t status;
@@ -1398,7 +1398,7 @@ cdda_get_vnode_name(fs_volume _volume, fs_vnode _node, char *buffer, size_t buff
static status_t static status_t
cdda_get_vnode(fs_volume _volume, vnode_id id, fs_vnode *_inode, bool reenter) cdda_get_vnode(fs_volume _volume, ino_t id, fs_vnode *_inode, bool reenter)
{ {
Volume *volume = (Volume *)_volume; Volume *volume = (Volume *)_volume;
Inode *inode; Inode *inode;
+22 -18
View File
@@ -39,7 +39,7 @@ typedef struct dircookie {
static CHECK_MAGIC(dircookie,struct dircookie, DIRCOOKIE_MAGIC) static CHECK_MAGIC(dircookie,struct dircookie, DIRCOOKIE_MAGIC)
static status_t findfile(nspace *vol, vnode *dir, const char *file, static status_t findfile(nspace *vol, vnode *dir, const char *file,
vnode_id *vnid, vnode **node, bool check_case, ino_t *vnid, vnode **node, bool check_case,
bool check_dups, bool *dups_exist); bool check_dups, bool *dups_exist);
// private structure for returning data from _next_dirent_() // private structure for returning data from _next_dirent_()
@@ -205,7 +205,7 @@ _next_dirent_(struct diri *iter, struct _dirent_info_ *oinfo, char *filename,
static status_t static status_t
get_next_dirent(nspace *vol, vnode *dir, struct diri *iter, vnode_id *vnid, get_next_dirent(nspace *vol, vnode *dir, struct diri *iter, ino_t *vnid,
char *filename, int len) char *filename, int len)
{ {
struct _dirent_info_ info; struct _dirent_info_ info;
@@ -229,7 +229,7 @@ get_next_dirent(nspace *vol, vnode *dir, struct diri *iter, vnode_id *vnid,
if (vnid) *vnid = dir->dir_vnid; if (vnid) *vnid = dir->dir_vnid;
} else { } else {
if (vnid) { if (vnid) {
vnode_id loc = (IS_DATA_CLUSTER(info.cluster)) ino_t loc = (IS_DATA_CLUSTER(info.cluster))
? GENERATE_DIR_CLUSTER_VNID(dir->vnid, info.cluster) ? GENERATE_DIR_CLUSTER_VNID(dir->vnid, info.cluster)
: GENERATE_DIR_INDEX_VNID(dir->vnid, info.sindex); : GENERATE_DIR_INDEX_VNID(dir->vnid, info.sindex);
bool added_to_vcache = false; bool added_to_vcache = false;
@@ -320,7 +320,7 @@ check_dir_empty(nspace *vol, vnode *dir)
status_t status_t
findfile_case(nspace *vol, vnode *dir, const char *file, vnode_id *vnid, findfile_case(nspace *vol, vnode *dir, const char *file, ino_t *vnid,
vnode **node) vnode **node)
{ {
return findfile(vol, dir, file, vnid, node, true, false, NULL); return findfile(vol, dir, file, vnid, node, true, false, NULL);
@@ -328,7 +328,7 @@ findfile_case(nspace *vol, vnode *dir, const char *file, vnode_id *vnid,
status_t status_t
findfile_nocase(nspace *vol, vnode *dir, const char *file, vnode_id *vnid, findfile_nocase(nspace *vol, vnode *dir, const char *file, ino_t *vnid,
vnode **node) vnode **node)
{ {
return findfile(vol, dir, file, vnid, node, false, false, NULL); return findfile(vol, dir, file, vnid, node, false, false, NULL);
@@ -337,7 +337,7 @@ findfile_nocase(nspace *vol, vnode *dir, const char *file, vnode_id *vnid,
status_t status_t
findfile_nocase_duplicates(nspace *vol, vnode *dir, const char *file, findfile_nocase_duplicates(nspace *vol, vnode *dir, const char *file,
vnode_id *vnid, vnode **node, bool *dups_exist) ino_t *vnid, vnode **node, bool *dups_exist)
{ {
return findfile(vol, dir, file, vnid, node, false, true, dups_exist); return findfile(vol, dir, file, vnid, node, false, true, dups_exist);
} }
@@ -345,14 +345,14 @@ findfile_nocase_duplicates(nspace *vol, vnode *dir, const char *file,
status_t status_t
findfile_case_duplicates(nspace *vol, vnode *dir, const char *file, findfile_case_duplicates(nspace *vol, vnode *dir, const char *file,
vnode_id *vnid, vnode **node, bool *dups_exist) ino_t *vnid, vnode **node, bool *dups_exist)
{ {
return findfile(vol, dir, file, vnid, node, true, true, dups_exist); return findfile(vol, dir, file, vnid, node, true, true, dups_exist);
} }
static status_t static status_t
findfile(nspace *vol, vnode *dir, const char *file, vnode_id *vnid, findfile(nspace *vol, vnode *dir, const char *file, ino_t *vnid,
vnode **node, bool check_case, bool check_dups, bool *dups_exist) vnode **node, bool check_case, bool check_dups, bool *dups_exist)
{ {
/* Starting at the base, find the file in the subdir /* Starting at the base, find the file in the subdir
@@ -366,7 +366,7 @@ findfile(nspace *vol, vnode *dir, const char *file, vnode_id *vnid,
any other case-insensitive matches. If there are, the any other case-insensitive matches. If there are, the
dups_exist flag is set to true. */ dups_exist flag is set to true. */
int result = 0; int result = 0;
vnode_id found_vnid = 0; ino_t found_vnid = 0;
bool found_file = false; bool found_file = false;
// dprintf("findfile: %s in %Lx, case %d dups %d\n", file, dir->vnid, check_case, check_dups); // dprintf("findfile: %s in %Lx, case %d dups %d\n", file, dir->vnid, check_case, check_dups);
@@ -400,7 +400,7 @@ findfile(nspace *vol, vnode *dir, const char *file, vnode_id *vnid,
while (1) { while (1) {
char filename[512]; char filename[512];
vnode_id _vnid; ino_t _vnid;
result = get_next_dirent(vol, dir, &diri, &_vnid, filename, 512); result = get_next_dirent(vol, dir, &diri, &_vnid, filename, 512);
if (result != B_NO_ERROR) if (result != B_NO_ERROR)
@@ -922,11 +922,11 @@ create_dir_entry(nspace *vol, vnode *dir, vnode *node, const char *name,
status_t status_t
dosfs_read_vnode(void *_vol, vnode_id vnid, void **_node, bool reenter) dosfs_read_vnode(void *_vol, ino_t vnid, void **_node, bool reenter)
{ {
nspace *vol = (nspace*)_vol; nspace *vol = (nspace*)_vol;
int result = B_NO_ERROR; int result = B_NO_ERROR;
vnode_id loc, dir_vnid; ino_t loc, dir_vnid;
vnode *entry; vnode *entry;
struct _dirent_info_ info; struct _dirent_info_ info;
struct diri iter; struct diri iter;
@@ -1027,11 +1027,11 @@ dosfs_read_vnode(void *_vol, vnode_id vnid, void **_node, bool reenter)
entry->st_size = count_clusters(vol,entry->cluster) entry->st_size = count_clusters(vol,entry->cluster)
* vol->sectors_per_cluster * vol->bytes_per_sector; * vol->sectors_per_cluster * vol->bytes_per_sector;
} }
if (entry->cluster) if (entry->cluster) {
entry->end_cluster = get_nth_fat_entry(vol, info.cluster, entry->end_cluster = get_nth_fat_entry(vol, info.cluster,
(entry->st_size + vol->bytes_per_sector * vol->sectors_per_cluster - 1) / (entry->st_size + vol->bytes_per_sector * vol->sectors_per_cluster - 1) /
vol->bytes_per_sector / vol->sectors_per_cluster - 1); vol->bytes_per_sector / vol->sectors_per_cluster - 1);
else } else
entry->end_cluster = 0; entry->end_cluster = 0;
entry->st_time = dos2time_t(info.time); entry->st_time = dos2time_t(info.time);
#if TRACK_FILENAME #if TRACK_FILENAME
@@ -1044,17 +1044,21 @@ dosfs_read_vnode(void *_vol, vnode_id vnid, void **_node, bool reenter)
*_node = entry; *_node = entry;
bi2:diri_free(&iter); bi2:
bi: if (!reenter) UNLOCK_VOL(vol); diri_free(&iter);
bi:
if (!reenter)
UNLOCK_VOL(vol);
if (result != B_OK) DPRINTF(0, ("dosfs_read_vnode (%s)\n", strerror(result))); if (result != B_OK)
DPRINTF(0, ("dosfs_read_vnode (%s)\n", strerror(result)));
return result; return result;
} }
status_t status_t
dosfs_walk(void *_vol, void *_dir, const char *file, vnode_id *_vnid, int *_type) dosfs_walk(void *_vol, void *_dir, const char *file, ino_t *_vnid, int *_type)
{ {
/* Starting at the base, find file in the subdir, and return path /* Starting at the base, find file in the subdir, and return path
string and vnode id of file. */ string and vnode id of file. */
+6 -6
View File
@@ -8,22 +8,22 @@
bool is_filename_legal(const char *name); bool is_filename_legal(const char *name);
status_t check_dir_empty(nspace *vol, vnode *dir); status_t check_dir_empty(nspace *vol, vnode *dir);
status_t findfile_case(nspace *vol, vnode *dir, const char *file, status_t findfile_case(nspace *vol, vnode *dir, const char *file,
vnode_id *vnid, vnode **node); ino_t *vnid, vnode **node);
status_t findfile_nocase(nspace *vol, vnode *dir, const char *file, status_t findfile_nocase(nspace *vol, vnode *dir, const char *file,
vnode_id *vnid, vnode **node); ino_t *vnid, vnode **node);
status_t findfile_nocase_duplicates(nspace *vol, vnode *dir, const char *file, status_t findfile_nocase_duplicates(nspace *vol, vnode *dir, const char *file,
vnode_id *vnid, vnode **node, bool *dups_exist); ino_t *vnid, vnode **node, bool *dups_exist);
status_t findfile_case_duplicates(nspace *vol, vnode *dir, const char *file, status_t findfile_case_duplicates(nspace *vol, vnode *dir, const char *file,
vnode_id *vnid, vnode **node, bool *dups_exist); ino_t *vnid, vnode **node, bool *dups_exist);
status_t erase_dir_entry(nspace *vol, vnode *node); status_t erase_dir_entry(nspace *vol, vnode *node);
status_t compact_directory(nspace *vol, vnode *dir); status_t compact_directory(nspace *vol, vnode *dir);
status_t create_volume_label(nspace *vol, const char name[11], uint32 *index); status_t create_volume_label(nspace *vol, const char name[11], uint32 *index);
status_t create_dir_entry(nspace *vol, vnode *dir, vnode *node, status_t create_dir_entry(nspace *vol, vnode *dir, vnode *node,
const char *name, uint32 *ns, uint32 *ne); const char *name, uint32 *ns, uint32 *ne);
status_t dosfs_read_vnode(void *_vol, vnode_id vnid, void **node, bool reenter); status_t dosfs_read_vnode(void *_vol, ino_t vnid, void **node, bool reenter);
status_t dosfs_walk(void *_vol, void *_dir, const char *file, status_t dosfs_walk(void *_vol, void *_dir, const char *file,
vnode_id *_vnid, int *_type); ino_t *_vnid, int *_type);
status_t dosfs_access(void *_vol, void *_node, int mode); status_t dosfs_access(void *_vol, void *_node, int mode);
status_t dosfs_readlink(void *_vol, void *_node, char *buf, size_t *bufsize); status_t dosfs_readlink(void *_vol, void *_node, char *buf, size_t *bufsize);
status_t dosfs_opendir(void *_vol, void *_node, void **cookie); status_t dosfs_opendir(void *_vol, void *_node, void **cookie);
+26 -12
View File
@@ -35,13 +35,15 @@ TODO:
#define DLIST_ENTRY_QUANTUM 0x20 #define DLIST_ENTRY_QUANTUM 0x20
#endif #endif
status_t dlist_init(nspace *vol)
status_t
dlist_init(nspace *vol)
{ {
DPRINTF(0, ("dlist_init called\n")); DPRINTF(0, ("dlist_init called\n"));
vol->dlist.entries = 0; vol->dlist.entries = 0;
vol->dlist.allocated = DLIST_ENTRY_QUANTUM; vol->dlist.allocated = DLIST_ENTRY_QUANTUM;
vol->dlist.vnid_list = malloc(sizeof(vnode_id) * vol->dlist.allocated); vol->dlist.vnid_list = malloc(sizeof(ino_t) * vol->dlist.allocated);
if (vol->dlist.vnid_list == NULL) { if (vol->dlist.vnid_list == NULL) {
vol->dlist.allocated = 0; vol->dlist.allocated = 0;
dprintf("dlist_init: out of core\n"); dprintf("dlist_init: out of core\n");
@@ -51,7 +53,9 @@ status_t dlist_init(nspace *vol)
return B_OK; return B_OK;
} }
status_t dlist_uninit(nspace *vol)
status_t
dlist_uninit(nspace *vol)
{ {
DPRINTF(0, ("dlist_uninit called\n")); DPRINTF(0, ("dlist_uninit called\n"));
@@ -63,22 +67,24 @@ status_t dlist_uninit(nspace *vol)
return B_OK; return B_OK;
} }
static status_t dlist_realloc(nspace *vol, uint32 allocate)
static status_t
dlist_realloc(nspace *vol, uint32 allocate)
{ {
vnode_id *vnid_list; ino_t *vnid_list;
DPRINTF(0, ("dlist_realloc %lx -> %lx\n", vol->dlist.allocated, allocate)); DPRINTF(0, ("dlist_realloc %lx -> %lx\n", vol->dlist.allocated, allocate));
ASSERT(allocate != vol->dlist.allocated); ASSERT(allocate != vol->dlist.allocated);
ASSERT(allocate > vol->dlist.entries); ASSERT(allocate > vol->dlist.entries);
vnid_list = malloc(sizeof(vnode_id) * allocate); vnid_list = malloc(sizeof(ino_t) * allocate);
if (vnid_list == NULL) { if (vnid_list == NULL) {
dprintf("dlist_realloc: out of core\n"); dprintf("dlist_realloc: out of core\n");
return ENOMEM; return ENOMEM;
} }
memcpy(vnid_list, vol->dlist.vnid_list, sizeof(vnode_id) * vol->dlist.entries); memcpy(vnid_list, vol->dlist.vnid_list, sizeof(ino_t) * vol->dlist.entries);
free(vol->dlist.vnid_list); free(vol->dlist.vnid_list);
vol->dlist.vnid_list = vnid_list; vol->dlist.vnid_list = vnid_list;
vol->dlist.allocated = allocate; vol->dlist.allocated = allocate;
@@ -86,7 +92,9 @@ static status_t dlist_realloc(nspace *vol, uint32 allocate)
return B_OK; return B_OK;
} }
status_t dlist_add(nspace *vol, vnode_id vnid)
status_t
dlist_add(nspace *vol, ino_t vnid)
{ {
DPRINTF(0, ("dlist_add vnid %Lx\n", vnid)); DPRINTF(0, ("dlist_add vnid %Lx\n", vnid));
@@ -103,7 +111,9 @@ status_t dlist_add(nspace *vol, vnode_id vnid)
return B_OK; return B_OK;
} }
status_t dlist_remove(nspace *vol, vnode_id vnid)
status_t
dlist_remove(nspace *vol, ino_t vnid)
{ {
uint32 i; uint32 i;
@@ -125,7 +135,9 @@ status_t dlist_remove(nspace *vol, vnode_id vnid)
return B_OK; return B_OK;
} }
vnode_id dlist_find(nspace *vol, uint32 cluster)
ino_t
dlist_find(nspace *vol, uint32 cluster)
{ {
uint32 i; uint32 i;
@@ -134,7 +146,7 @@ vnode_id dlist_find(nspace *vol, uint32 cluster)
ASSERT(((cluster >= 2) && (cluster < vol->total_clusters + 2)) || (cluster == 1)); ASSERT(((cluster >= 2) && (cluster < vol->total_clusters + 2)) || (cluster == 1));
for (i = 0; i < vol->dlist.entries; i++) { for (i = 0; i < vol->dlist.entries; i++) {
vnode_id loc; ino_t loc;
if (vcache_vnid_to_loc(vol, vol->dlist.vnid_list[i], &loc) < B_OK) if (vcache_vnid_to_loc(vol, vol->dlist.vnid_list[i], &loc) < B_OK)
loc = vol->dlist.vnid_list[i]; loc = vol->dlist.vnid_list[i];
@@ -148,7 +160,9 @@ vnode_id dlist_find(nspace *vol, uint32 cluster)
return -1LL; return -1LL;
} }
void dlist_dump(nspace *vol)
void
dlist_dump(nspace *vol)
{ {
uint32 i; uint32 i;
+3 -3
View File
@@ -7,9 +7,9 @@
status_t dlist_init(nspace *vol); status_t dlist_init(nspace *vol);
status_t dlist_uninit(nspace *vol); status_t dlist_uninit(nspace *vol);
status_t dlist_add(nspace *vol, vnode_id vnid); status_t dlist_add(nspace *vol, ino_t vnid);
status_t dlist_remove(nspace *vol, vnode_id vnid); status_t dlist_remove(nspace *vol, ino_t vnid);
vnode_id dlist_find(nspace *vol, uint32 cluster); ino_t dlist_find(nspace *vol, uint32 cluster);
void dlist_dump(nspace *vol); void dlist_dump(nspace *vol);
+3 -3
View File
@@ -144,7 +144,7 @@ static int lock_removable_device(int fd, bool state)
return ioctl(fd, B_SCSI_PREVENT_ALLOW, &state, sizeof(state)); return ioctl(fd, B_SCSI_PREVENT_ALLOW, &state, sizeof(state));
} }
static status_t mount_fat_disk(const char *path, mount_id nsid, static status_t mount_fat_disk(const char *path, dev_t nsid,
const int flags, nspace** newVol, int fs_flags, int op_sync_mode) const int flags, nspace** newVol, int fs_flags, int op_sync_mode)
{ {
nspace *vol = NULL; nspace *vol = NULL;
@@ -665,8 +665,8 @@ dosfs_free_identify_partition_cookie(partition_data *partition, void *_cookie)
static status_t static status_t
dosfs_mount(mount_id nsid, const char *device, uint32 flags, dosfs_mount(dev_t nsid, const char *device, uint32 flags,
const char *args, void **_data, vnode_id *_rootID) const char *args, void **_data, ino_t *_rootID)
{ {
int result; int result;
nspace *vol; nspace *vol;
+11 -11
View File
@@ -19,9 +19,9 @@ typedef recursive_lock lock;
/* for multiple reader/single writer locks */ /* for multiple reader/single writer locks */
#define READERS 100000 #define READERS 100000
/* Unfortunately, vnode_id's are defined as signed. This causes problems with /* Unfortunately, ino_t's are defined as signed. This causes problems with
* programs (notably cp) that use the modulo of a vnode_id (or ino_t) as a * programs (notably cp) that use the modulo of a ino_t as a
* hash function to index an array. This means the high bit of every vnode_id * hash function to index an array. This means the high bit of every ino_t
* is off-limits. Luckily, FAT32 is actually FAT28, so dosfs can make do with * is off-limits. Luckily, FAT32 is actually FAT28, so dosfs can make do with
* only 63 bits. * only 63 bits.
*/ */
@@ -46,10 +46,10 @@ typedef recursive_lock lock;
((vnid) & INVALID_VNID_BITS_MASK)) ((vnid) & INVALID_VNID_BITS_MASK))
#define GENERATE_DIR_INDEX_VNID(dircluster, index) \ #define GENERATE_DIR_INDEX_VNID(dircluster, index) \
(DIR_INDEX_VNID_BITS | ((vnode_id)(dircluster) << 32) | (index)) (DIR_INDEX_VNID_BITS | ((ino_t)(dircluster) << 32) | (index))
#define GENERATE_DIR_CLUSTER_VNID(dircluster, filecluster) \ #define GENERATE_DIR_CLUSTER_VNID(dircluster, filecluster) \
(DIR_CLUSTER_VNID_BITS | ((vnode_id)(dircluster) << 32) | (filecluster)) (DIR_CLUSTER_VNID_BITS | ((ino_t)(dircluster) << 32) | (filecluster))
#define CLUSTER_OF_DIR_CLUSTER_VNID(vnid) \ #define CLUSTER_OF_DIR_CLUSTER_VNID(vnid) \
((uint32)((vnid) & 0xffffffff)) ((uint32)((vnid) & 0xffffffff))
@@ -68,8 +68,8 @@ typedef recursive_lock lock;
typedef struct vnode typedef struct vnode
{ {
uint32 magic; uint32 magic;
vnode_id vnid; // self id ino_t vnid; // self id
vnode_id dir_vnid; // parent vnode id (directory containing entry) ino_t dir_vnid; // parent vnode id (directory containing entry)
void *cache; // for file cache void *cache; // for file cache
uint32 disk_image; // 0 = no, 1 = BEOS, 2 = IMAGE.BE uint32 disk_image; // 0 = no, 1 = BEOS, 2 = IMAGE.BE
@@ -116,7 +116,7 @@ struct vcache_entry;
typedef struct _nspace typedef struct _nspace
{ {
uint32 magic; uint32 magic;
mount_id id; // ID passed in to fs_mount dev_t id; // ID passed in to fs_mount
int fd; // File descriptor int fd; // File descriptor
char device[256]; char device[256];
uint32 flags; // see <fcntl.be.h> for modes uint32 flags; // see <fcntl.be.h> for modes
@@ -148,7 +148,7 @@ typedef struct _nspace
uint32 data_start; uint32 data_start;
uint32 last_allocated; // last allocated cluster uint32 last_allocated; // last allocated cluster
vnode_id beos_vnid; // vnid of \BEOS directory ino_t beos_vnid; // vnid of \BEOS directory
bool respect_disk_image; bool respect_disk_image;
int fs_flags; // flags for this mount int fs_flags; // flags for this mount
@@ -158,7 +158,7 @@ typedef struct _nspace
// vcache state // vcache state
struct { struct {
sem_id vc_sem; sem_id vc_sem;
vnode_id cur_vnid; ino_t cur_vnid;
uint32 cache_size; uint32 cache_size;
struct vcache_entry **by_vnid, **by_loc; struct vcache_entry **by_vnid, **by_loc;
} vcache; } vcache;
@@ -166,7 +166,7 @@ typedef struct _nspace
struct { struct {
uint32 entries; uint32 entries;
uint32 allocated; uint32 allocated;
vnode_id *vnid_list; ino_t *vnid_list;
} dlist; } dlist;
} nspace; } nspace;
+7 -6
View File
@@ -2,6 +2,7 @@
Copyright 1999-2001, Be Incorporated. All Rights Reserved. Copyright 1999-2001, Be Incorporated. All Rights Reserved.
This file may be used under the terms of the Be Sample Code License. This file may be used under the terms of the Be Sample Code License.
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
@@ -125,7 +126,7 @@ dosfs_release_vnode(void *_vol, void *_node, bool reenter)
return EINVAL; return EINVAL;
} }
DPRINTF(0, ("dosfs_write_vnode (vnode_id %Lx)\n", ((vnode *)_node)->vnid)); DPRINTF(0, ("dosfs_write_vnode (ino_t %Lx)\n", ((vnode *)_node)->vnid));
if ((vol->fs_flags & FS_FLAGS_OP_SYNC) && node->dirty) { if ((vol->fs_flags & FS_FLAGS_OP_SYNC) && node->dirty) {
LOCK_VOL(vol); LOCK_VOL(vol);
@@ -758,7 +759,7 @@ dosfs_free_cookie(void *_vol, void *_node, void *_cookie)
status_t status_t
dosfs_create(void *_vol, void *_dir, const char *name, int omode, dosfs_create(void *_vol, void *_dir, const char *name, int omode,
int perms, void **_cookie, vnode_id *vnid) int perms, void **_cookie, ino_t *vnid)
{ {
nspace *vol = (nspace *)_vol; nspace *vol = (nspace *)_vol;
vnode *dir = (vnode *)_dir, *file; vnode *dir = (vnode *)_dir, *file;
@@ -907,7 +908,7 @@ bi: if (result != B_OK) free(cookie);
status_t status_t
dosfs_mkdir(void *_vol, void *_dir, const char *name, int perms, vnode_id *_vnid) dosfs_mkdir(void *_vol, void *_dir, const char *name, int perms, ino_t *_vnid)
{ {
nspace *vol = (nspace *)_vol; nspace *vol = (nspace *)_vol;
vnode *dir = (vnode *)_dir, dummy; vnode *dir = (vnode *)_dir, dummy;
@@ -1121,10 +1122,10 @@ dosfs_rename(void *_vol, void *_odir, const char *oldname,
// don't move a directory into one of its children // don't move a directory into one of its children
if (file->mode & FAT_SUBDIR) { if (file->mode & FAT_SUBDIR) {
vnode_id vnid = ndir->vnid; ino_t vnid = ndir->vnid;
while (1) { while (1) {
vnode *dir; vnode *dir;
vnode_id parent; ino_t parent;
if (vnid == file->vnid) { if (vnid == file->vnid) {
result = EINVAL; result = EINVAL;
@@ -1347,7 +1348,7 @@ do_unlink(void *_vol, void *_dir, const char *name, bool is_file)
status_t result = EINVAL; status_t result = EINVAL;
nspace *vol = (nspace *)_vol; nspace *vol = (nspace *)_vol;
vnode *dir = (vnode *)_dir, *file; vnode *dir = (vnode *)_dir, *file;
vnode_id vnid; ino_t vnid;
if (!strcmp(name, ".")) if (!strcmp(name, "."))
return EPERM; return EPERM;
+2 -2
View File
@@ -18,8 +18,8 @@ status_t dosfs_close(void *vol, void *node, void *cookie);
status_t dosfs_remove_vnode(void *vol, void *node, bool reenter); status_t dosfs_remove_vnode(void *vol, void *node, bool reenter);
status_t dosfs_create(void *vol, void *dir, const char *name, status_t dosfs_create(void *vol, void *dir, const char *name,
int omode, int perms, void **cookie, vnode_id *vnid); int omode, int perms, void **cookie, ino_t *vnid);
status_t dosfs_mkdir(void *vol, void *dir, const char *name, int perms, vnode_id *_vnid); status_t dosfs_mkdir(void *vol, void *dir, const char *name, int perms, ino_t *_vnid);
status_t dosfs_rename(void *vol, void *olddir, const char *oldname, status_t dosfs_rename(void *vol, void *olddir, const char *oldname,
void *newdir, const char *newname); void *newdir, const char *newname);
status_t dosfs_unlink(void *vol, void *dir, const char *name); status_t dosfs_unlink(void *vol, void *dir, const char *name);
+18 -16
View File
@@ -62,8 +62,8 @@ purpose.
#include "util.h" #include "util.h"
struct vcache_entry { struct vcache_entry {
vnode_id vnid; /* originally reported vnid */ ino_t vnid; /* originally reported vnid */
vnode_id loc; /* where the file is now */ ino_t loc; /* where the file is now */
struct vcache_entry *next_vnid; /* next entry in vnid hash table */ struct vcache_entry *next_vnid; /* next entry in vnid hash table */
struct vcache_entry *next_loc; /* next entry in location hash table */ struct vcache_entry *next_loc; /* next entry in location hash table */
}; };
@@ -147,7 +147,7 @@ status_t uninit_vcache(nspace *vol)
return 0; return 0;
} }
vnode_id generate_unique_vnid(nspace *vol) ino_t generate_unique_vnid(nspace *vol)
{ {
DPRINTF(0, ("generate_unique_vnid\n")); DPRINTF(0, ("generate_unique_vnid\n"));
/* only one thread per volume will be in here at any given time anyway /* only one thread per volume will be in here at any given time anyway
@@ -155,7 +155,7 @@ vnode_id generate_unique_vnid(nspace *vol)
return vol->vcache.cur_vnid++; return vol->vcache.cur_vnid++;
} }
static status_t _add_to_vcache_(nspace *vol, vnode_id vnid, vnode_id loc) static status_t _add_to_vcache_(nspace *vol, ino_t vnid, ino_t loc)
{ {
int hash1 = hash(vnid), hash2 = hash(loc); int hash1 = hash(vnid), hash2 = hash(loc);
struct vcache_entry *e, *c, *p; struct vcache_entry *e, *c, *p;
@@ -205,7 +205,7 @@ static status_t _add_to_vcache_(nspace *vol, vnode_id vnid, vnode_id loc)
return B_OK; return B_OK;
} }
static status_t _remove_from_vcache_(nspace *vol, vnode_id vnid) static status_t _remove_from_vcache_(nspace *vol, ino_t vnid)
{ {
int hash1 = hash(vnid), hash2; int hash1 = hash(vnid), hash2;
struct vcache_entry *c, *p, *e; struct vcache_entry *c, *p, *e;
@@ -252,7 +252,7 @@ static status_t _remove_from_vcache_(nspace *vol, vnode_id vnid)
return 0; return 0;
} }
static struct vcache_entry *_find_vnid_in_vcache_(nspace *vol, vnode_id vnid) static struct vcache_entry *_find_vnid_in_vcache_(nspace *vol, ino_t vnid)
{ {
int hash1 = hash(vnid); int hash1 = hash(vnid);
struct vcache_entry *c; struct vcache_entry *c;
@@ -268,7 +268,7 @@ static struct vcache_entry *_find_vnid_in_vcache_(nspace *vol, vnode_id vnid)
return c; return c;
} }
static struct vcache_entry *_find_loc_in_vcache_(nspace *vol, vnode_id loc) static struct vcache_entry *_find_loc_in_vcache_(nspace *vol, ino_t loc)
{ {
int hash2 = hash(loc); int hash2 = hash(loc);
struct vcache_entry *c; struct vcache_entry *c;
@@ -284,7 +284,7 @@ static struct vcache_entry *_find_loc_in_vcache_(nspace *vol, vnode_id loc)
return c; return c;
} }
status_t add_to_vcache(nspace *vol, vnode_id vnid, vnode_id loc) status_t add_to_vcache(nspace *vol, ino_t vnid, ino_t loc)
{ {
status_t result; status_t result;
@@ -297,7 +297,7 @@ status_t add_to_vcache(nspace *vol, vnode_id vnid, vnode_id loc)
} }
/* XXX: do this in a smarter fashion */ /* XXX: do this in a smarter fashion */
static status_t _update_loc_in_vcache_(nspace *vol, vnode_id vnid, vnode_id loc) static status_t _update_loc_in_vcache_(nspace *vol, ino_t vnid, ino_t loc)
{ {
status_t result; status_t result;
@@ -308,7 +308,7 @@ static status_t _update_loc_in_vcache_(nspace *vol, vnode_id vnid, vnode_id loc)
return result; return result;
} }
status_t remove_from_vcache(nspace *vol, vnode_id vnid) status_t remove_from_vcache(nspace *vol, ino_t vnid)
{ {
status_t result; status_t result;
@@ -320,7 +320,7 @@ status_t remove_from_vcache(nspace *vol, vnode_id vnid)
return result; return result;
} }
status_t vcache_vnid_to_loc(nspace *vol, vnode_id vnid, vnode_id *loc) status_t vcache_vnid_to_loc(nspace *vol, ino_t vnid, ino_t *loc)
{ {
struct vcache_entry *e; struct vcache_entry *e;
@@ -335,7 +335,7 @@ status_t vcache_vnid_to_loc(nspace *vol, vnode_id vnid, vnode_id *loc)
return (e) ? B_OK : ENOENT; return (e) ? B_OK : ENOENT;
} }
status_t vcache_loc_to_vnid(nspace *vol, vnode_id loc, vnode_id *vnid) status_t vcache_loc_to_vnid(nspace *vol, ino_t loc, ino_t *vnid)
{ {
struct vcache_entry *e; struct vcache_entry *e;
@@ -350,7 +350,7 @@ status_t vcache_loc_to_vnid(nspace *vol, vnode_id loc, vnode_id *vnid)
return (e) ? B_OK : ENOENT; return (e) ? B_OK : ENOENT;
} }
status_t vcache_set_entry(nspace *vol, vnode_id vnid, vnode_id loc) status_t vcache_set_entry(nspace *vol, ino_t vnid, ino_t loc)
{ {
struct vcache_entry *e; struct vcache_entry *e;
status_t result = B_OK; status_t result = B_OK;
@@ -400,7 +400,7 @@ int debug_dfvnid(int argc, char **argv)
return B_OK; return B_OK;
for (i=2;i<argc;i++) { for (i=2;i<argc;i++) {
vnode_id vnid = strtoull(argv[i], NULL, 0); ino_t vnid = strtoull(argv[i], NULL, 0);
struct vcache_entry *e; struct vcache_entry *e;
if ((e = _find_vnid_in_vcache_(vol, vnid)) != NULL) { if ((e = _find_vnid_in_vcache_(vol, vnid)) != NULL) {
kprintf("vnid %Lx -> loc %Lx @ %p\n", vnid, e->loc, e); kprintf("vnid %Lx -> loc %Lx @ %p\n", vnid, e->loc, e);
@@ -412,7 +412,9 @@ int debug_dfvnid(int argc, char **argv)
return B_OK; return B_OK;
} }
int debug_dfloc(int argc, char **argv)
int
debug_dfloc(int argc, char **argv)
{ {
int i; int i;
nspace *vol; nspace *vol;
@@ -427,7 +429,7 @@ int debug_dfloc(int argc, char **argv)
return B_OK; return B_OK;
for (i = 2; i < argc; i++) { for (i = 2; i < argc; i++) {
vnode_id loc = strtoull(argv[i], NULL, 0); ino_t loc = strtoull(argv[i], NULL, 0);
struct vcache_entry *e; struct vcache_entry *e;
if ((e = _find_loc_in_vcache_(vol, loc)) != NULL) { if ((e = _find_loc_in_vcache_(vol, loc)) != NULL) {
kprintf("loc %Lx -> vnid %Lx @ %p\n", loc, e->vnid, e); kprintf("loc %Lx -> vnid %Lx @ %p\n", loc, e->vnid, e);
+6 -6
View File
@@ -10,14 +10,14 @@ void dump_vcache(nspace *vol);
status_t init_vcache(nspace *vol); status_t init_vcache(nspace *vol);
status_t uninit_vcache(nspace *vol); status_t uninit_vcache(nspace *vol);
vnode_id generate_unique_vnid(nspace *vol); ino_t generate_unique_vnid(nspace *vol);
status_t add_to_vcache(nspace *vol, vnode_id vnid, vnode_id loc); status_t add_to_vcache(nspace *vol, ino_t vnid, ino_t loc);
status_t remove_from_vcache(nspace *vol, vnode_id vnid); status_t remove_from_vcache(nspace *vol, ino_t vnid);
status_t vcache_vnid_to_loc(nspace *vol, vnode_id vnid, vnode_id *loc); status_t vcache_vnid_to_loc(nspace *vol, ino_t vnid, ino_t *loc);
status_t vcache_loc_to_vnid(nspace *vol, vnode_id loc, vnode_id *vnid); status_t vcache_loc_to_vnid(nspace *vol, ino_t loc, ino_t *vnid);
status_t vcache_set_entry(nspace *vol, vnode_id vnid, vnode_id loc); status_t vcache_set_entry(nspace *vol, ino_t vnid, ino_t loc);
#define find_vnid_in_vcache(vol,vnid) vcache_vnid_to_loc(vol,vnid,NULL) #define find_vnid_in_vcache(vol,vnid) vcache_vnid_to_loc(vol,vnid,NULL)
#define find_loc_in_vcache(vol,loc) vcache_loc_to_vnid(vol,loc,NULL) #define find_loc_in_vcache(vol,loc) vcache_loc_to_vnid(vol,loc,NULL)
@@ -14,7 +14,6 @@
#include <BeBuild.h> #include <BeBuild.h>
typedef dev_t nspace_id; typedef dev_t nspace_id;
typedef ino_t vnode_id;
/* UGLY UGLY UGLY */ /* UGLY UGLY UGLY */
#ifndef _DRIVERS_H #ifndef _DRIVERS_H
@@ -63,18 +62,18 @@ typedef struct selectsync selectsync;
struct attr_info; struct attr_info;
struct index_info; struct index_info;
typedef int op_read_vnode(void *ns, vnode_id vnid, char r, void **node); typedef int op_read_vnode(void *ns, ino_t vnid, char r, void **node);
typedef int op_write_vnode(void *ns, void *node, char r); typedef int op_write_vnode(void *ns, void *node, char r);
typedef int op_remove_vnode(void *ns, void *node, char r); typedef int op_remove_vnode(void *ns, void *node, char r);
typedef int op_secure_vnode(void *ns, void *node); typedef int op_secure_vnode(void *ns, void *node);
typedef int op_walk(void *ns, void *base, const char *file, char **newpath, typedef int op_walk(void *ns, void *base, const char *file, char **newpath,
vnode_id *vnid); ino_t *vnid);
typedef int op_access(void *ns, void *node, int mode); typedef int op_access(void *ns, void *node, int mode);
typedef int op_create(void *ns, void *dir, const char *name, typedef int op_create(void *ns, void *dir, const char *name,
int omode, int perms, vnode_id *vnid, void **cookie); int omode, int perms, ino_t *vnid, void **cookie);
typedef int op_mkdir(void *ns, void *dir, const char *name, int perms); typedef int op_mkdir(void *ns, void *dir, const char *name, int perms);
typedef int op_symlink(void *ns, void *dir, const char *name, typedef int op_symlink(void *ns, void *dir, const char *name,
const char *path); const char *path);
@@ -119,7 +118,7 @@ typedef int op_deselect(void *ns, void *node, void *cookie, uint8 event,
typedef int op_initialize(const char *devname, void *parms, size_t len); typedef int op_initialize(const char *devname, void *parms, size_t len);
typedef int op_mount(nspace_id nsid, const char *devname, ulong flags, typedef int op_mount(nspace_id nsid, const char *devname, ulong flags,
void *parms, size_t len, void **data, vnode_id *vnid); void *parms, size_t len, void **data, ino_t *vnid);
typedef int op_unmount(void *ns); typedef int op_unmount(void *ns);
typedef int op_sync(void *ns); typedef int op_sync(void *ns);
typedef int op_rfsstat(void *ns, struct fs_info *); typedef int op_rfsstat(void *ns, struct fs_info *);
@@ -228,20 +227,20 @@ extern _IMPEXP_KERNEL int new_path(const char *path, char **copy);
extern _IMPEXP_KERNEL void free_path(char *p); extern _IMPEXP_KERNEL void free_path(char *p);
extern _IMPEXP_KERNEL int notify_listener(int op, nspace_id nsid, extern _IMPEXP_KERNEL int notify_listener(int op, nspace_id nsid,
vnode_id vnida, vnode_id vnidb, ino_t vnida, ino_t vnidb,
vnode_id vnidc, const char *name); ino_t vnidc, const char *name);
extern _IMPEXP_KERNEL void notify_select_event(selectsync *sync, uint32 ref); extern _IMPEXP_KERNEL void notify_select_event(selectsync *sync, uint32 ref);
extern _IMPEXP_KERNEL int send_notification(port_id port, long token, extern _IMPEXP_KERNEL int send_notification(port_id port, long token,
ulong what, long op, nspace_id nsida, ulong what, long op, nspace_id nsida,
nspace_id nsidb, vnode_id vnida, nspace_id nsidb, ino_t vnida,
vnode_id vnidb, vnode_id vnidc, ino_t vnidb, ino_t vnidc,
const char *name); const char *name);
extern _IMPEXP_KERNEL int get_vnode(nspace_id nsid, vnode_id vnid, void **data); extern _IMPEXP_KERNEL int get_vnode(nspace_id nsid, ino_t vnid, void **data);
extern _IMPEXP_KERNEL int put_vnode(nspace_id nsid, vnode_id vnid); extern _IMPEXP_KERNEL int put_vnode(nspace_id nsid, ino_t vnid);
extern _IMPEXP_KERNEL int new_vnode(nspace_id nsid, vnode_id vnid, void *data); extern _IMPEXP_KERNEL int new_vnode(nspace_id nsid, ino_t vnid, void *data);
extern _IMPEXP_KERNEL int remove_vnode(nspace_id nsid, vnode_id vnid); extern _IMPEXP_KERNEL int remove_vnode(nspace_id nsid, ino_t vnid);
extern _IMPEXP_KERNEL int unremove_vnode(nspace_id nsid, vnode_id vnid); extern _IMPEXP_KERNEL int unremove_vnode(nspace_id nsid, ino_t vnid);
extern _IMPEXP_KERNEL int is_vnode_removed(nspace_id nsid, vnode_id vnid); extern _IMPEXP_KERNEL int is_vnode_removed(nspace_id nsid, ino_t vnid);
extern _EXPORT vnode_ops fs_entry; extern _EXPORT vnode_ops fs_entry;
@@ -50,9 +50,9 @@ extern struct attr_entry mailto_me_bookmark_attrs[];
extern char *readmestr; extern char *readmestr;
static int googlefs_create_gen(fs_nspace *ns, fs_node *dir, const char *name, int omode, int perms, vnode_id *vnid, fs_node **node, struct attr_entry *iattrs, bool mkdir, bool uniq); static int googlefs_create_gen(fs_nspace *ns, fs_node *dir, const char *name, int omode, int perms, ino_t *vnid, fs_node **node, struct attr_entry *iattrs, bool mkdir, bool uniq);
static void fill_default_stat(struct stat *st, nspace_id nsid, vnode_id vnid, mode_t mode) static void fill_default_stat(struct stat *st, nspace_id nsid, ino_t vnid, mode_t mode)
{ {
time_t tm = time(NULL); time_t tm = time(NULL);
st->st_dev = nsid; st->st_dev = nsid;
@@ -109,10 +109,10 @@ err:
#ifdef __HAIKU__ #ifdef __HAIKU__
int googlefs_mount(nspace_id nsid, const char *devname, uint32 flags, int googlefs_mount(nspace_id nsid, const char *devname, uint32 flags,
const char *parms, fs_nspace **data, vnode_id *vnid) const char *parms, fs_nspace **data, ino_t *vnid)
#else #else
int googlefs_mount(nspace_id nsid, const char *devname, ulong flags, int googlefs_mount(nspace_id nsid, const char *devname, ulong flags,
const char *parms, size_t len, fs_nspace **data, vnode_id *vnid) const char *parms, size_t len, fs_nspace **data, ino_t *vnid)
#endif #endif
{ {
fs_nspace *ns; fs_nspace *ns;
@@ -214,7 +214,7 @@ int googlefs_unmount(fs_nspace *ns)
return B_OK; return B_OK;
} }
static int compare_fs_node_by_vnid(fs_node *node, vnode_id *id) static int compare_fs_node_by_vnid(fs_node *node, ino_t *id)
{ {
return !(node->vnid == *id); return !(node->vnid == *id);
} }
@@ -262,9 +262,9 @@ int googlefs_remove_vnode(fs_nspace *ns, fs_node *node, char r)
} }
#ifdef __HAIKU__ #ifdef __HAIKU__
int googlefs_read_vnode(fs_nspace *ns, vnode_id vnid, fs_node **node, char r) int googlefs_read_vnode(fs_nspace *ns, ino_t vnid, fs_node **node, char r)
#else #else
int googlefs_read_vnode(fs_nspace *ns, vnode_id vnid, char r, fs_node **node) int googlefs_read_vnode(fs_nspace *ns, ino_t vnid, char r, fs_node **node)
#endif #endif
{ {
fs_node *n; fs_node *n;
@@ -321,9 +321,9 @@ int googlefs_get_vnode_name(fs_nspace *ns, fs_node *node, char *buffer, size_t l
#endif #endif
#ifdef __HAIKU__ #ifdef __HAIKU__
int googlefs_walk(fs_nspace *ns, fs_node *base, const char *file, vnode_id *vnid, int *type) int googlefs_walk(fs_nspace *ns, fs_node *base, const char *file, ino_t *vnid, int *type)
#else #else
int googlefs_walk(fs_nspace *ns, fs_node *base, const char *file, char **newpath, vnode_id *vnid) int googlefs_walk(fs_nspace *ns, fs_node *base, const char *file, char **newpath, ino_t *vnid)
#endif #endif
{ {
fs_node *n, *dummy; fs_node *n, *dummy;
@@ -658,7 +658,7 @@ int googlefs_wfsstat(fs_nspace *ns, struct fs_info *info, long mask)
* @param mkdir create a directory instead of a file * @param mkdir create a directory instead of a file
* @param uniq choose an unique name, appending a number if required * @param uniq choose an unique name, appending a number if required
*/ */
static int googlefs_create_gen(fs_nspace *ns, fs_node *dir, const char *name, int omode, int perms, vnode_id *vnid, fs_node **node, struct attr_entry *iattrs, bool mkdir, bool uniq) static int googlefs_create_gen(fs_nspace *ns, fs_node *dir, const char *name, int omode, int perms, ino_t *vnid, fs_node **node, struct attr_entry *iattrs, bool mkdir, bool uniq)
{ {
char newname[GOOGLEFS_NAME_LEN]; char newname[GOOGLEFS_NAME_LEN];
status_t err; status_t err;
@@ -760,7 +760,7 @@ done:
return err; return err;
} }
int googlefs_create(fs_nspace *ns, fs_node *dir, const char *name, int omode, int perms, vnode_id *vnid, fs_file_cookie **cookie) int googlefs_create(fs_nspace *ns, fs_node *dir, const char *name, int omode, int perms, ino_t *vnid, fs_file_cookie **cookie)
{ {
status_t err; status_t err;
fs_node *n; fs_node *n;
@@ -66,7 +66,7 @@ struct fs_node
struct fs_file_cookie *opened; /* opened on this node */ struct fs_file_cookie *opened; /* opened on this node */
char name[GOOGLEFS_NAME_LEN]; char name[GOOGLEFS_NAME_LEN];
vnode_id vnid; ino_t vnid;
lock l; lock l;
int is_perm:1; /* don't delete on last close */ int is_perm:1; /* don't delete on last close */
@@ -87,7 +87,7 @@ struct vnidpool;
struct fs_nspace struct fs_nspace
{ {
nspace_id nsid; nspace_id nsid;
vnode_id rootid; ino_t rootid;
struct vnidpool *vnids; struct vnidpool *vnids;
struct fs_node *root; /* fast access for stat time change */ struct fs_node *root; /* fast access for stat time change */
struct fs_node *nodes; struct fs_node *nodes;
@@ -118,7 +118,7 @@ typedef struct fs_file_cookie fs_file_cookie;
#define fs_attr_dir_cookie fs_file_cookie #define fs_attr_dir_cookie fs_file_cookie
#define fs_query_cookie fs_file_cookie #define fs_query_cookie fs_file_cookie
vnode_id new_vnid(fs_nspace *ns); ino_t new_vnid(fs_nspace *ns);
int googlefs_free_vnode(fs_nspace *ns, fs_node *node); int googlefs_free_vnode(fs_nspace *ns, fs_node *node);
int googlefs_event(fs_nspace *ns, fs_node *node, int flags); int googlefs_event(fs_nspace *ns, fs_node *node, int flags);
@@ -52,7 +52,7 @@ status_t vnidpool_free(struct vnidpool *pool) {
return B_OK; return B_OK;
} }
status_t vnidpool_get(struct vnidpool *pool, vnode_id *vnid) status_t vnidpool_get(struct vnidpool *pool, ino_t *vnid)
{ {
status_t err = B_ERROR; status_t err = B_ERROR;
uint32 i; uint32 i;
@@ -76,7 +76,7 @@ status_t vnidpool_get(struct vnidpool *pool, vnode_id *vnid)
return err; return err;
} }
status_t vnidpool_put(struct vnidpool *pool, vnode_id vnid) status_t vnidpool_put(struct vnidpool *pool, ino_t vnid)
{ {
status_t err = B_ERROR; status_t err = B_ERROR;
uint32 i; uint32 i;
@@ -5,14 +5,14 @@
typedef struct vnidpool { typedef struct vnidpool {
lock lock; lock lock;
vnode_id nextvnid; ino_t nextvnid;
uint32 *bitmap; uint32 *bitmap;
size_t bmsize; size_t bmsize;
} vnidpool; } vnidpool;
status_t vnidpool_alloc(struct vnidpool **pool, size_t size); status_t vnidpool_alloc(struct vnidpool **pool, size_t size);
status_t vnidpool_free(struct vnidpool *pool); status_t vnidpool_free(struct vnidpool *pool);
status_t vnidpool_get(struct vnidpool *pool, vnode_id *vnid); status_t vnidpool_get(struct vnidpool *pool, ino_t *vnid);
status_t vnidpool_put(struct vnidpool *pool, vnode_id vnid); status_t vnidpool_put(struct vnidpool *pool, ino_t vnid);
#endif /* _VNIDPOOL_H */ #endif /* _VNIDPOOL_H */
+19 -21
View File
@@ -1,31 +1,29 @@
/* /*
** Copyright 1999, Be Incorporated. All Rights Reserved. * Copyright 1999, Be Incorporated. All Rights Reserved.
** This file may be used under the terms of the Be Sample Code License. * This file may be used under the terms of the Be Sample Code License.
** *
** Copyright 2001, pinc Software. All Rights Reserved. * Copyright 2001, pinc Software. All Rights Reserved.
**
** iso9960/multi-session
** 2001-03-11: added multi-session support, axeld.
*/ */
#include <malloc.h>
#include <SupportDefs.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <Drivers.h>
#include <OS.h>
#include <KernelExport.h>
#include <string.h>
#include <dirent.h>
#include <time.h>
#include <malloc.h>
#include <ByteOrder.h>
#include <fs_cache.h>
#include "rock.h" #include "rock.h"
#include "iso.h" #include "iso.h"
#include <ByteOrder.h>
#include <Drivers.h>
#include <KernelExport.h>
#include <OS.h>
#include <SupportDefs.h>
#include <fs_cache.h>
#include <dirent.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
//#define TRACE_ISO9660 1 //#define TRACE_ISO9660 1
#if TRACE_ISO9660 #if TRACE_ISO9660
# define TRACE(x) dprintf x # define TRACE(x) dprintf x
+24 -31
View File
@@ -1,21 +1,23 @@
/* /*
** Copyright 1999, Be Incorporated. All Rights Reserved. * Copyright 1999, Be Incorporated. All Rights Reserved.
** This file may be used under the terms of the Be Sample Code License. * This file may be used under the terms of the Be Sample Code License.
** *
** Copyright 2001, pinc Software. All Rights Reserved. * Copyright 2001, pinc Software. All Rights Reserved.
*/ */
#ifndef _ISO_H #ifndef _ISO_H
#define _ISO_H #define _ISO_H
#include "lock.h"
#include <fs_interface.h>
#include <SupportDefs.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <fs_interface.h>
#include "lock.h"
#include <time.h> #include <time.h>
#include <endian.h> #include <endian.h>
#include <SupportDefs.h>
// Size of primary volume descriptor for ISO9660 // Size of primary volume descriptor for ISO9660
#define ISO_PVD_SIZE 882 #define ISO_PVD_SIZE 882
@@ -23,8 +25,7 @@
// ISO structure has both msb and lsb first data. These let you do a // ISO structure has both msb and lsb first data. These let you do a
// compile-time switch for different platforms. // compile-time switch for different platforms.
enum enum {
{
LSB_DATA = 0, LSB_DATA = 0,
MSB_DATA MSB_DATA
}; };
@@ -40,8 +41,7 @@ enum
// ISO pdf file spec I read appears to be WRONG about the date format. See // ISO pdf file spec I read appears to be WRONG about the date format. See
// www.alumni.caltech.edu/~pje/iso9660.html, definition there seems // www.alumni.caltech.edu/~pje/iso9660.html, definition there seems
// to match. // to match.
typedef struct ISOVolDate typedef struct ISOVolDate {
{
char year[5]; char year[5];
char month[3]; char month[3];
char day[3]; char day[3];
@@ -52,8 +52,7 @@ typedef struct ISOVolDate
int8 offsetGMT; int8 offsetGMT;
} ISOVolDate; } ISOVolDate;
typedef struct ISORecDate typedef struct ISORecDate {
{
uint8 year; // Year - 1900 uint8 year; // Year - 1900
uint8 month; uint8 month;
uint8 date; uint8 date;
@@ -64,8 +63,7 @@ typedef struct ISORecDate
} ISORecDate; } ISORecDate;
/* This next section is data structure to hold the data found in the rock ridge extensions. */ /* This next section is data structure to hold the data found in the rock ridge extensions. */
typedef struct RRAttr typedef struct RRAttr {
{
char* slName; char* slName;
struct stat stat[2]; struct stat stat[2];
uint8 nmVer; uint8 nmVer;
@@ -84,11 +82,10 @@ typedef struct RRAttr
fs_write_vnode (somewhat of a misnomer) where you should deallocate the struct. fs_write_vnode (somewhat of a misnomer) where you should deallocate the struct.
*/ */
typedef struct vnode typedef struct vnode {
{
/* Most drivers will probably want the first things defined here. */ /* Most drivers will probably want the first things defined here. */
vnode_id id; ino_t id;
vnode_id parID; // parent vnode ID. ino_t parID; // parent vnode ID.
void *cache; // for file cache void *cache; // for file cache
// End of members other drivers will definitely want. // End of members other drivers will definitely want.
@@ -124,8 +121,7 @@ typedef struct vnode
} vnode; } vnode;
// These go with the flags member of the nspace struct. // These go with the flags member of the nspace struct.
enum enum {
{
ISO_ISHIDDEN = 0, ISO_ISHIDDEN = 0,
ISO_ISDIR = 2, ISO_ISDIR = 2,
ISO_ISASSOCFILE = 4, ISO_ISASSOCFILE = 4,
@@ -144,8 +140,7 @@ enum
need to determine where you are at in reading the directory need to determine where you are at in reading the directory
entries, incremented every time readdir is called, until finally entries, incremented every time readdir is called, until finally
the end is reached, when readdir returns NULL. */ the end is reached, when readdir returns NULL. */
typedef struct dircookie typedef struct dircookie {
{
off_t startBlock; off_t startBlock;
off_t block; // Current block off_t block; // Current block
off_t pos; // Position within block. off_t pos; // Position within block.
@@ -158,8 +153,7 @@ typedef struct dircookie
cookie function is called. For ISO, we didn't need one. cookie function is called. For ISO, we didn't need one.
*/ */
typedef struct attrfilemap typedef struct attrfilemap {
{
char *name; char *name;
off_t offset; off_t offset;
} attrfilemap; } attrfilemap;
@@ -169,10 +163,9 @@ typedef struct attrfilemap
global information you need. You'll need to change this struct to suit your purposes. global information you need. You'll need to change this struct to suit your purposes.
*/ */
typedef struct nspace typedef struct nspace {
{
// Start of members other drivers will definitely want. // Start of members other drivers will definitely want.
mount_id id; // ID passed in to fs_mount dev_t id; // ID passed in to fs_mount
int fd; // File descriptor int fd; // File descriptor
int fdOfSession; // File descriptor of the (mounted) session int fdOfSession; // File descriptor of the (mounted) session
//unsigned int blockSize; // usually need this, but it's part of ISO //unsigned int blockSize; // usually need this, but it's part of ISO
@@ -186,7 +179,7 @@ typedef struct nspace
// attribute extensions // attribute extensions
int32 readAttributes; int32 readAttributes;
attrfilemap *attrFileMap; attrfilemap *attrFileMap;
vnode_id attributesID; ino_t attributesID;
// JOLIET extension: joliet_level for this volume // JOLIET extension: joliet_level for this volume
uint8 joliet_level; uint8 joliet_level;
@@ -240,4 +233,4 @@ int ConvertRecDate(ISORecDate* inDate, time_t* outDate);
} }
#endif #endif
#endif #endif /* _ISO_H */
@@ -1,13 +1,16 @@
/* /*
** Copyright 1999, Be Incorporated. All Rights Reserved. * Copyright 1999, Be Incorporated. All Rights Reserved.
** This file may be used under the terms of the Be Sample Code License. * This file may be used under the terms of the Be Sample Code License.
** *
** Copyright 2001, pinc Software. All Rights Reserved. * Copyright 2001, pinc Software. All Rights Reserved.
** *
** iso9960/multi-session, 1.0.0 * iso9960/multi-session, 1.0.0
** 2001-03-11: added multi-session support, axeld.
*/ */
#include "iso.h"
#include "iso9660.h"
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
@@ -33,9 +36,6 @@
#include <util/kernel_cpp.h> #include <util/kernel_cpp.h>
#include "iso.h"
#include "iso9660.h"
//#define TRACE_ISO9660 1 //#define TRACE_ISO9660 1
#if TRACE_ISO9660 #if TRACE_ISO9660
# define TRACE(x) dprintf x # define TRACE(x) dprintf x
@@ -45,16 +45,16 @@
/* Start of fundamental (read-only) required functions */ /* Start of fundamental (read-only) required functions */
static status_t fs_mount(mount_id mountID, const char *device, uint32 flags, static status_t fs_mount(dev_t mountID, const char *device, uint32 flags,
const char *args, void **_data, vnode_id *_rootID); const char *args, void **_data, ino_t *_rootID);
static status_t fs_unmount(void *ns); static status_t fs_unmount(void *ns);
static status_t fs_get_vnode_name(void *_ns, void *_node, static status_t fs_get_vnode_name(void *_ns, void *_node,
char *buffer, size_t bufferSize); char *buffer, size_t bufferSize);
static status_t fs_walk(void *_ns, void *_base, const char *file, static status_t fs_walk(void *_ns, void *_base, const char *file,
vnode_id *_vnodeID, int *_type); ino_t *_vnodeID, int *_type);
static status_t fs_read_vnode(void *_ns, vnode_id vnid, void **node, bool reenter); static status_t fs_read_vnode(void *_ns, ino_t vnid, void **node, bool reenter);
static status_t fs_release_vnode(void *_ns, void *_node, bool reenter); static status_t fs_release_vnode(void *_ns, void *_node, bool reenter);
static status_t fs_get_file_map(fs_volume _fs, fs_vnode _node, off_t offset, size_t size, static status_t fs_get_file_map(fs_volume _fs, fs_vnode _node, off_t offset, size_t size,
struct file_io_vec *vecs, size_t *_count); struct file_io_vec *vecs, size_t *_count);
@@ -142,8 +142,8 @@ fs_free_identify_partition_cookie(partition_data *partition, void *_cookie)
static status_t static status_t
fs_mount(mount_id mountID, const char *device, uint32 flags, fs_mount(dev_t mountID, const char *device, uint32 flags,
const char *args, void **_data, vnode_id *_rootID) const char *args, void **_data, ino_t *_rootID)
{ {
/* /*
Kernel passes in nspace_id, (representing a disk or partition?) Kernel passes in nspace_id, (representing a disk or partition?)
@@ -191,7 +191,7 @@ fs_mount(mount_id mountID, const char *device, uint32 flags,
// If it is ISO … // If it is ISO …
if (result == B_NO_ERROR) { if (result == B_NO_ERROR) {
//vnode_id rootID = vol->rootDirRec.startLBN[FS_DATA_FORMAT]; //ino_t rootID = vol->rootDirRec.startLBN[FS_DATA_FORMAT];
//*vnid = rootID; //*vnid = rootID;
*_rootID = ISO_ROOTNODE_ID; *_rootID = ISO_ROOTNODE_ID;
*_data = (void*)vol; *_data = (void*)vol;
@@ -299,7 +299,7 @@ fs_get_vnode_name(void *ns, void *_node, char *buffer, size_t bufferSize)
it for the kernel. it for the kernel.
*/ */
static status_t static status_t
fs_walk(void *_ns, void *base, const char *file, vnode_id *_vnodeID, int *_type) fs_walk(void *_ns, void *base, const char *file, ino_t *_vnodeID, int *_type)
{ {
/* Starting at the base, find file in the subdir, and return path /* Starting at the base, find file in the subdir, and return path
string and vnode id of file. */ string and vnode id of file. */
@@ -420,7 +420,7 @@ fs_walk(void *_ns, void *base, const char *file, vnode_id *_vnodeID, int *_type)
static status_t static status_t
fs_read_vnode(void *_ns, vnode_id vnid, void **node, bool reenter) fs_read_vnode(void *_ns, ino_t vnid, void **node, bool reenter)
{ {
uint32 block, pos; uint32 block, pos;
nspace *ns = (nspace*)_ns; nspace *ns = (nspace*)_ns;
+14 -15
View File
@@ -14,7 +14,6 @@
#include <BeBuild.h> #include <BeBuild.h>
typedef dev_t nspace_id; typedef dev_t nspace_id;
typedef ino_t vnode_id;
/* UGLY UGLY UGLY */ /* UGLY UGLY UGLY */
#ifndef _DRIVERS_H #ifndef _DRIVERS_H
@@ -60,18 +59,18 @@ typedef struct selectsync selectsync;
struct attr_info; struct attr_info;
struct index_info; struct index_info;
typedef int op_read_vnode(void *ns, vnode_id vnid, char r, void **node); typedef int op_read_vnode(void *ns, ino_t vnid, char r, void **node);
typedef int op_write_vnode(void *ns, void *node, char r); typedef int op_write_vnode(void *ns, void *node, char r);
typedef int op_remove_vnode(void *ns, void *node, char r); typedef int op_remove_vnode(void *ns, void *node, char r);
typedef int op_secure_vnode(void *ns, void *node); typedef int op_secure_vnode(void *ns, void *node);
typedef int op_walk(void *ns, void *base, const char *file, char **newpath, typedef int op_walk(void *ns, void *base, const char *file, char **newpath,
vnode_id *vnid); ino_t *vnid);
typedef int op_access(void *ns, void *node, int mode); typedef int op_access(void *ns, void *node, int mode);
typedef int op_create(void *ns, void *dir, const char *name, typedef int op_create(void *ns, void *dir, const char *name,
int omode, int perms, vnode_id *vnid, void **cookie); int omode, int perms, ino_t *vnid, void **cookie);
typedef int op_mkdir(void *ns, void *dir, const char *name, int perms); typedef int op_mkdir(void *ns, void *dir, const char *name, int perms);
typedef int op_symlink(void *ns, void *dir, const char *name, typedef int op_symlink(void *ns, void *dir, const char *name,
const char *path); const char *path);
@@ -116,7 +115,7 @@ typedef int op_deselect(void *ns, void *node, void *cookie, uint8 event,
typedef int op_initialize(const char *devname, void *parms, size_t len); typedef int op_initialize(const char *devname, void *parms, size_t len);
typedef int op_mount(nspace_id nsid, const char *devname, ulong flags, typedef int op_mount(nspace_id nsid, const char *devname, ulong flags,
void *parms, size_t len, void **data, vnode_id *vnid); void *parms, size_t len, void **data, ino_t *vnid);
typedef int op_unmount(void *ns); typedef int op_unmount(void *ns);
typedef int op_sync(void *ns); typedef int op_sync(void *ns);
typedef int op_rfsstat(void *ns, struct fs_info *); typedef int op_rfsstat(void *ns, struct fs_info *);
@@ -225,20 +224,20 @@ extern int new_path(const char *path, char **copy);
extern void free_path(char *p); extern void free_path(char *p);
extern int notify_listener(int op, nspace_id nsid, extern int notify_listener(int op, nspace_id nsid,
vnode_id vnida, vnode_id vnidb, ino_t vnida, ino_t vnidb,
vnode_id vnidc, const char *name); ino_t vnidc, const char *name);
extern void notify_select_event(selectsync *sync, uint32 ref); extern void notify_select_event(selectsync *sync, uint32 ref);
extern int send_notification(port_id port, long token, extern int send_notification(port_id port, long token,
ulong what, long op, nspace_id nsida, ulong what, long op, nspace_id nsida,
nspace_id nsidb, vnode_id vnida, nspace_id nsidb, ino_t vnida,
vnode_id vnidb, vnode_id vnidc, ino_t vnidb, ino_t vnidc,
const char *name); const char *name);
extern int get_vnode(nspace_id nsid, vnode_id vnid, void **data); extern int get_vnode(nspace_id nsid, ino_t vnid, void **data);
extern int put_vnode(nspace_id nsid, vnode_id vnid); extern int put_vnode(nspace_id nsid, ino_t vnid);
extern int new_vnode(nspace_id nsid, vnode_id vnid, void *data); extern int new_vnode(nspace_id nsid, ino_t vnid, void *data);
extern int remove_vnode(nspace_id nsid, vnode_id vnid); extern int remove_vnode(nspace_id nsid, ino_t vnid);
extern int unremove_vnode(nspace_id nsid, vnode_id vnid); extern int unremove_vnode(nspace_id nsid, ino_t vnid);
extern int is_vnode_removed(nspace_id nsid, vnode_id vnid); extern int is_vnode_removed(nspace_id nsid, ino_t vnid);
extern _EXPORT vnode_ops fs_entry; extern _EXPORT vnode_ops fs_entry;
@@ -747,7 +747,7 @@ status_t map_nfs_to_system_error (status_t nfsstatus)
} }
extern nfs_fhandle extern nfs_fhandle
handle_from_vnid(fs_nspace *ns, vnode_id vnid) handle_from_vnid(fs_nspace *ns, ino_t vnid)
{ {
fs_node *current; fs_node *current;
@@ -787,7 +787,7 @@ void insert_node (fs_nspace *ns, fs_node *node)
while (release_sem (ns->sem)==B_INTERRUPTED); while (release_sem (ns->sem)==B_INTERRUPTED);
} }
void remove_node (fs_nspace *ns, vnode_id vnid) void remove_node (fs_nspace *ns, ino_t vnid)
{ {
fs_node *current; fs_node *current;
fs_node *previous; fs_node *previous;
@@ -818,9 +818,9 @@ void remove_node (fs_nspace *ns, vnode_id vnid)
extern int extern int
#ifdef __HAIKU__ #ifdef __HAIKU__
fs_read_vnode(fs_nspace *ns, vnode_id vnid, fs_node **node, char r) fs_read_vnode(fs_nspace *ns, ino_t vnid, fs_node **node, char r)
#else #else
fs_read_vnode(fs_nspace *ns, vnode_id vnid, char r, fs_node **node) fs_read_vnode(fs_nspace *ns, ino_t vnid, char r, fs_node **node)
#endif #endif
{ {
fs_node *current; fs_node *current;
@@ -875,9 +875,9 @@ fs_get_vnode_name(fs_nspace *ns, fs_node *node, char *buffer, size_t len)
extern int extern int
#ifdef __HAIKU__ #ifdef __HAIKU__
fs_walk(fs_nspace *ns, fs_node *base, const char *file, vnode_id *vnid, int *type) fs_walk(fs_nspace *ns, fs_node *base, const char *file, ino_t *vnid, int *type)
#else #else
fs_walk(fs_nspace *ns, fs_node *base, const char *file, char **newpath, vnode_id *vnid) fs_walk(fs_nspace *ns, fs_node *base, const char *file, char **newpath, ino_t *vnid)
#endif #endif
{ {
bool isLink; bool isLink;
@@ -1000,7 +1000,7 @@ fs_readdir(fs_nspace *ns, fs_node *node, nfs_cookie *cookie, long *num, struct d
do do
{ {
vnode_id vnid; ino_t vnid;
char *filename; char *filename;
uint8 *replyBuf; uint8 *replyBuf;
struct XDROutPacket call; struct XDROutPacket call;
@@ -1241,9 +1241,9 @@ dprintf("nfs:gid!\n");
extern int extern int
#ifdef __HAIKU__ #ifdef __HAIKU__
fs_mount(nspace_id nsid, const char *devname, uint32 flags, const char *_parms, fs_nspace **data, vnode_id *vnid) fs_mount(nspace_id nsid, const char *devname, uint32 flags, const char *_parms, fs_nspace **data, ino_t *vnid)
#else #else
fs_mount(nspace_id nsid, const char *devname, ulong flags, const char *_parms, size_t len, fs_nspace **data, vnode_id *vnid) fs_mount(nspace_id nsid, const char *devname, ulong flags, const char *_parms, size_t len, fs_nspace **data, ino_t *vnid)
#endif #endif
{ {
#ifndef PARAMS_AS_STRING #ifndef PARAMS_AS_STRING
@@ -1742,9 +1742,9 @@ fs_wfsstat(fs_nspace *ns, struct fs_info *info, long mask)
extern int extern int
#ifdef __HAIKU__ #ifdef __HAIKU__
fs_create(fs_nspace *ns, fs_node *dir, const char *name, int omode, int perms, fs_file_cookie **cookie, vnode_id *vnid) fs_create(fs_nspace *ns, fs_node *dir, const char *name, int omode, int perms, fs_file_cookie **cookie, ino_t *vnid)
#else #else
fs_create(fs_nspace *ns, fs_node *dir, const char *name, int omode, int perms, vnode_id *vnid, fs_file_cookie **cookie) fs_create(fs_nspace *ns, fs_node *dir, const char *name, int omode, int perms, ino_t *vnid, fs_file_cookie **cookie)
#endif #endif
{ {
nfs_fhandle fhandle; nfs_fhandle fhandle;
@@ -44,7 +44,7 @@ struct mount_nfs_params
struct fs_node struct fs_node
{ {
vnode_id vnid; ino_t vnid;
struct nfs_fhandle fhandle; struct nfs_fhandle fhandle;
struct fs_node *next; struct fs_node *next;
}; };
@@ -62,7 +62,7 @@ struct fs_nspace
int32 xid; int32 xid;
vnode_id rootid; ino_t rootid;
sem_id sem; sem_id sem;
struct fs_node *first; struct fs_node *first;
@@ -90,11 +90,11 @@ typedef struct fs_file_cookie fs_file_cookie;
typedef struct nfs_fhandle nfs_fhandle; typedef struct nfs_fhandle nfs_fhandle;
#if 0 #if 0
int fs_read_vnode(fs_nspace *ns, vnode_id vnid, char r, fs_node **node); int fs_read_vnode(fs_nspace *ns, ino_t vnid, char r, fs_node **node);
int fs_write_vnode(fs_nspace *ns, fs_node *node, char r); int fs_write_vnode(fs_nspace *ns, fs_node *node, char r);
int fs_walk(fs_nspace *ns, fs_node *base, const char *file, char **newpath, int fs_walk(fs_nspace *ns, fs_node *base, const char *file, char **newpath,
vnode_id *vnid); ino_t *vnid);
int fs_opendir(fs_nspace *ns, fs_node *node, nfs_cookie **cookie); int fs_opendir(fs_nspace *ns, fs_node *node, nfs_cookie **cookie);
int fs_closedir(fs_nspace *ns, fs_node *node, nfs_cookie *cookie); int fs_closedir(fs_nspace *ns, fs_node *node, nfs_cookie *cookie);
@@ -105,7 +105,7 @@ int fs_readdir(fs_nspace *ns, fs_node *node, nfs_cookie *cookie, long *num,
int fs_free_dircookie(fs_nspace *ns, fs_node *node, nfs_cookie *cookie); int fs_free_dircookie(fs_nspace *ns, fs_node *node, nfs_cookie *cookie);
int fs_rstat(fs_nspace *ns, fs_node *node, struct stat *); int fs_rstat(fs_nspace *ns, fs_node *node, struct stat *);
int fs_mount(nspace_id nsid, const char *devname, ulong flags, int fs_mount(nspace_id nsid, const char *devname, ulong flags,
struct mount_nfs_params *parms, size_t len, fs_nspace **data, vnode_id *vnid); struct mount_nfs_params *parms, size_t len, fs_nspace **data, ino_t *vnid);
int fs_unmount(fs_nspace *ns); int fs_unmount(fs_nspace *ns);
int fs_rfsstat(fs_nspace *ns, struct fs_info *); int fs_rfsstat(fs_nspace *ns, struct fs_info *);
@@ -121,7 +121,7 @@ int fs_write(fs_nspace *ns, fs_node *node, fs_file_cookie *cookie, off_t pos,
int fs_wstat(fs_nspace *ns, fs_node *node, struct stat *, long mask); int fs_wstat(fs_nspace *ns, fs_node *node, struct stat *, long mask);
int fs_wfsstat(fs_nspace *ns, struct fs_info *, long mask); int fs_wfsstat(fs_nspace *ns, struct fs_info *, long mask);
int fs_create(fs_nspace *ns, fs_node *dir, const char *name, int fs_create(fs_nspace *ns, fs_node *dir, const char *name,
int omode, int perms, vnode_id *vnid, fs_file_cookie **cookie); int omode, int perms, ino_t *vnid, fs_file_cookie **cookie);
int fs_unlink(fs_nspace *ns, fs_node *dir, const char *name); int fs_unlink(fs_nspace *ns, fs_node *dir, const char *name);
int fs_remove_vnode(fs_nspace *ns, fs_node *node, char r); int fs_remove_vnode(fs_nspace *ns, fs_node *node, char r);
@@ -153,11 +153,11 @@ extern void get_nfs_attr(struct XDRInPacket *reply, struct stat *st);
extern status_t nfs_lookup(fs_nspace *ns, const nfs_fhandle *dir, const char *filename, nfs_fhandle *fhandle, struct stat *st); extern status_t nfs_lookup(fs_nspace *ns, const nfs_fhandle *dir, const char *filename, nfs_fhandle *fhandle, struct stat *st);
extern status_t nfs_truncate_file(fs_nspace *ns, const nfs_fhandle *fhandle, struct stat *st); extern status_t nfs_truncate_file(fs_nspace *ns, const nfs_fhandle *fhandle, struct stat *st);
nfs_fhandle handle_from_vnid (fs_nspace *ns, vnode_id vnid); nfs_fhandle handle_from_vnid (fs_nspace *ns, ino_t vnid);
extern status_t nfs_getattr(fs_nspace *ns, const nfs_fhandle *fhandle, struct stat *st); extern status_t nfs_getattr(fs_nspace *ns, const nfs_fhandle *fhandle, struct stat *st);
extern void insert_node(fs_nspace *ns, fs_node *node); extern void insert_node(fs_nspace *ns, fs_node *node);
extern void remove_node(fs_nspace *ns, vnode_id vnid); extern void remove_node(fs_nspace *ns, ino_t vnid);
extern int fs_access(void *ns, void *node, int mode); extern int fs_access(void *ns, void *node, int mode);
+12 -13
View File
@@ -121,10 +121,10 @@ fs_free_identify_partition_cookie(partition_data *partition, void *_cookie)
#ifdef __HAIKU__ #ifdef __HAIKU__
status_t status_t
fs_mount( mount_id nsid, const char *device, ulong flags, const char *args, void **data, vnode_id *vnid ) fs_mount(dev_t nsid, const char *device, ulong flags, const char *args, void **data, ino_t *vnid)
#else #else
int int
fs_mount(nspace_id nsid, const char *device, ulong flags, void *parms, size_t len, void **data, vnode_id *vnid) fs_mount(nspace_id nsid, const char *device, ulong flags, void *parms, size_t len, void **data, ino_t *vnid)
#endif #endif
{ {
nspace *ns; nspace *ns;
@@ -142,7 +142,6 @@ fs_mount(nspace_id nsid, const char *device, ulong flags, void *parms, size_t le
goto exit; goto exit;
} }
*ns = (nspace) { *ns = (nspace) {
.state = NF_FreeClustersOutdate | NF_FreeMFTOutdate, .state = NF_FreeClustersOutdate | NF_FreeMFTOutdate,
.show_sys_files = false, .show_sys_files = false,
@@ -326,10 +325,10 @@ exit:
#ifdef __HAIKU__ #ifdef __HAIKU__
status_t status_t
fs_walk(void *_ns, void *_base, const char *file, vnode_id *vnid,int *_type) fs_walk(void *_ns, void *_base, const char *file, ino_t *vnid,int *_type)
#else #else
int int
fs_walk(void *_ns, void *_base, const char *file, char **newpath, vnode_id *vnid) fs_walk(void *_ns, void *_base, const char *file, char **newpath, ino_t *vnid)
#endif #endif
{ {
nspace *ns = (nspace*)_ns; nspace *ns = (nspace*)_ns;
@@ -441,10 +440,10 @@ exit:
#ifdef __HAIKU__ #ifdef __HAIKU__
status_t status_t
fs_read_vnode(void *_ns, vnode_id vnid, void **node, bool reenter) fs_read_vnode(void *_ns, ino_t vnid, void **node, bool reenter)
#else #else
int int
fs_read_vnode(void *_ns, vnode_id vnid, char reenter, void **node) fs_read_vnode(void *_ns, ino_t vnid, char reenter, void **node)
#endif #endif
{ {
nspace *ns = (nspace*)_ns; nspace *ns = (nspace*)_ns;
@@ -876,10 +875,10 @@ exit:
#ifdef __HAIKU__ #ifdef __HAIKU__
status_t status_t
fs_create(void *_ns, void *_dir, const char *name, int omode, int perms, void **_cookie, vnode_id *_vnid) fs_create(void *_ns, void *_dir, const char *name, int omode, int perms, void **_cookie, ino_t *_vnid)
#else #else
int int
fs_create(void *_ns, void *_dir, const char *name, int omode, int perms, vnode_id *_vnid, void **_cookie) fs_create(void *_ns, void *_dir, const char *name, int omode, int perms, ino_t *_vnid, void **_cookie)
#endif #endif
{ {
nspace *ns = (nspace*)_ns; nspace *ns = (nspace*)_ns;
@@ -1427,7 +1426,7 @@ exit:
#ifdef __HAIKU__ #ifdef __HAIKU__
status_t status_t
fs_mkdir(void *_ns, void *_node, const char *name, int perms, vnode_id *_vnid) fs_mkdir(void *_ns, void *_node, const char *name, int perms, ino_t *_vnid)
#else #else
int int
fs_mkdir(void *_ns, void *_node, const char *name, int perms) fs_mkdir(void *_ns, void *_node, const char *name, int perms)
@@ -1484,7 +1483,7 @@ fs_mkdir(void *_ns, void *_node, const char *name, int perms)
ni = ntfs_create(bi, uname, uname_len, S_IFDIR); ni = ntfs_create(bi, uname, uname_len, S_IFDIR);
if (ni) { if (ni) {
vnode_id vnid = MREF( ni->mft_no ); ino_t vnid = MREF( ni->mft_no );
newNode = (vnode*)ntfs_calloc( sizeof(vnode) ); newNode = (vnode*)ntfs_calloc( sizeof(vnode) );
if(newNode==NULL) { if(newNode==NULL) {
@@ -1544,7 +1543,7 @@ fs_rename(void *_ns, void *_odir, const char *oldname, void *_ndir, const char *
vnode *onode = NULL; vnode *onode = NULL;
vnode *nnode = NULL; vnode *nnode = NULL;
vnode_id ovnid,nvnid; ino_t ovnid,nvnid;
ntfs_inode *oi = NULL; ntfs_inode *oi = NULL;
ntfs_inode *ndi = NULL; ntfs_inode *ndi = NULL;
@@ -1733,7 +1732,7 @@ exit:
status_t status_t
do_unlink(nspace *vol, vnode *dir, const char *name, bool isdir) do_unlink(nspace *vol, vnode *dir, const char *name, bool isdir)
{ {
vnode_id vnid; ino_t vnid;
vnode *node = NULL; vnode *node = NULL;
ntfs_inode *ni = NULL; ntfs_inode *ni = NULL;
ntfs_inode *bi = NULL; ntfs_inode *bi = NULL;
@@ -49,16 +49,16 @@ float fs_identify_partition(int fd, partition_data *partition, void **_cookie);
status_t fs_scan_partition(int fd, partition_data *partition, void *_cookie); status_t fs_scan_partition(int fd, partition_data *partition, void *_cookie);
void fs_free_identify_partition_cookie(partition_data *partition, void *_cookie); void fs_free_identify_partition_cookie(partition_data *partition, void *_cookie);
status_t fs_mount( mount_id nsid, const char *device, ulong flags, const char *args, void **data, vnode_id *vnid ); status_t fs_mount(dev_t nsid, const char *device, ulong flags, const char *args, void **data, ino_t *vnid);
status_t fs_create_symlink(void *_ns, void *_dir, const char *name, const char *target, int mode); status_t fs_create_symlink(void *_ns, void *_dir, const char *name, const char *target, int mode);
status_t fs_create(void *_ns, void *_dir, const char *name, int omode, int perms, void **_cookie, vnode_id *_vnid); status_t fs_create(void *_ns, void *_dir, const char *name, int omode, int perms, void **_cookie, ino_t *_vnid);
status_t fs_walk(void *_ns, void *_base, const char *file, vnode_id *vnid,int *_type); status_t fs_walk(void *_ns, void *_base, const char *file, ino_t *vnid,int *_type);
status_t fs_get_vnode_name(void *_ns, void *_node, char *buffer, size_t bufferSize); status_t fs_get_vnode_name(void *_ns, void *_node, char *buffer, size_t bufferSize);
status_t fs_unmount(void *_ns); status_t fs_unmount(void *_ns);
status_t fs_rfsstat(void *_ns, struct fs_info *); status_t fs_rfsstat(void *_ns, struct fs_info *);
status_t fs_wfsstat(void *_vol, const struct fs_info *fss, uint32 mask); status_t fs_wfsstat(void *_vol, const struct fs_info *fss, uint32 mask);
status_t fs_sync(void *_ns); status_t fs_sync(void *_ns);
status_t fs_read_vnode(void *_ns, vnode_id vnid, void **_node, bool reenter); status_t fs_read_vnode(void *_ns, ino_t vnid, void **_node, bool reenter);
status_t fs_write_vnode(void *_ns, void *_node, bool reenter); status_t fs_write_vnode(void *_ns, void *_node, bool reenter);
status_t fs_remove_vnode( void *_ns, void *_node, bool reenter ); status_t fs_remove_vnode( void *_ns, void *_node, bool reenter );
status_t fs_access( void *ns, void *node, int mode ); status_t fs_access( void *ns, void *node, int mode );
@@ -69,7 +69,7 @@ status_t fs_close(void *ns, void *node, void *cookie);
status_t fs_free_cookie(void *ns, void *node, void *cookie); status_t fs_free_cookie(void *ns, void *node, void *cookie);
status_t fs_read(void *_ns, void *_node, void *cookie, off_t pos, void *buf, size_t *len); status_t fs_read(void *_ns, void *_node, void *cookie, off_t pos, void *buf, size_t *len);
status_t fs_write(void *ns, void *node, void *cookie, off_t pos, const void *buf, size_t *len); status_t fs_write(void *ns, void *node, void *cookie, off_t pos, const void *buf, size_t *len);
status_t fs_mkdir(void *_ns, void *_node, const char *name, int perms, vnode_id *_vnid); status_t fs_mkdir(void *_ns, void *_node, const char *name, int perms, ino_t *_vnid);
status_t fs_rmdir(void *_ns, void *dir, const char *name); status_t fs_rmdir(void *_ns, void *dir, const char *name);
status_t fs_opendir(void* _ns, void* _node, void** cookie); status_t fs_opendir(void* _ns, void* _node, void** cookie);
status_t fs_readdir( void *_ns, void *_node, void *_cookie, struct dirent *buf, size_t bufsize, uint32 *num ); status_t fs_readdir( void *_ns, void *_node, void *_cookie, struct dirent *buf, size_t bufsize, uint32 *num );
@@ -83,10 +83,10 @@ status_t fs_unlink(void *_ns, void *_node, const char *name);
#else #else
int fs_mount(nspace_id nsid, const char *device, ulong flags, void *parms, size_t len, void **data, vnode_id *vnid); int fs_mount(nspace_id nsid, const char *device, ulong flags, void *parms, size_t len, void **data, ino_t *vnid);
int fs_unmount(void *_ns); int fs_unmount(void *_ns);
int fs_walk(void *_ns, void *_base, const char *file, char **newpath, vnode_id *vnid); int fs_walk(void *_ns, void *_base, const char *file, char **newpath, ino_t *vnid);
int fs_read_vnode(void *_ns, vnode_id vnid, char r, void **node); int fs_read_vnode(void *_ns, ino_t vnid, char r, void **node);
int fs_write_vnode(void *_ns, void *_node, char r); int fs_write_vnode(void *_ns, void *_node, char r);
int fs_rstat(void *_ns, void *_node, struct stat *st); int fs_rstat(void *_ns, void *_node, struct stat *st);
int fs_wstat(void *_vol, void *_node, struct stat *st, long mask); int fs_wstat(void *_vol, void *_node, struct stat *st, long mask);
@@ -108,7 +108,7 @@ int fs_mkdir(void *_ns, void *_node, const char *name, int perms);
int fs_rmdir(void *_ns, void *dir, const char *name); int fs_rmdir(void *_ns, void *dir, const char *name);
int fs_remove_vnode( void *_ns, void *_node, char reenter ); int fs_remove_vnode( void *_ns, void *_node, char reenter );
int fs_rename(void *_ns, void *_odir, const char *oldname, void *_ndir, const char *newname); int fs_rename(void *_ns, void *_odir, const char *oldname, void *_ndir, const char *newname);
int fs_create(void *_ns, void *_dir, const char *name, int omode, int perms, vnode_id *_vnid, void **_cookie); int fs_create(void *_ns, void *_dir, const char *name, int omode, int perms, ino_t *_vnid, void **_cookie);
int fs_unlink(void *_ns, void *_node, const char *name); int fs_unlink(void *_ns, void *_node, const char *name);
int fs_fsync(void *_ns, void *_node); int fs_fsync(void *_ns, void *_node);
int fs_sync(void *_ns); int fs_sync(void *_ns);
+14 -15
View File
@@ -14,7 +14,6 @@
#include <BeBuild.h> #include <BeBuild.h>
typedef dev_t nspace_id; typedef dev_t nspace_id;
typedef ino_t vnode_id;
/* UGLY UGLY UGLY */ /* UGLY UGLY UGLY */
#ifndef _DRIVERS_H #ifndef _DRIVERS_H
@@ -60,18 +59,18 @@ typedef struct selectsync selectsync;
struct attr_info; struct attr_info;
struct index_info; struct index_info;
typedef int op_read_vnode(void *ns, vnode_id vnid, char r, void **node); typedef int op_read_vnode(void *ns, ino_t vnid, char r, void **node);
typedef int op_write_vnode(void *ns, void *node, char r); typedef int op_write_vnode(void *ns, void *node, char r);
typedef int op_remove_vnode(void *ns, void *node, char r); typedef int op_remove_vnode(void *ns, void *node, char r);
typedef int op_secure_vnode(void *ns, void *node); typedef int op_secure_vnode(void *ns, void *node);
typedef int op_walk(void *ns, void *base, const char *file, char **newpath, typedef int op_walk(void *ns, void *base, const char *file, char **newpath,
vnode_id *vnid); ino_t *vnid);
typedef int op_access(void *ns, void *node, int mode); typedef int op_access(void *ns, void *node, int mode);
typedef int op_create(void *ns, void *dir, const char *name, typedef int op_create(void *ns, void *dir, const char *name,
int omode, int perms, vnode_id *vnid, void **cookie); int omode, int perms, ino_t *vnid, void **cookie);
typedef int op_mkdir(void *ns, void *dir, const char *name, int perms); typedef int op_mkdir(void *ns, void *dir, const char *name, int perms);
typedef int op_symlink(void *ns, void *dir, const char *name, typedef int op_symlink(void *ns, void *dir, const char *name,
const char *path); const char *path);
@@ -116,7 +115,7 @@ typedef int op_deselect(void *ns, void *node, void *cookie, uint8 event,
typedef int op_initialize(const char *devname, void *parms, size_t len); typedef int op_initialize(const char *devname, void *parms, size_t len);
typedef int op_mount(nspace_id nsid, const char *devname, ulong flags, typedef int op_mount(nspace_id nsid, const char *devname, ulong flags,
void *parms, size_t len, void **data, vnode_id *vnid); void *parms, size_t len, void **data, ino_t *vnid);
typedef int op_unmount(void *ns); typedef int op_unmount(void *ns);
typedef int op_sync(void *ns); typedef int op_sync(void *ns);
typedef int op_rfsstat(void *ns, struct fs_info *); typedef int op_rfsstat(void *ns, struct fs_info *);
@@ -225,20 +224,20 @@ extern int new_path(const char *path, char **copy);
extern void free_path(char *p); extern void free_path(char *p);
extern int notify_listener(int op, nspace_id nsid, extern int notify_listener(int op, nspace_id nsid,
vnode_id vnida, vnode_id vnidb, ino_t vnida, ino_t vnidb,
vnode_id vnidc, const char *name); ino_t vnidc, const char *name);
extern void notify_select_event(selectsync *sync, uint32 ref); extern void notify_select_event(selectsync *sync, uint32 ref);
extern int send_notification(port_id port, long token, extern int send_notification(port_id port, long token,
ulong what, long op, nspace_id nsida, ulong what, long op, nspace_id nsida,
nspace_id nsidb, vnode_id vnida, nspace_id nsidb, ino_t vnida,
vnode_id vnidb, vnode_id vnidc, ino_t vnidb, ino_t vnidc,
const char *name); const char *name);
extern int get_vnode(nspace_id nsid, vnode_id vnid, void **data); extern int get_vnode(nspace_id nsid, ino_t vnid, void **data);
extern int put_vnode(nspace_id nsid, vnode_id vnid); extern int put_vnode(nspace_id nsid, ino_t vnid);
extern int new_vnode(nspace_id nsid, vnode_id vnid, void *data); extern int new_vnode(nspace_id nsid, ino_t vnid, void *data);
extern int remove_vnode(nspace_id nsid, vnode_id vnid); extern int remove_vnode(nspace_id nsid, ino_t vnid);
extern int unremove_vnode(nspace_id nsid, vnode_id vnid); extern int unremove_vnode(nspace_id nsid, ino_t vnid);
extern int is_vnode_removed(nspace_id nsid, vnode_id vnid); extern int is_vnode_removed(nspace_id nsid, ino_t vnid);
extern _EXPORT vnode_ops fs_entry; extern _EXPORT vnode_ops fs_entry;
+1 -1
View File
@@ -112,7 +112,7 @@ typedef struct nspace
ntfs_volume *ntvol; ntfs_volume *ntvol;
char devicePath[MAX_PATH]; char devicePath[MAX_PATH];
#ifdef __HAIKU__ #ifdef __HAIKU__
mount_id id; dev_t id;
#else #else
nspace_id id; nspace_id id;
#endif #endif
+2 -2
View File
@@ -39,7 +39,7 @@ public:
inline void SetVolume(Volume *volume) { fVolume = volume; } inline void SetVolume(Volume *volume) { fVolume = volume; }
inline Volume *GetVolume() const { return fVolume; } inline Volume *GetVolume() const { return fVolume; }
inline vnode_id GetID() const { return fID; } inline ino_t GetID() const { return fID; }
status_t AddReference(); status_t AddReference();
void RemoveReference(); void RemoveReference();
@@ -108,7 +108,7 @@ public:
private: private:
Volume *fVolume; Volume *fVolume;
vnode_id fID; ino_t fID;
int32 fRefCount; int32 fRefCount;
mode_t fMode; mode_t fMode;
uid_t fUID; uid_t fUID;
@@ -21,7 +21,7 @@ public:
fNext = -1; fNext = -1;
} }
static inline uint32 HashFor(vnode_id id, const char *name) static inline uint32 HashFor(ino_t id, const char *name)
{ {
return node_child_hash(id, name); return node_child_hash(id, name);
} }
@@ -36,7 +36,7 @@ public:
return HashFor(fID, fChild->GetName()); return HashFor(fID, fChild->GetName());
} }
inline bool Equals(vnode_id id, const char *name) inline bool Equals(ino_t id, const char *name)
{ {
return (fID == id && !strcmp(fChild->GetName(), name)); return (fID == id && !strcmp(fChild->GetName(), name));
} }
@@ -53,7 +53,7 @@ public:
fChild = element.fChild; fChild = element.fChild;
} }
vnode_id fID; ino_t fID;
NodeChild *fChild; NodeChild *fChild;
}; };
@@ -67,17 +67,17 @@ public:
status_t InitCheck() const; status_t InitCheck() const;
status_t AddNodeChild(ParentNode *node, NodeChild *child); status_t AddNodeChild(ParentNode *node, NodeChild *child);
status_t AddNodeChild(vnode_id, NodeChild *child); status_t AddNodeChild(ino_t, NodeChild *child);
status_t RemoveNodeChild(ParentNode *node, NodeChild *child); status_t RemoveNodeChild(ParentNode *node, NodeChild *child);
status_t RemoveNodeChild(vnode_id id, NodeChild *child); status_t RemoveNodeChild(ino_t id, NodeChild *child);
status_t RemoveNodeChild(vnode_id id, const char *name); status_t RemoveNodeChild(ino_t id, const char *name);
NodeChild *GetNodeChild(vnode_id id, const char *name); NodeChild *GetNodeChild(ino_t id, const char *name);
protected: protected:
typedef NodeChildHashElement<ParentNode, NodeChild> Element; typedef NodeChildHashElement<ParentNode, NodeChild> Element;
private: private:
Element *_FindElement(vnode_id id, const char *name) const; Element *_FindElement(ino_t id, const char *name) const;
protected: protected:
OpenHashElementArray<Element> fElementArray; OpenHashElementArray<Element> fElementArray;
@@ -157,7 +157,7 @@ NodeChildTable<ParentNode, NodeChild>::AddNodeChild(ParentNode *node,
// AddNodeChild // AddNodeChild
template<typename ParentNode, typename NodeChild> template<typename ParentNode, typename NodeChild>
status_t status_t
NodeChildTable<ParentNode, NodeChild>::AddNodeChild(vnode_id id, NodeChildTable<ParentNode, NodeChild>::AddNodeChild(ino_t id,
NodeChild *child) NodeChild *child)
{ {
status_t error = (child ? B_OK : B_BAD_VALUE); status_t error = (child ? B_OK : B_BAD_VALUE);
@@ -187,7 +187,7 @@ NodeChildTable<ParentNode, NodeChild>::RemoveNodeChild(ParentNode *node,
// RemoveNodeChild // RemoveNodeChild
template<typename ParentNode, typename NodeChild> template<typename ParentNode, typename NodeChild>
status_t status_t
NodeChildTable<ParentNode, NodeChild>::RemoveNodeChild(vnode_id id, NodeChildTable<ParentNode, NodeChild>::RemoveNodeChild(ino_t id,
NodeChild *child) NodeChild *child)
{ {
status_t error = (child ? B_OK : B_BAD_VALUE); status_t error = (child ? B_OK : B_BAD_VALUE);
@@ -199,7 +199,7 @@ NodeChildTable<ParentNode, NodeChild>::RemoveNodeChild(vnode_id id,
// RemoveNodeChild // RemoveNodeChild
template<typename ParentNode, typename NodeChild> template<typename ParentNode, typename NodeChild>
status_t status_t
NodeChildTable<ParentNode, NodeChild>::RemoveNodeChild(vnode_id id, NodeChildTable<ParentNode, NodeChild>::RemoveNodeChild(ino_t id,
const char *name) const char *name)
{ {
status_t error = B_OK; status_t error = B_OK;
@@ -213,7 +213,7 @@ NodeChildTable<ParentNode, NodeChild>::RemoveNodeChild(vnode_id id,
// GetNodeChild // GetNodeChild
template<typename ParentNode, typename NodeChild> template<typename ParentNode, typename NodeChild>
NodeChild * NodeChild *
NodeChildTable<ParentNode, NodeChild>::GetNodeChild(vnode_id id, NodeChildTable<ParentNode, NodeChild>::GetNodeChild(ino_t id,
const char *name) const char *name)
{ {
NodeChild *child = NULL; NodeChild *child = NULL;
@@ -225,7 +225,7 @@ NodeChildTable<ParentNode, NodeChild>::GetNodeChild(vnode_id id,
// _FindElement // _FindElement
template<typename ParentNode, typename NodeChild> template<typename ParentNode, typename NodeChild>
typename NodeChildTable<ParentNode, NodeChild>::Element * typename NodeChildTable<ParentNode, NodeChild>::Element *
NodeChildTable<ParentNode, NodeChild>::_FindElement(vnode_id id, NodeChildTable<ParentNode, NodeChild>::_FindElement(ino_t id,
const char *name) const const char *name) const
{ {
Element *element = fTable.FindFirst(Element::HashFor(id, name)); Element *element = fTable.FindFirst(Element::HashFor(id, name));
@@ -51,7 +51,7 @@ NodeTable::RemoveNode(Node *node)
// RemoveNode // RemoveNode
status_t status_t
NodeTable::RemoveNode(vnode_id id) NodeTable::RemoveNode(ino_t id)
{ {
status_t error = B_OK; status_t error = B_OK;
if (NodeHashElement *element = _FindElement(id)) if (NodeHashElement *element = _FindElement(id))
@@ -63,7 +63,7 @@ NodeTable::RemoveNode(vnode_id id)
// GetNode // GetNode
Node * Node *
NodeTable::GetNode(vnode_id id) NodeTable::GetNode(ino_t id)
{ {
Node *node = NULL; Node *node = NULL;
if (NodeHashElement *element = _FindElement(id)) if (NodeHashElement *element = _FindElement(id))
@@ -82,7 +82,7 @@ NodeTable::GetAllocationInfo(AllocationInfo &info)
// _FindElement // _FindElement
NodeHashElement * NodeHashElement *
NodeTable::_FindElement(vnode_id id) const NodeTable::_FindElement(ino_t id) const
{ {
NodeHashElement *element NodeHashElement *element
= fNodes.FindFirst(NodeHashElement::HashForID(id)); = fNodes.FindFirst(NodeHashElement::HashForID(id));
@@ -15,7 +15,7 @@ public:
fNext = -1; fNext = -1;
} }
static inline uint32 HashForID(vnode_id id) static inline uint32 HashForID(ino_t id)
{ {
return uint32(id & 0xffffffff); return uint32(id & 0xffffffff);
} }
@@ -53,14 +53,14 @@ public:
status_t AddNode(Node *node); status_t AddNode(Node *node);
status_t RemoveNode(Node *node); status_t RemoveNode(Node *node);
status_t RemoveNode(vnode_id id); status_t RemoveNode(ino_t id);
Node *GetNode(vnode_id id); Node *GetNode(ino_t id);
// debugging // debugging
void GetAllocationInfo(AllocationInfo &info); void GetAllocationInfo(AllocationInfo &info);
private: private:
NodeHashElement *_FindElement(vnode_id id) const; NodeHashElement *_FindElement(ino_t id) const;
private: private:
OpenHashElementArray<NodeHashElement> fElementArray; OpenHashElementArray<NodeHashElement> fElementArray;
@@ -164,7 +164,7 @@ Volume::~Volume()
// Mount // Mount
status_t status_t
Volume::Mount(mount_id id) Volume::Mount(dev_t id)
{ {
Unmount(); Unmount();
@@ -369,7 +369,7 @@ Volume::PublishVNode(Node *node)
// GetVNode // GetVNode
status_t status_t
Volume::GetVNode(vnode_id id, Node **node) Volume::GetVNode(ino_t id, Node **node)
{ {
return (fMounted ? get_vnode(GetID(), id, (void**)node) : B_BAD_VALUE); return (fMounted ? get_vnode(GetID(), id, (void**)node) : B_BAD_VALUE);
} }
@@ -391,7 +391,7 @@ Volume::GetVNode(Node *node)
// PutVNode // PutVNode
status_t status_t
Volume::PutVNode(vnode_id id) Volume::PutVNode(ino_t id)
{ {
return (fMounted ? put_vnode(GetID(), id) : B_BAD_VALUE); return (fMounted ? put_vnode(GetID(), id) : B_BAD_VALUE);
} }
@@ -485,7 +485,7 @@ Volume::NodeRemoved(Node *node)
} }
// FindNode // FindNode
/*! \brief Finds the node identified by a vnode_id. /*! \brief Finds the node identified by a ino_t.
\note The method does not initialize the parent ID for non-directory nodes. \note The method does not initialize the parent ID for non-directory nodes.
@@ -494,7 +494,7 @@ Volume::NodeRemoved(Node *node)
\return \c B_OK, if everything went fine. \return \c B_OK, if everything went fine.
*/ */
status_t status_t
Volume::FindNode(vnode_id id, Node **node) Volume::FindNode(ino_t id, Node **node)
{ {
status_t error = (node ? B_OK : B_BAD_VALUE); status_t error = (node ? B_OK : B_BAD_VALUE);
if (error == B_OK) { if (error == B_OK) {
@@ -544,7 +544,7 @@ Volume::RemoveNodeListener(NodeListener *listener, Node *node)
// EntryAdded // EntryAdded
status_t status_t
Volume::EntryAdded(vnode_id id, Entry *entry) Volume::EntryAdded(ino_t id, Entry *entry)
{ {
status_t error = (entry ? B_OK : B_BAD_VALUE); status_t error = (entry ? B_OK : B_BAD_VALUE);
if (error == B_OK) { if (error == B_OK) {
@@ -575,7 +575,7 @@ Volume::EntryAdded(vnode_id id, Entry *entry)
// EntryRemoved // EntryRemoved
status_t status_t
Volume::EntryRemoved(vnode_id id, Entry *entry) Volume::EntryRemoved(ino_t id, Entry *entry)
{ {
status_t error = (entry ? B_OK : B_BAD_VALUE); status_t error = (entry ? B_OK : B_BAD_VALUE);
if (error == B_OK) { if (error == B_OK) {
@@ -606,7 +606,7 @@ Volume::EntryRemoved(vnode_id id, Entry *entry)
// FindEntry // FindEntry
status_t status_t
Volume::FindEntry(vnode_id id, const char *name, Entry **entry) Volume::FindEntry(ino_t id, const char *name, Entry **entry)
{ {
status_t error = (entry ? B_OK : B_BAD_VALUE); status_t error = (entry ? B_OK : B_BAD_VALUE);
if (error == B_OK) { if (error == B_OK) {
@@ -656,7 +656,7 @@ Volume::RemoveEntryListener(EntryListener *listener, Entry *entry)
// NodeAttributeAdded // NodeAttributeAdded
status_t status_t
Volume::NodeAttributeAdded(vnode_id id, Attribute *attribute) Volume::NodeAttributeAdded(ino_t id, Attribute *attribute)
{ {
status_t error = (attribute ? B_OK : B_BAD_VALUE); status_t error = (attribute ? B_OK : B_BAD_VALUE);
if (error == B_OK) { if (error == B_OK) {
@@ -674,7 +674,7 @@ Volume::NodeAttributeAdded(vnode_id id, Attribute *attribute)
// NodeAttributeRemoved // NodeAttributeRemoved
status_t status_t
Volume::NodeAttributeRemoved(vnode_id id, Attribute *attribute) Volume::NodeAttributeRemoved(ino_t id, Attribute *attribute)
{ {
status_t error = (attribute ? B_OK : B_BAD_VALUE); status_t error = (attribute ? B_OK : B_BAD_VALUE);
if (error == B_OK) { if (error == B_OK) {
@@ -701,7 +701,7 @@ Volume::NodeAttributeRemoved(vnode_id id, Attribute *attribute)
// FindNodeAttribute // FindNodeAttribute
status_t status_t
Volume::FindNodeAttribute(vnode_id id, const char *name, Attribute **attribute) Volume::FindNodeAttribute(ino_t id, const char *name, Attribute **attribute)
{ {
status_t error = (attribute ? B_OK : B_BAD_VALUE); status_t error = (attribute ? B_OK : B_BAD_VALUE);
if (error == B_OK) { if (error == B_OK) {
+15 -15
View File
@@ -52,7 +52,7 @@ class NodeListenerTree;
class NodeTable; class NodeTable;
class SizeIndex; class SizeIndex;
const vnode_id kRootParentID = 0; const ino_t kRootParentID = 0;
// NodeListenerValue // NodeListenerValue
class NodeListenerValue { class NodeListenerValue {
@@ -93,10 +93,10 @@ public:
Volume(); Volume();
~Volume(); ~Volume();
status_t Mount(mount_id nsid); status_t Mount(dev_t nsid);
status_t Unmount(); status_t Unmount();
mount_id GetID() const { return fID; } dev_t GetID() const { return fID; }
off_t GetBlockSize() const; off_t GetBlockSize() const;
off_t CountBlocks() const; off_t CountBlocks() const;
@@ -109,9 +109,9 @@ public:
status_t NewVNode(Node *node); status_t NewVNode(Node *node);
status_t PublishVNode(Node *node); status_t PublishVNode(Node *node);
status_t GetVNode(vnode_id id, Node **node); status_t GetVNode(ino_t id, Node **node);
status_t GetVNode(Node *node); status_t GetVNode(Node *node);
status_t PutVNode(vnode_id id); status_t PutVNode(ino_t id);
status_t PutVNode(Node *node); status_t PutVNode(Node *node);
status_t RemoveVNode(Node *node); status_t RemoveVNode(Node *node);
status_t UnremoveVNode(Node *node); status_t UnremoveVNode(Node *node);
@@ -119,23 +119,23 @@ public:
// node table and listeners // node table and listeners
status_t NodeAdded(Node *node); status_t NodeAdded(Node *node);
status_t NodeRemoved(Node *node); status_t NodeRemoved(Node *node);
status_t FindNode(vnode_id id, Node **node); status_t FindNode(ino_t id, Node **node);
status_t AddNodeListener(NodeListener *listener, Node *node, status_t AddNodeListener(NodeListener *listener, Node *node,
uint32 flags); uint32 flags);
status_t RemoveNodeListener(NodeListener *listener, Node *node); status_t RemoveNodeListener(NodeListener *listener, Node *node);
// entry table and listeners // entry table and listeners
status_t EntryAdded(vnode_id id, Entry *entry); status_t EntryAdded(ino_t id, Entry *entry);
status_t EntryRemoved(vnode_id id, Entry *entry); status_t EntryRemoved(ino_t id, Entry *entry);
status_t FindEntry(vnode_id id, const char *name, Entry **entry); status_t FindEntry(ino_t id, const char *name, Entry **entry);
status_t AddEntryListener(EntryListener *listener, Entry *entry, status_t AddEntryListener(EntryListener *listener, Entry *entry,
uint32 flags); uint32 flags);
status_t RemoveEntryListener(EntryListener *listener, Entry *entry); status_t RemoveEntryListener(EntryListener *listener, Entry *entry);
// node attribute table // node attribute table
status_t NodeAttributeAdded(vnode_id id, Attribute *attribute); status_t NodeAttributeAdded(ino_t id, Attribute *attribute);
status_t NodeAttributeRemoved(vnode_id id, Attribute *attribute); status_t NodeAttributeRemoved(ino_t id, Attribute *attribute);
status_t FindNodeAttribute(vnode_id id, const char *name, status_t FindNodeAttribute(ino_t id, const char *name,
Attribute **attribute); Attribute **attribute);
// indices // indices
@@ -153,7 +153,7 @@ public:
int32 type, const uint8 *oldKey, size_t oldLength, int32 type, const uint8 *oldKey, size_t oldLength,
const uint8 *newKey, size_t newLength); const uint8 *newKey, size_t newLength);
vnode_id NextNodeID() { return fNextNodeID++; } ino_t NextNodeID() { return fNextNodeID++; }
status_t AllocateBlock(size_t size, BlockReference **block); status_t AllocateBlock(size_t size, BlockReference **block);
void FreeBlock(BlockReference *block); void FreeBlock(BlockReference *block);
@@ -176,8 +176,8 @@ public:
private: private:
typedef DLList<Query> QueryList; typedef DLList<Query> QueryList;
mount_id fID; dev_t fID;
vnode_id fNextNodeID; ino_t fNextNodeID;
NodeTable *fNodeTable; NodeTable *fNodeTable;
DirectoryEntryTable *fDirectoryEntryTable; DirectoryEntryTable *fDirectoryEntryTable;
NodeAttributeTable *fNodeAttributeTable; NodeAttributeTable *fNodeAttributeTable;
@@ -79,8 +79,8 @@ notify_if_stat_changed(Volume *volume, Node *node)
// ramfs_mount // ramfs_mount
static status_t static status_t
ramfs_mount(mount_id nsid, const char* /*device*/, uint32 flags, ramfs_mount(dev_t nsid, const char* /*device*/, uint32 flags,
const char* /*args*/, fs_volume* _volume, vnode_id* rootID) const char* /*args*/, fs_volume* _volume, ino_t* rootID)
{ {
FUNCTION_START(); FUNCTION_START();
// parameters are ignored for now // parameters are ignored for now
@@ -176,7 +176,7 @@ ramfs_sync(fs_volume /*fs*/)
// ramfs_lookup // ramfs_lookup
static status_t static status_t
ramfs_lookup(fs_volume fs, fs_vnode _dir, const char *entryName, vnode_id *vnid, ramfs_lookup(fs_volume fs, fs_vnode _dir, const char *entryName, ino_t *vnid,
int *type) int *type)
{ {
// FUNCTION_START(); // FUNCTION_START();
@@ -223,7 +223,7 @@ SET_ERROR(error, error);
// ramfs_read_vnode // ramfs_read_vnode
static status_t static status_t
ramfs_read_vnode(fs_volume fs, vnode_id vnid, fs_vnode *node, bool reenter) ramfs_read_vnode(fs_volume fs, ino_t vnid, fs_vnode *node, bool reenter)
{ {
// FUNCTION_START(); // FUNCTION_START();
FUNCTION(("node: %Ld\n", vnid)); FUNCTION(("node: %Ld\n", vnid));
@@ -489,7 +489,7 @@ ramfs_unlink(fs_volume fs, fs_vnode _dir, const char *name)
NodeMTimeUpdater mTimeUpdater(dir); NodeMTimeUpdater mTimeUpdater(dir);
// check directory write permissions // check directory write permissions
error = dir->CheckPermissions(ACCESS_W); error = dir->CheckPermissions(ACCESS_W);
vnode_id nodeID = -1; ino_t nodeID = -1;
if (error == B_OK) { if (error == B_OK) {
// check if entry exists // check if entry exists
Node *node = NULL; Node *node = NULL;
@@ -761,7 +761,7 @@ private:
// ramfs_create // ramfs_create
static status_t static status_t
ramfs_create(fs_volume fs, fs_vnode _dir, const char *name, int openMode, ramfs_create(fs_volume fs, fs_vnode _dir, const char *name, int openMode,
int mode, fs_cookie *_cookie, vnode_id *vnid) int mode, fs_cookie *_cookie, ino_t *vnid)
{ {
// FUNCTION_START(); // FUNCTION_START();
FUNCTION(("name: `%s', open mode: %x, mode: %x\n", name, openMode, mode)); FUNCTION(("name: `%s', open mode: %x, mode: %x\n", name, openMode, mode));
@@ -1075,7 +1075,7 @@ vint32 DirectoryCookie::fNextIteratorID = 0;
// ramfs_create_dir // ramfs_create_dir
static status_t static status_t
ramfs_create_dir(fs_volume fs, fs_vnode _dir, const char *name, ramfs_create_dir(fs_volume fs, fs_vnode _dir, const char *name,
int mode, vnode_id *_vnid) int mode, ino_t *_vnid)
{ {
FUNCTION(("name: `%s', mode: %x\n", name, mode)); FUNCTION(("name: `%s', mode: %x\n", name, mode));
Volume *volume = (Volume*)fs; Volume *volume = (Volume*)fs;
@@ -1147,7 +1147,7 @@ ramfs_remove_dir(fs_volume fs, fs_vnode _dir, const char *name)
NodeMTimeUpdater mTimeUpdater(dir); NodeMTimeUpdater mTimeUpdater(dir);
// check directory write permissions // check directory write permissions
error = dir->CheckPermissions(ACCESS_W); error = dir->CheckPermissions(ACCESS_W);
vnode_id nodeID = -1; ino_t nodeID = -1;
if (error == B_OK) { if (error == B_OK) {
// check if entry exists // check if entry exists
Node *node = NULL; Node *node = NULL;
@@ -27,7 +27,7 @@
This class bundles all information relevant to a vnode, i.e. its ID, This class bundles all information relevant to a vnode, i.e. its ID,
the ID of its parent node and its stat data (for fast and convenient the ID of its parent node and its stat data (for fast and convenient
access). VNode knows how to convert between the VFS vnode_id access). VNode knows how to convert between the VFS ino_t
and the object+dir ID representation in ReiserFS. and the object+dir ID representation in ReiserFS.
*/ */
@@ -51,7 +51,7 @@ VNode::VNode(const VNode &node)
} }
// constructor // constructor
VNode::VNode(vnode_id id) VNode::VNode(ino_t id)
: fParentID(0), : fParentID(0),
fDirID(GetDirIDFor(id)), fDirID(GetDirIDFor(id)),
fObjectID(GetObjectIDFor(id)), fObjectID(GetObjectIDFor(id)),
@@ -75,7 +75,7 @@ VNode::~VNode()
// SetTo // SetTo
status_t status_t
VNode::SetTo(vnode_id id) VNode::SetTo(ino_t id)
{ {
return SetTo(GetDirIDFor(id), GetObjectIDFor(id)); return SetTo(GetDirIDFor(id), GetObjectIDFor(id));
} }
@@ -92,7 +92,7 @@ VNode::SetTo(uint32 dirID, uint32 objectID)
} }
// GetID // GetID
vnode_id ino_t
VNode::GetID() const VNode::GetID() const
{ {
return GetIDFor(fDirID, fObjectID); return GetIDFor(fDirID, fObjectID);
@@ -30,11 +30,11 @@ class VNode {
public: public:
VNode(); VNode();
VNode(const VNode &node); VNode(const VNode &node);
VNode(vnode_id id); VNode(ino_t id);
VNode(uint32 dirID, uint32 objectID); VNode(uint32 dirID, uint32 objectID);
~VNode(); ~VNode();
status_t SetTo(vnode_id id); status_t SetTo(ino_t id);
status_t SetTo(uint32 dirID, uint32 objectID); status_t SetTo(uint32 dirID, uint32 objectID);
// void SetParentDirID(uint32 id) { fParentDirID = id; } // void SetParentDirID(uint32 id) { fParentDirID = id; }
@@ -46,11 +46,11 @@ public:
void SetObjectID(uint32 id) { fObjectID = id; } void SetObjectID(uint32 id) { fObjectID = id; }
uint32 GetObjectID() const { return fObjectID; } uint32 GetObjectID() const { return fObjectID; }
vnode_id GetID() const; ino_t GetID() const;
void SetParentID(uint32 dirID, uint32 objectID); void SetParentID(uint32 dirID, uint32 objectID);
void SetParentID(vnode_id id) { fParentID = id; } void SetParentID(ino_t id) { fParentID = id; }
// only valid for dirs! // only valid for dirs!
vnode_id GetParentID() const { return fParentID; } ino_t GetParentID() const { return fParentID; }
StatData *GetStatData() { return &fStatData; } StatData *GetStatData() { return &fStatData; }
const StatData *GetStatData() const { return &fStatData; } const StatData *GetStatData() const { return &fStatData; }
@@ -61,16 +61,16 @@ public:
bool IsEsoteric() const { return fStatData.IsEsoteric(); } bool IsEsoteric() const { return fStatData.IsEsoteric(); }
// vnode ID <-> dir,object ID conversion // vnode ID <-> dir,object ID conversion
static vnode_id GetIDFor(uint32 dirID, uint32 objectID) static ino_t GetIDFor(uint32 dirID, uint32 objectID)
{ return (vnode_id)((uint64)dirID << 32 | (uint64)objectID); } { return (ino_t)((uint64)dirID << 32 | (uint64)objectID); }
static uint32 GetDirIDFor(vnode_id id) { return uint32((uint64)id >> 32); } static uint32 GetDirIDFor(ino_t id) { return uint32((uint64)id >> 32); }
static uint32 GetObjectIDFor(vnode_id id) static uint32 GetObjectIDFor(ino_t id)
{ return uint32((uint64)id & 0xffffffffULL); } { return uint32((uint64)id & 0xffffffffULL); }
VNode &operator=(const VNode &node); VNode &operator=(const VNode &node);
private: private:
vnode_id fParentID; ino_t fParentID;
uint32 fDirID; uint32 fDirID;
uint32 fObjectID; uint32 fObjectID;
StatData fStatData; StatData fStatData;
@@ -84,7 +84,7 @@ Volume::~Volume()
// Mount // Mount
status_t status_t
Volume::Mount(mount_id id, const char *path) Volume::Mount(dev_t id, const char *path)
{ {
Unmount(); Unmount();
status_t error = (path ? B_OK : B_BAD_VALUE); status_t error = (path ? B_OK : B_BAD_VALUE);
@@ -255,20 +255,20 @@ Volume::GetKeyOffsetForName(const char *name, int len, uint64 *result)
// GetVNode // GetVNode
status_t status_t
Volume::GetVNode(vnode_id id, VNode **node) Volume::GetVNode(ino_t id, VNode **node)
{ {
return get_vnode(GetID(), id, (void**)node); return get_vnode(GetID(), id, (void**)node);
} }
// PutVNode // PutVNode
status_t status_t
Volume::PutVNode(vnode_id id) Volume::PutVNode(ino_t id)
{ {
return put_vnode(GetID(), id); return put_vnode(GetID(), id);
} }
// FindVNode // FindVNode
/*! \brief Finds the node identified by a vnode_id. /*! \brief Finds the node identified by a ino_t.
\note The method does not initialize the parent ID for non-directory nodes. \note The method does not initialize the parent ID for non-directory nodes.
@@ -278,7 +278,7 @@ Volume::PutVNode(vnode_id id)
\return \c B_OK, if everything went fine. \return \c B_OK, if everything went fine.
*/ */
status_t status_t
Volume::FindVNode(vnode_id id, VNode *node) Volume::FindVNode(ino_t id, VNode *node)
{ {
return FindVNode(VNode::GetDirIDFor(id), VNode::GetObjectIDFor(id), node); return FindVNode(VNode::GetDirIDFor(id), VNode::GetObjectIDFor(id), node);
} }
@@ -460,7 +460,7 @@ PRINT(("Volume::FindEntry(`%s') done: %s\n", path, strerror(error)));
// IsNegativeEntry // IsNegativeEntry
bool bool
Volume::IsNegativeEntry(vnode_id id) Volume::IsNegativeEntry(ino_t id)
{ {
for (int32 i = fNegativeEntries.CountItems() - 1; i >= 0; i--) { for (int32 i = fNegativeEntries.CountItems() - 1; i >= 0; i--) {
if (fNegativeEntries.ItemAt(i) == id) if (fNegativeEntries.ItemAt(i) == id)
@@ -41,10 +41,10 @@ public:
Volume(); Volume();
~Volume(); ~Volume();
status_t Mount(mount_id nsid, const char *path); status_t Mount(dev_t nsid, const char *path);
status_t Unmount(); status_t Unmount();
mount_id GetID() const { return fID; } dev_t GetID() const { return fID; }
off_t GetBlockSize() const; off_t GetBlockSize() const;
off_t CountBlocks() const; off_t CountBlocks() const;
@@ -60,10 +60,10 @@ public:
VNode *GetRootVNode() const { return fRootVNode; } VNode *GetRootVNode() const { return fRootVNode; }
status_t GetVNode(vnode_id id, VNode **node); status_t GetVNode(ino_t id, VNode **node);
status_t PutVNode(vnode_id id); status_t PutVNode(ino_t id);
status_t FindVNode(vnode_id id, VNode *node); status_t FindVNode(ino_t id, VNode *node);
status_t FindVNode(uint32 dirID, uint32 objectID, VNode *node); status_t FindVNode(uint32 dirID, uint32 objectID, VNode *node);
status_t FindDirEntry(VNode *dir, const char *entryName, status_t FindDirEntry(VNode *dir, const char *entryName,
@@ -76,7 +76,7 @@ public:
status_t FindEntry(const VNode *rootDir, const char *path, status_t FindEntry(const VNode *rootDir, const char *path,
VNode *foundNode); VNode *foundNode);
bool IsNegativeEntry(vnode_id id); bool IsNegativeEntry(ino_t id);
bool IsNegativeEntry(uint32 dirID, uint32 objectID); bool IsNegativeEntry(uint32 dirID, uint32 objectID);
bool GetHideEsoteric() const; bool GetHideEsoteric() const;
@@ -89,7 +89,7 @@ private:
void _InitNegativeEntries(); void _InitNegativeEntries();
private: private:
mount_id fID; dev_t fID;
int fDevice; int fDevice;
BlockCache *fBlockCache; BlockCache *fBlockCache;
Tree *fTree; Tree *fTree;
@@ -98,7 +98,7 @@ private:
VNode *fRootVNode; VNode *fRootVNode;
char *fDeviceName; char *fDeviceName;
Settings *fSettings; Settings *fSettings;
List<vnode_id> fNegativeEntries; List<ino_t> fNegativeEntries;
}; };
#endif // VOLUME_H #endif // VOLUME_H
@@ -55,8 +55,8 @@ inline static bool is_user_in_group(gid_t gid);
// reiserfs_mount // reiserfs_mount
static status_t static status_t
reiserfs_mount(mount_id nsid, const char *device, uint32 flags, reiserfs_mount(dev_t nsid, const char *device, uint32 flags,
const char *parameters, fs_volume *data, vnode_id *rootID) const char *parameters, fs_volume *data, ino_t *rootID)
{ {
TOUCH(flags); TOUCH(parameters); TOUCH(flags); TOUCH(parameters);
FUNCTION_START(); FUNCTION_START();
@@ -118,7 +118,7 @@ reiserfs_read_fs_info(fs_volume fs, struct fs_info *info)
// reiserfs_lookup // reiserfs_lookup
static status_t static status_t
reiserfs_lookup(fs_volume fs, fs_vnode _dir, const char *entryName, reiserfs_lookup(fs_volume fs, fs_vnode _dir, const char *entryName,
vnode_id *vnid, int *type) ino_t *vnid, int *type)
{ {
// FUNCTION_START(); // FUNCTION_START();
Volume *volume = (Volume*)fs; Volume *volume = (Volume*)fs;
@@ -170,7 +170,7 @@ FUNCTION(("dir: (%Ld: %lu, %lu), entry: `%s'\n", dir->GetID(), dir->GetDirID(),
// reiserfs_read_vnode // reiserfs_read_vnode
static status_t static status_t
reiserfs_read_vnode(fs_volume fs, vnode_id vnid, fs_vnode *node, bool reenter) reiserfs_read_vnode(fs_volume fs, ino_t vnid, fs_vnode *node, bool reenter)
{ {
TOUCH(reenter); TOUCH(reenter);
// FUNCTION_START(); // FUNCTION_START();
@@ -1,6 +1,6 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered // This software is part of the Haiku distribution and is covered
// by the OpenBeOS license. // by the MIT license.
// //
// Copyright (c) 2003 Tyler Dauwalder, [email protected] // Copyright (c) 2003 Tyler Dauwalder, [email protected]
//--------------------------------------------------------------------- //---------------------------------------------------------------------
@@ -21,7 +21,7 @@
using namespace Udf; using namespace Udf;
status_t status_t
DirectoryIterator::GetNextEntry(char *name, uint32 *length, vnode_id *id) DirectoryIterator::GetNextEntry(char *name, uint32 *length, ino_t *id)
{ {
DEBUG_INIT_ETC("DirectoryIterator", DEBUG_INIT_ETC("DirectoryIterator",
("name: %p, length: %p, id: %p", name, length, id)); ("name: %p, length: %p, id: %p", name, length, id));
@@ -1,6 +1,6 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered // This software is part of the Haiku distribution and is covered
// by the OpenBeOS license. // by the MIT license.
// //
// Copyright (c) 2003 Tyler Dauwalder, [email protected] // Copyright (c) 2003 Tyler Dauwalder, [email protected]
//--------------------------------------------------------------------- //---------------------------------------------------------------------
@@ -31,7 +31,7 @@ class Icb;
class DirectoryIterator { class DirectoryIterator {
public: public:
status_t GetNextEntry(char *name, uint32 *length, vnode_id *id); status_t GetNextEntry(char *name, uint32 *length, ino_t *id);
void Rewind(); void Rewind();
Icb* Parent() { return fParent; } Icb* Parent() { return fParent; }
+4 -4
View File
@@ -1,6 +1,6 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered // This software is part of the Haiku distribution and is covered
// by the OpenBeOS license. // by the MIT license.
// //
// Copyright (c) 2003 Tyler Dauwalder, [email protected] // Copyright (c) 2003 Tyler Dauwalder, [email protected]
//--------------------------------------------------------------------- //---------------------------------------------------------------------
@@ -136,7 +136,7 @@ Icb::GetDirectoryIterator(DirectoryIterator **iterator)
} }
status_t status_t
Icb::Find(const char *filename, vnode_id *id) Icb::Find(const char *filename, ino_t *id)
{ {
DEBUG_INIT_ETC("Icb", DEBUG_INIT_ETC("Icb",
("filename: `%s', id: %p", filename, id)); ("filename: `%s', id: %p", filename, id));
@@ -147,7 +147,7 @@ Icb::Find(const char *filename, vnode_id *id)
DirectoryIterator *i; DirectoryIterator *i;
status_t error = GetDirectoryIterator(&i); status_t error = GetDirectoryIterator(&i);
if (!error) { if (!error) {
vnode_id entryId; ino_t entryId;
uint32 length = B_FILE_NAME_LENGTH; uint32 length = B_FILE_NAME_LENGTH;
char name[B_FILE_NAME_LENGTH]; char name[B_FILE_NAME_LENGTH];
+5 -5
View File
@@ -1,6 +1,6 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered // This software is part of the Haiku distribution and is covered
// by the OpenBeOS license. // by the MIT license.
// //
// Copyright (c) 2003 Tyler Dauwalder, [email protected] // Copyright (c) 2003 Tyler Dauwalder, [email protected]
//--------------------------------------------------------------------- //---------------------------------------------------------------------
@@ -67,7 +67,7 @@ class Icb {
public: public:
Icb(Volume *volume, long_address address); Icb(Volume *volume, long_address address);
status_t InitCheck(); status_t InitCheck();
vnode_id Id() { return fId; } ino_t Id() { return fId; }
// categorization // categorization
uint8 Type() { return IcbTag().file_type(); } uint8 Type() { return IcbTag().file_type(); }
@@ -90,7 +90,7 @@ public:
// for directories only // for directories only
status_t GetDirectoryIterator(DirectoryIterator **iterator); status_t GetDirectoryIterator(DirectoryIterator **iterator);
status_t Find(const char *filename, vnode_id *id); status_t Find(const char *filename, ino_t *id);
Volume* GetVolume() const { return fVolume; } Volume* GetVolume() const { return fVolume; }
@@ -118,7 +118,7 @@ private:
Volume *fVolume; Volume *fVolume;
CachedBlock fData; CachedBlock fData;
status_t fInitStatus; status_t fInitStatus;
vnode_id fId; ino_t fId;
SinglyLinkedList<DirectoryIterator*> fIteratorList; SinglyLinkedList<DirectoryIterator*> fIteratorList;
/* [zooey]: gcc-2.95.3 requires the explicit namespace here, otherwise /* [zooey]: gcc-2.95.3 requires the explicit namespace here, otherwise
it complains about a syntax error(!). This is most probably a bug. */ it complains about a syntax error(!). This is most probably a bug. */
@@ -1,6 +1,6 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered // This software is part of the Haiku distribution and is covered
// by the OpenBeOS license. // by the MIT license.
// //
// Copyright (c) 2003 Tyler Dauwalder, [email protected] // Copyright (c) 2003 Tyler Dauwalder, [email protected]
//--------------------------------------------------------------------- //---------------------------------------------------------------------
@@ -24,9 +24,9 @@ extern "C" {
namespace Udf { namespace Udf {
long_address long_address
to_long_address(vnode_id id, uint32 length) to_long_address(ino_t id, uint32 length)
{ {
DEBUG_INIT_ETC(NULL, ("vnode_id: %Ld (0x%Lx), length: %ld", id, id, length)); DEBUG_INIT_ETC(NULL, ("ino_t: %Ld (0x%Lx), length: %ld", id, id, length));
long_address result; long_address result;
result.set_block((id >> 16) & 0xffffffff); result.set_block((id >> 16) & 0xffffffff);
result.set_partition(id & 0xffff); result.set_partition(id & 0xffff);
@@ -35,17 +35,17 @@ to_long_address(vnode_id id, uint32 length)
return result; return result;
} }
vnode_id ino_t
to_vnode_id(long_address address) to_vnode_id(long_address address)
{ {
DEBUG_INIT(NULL); DEBUG_INIT(NULL);
vnode_id result = address.block(); ino_t result = address.block();
result <<= 16; result <<= 16;
result |= address.partition(); result |= address.partition();
PRINT(("block: %ld, 0x%lx\n", address.block(), address.block())); PRINT(("block: %ld, 0x%lx\n", address.block(), address.block()));
PRINT(("partition: %d, 0x%x\n", address.partition(), address.partition())); PRINT(("partition: %d, 0x%x\n", address.partition(), address.partition()));
PRINT(("length: %ld, 0x%lx\n", address.length(), address.length())); PRINT(("length: %ld, 0x%lx\n", address.length(), address.length()));
PRINT(("vnode_id: %Ld, 0x%Lx\n", result, result)); PRINT(("ino_t: %Ld, 0x%Lx\n", result, result));
return result; return result;
} }
+4 -4
View File
@@ -1,6 +1,6 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered // This software is part of the Haiku distribution and is covered
// by the OpenBeOS license. // by the MIT license.
// //
// Copyright (c) 2003 Tyler Dauwalder, [email protected] // Copyright (c) 2003 Tyler Dauwalder, [email protected]
//--------------------------------------------------------------------- //---------------------------------------------------------------------
@@ -27,9 +27,9 @@ extern "C" {
namespace Udf { namespace Udf {
long_address to_long_address(vnode_id id, uint32 length = 0); long_address to_long_address(ino_t id, uint32 length = 0);
vnode_id to_vnode_id(long_address address); ino_t to_vnode_id(long_address address);
time_t make_time(timestamp &timestamp); time_t make_time(timestamp &timestamp);
+14 -16
View File
@@ -2,7 +2,6 @@
Copyright 1999-2001, Be Incorporated. All Rights Reserved. Copyright 1999-2001, Be Incorporated. All Rights Reserved.
This file may be used under the terms of the Be Sample Code License. This file may be used under the terms of the Be Sample Code License.
*/ */
#ifndef _FSPROTO_H #ifndef _FSPROTO_H
#define _FSPROTO_H #define _FSPROTO_H
@@ -20,7 +19,6 @@
#include <Drivers.h> #include <Drivers.h>
typedef dev_t nspace_id; typedef dev_t nspace_id;
typedef ino_t vnode_id;
/* /*
* PUBLIC PART OF THE FILE SYSTEM PROTOCOL * PUBLIC PART OF THE FILE SYSTEM PROTOCOL
@@ -63,7 +61,7 @@ typedef ino_t vnode_id;
struct attr_info; struct attr_info;
struct index_info; struct index_info;
typedef int op_read_vnode(void *ns, vnode_id vnid, char r, void **node); typedef int op_read_vnode(void *ns, ino_t vnid, char r, void **node);
typedef int op_write_vnode(void *ns, void *node, char r); typedef int op_write_vnode(void *ns, void *node, char r);
typedef int op_remove_vnode(void *ns, void *node, char r); typedef int op_remove_vnode(void *ns, void *node, char r);
typedef int op_secure_vnode(void *ns, void *node); typedef int op_secure_vnode(void *ns, void *node);
@@ -71,12 +69,12 @@ typedef int op_wake_vnode(void *ns, void *node);
typedef int op_suspend_vnode(void *ns, void *node); typedef int op_suspend_vnode(void *ns, void *node);
typedef int op_walk(void *ns, void *base, const char *file, char **newpath, typedef int op_walk(void *ns, void *base, const char *file, char **newpath,
vnode_id *vnid); ino_t *vnid);
typedef int op_access(void *ns, void *node, int mode); typedef int op_access(void *ns, void *node, int mode);
typedef int op_create(void *ns, void *dir, const char *name, typedef int op_create(void *ns, void *dir, const char *name,
int omode, int perms, vnode_id *vnid, void **cookie); int omode, int perms, ino_t *vnid, void **cookie);
typedef int op_mkdir(void *ns, void *dir, const char *name, int perms); typedef int op_mkdir(void *ns, void *dir, const char *name, int perms);
typedef int op_symlink(void *ns, void *dir, const char *name, typedef int op_symlink(void *ns, void *dir, const char *name,
const char *path); const char *path);
@@ -121,7 +119,7 @@ typedef int op_deselect(void *ns, void *node, void *cookie, uint8 event,
typedef int op_initialize(const char *devname, void *parms, size_t len); typedef int op_initialize(const char *devname, void *parms, size_t len);
typedef int op_mount(nspace_id nsid, const char *devname, ulong flags, typedef int op_mount(nspace_id nsid, const char *devname, ulong flags,
void *parms, size_t len, void **data, vnode_id *vnid); void *parms, size_t len, void **data, ino_t *vnid);
typedef int op_unmount(void *ns); typedef int op_unmount(void *ns);
typedef int op_sync(void *ns); typedef int op_sync(void *ns);
typedef int op_rfsstat(void *ns, struct fs_info *); typedef int op_rfsstat(void *ns, struct fs_info *);
@@ -237,19 +235,19 @@ extern _IMPEXP_KERNEL int new_path(const char *path, char **copy);
extern _IMPEXP_KERNEL void free_path(char *p); extern _IMPEXP_KERNEL void free_path(char *p);
extern _IMPEXP_KERNEL int notify_listener(int op, nspace_id nsid, extern _IMPEXP_KERNEL int notify_listener(int op, nspace_id nsid,
vnode_id vnida, vnode_id vnidb, ino_t vnida, ino_t vnidb,
vnode_id vnidc, const char *name); ino_t vnidc, const char *name);
extern _IMPEXP_KERNEL int send_notification(port_id port, long token, extern _IMPEXP_KERNEL int send_notification(port_id port, long token,
ulong what, long op, nspace_id nsida, ulong what, long op, nspace_id nsida,
nspace_id nsidb, vnode_id vnida, nspace_id nsidb, ino_t vnida,
vnode_id vnidb, vnode_id vnidc, ino_t vnidb, ino_t vnidc,
const char *name); const char *name);
extern _IMPEXP_KERNEL int get_vnode(nspace_id nsid, vnode_id vnid, void **data); extern _IMPEXP_KERNEL int get_vnode(nspace_id nsid, ino_t vnid, void **data);
extern _IMPEXP_KERNEL int put_vnode(nspace_id nsid, vnode_id vnid); extern _IMPEXP_KERNEL int put_vnode(nspace_id nsid, ino_t vnid);
extern _IMPEXP_KERNEL int new_vnode(nspace_id nsid, vnode_id vnid, void *data); extern _IMPEXP_KERNEL int new_vnode(nspace_id nsid, ino_t vnid, void *data);
extern _IMPEXP_KERNEL int remove_vnode(nspace_id nsid, vnode_id vnid); extern _IMPEXP_KERNEL int remove_vnode(nspace_id nsid, ino_t vnid);
extern _IMPEXP_KERNEL int unremove_vnode(nspace_id nsid, vnode_id vnid); extern _IMPEXP_KERNEL int unremove_vnode(nspace_id nsid, ino_t vnid);
extern _IMPEXP_KERNEL int is_vnode_removed(nspace_id nsid, vnode_id vnid); extern _IMPEXP_KERNEL int is_vnode_removed(nspace_id nsid, ino_t vnid);
#ifdef __cplusplus #ifdef __cplusplus
} }
+10 -10
View File
@@ -1,6 +1,6 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered // This software is part of the Haiku distribution and is covered
// by the OpenBeOS license. // by the MIT license.
// //
// Copyright (c) 2003 Tyler Dauwalder, [email protected] // Copyright (c) 2003 Tyler Dauwalder, [email protected]
// Mucho respecto to Axel Dörfler and his BFS implementation, from // Mucho respecto to Axel Dörfler and his BFS implementation, from
@@ -47,7 +47,7 @@ extern "C" {
extern "C" { extern "C" {
// general/volume stuff // general/volume stuff
static int udf_mount(nspace_id nsid, const char *device, ulong flags, static int udf_mount(nspace_id nsid, const char *device, ulong flags,
void *parms, size_t len, void **data, vnode_id *vnid); void *parms, size_t len, void **data, ino_t *vnid);
static int udf_unmount(void *_ns); static int udf_unmount(void *_ns);
static int udf_read_fs_stat(void *_ns, struct fs_info *); static int udf_read_fs_stat(void *_ns, struct fs_info *);
static int udf_write_fs_stat(void *ns, struct fs_info *, long mode); static int udf_write_fs_stat(void *ns, struct fs_info *, long mode);
@@ -55,12 +55,12 @@ extern "C" {
static int udf_sync(void *ns); static int udf_sync(void *ns);
static int udf_read_vnode(void *_ns, vnode_id vnid, char r, void **node); static int udf_read_vnode(void *_ns, ino_t vnid, char r, void **node);
static int udf_release_vnode(void *_ns, void *_node, char r); static int udf_release_vnode(void *_ns, void *_node, char r);
static int udf_remove_vnode(void *ns, void *node, char r); static int udf_remove_vnode(void *ns, void *node, char r);
static int udf_walk(void *_ns, void *_base, const char *file, static int udf_walk(void *_ns, void *_base, const char *file,
char **newpath, vnode_id *vnid); char **newpath, ino_t *vnid);
static int udf_ioctl(void *ns, void *node, void *cookie, int cmd, void *buf,size_t len); static int udf_ioctl(void *ns, void *node, void *cookie, int cmd, void *buf,size_t len);
static int udf_setflags(void *ns, void *node, void *cookie, int flags); static int udf_setflags(void *ns, void *node, void *cookie, int flags);
@@ -73,7 +73,7 @@ extern "C" {
// file stuff // file stuff
static int udf_create(void *ns, void *dir, const char *name, static int udf_create(void *ns, void *dir, const char *name,
int perms, int omode, vnode_id *vnid, void **cookie); int perms, int omode, ino_t *vnid, void **cookie);
static int udf_symlink(void *ns, void *dir, const char *name, static int udf_symlink(void *ns, void *dir, const char *name,
const char *path); const char *path);
static int udf_link(void *ns, void *dir, const char *name, void *node); static int udf_link(void *ns, void *dir, const char *name, void *node);
@@ -239,7 +239,7 @@ int32 api_version = B_CUR_FS_API_VERSION;
*/ */
int int
udf_mount(nspace_id nsid, const char *name, ulong flags, void *parms, udf_mount(nspace_id nsid, const char *name, ulong flags, void *parms,
size_t parmsLength, void **volumeCookie, vnode_id *rootID) size_t parmsLength, void **volumeCookie, ino_t *rootID)
{ {
INITIALIZE_DEBUGGING_OUTPUT_FILE("/boot/home/Desktop/udf_debug.txt"); INITIALIZE_DEBUGGING_OUTPUT_FILE("/boot/home/Desktop/udf_debug.txt");
DEBUG_INIT_ETC(NULL, ("name: `%s'", name)); DEBUG_INIT_ETC(NULL, ("name: `%s'", name));
@@ -397,7 +397,7 @@ udf_sync(void *ns)
int int
udf_read_vnode(void *ns, vnode_id id, char reenter, void **node) udf_read_vnode(void *ns, ino_t id, char reenter, void **node)
{ {
DEBUG_INIT_ETC(NULL, ("id: %Ld, reenter: %s", id, (reenter ? "true" : "false"))); DEBUG_INIT_ETC(NULL, ("id: %Ld, reenter: %s", id, (reenter ? "true" : "false")));
@@ -467,7 +467,7 @@ udf_suspend_vnode(void *ns, void *node)
int int
udf_walk(void *ns, void *_dir, const char *filename, char **resolvedPath, vnode_id *vnodeId) udf_walk(void *ns, void *_dir, const char *filename, char **resolvedPath, ino_t *vnodeId)
{ {
DEBUG_INIT_ETC(NULL, ("dir: %p, filename = `%s'", _dir, filename)); DEBUG_INIT_ETC(NULL, ("dir: %p, filename = `%s'", _dir, filename));
@@ -591,7 +591,7 @@ udf_write_stat(void *ns, void *node, struct stat *stat, long mask)
int int
udf_create(void *ns, void *dir, const char *name, int omode, int mode, udf_create(void *ns, void *dir, const char *name, int omode, int mode,
vnode_id *newID, void **newNode) ino_t *newID, void **newNode)
{ {
DEBUG_INIT(NULL); DEBUG_INIT(NULL);
// FUNCTION_START(("name: `%s\', perms: %d, omode: %d\n", name, mode, omode)); // FUNCTION_START(("name: `%s\', perms: %d, omode: %d\n", name, mode, omode));
@@ -179,7 +179,7 @@ FileSystem::GetPortPool()
// Mount // Mount
status_t status_t
FileSystem::Mount(mount_id id, const char* device, uint32 flags, FileSystem::Mount(dev_t id, const char* device, uint32 flags,
const char* parameters, Volume** _volume) const char* parameters, Volume** _volume)
{ {
// check initialization and parameters // check initialization and parameters
@@ -257,7 +257,7 @@ FileSystem::VolumeUnmounted(Volume* volume)
// GetVolume // GetVolume
Volume* Volume*
FileSystem::GetVolume(mount_id id) FileSystem::GetVolume(dev_t id)
{ {
AutoLocker<Locker> _(fVolumeLock); AutoLocker<Locker> _(fVolumeLock);
for (Vector<Volume*>::Iterator it = fVolumes.Begin(); for (Vector<Volume*>::Iterator it = fVolumes.Begin();
@@ -35,14 +35,14 @@ public:
RequestPortPool* GetPortPool(); RequestPortPool* GetPortPool();
status_t Mount(mount_id id, const char* device, status_t Mount(dev_t id, const char* device,
ulong flags, const char* parameters, ulong flags, const char* parameters,
Volume** volume); Volume** volume);
// status_t Initialize(const char* deviceName, // status_t Initialize(const char* deviceName,
// const char* parameters, size_t len); // const char* parameters, size_t len);
void VolumeUnmounted(Volume* volume); void VolumeUnmounted(Volume* volume);
Volume* GetVolume(mount_id id); Volume* GetVolume(dev_t id);
const IOCtlInfo* GetIOCtlInfo(int command) const; const IOCtlInfo* GetIOCtlInfo(int command) const;
@@ -458,7 +458,7 @@ KernelRequestHandler::_HandleRequest(GetVNodeRemovedRequest* request)
// _GetVolume // _GetVolume
status_t status_t
KernelRequestHandler::_GetVolume(mount_id id, Volume** volume) KernelRequestHandler::_GetVolume(dev_t id, Volume** volume)
{ {
if (fVolume) { if (fVolume) {
if (fVolume->GetID() != id) { if (fVolume->GetID() != id) {
@@ -60,7 +60,7 @@ private:
status_t _HandleRequest(UnremoveVNodeRequest* request); status_t _HandleRequest(UnremoveVNodeRequest* request);
status_t _HandleRequest(GetVNodeRemovedRequest* request); status_t _HandleRequest(GetVNodeRemovedRequest* request);
status_t _GetVolume(mount_id id, Volume** volume); status_t _GetVolume(dev_t id, Volume** volume);
private: private:
FileSystem* fFileSystem; FileSystem* fFileSystem;
@@ -32,12 +32,12 @@
static const bigtime_t kUserlandServerlandPortTimeout = 10000000; // 10s static const bigtime_t kUserlandServerlandPortTimeout = 10000000; // 10s
// MountVNodeMap // MountVNodeMap
struct Volume::MountVNodeMap : public HashMap<HashKey64<vnode_id>, void*> { struct Volume::MountVNodeMap : public HashMap<HashKey64<ino_t>, void*> {
}; };
// VNodeCountMap // VNodeCountMap
struct Volume::VNodeCountMap struct Volume::VNodeCountMap
: public SynchronizedHashMap<HashKey64<vnode_id>, int32*> { : public SynchronizedHashMap<HashKey64<ino_t>, int32*> {
}; };
// AutoIncrementer // AutoIncrementer
@@ -66,7 +66,7 @@ private:
}; };
// constructor // constructor
Volume::Volume(FileSystem* fileSystem, mount_id id) Volume::Volume(FileSystem* fileSystem, dev_t id)
: Referencable(true), : Referencable(true),
fFileSystem(fileSystem), fFileSystem(fileSystem),
fID(id), fID(id),
@@ -98,7 +98,7 @@ Volume::GetFileSystem() const
} }
// GetID // GetID
mount_id dev_t
Volume::GetID() const Volume::GetID() const
{ {
return fID; return fID;
@@ -112,7 +112,7 @@ Volume::GetUserlandVolume() const
} }
// GetRootID // GetRootID
vnode_id ino_t
Volume::GetRootID() const Volume::GetRootID() const
{ {
return fRootID; return fRootID;
@@ -130,7 +130,7 @@ Volume::IsMounting() const
// GetVNode // GetVNode
status_t status_t
Volume::GetVNode(vnode_id vnid, fs_vnode* node) Volume::GetVNode(ino_t vnid, fs_vnode* node)
{ {
PRINT(("get_vnode(%ld, %lld)\n", fID, vnid)); PRINT(("get_vnode(%ld, %lld)\n", fID, vnid));
if (IsMounting() && !fMountVNodes->ContainsKey(vnid)) { if (IsMounting() && !fMountVNodes->ContainsKey(vnid)) {
@@ -145,7 +145,7 @@ PRINT(("get_vnode(%ld, %lld)\n", fID, vnid));
// PutVNode // PutVNode
status_t status_t
Volume::PutVNode(vnode_id vnid) Volume::PutVNode(ino_t vnid)
{ {
PRINT(("put_vnode(%ld, %lld)\n", fID, vnid)); PRINT(("put_vnode(%ld, %lld)\n", fID, vnid));
status_t error = put_vnode(fID, vnid); status_t error = put_vnode(fID, vnid);
@@ -156,7 +156,7 @@ PRINT(("put_vnode(%ld, %lld)\n", fID, vnid));
// NewVNode // NewVNode
status_t status_t
Volume::NewVNode(vnode_id vnid, fs_vnode node) Volume::NewVNode(ino_t vnid, fs_vnode node)
{ {
PRINT(("new_vnode(%ld, %lld)\n", fID, vnid)); PRINT(("new_vnode(%ld, %lld)\n", fID, vnid));
status_t error = new_vnode(fID, vnid, node); status_t error = new_vnode(fID, vnid, node);
@@ -179,7 +179,7 @@ PRINT(("new_vnode(%ld, %lld)\n", fID, vnid));
// PublishVNode // PublishVNode
status_t status_t
Volume::PublishVNode(vnode_id vnid, fs_vnode node) Volume::PublishVNode(ino_t vnid, fs_vnode node)
{ {
PRINT(("publish_vnode(%ld, %lld, %p)\n", fID, vnid, node)); PRINT(("publish_vnode(%ld, %lld, %p)\n", fID, vnid, node));
status_t error = publish_vnode(fID, vnid, node); status_t error = publish_vnode(fID, vnid, node);
@@ -200,7 +200,7 @@ PRINT(("publish_vnode(%ld, %lld, %p)\n", fID, vnid, node));
// RemoveVNode // RemoveVNode
status_t status_t
Volume::RemoveVNode(vnode_id vnid) Volume::RemoveVNode(ino_t vnid)
{ {
PRINT(("remove_vnode(%ld, %lld)\n", fID, vnid)); PRINT(("remove_vnode(%ld, %lld)\n", fID, vnid));
return remove_vnode(fID, vnid); return remove_vnode(fID, vnid);
@@ -208,7 +208,7 @@ PRINT(("remove_vnode(%ld, %lld)\n", fID, vnid));
// UnremoveVNode // UnremoveVNode
status_t status_t
Volume::UnremoveVNode(vnode_id vnid) Volume::UnremoveVNode(ino_t vnid)
{ {
PRINT(("unremove_vnode(%ld, %lld)\n", fID, vnid)); PRINT(("unremove_vnode(%ld, %lld)\n", fID, vnid));
return unremove_vnode(fID, vnid); return unremove_vnode(fID, vnid);
@@ -216,7 +216,7 @@ PRINT(("unremove_vnode(%ld, %lld)\n", fID, vnid));
// GetVNodeRemoved // GetVNodeRemoved
status_t status_t
Volume::GetVNodeRemoved(vnode_id vnid, bool* removed) Volume::GetVNodeRemoved(ino_t vnid, bool* removed)
{ {
PRINT(("get_vnode_removed(%ld, %lld, %p)\n", fID, vnid, removed)); PRINT(("get_vnode_removed(%ld, %lld, %p)\n", fID, vnid, removed));
return get_vnode_removed(fID, vnid, removed); return get_vnode_removed(fID, vnid, removed);
@@ -230,7 +230,7 @@ PRINT(("get_vnode_removed(%ld, %lld, %p)\n", fID, vnid, removed));
status_t status_t
Volume::Mount(const char* device, uint32 flags, const char* parameters) Volume::Mount(const char* device, uint32 flags, const char* parameters)
{ {
// Create a map that holds vnode_id->void* mappings of all vnodes // Create a map that holds ino_t->void* mappings of all vnodes
// created while mounting. We need it to get the root node. // created while mounting. We need it to get the root node.
MountVNodeMap vnodeMap; MountVNodeMap vnodeMap;
status_t error = vnodeMap.InitCheck(); status_t error = vnodeMap.InitCheck();
@@ -384,7 +384,7 @@ Volume::WriteFSInfo(const struct fs_info *info, uint32 mask)
// Lookup // Lookup
status_t status_t
Volume::Lookup(fs_vnode dir, const char* entryName, vnode_id* vnid, int* type) Volume::Lookup(fs_vnode dir, const char* entryName, ino_t* vnid, int* type)
{ {
// When the connection to the userland server is lost, we serve // When the connection to the userland server is lost, we serve
// lookup(fRootNode, `.') requests manually to allow clean unmounting. // lookup(fRootNode, `.') requests manually to allow clean unmounting.
@@ -455,7 +455,7 @@ Volume::GetVNodeName(fs_vnode node, char* buffer, size_t bufferSize)
// ReadVNode // ReadVNode
status_t status_t
Volume::ReadVNode(vnode_id vnid, bool reenter, fs_vnode* node) Volume::ReadVNode(ino_t vnid, bool reenter, fs_vnode* node)
{ {
// get a free port // get a free port
RequestPort* port = fFileSystem->GetPortPool()->AcquirePort(); RequestPort* port = fFileSystem->GetPortPool()->AcquirePort();
@@ -1210,7 +1210,7 @@ Volume::WriteStat(fs_vnode node, const struct stat* st, uint32 mask)
// Create // Create
status_t status_t
Volume::Create(fs_vnode dir, const char* name, int openMode, int mode, Volume::Create(fs_vnode dir, const char* name, int openMode, int mode,
void** cookie, vnode_id* vnid) void** cookie, ino_t* vnid)
{ {
// check capability // check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE)) if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE))
@@ -1439,7 +1439,7 @@ Volume::Write(fs_vnode node, fs_cookie cookie, off_t pos, const void* buffer,
// CreateDir // CreateDir
status_t status_t
Volume::CreateDir(fs_vnode dir, const char* name, int mode, vnode_id *newDir) Volume::CreateDir(fs_vnode dir, const char* name, int mode, ino_t *newDir)
{ {
// check capability // check capability
if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE_DIR)) if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE_DIR))
@@ -2894,7 +2894,7 @@ Volume::_ReadFSInfo(fs_info* info)
// _Lookup // _Lookup
status_t status_t
Volume::_Lookup(fs_vnode dir, const char* entryName, vnode_id* vnid, int* type) Volume::_Lookup(fs_vnode dir, const char* entryName, ino_t* vnid, int* type)
{ {
// get a free port // get a free port
RequestPort* port = fFileSystem->GetPortPool()->AcquirePort(); RequestPort* port = fFileSystem->GetPortPool()->AcquirePort();
@@ -3501,7 +3501,7 @@ Volume::_SendReceiptAck(RequestPort* port)
// _IncrementVNodeCount // _IncrementVNodeCount
void void
Volume::_IncrementVNodeCount(vnode_id vnid) Volume::_IncrementVNodeCount(ino_t vnid)
{ {
if (!fVNodeCountingEnabled) if (!fVNodeCountingEnabled)
return; return;
@@ -3534,7 +3534,7 @@ Volume::_IncrementVNodeCount(vnode_id vnid)
// _DecrementVNodeCount // _DecrementVNodeCount
void void
Volume::_DecrementVNodeCount(vnode_id vnid) Volume::_DecrementVNodeCount(ino_t vnid)
{ {
if (!fVNodeCountingEnabled) if (!fVNodeCountingEnabled)
return; return;
@@ -27,24 +27,24 @@ class FileSystem;
class Volume : public Referencable { class Volume : public Referencable {
public: public:
Volume(FileSystem* fileSystem, mount_id id); Volume(FileSystem* fileSystem, dev_t id);
~Volume(); ~Volume();
FileSystem* GetFileSystem() const; FileSystem* GetFileSystem() const;
mount_id GetID() const; dev_t GetID() const;
void* GetUserlandVolume() const; void* GetUserlandVolume() const;
vnode_id GetRootID() const; ino_t GetRootID() const;
bool IsMounting() const; bool IsMounting() const;
// client methods // client methods
status_t GetVNode(vnode_id vnid, fs_vnode* node); status_t GetVNode(ino_t vnid, fs_vnode* node);
status_t PutVNode(vnode_id vnid); status_t PutVNode(ino_t vnid);
status_t NewVNode(vnode_id vnid, fs_vnode node); status_t NewVNode(ino_t vnid, fs_vnode node);
status_t PublishVNode(vnode_id vnid, fs_vnode node); status_t PublishVNode(ino_t vnid, fs_vnode node);
status_t RemoveVNode(vnode_id vnid); status_t RemoveVNode(ino_t vnid);
status_t UnremoveVNode(vnode_id vnid); status_t UnremoveVNode(ino_t vnid);
status_t GetVNodeRemoved(vnode_id vnid, bool* removed); status_t GetVNodeRemoved(ino_t vnid, bool* removed);
// FS // FS
status_t Mount(const char* device, uint32 flags, status_t Mount(const char* device, uint32 flags,
@@ -57,10 +57,10 @@ public:
// vnodes // vnodes
status_t Lookup(fs_vnode dir, const char* entryName, status_t Lookup(fs_vnode dir, const char* entryName,
vnode_id* vnid, int* type); ino_t* vnid, int* type);
status_t GetVNodeName(fs_vnode node, char* buffer, status_t GetVNodeName(fs_vnode node, char* buffer,
size_t bufferSize); size_t bufferSize);
status_t ReadVNode(vnode_id vnid, bool reenter, status_t ReadVNode(ino_t vnid, bool reenter,
fs_vnode* node); fs_vnode* node);
status_t WriteVNode(fs_vnode node, bool reenter); status_t WriteVNode(fs_vnode node, bool reenter);
status_t RemoveVNode(fs_vnode node, bool reenter); status_t RemoveVNode(fs_vnode node, bool reenter);
@@ -96,7 +96,7 @@ public:
// files // files
status_t Create(fs_vnode dir, const char* name, status_t Create(fs_vnode dir, const char* name,
int openMode, int mode, fs_cookie* cookie, int openMode, int mode, fs_cookie* cookie,
vnode_id* vnid); ino_t* vnid);
status_t Open(fs_vnode node, int openMode, status_t Open(fs_vnode node, int openMode,
fs_cookie* cookie); fs_cookie* cookie);
status_t Close(fs_vnode node, fs_cookie cookie); status_t Close(fs_vnode node, fs_cookie cookie);
@@ -110,7 +110,7 @@ public:
// directories // directories
status_t CreateDir(fs_vnode dir, const char* name, status_t CreateDir(fs_vnode dir, const char* name,
int mode, vnode_id *newDir); int mode, ino_t *newDir);
status_t RemoveDir(fs_vnode dir, const char* name); status_t RemoveDir(fs_vnode dir, const char* name);
status_t OpenDir(fs_vnode node, fs_cookie* cookie); status_t OpenDir(fs_vnode node, fs_cookie* cookie);
status_t CloseDir(fs_vnode node, fs_vnode cookie); status_t CloseDir(fs_vnode node, fs_vnode cookie);
@@ -184,7 +184,7 @@ private:
status_t _Unmount(); status_t _Unmount();
status_t _ReadFSInfo(fs_info* info); status_t _ReadFSInfo(fs_info* info);
status_t _Lookup(fs_vnode dir, const char* entryName, status_t _Lookup(fs_vnode dir, const char* entryName,
vnode_id* vnid, int* type); ino_t* vnid, int* type);
status_t _WriteVNode(fs_vnode node, bool reenter); status_t _WriteVNode(fs_vnode node, bool reenter);
status_t _ReadStat(fs_vnode node, struct stat* st); status_t _ReadStat(fs_vnode node, struct stat* st);
status_t _Close(fs_vnode node, fs_cookie cookie); status_t _Close(fs_vnode node, fs_cookie cookie);
@@ -207,8 +207,8 @@ private:
RequestHandler* handler, Request** reply); RequestHandler* handler, Request** reply);
status_t _SendReceiptAck(RequestPort* port); status_t _SendReceiptAck(RequestPort* port);
void _IncrementVNodeCount(vnode_id vnid); void _IncrementVNodeCount(ino_t vnid);
void _DecrementVNodeCount(vnode_id vnid); void _DecrementVNodeCount(ino_t vnid);
status_t _InternalIOCtl(userlandfs_ioctl* buffer, status_t _InternalIOCtl(userlandfs_ioctl* buffer,
int32 bufferSize); int32 bufferSize);
@@ -221,9 +221,9 @@ private:
class AutoIncrementer; class AutoIncrementer;
FileSystem* fFileSystem; FileSystem* fFileSystem;
mount_id fID; dev_t fID;
void* fUserlandVolume; void* fUserlandVolume;
vnode_id fRootID; ino_t fRootID;
fs_vnode fRootNode; fs_vnode fRootNode;
MountVNodeMap* fMountVNodes; MountVNodeMap* fMountVNodes;
vint32 fOpenFiles; vint32 fOpenFiles;
@@ -64,8 +64,8 @@ parse_parameters(const char *parameters, String &fsName,
// userlandfs_mount // userlandfs_mount
static status_t static status_t
userlandfs_mount(mount_id id, const char *device, uint32 flags, userlandfs_mount(dev_t id, const char *device, uint32 flags,
const char *args, fs_volume *fsCookie, vnode_id *rootVnodeID) const char *args, fs_volume *fsCookie, ino_t *rootVnodeID)
{ {
PRINT(("userlandfs_mount(%ld, %s, 0x%lx, %s, %p, %p)\n", id, device, flags, PRINT(("userlandfs_mount(%ld, %s, 0x%lx, %s, %p, %p)\n", id, device, flags,
args, fsCookie, rootVnodeID)); args, fsCookie, rootVnodeID));
@@ -165,7 +165,7 @@ userlandfs_write_fs_info(fs_volume fs, const struct fs_info *info, uint32 mask)
// userlandfs_lookup // userlandfs_lookup
static status_t static status_t
userlandfs_lookup(fs_volume fs, fs_vnode dir, const char *entryName, userlandfs_lookup(fs_volume fs, fs_vnode dir, const char *entryName,
vnode_id *vnid, int *type) ino_t *vnid, int *type)
{ {
Volume* volume = (Volume*)fs; Volume* volume = (Volume*)fs;
PRINT(("userlandfs_lookup(%p, %p, `%s', %p, %p)\n", fs, dir, PRINT(("userlandfs_lookup(%p, %p, `%s', %p, %p)\n", fs, dir,
@@ -192,7 +192,7 @@ userlandfs_get_vnode_name(fs_volume fs, fs_vnode node, char *buffer,
// userlandfs_get_vnode // userlandfs_get_vnode
static status_t static status_t
userlandfs_get_vnode(fs_volume fs, vnode_id vnid, fs_vnode *node, bool reenter) userlandfs_get_vnode(fs_volume fs, ino_t vnid, fs_vnode *node, bool reenter)
{ {
Volume* volume = (Volume*)fs; Volume* volume = (Volume*)fs;
PRINT(("userlandfs_get_vnode(%p, %lld, %p, %d)\n", fs, vnid, node, PRINT(("userlandfs_get_vnode(%p, %lld, %p, %d)\n", fs, vnid, node,
@@ -413,7 +413,7 @@ userlandfs_write_stat(fs_volume fs, fs_vnode node, const struct stat *st,
// userlandfs_create // userlandfs_create
static status_t static status_t
userlandfs_create(fs_volume fs, fs_vnode dir, const char *name, int openMode, userlandfs_create(fs_volume fs, fs_vnode dir, const char *name, int openMode,
int perms, fs_cookie *cookie, vnode_id *vnid) int perms, fs_cookie *cookie, ino_t *vnid)
{ {
Volume* volume = (Volume*)fs; Volume* volume = (Volume*)fs;
PRINT(("userlandfs_create(%p, %p, `%s', %d, %d, %p, %p)\n", fs, dir, PRINT(("userlandfs_create(%p, %p, `%s', %d, %d, %p, %p)\n", fs, dir,
@@ -491,7 +491,7 @@ userlandfs_write(fs_volume fs, fs_vnode node, fs_cookie cookie, off_t pos,
// userlandfs_create_dir // userlandfs_create_dir
static status_t static status_t
userlandfs_create_dir(fs_volume fs, fs_vnode parent, const char *name, userlandfs_create_dir(fs_volume fs, fs_vnode parent, const char *name,
int perms, vnode_id *newDir) int perms, ino_t *newDir)
{ {
Volume* volume = (Volume*)fs; Volume* volume = (Volume*)fs;
PRINT(("userlandfs_create_dir(%p, %p, `%s', %d, %p)\n", fs, parent, name, PRINT(("userlandfs_create_dir(%p, %p, `%s', %d, %p)\n", fs, parent, name,
@@ -24,7 +24,7 @@ BeOSKernelFileSystem::~BeOSKernelFileSystem()
// CreateVolume // CreateVolume
status_t status_t
BeOSKernelFileSystem::CreateVolume(Volume** volume, mount_id id) BeOSKernelFileSystem::CreateVolume(Volume** volume, dev_t id)
{ {
// check initialization and parameters // check initialization and parameters
if (!fFSOps || !volume) if (!fFSOps || !volume)
@@ -14,7 +14,7 @@ public:
BeOSKernelFileSystem(beos_vnode_ops* fsOps); BeOSKernelFileSystem(beos_vnode_ops* fsOps);
virtual ~BeOSKernelFileSystem(); virtual ~BeOSKernelFileSystem();
virtual status_t CreateVolume(Volume** volume, mount_id id); virtual status_t CreateVolume(Volume** volume, dev_t id);
virtual status_t DeleteVolume(Volume* volume); virtual status_t DeleteVolume(Volume* volume);
private: private:
@@ -39,7 +39,7 @@ public:
// constructor // constructor
BeOSKernelVolume::BeOSKernelVolume(FileSystem* fileSystem, mount_id id, BeOSKernelVolume::BeOSKernelVolume(FileSystem* fileSystem, dev_t id,
beos_vnode_ops* fsOps) beos_vnode_ops* fsOps)
: Volume(fileSystem, id), : Volume(fileSystem, id),
fFSOps(fsOps), fFSOps(fsOps),
@@ -58,7 +58,7 @@ BeOSKernelVolume::~BeOSKernelVolume()
// Mount // Mount
status_t status_t
BeOSKernelVolume::Mount(const char* device, uint32 flags, BeOSKernelVolume::Mount(const char* device, uint32 flags,
const char* parameters, vnode_id* rootID) const char* parameters, ino_t* rootID)
{ {
if (!fFSOps->mount) if (!fFSOps->mount)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -114,7 +114,7 @@ BeOSKernelVolume::WriteFSInfo(const struct fs_info* info, uint32 mask)
// Lookup // Lookup
status_t status_t
BeOSKernelVolume::Lookup(fs_vnode dir, const char* entryName, vnode_id* vnid, BeOSKernelVolume::Lookup(fs_vnode dir, const char* entryName, ino_t* vnid,
int* type) int* type)
{ {
if (!fFSOps->walk) if (!fFSOps->walk)
@@ -160,7 +160,7 @@ BeOSKernelVolume::Lookup(fs_vnode dir, const char* entryName, vnode_id* vnid,
// LookupNoType // LookupNoType
status_t status_t
BeOSKernelVolume::LookupNoType(fs_vnode dir, const char* entryName, BeOSKernelVolume::LookupNoType(fs_vnode dir, const char* entryName,
vnode_id* vnid) ino_t* vnid)
{ {
if (!fFSOps->walk) if (!fFSOps->walk)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -169,7 +169,7 @@ BeOSKernelVolume::LookupNoType(fs_vnode dir, const char* entryName,
// ReadVNode // ReadVNode
status_t status_t
BeOSKernelVolume::ReadVNode(vnode_id vnid, bool reenter, fs_vnode* node) BeOSKernelVolume::ReadVNode(ino_t vnid, bool reenter, fs_vnode* node)
{ {
if (!fFSOps->read_vnode) if (!fFSOps->read_vnode)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -340,7 +340,7 @@ BeOSKernelVolume::WriteStat(fs_vnode node, const struct stat *st, uint32 mask)
// Create // Create
status_t status_t
BeOSKernelVolume::Create(fs_vnode dir, const char* name, int openMode, int mode, BeOSKernelVolume::Create(fs_vnode dir, const char* name, int openMode, int mode,
fs_cookie* cookie, vnode_id* vnid) fs_cookie* cookie, ino_t* vnid)
{ {
if (!fFSOps->create) if (!fFSOps->create)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -405,7 +405,7 @@ BeOSKernelVolume::Write(fs_vnode node, fs_cookie cookie, off_t pos,
// CreateDir // CreateDir
status_t status_t
BeOSKernelVolume::CreateDir(fs_vnode dir, const char* name, int mode, BeOSKernelVolume::CreateDir(fs_vnode dir, const char* name, int mode,
vnode_id *newDir) ino_t *newDir)
{ {
if (!fFSOps->mkdir || !fFSOps->walk) // we need walk() too if (!fFSOps->mkdir || !fFSOps->walk) // we need walk() too
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -415,7 +415,7 @@ BeOSKernelVolume::CreateDir(fs_vnode dir, const char* name, int mode,
return error; return error;
// we need to get the node ID by invoking walk() // we need to get the node ID by invoking walk()
vnode_id id; ino_t id;
error = fFSOps->walk(fVolumeCookie, dir, name, NULL, &id); error = fFSOps->walk(fVolumeCookie, dir, name, NULL, &id);
if (error != B_OK) if (error != B_OK)
return error; return error;
@@ -12,12 +12,12 @@ namespace UserlandFS {
class BeOSKernelVolume : public Volume { class BeOSKernelVolume : public Volume {
public: public:
BeOSKernelVolume(FileSystem* fileSystem, BeOSKernelVolume(FileSystem* fileSystem,
mount_id id, beos_vnode_ops* fsOps); dev_t id, beos_vnode_ops* fsOps);
virtual ~BeOSKernelVolume(); virtual ~BeOSKernelVolume();
// FS // FS
virtual status_t Mount(const char* device, uint32 flags, virtual status_t Mount(const char* device, uint32 flags,
const char* parameters, vnode_id* rootID); const char* parameters, ino_t* rootID);
virtual status_t Unmount(); virtual status_t Unmount();
virtual status_t Sync(); virtual status_t Sync();
virtual status_t ReadFSInfo(fs_info* info); virtual status_t ReadFSInfo(fs_info* info);
@@ -26,11 +26,11 @@ public:
// vnodes // vnodes
virtual status_t Lookup(fs_vnode dir, const char* entryName, virtual status_t Lookup(fs_vnode dir, const char* entryName,
vnode_id* vnid, int* type); ino_t* vnid, int* type);
virtual status_t LookupNoType(fs_vnode dir, virtual status_t LookupNoType(fs_vnode dir,
const char* entryName, vnode_id* vnid); const char* entryName, ino_t* vnid);
// not required // not required
virtual status_t ReadVNode(vnode_id vnid, bool reenter, virtual status_t ReadVNode(ino_t vnid, bool reenter,
fs_vnode* node); fs_vnode* node);
virtual status_t WriteVNode(fs_vnode node, bool reenter); virtual status_t WriteVNode(fs_vnode node, bool reenter);
virtual status_t RemoveVNode(fs_vnode node, bool reenter); virtual status_t RemoveVNode(fs_vnode node, bool reenter);
@@ -66,7 +66,7 @@ public:
// files // files
virtual status_t Create(fs_vnode dir, const char* name, virtual status_t Create(fs_vnode dir, const char* name,
int openMode, int mode, fs_cookie* cookie, int openMode, int mode, fs_cookie* cookie,
vnode_id* vnid); ino_t* vnid);
virtual status_t Open(fs_vnode node, int openMode, virtual status_t Open(fs_vnode node, int openMode,
fs_cookie* cookie); fs_cookie* cookie);
virtual status_t Close(fs_vnode node, fs_cookie cookie); virtual status_t Close(fs_vnode node, fs_cookie cookie);
@@ -80,7 +80,7 @@ public:
// directories // directories
virtual status_t CreateDir(fs_vnode dir, const char* name, virtual status_t CreateDir(fs_vnode dir, const char* name,
int mode, vnode_id *newDir); int mode, ino_t *newDir);
virtual status_t RemoveDir(fs_vnode dir, const char* name); virtual status_t RemoveDir(fs_vnode dir, const char* name);
virtual status_t OpenDir(fs_vnode node, fs_cookie* cookie); virtual status_t OpenDir(fs_vnode node, fs_cookie* cookie);
virtual status_t CloseDir(fs_vnode node, fs_vnode cookie); virtual status_t CloseDir(fs_vnode node, fs_vnode cookie);
@@ -17,7 +17,7 @@ public:
FileSystem(); FileSystem();
virtual ~FileSystem(); virtual ~FileSystem();
virtual status_t CreateVolume(Volume** volume, mount_id id) = 0; virtual status_t CreateVolume(Volume** volume, dev_t id) = 0;
virtual status_t DeleteVolume(Volume* volume) = 0; virtual status_t DeleteVolume(Volume* volume) = 0;
void GetCapabilities( void GetCapabilities(
@@ -38,7 +38,7 @@ HaikuKernelFileSystem::Init()
// CreateVolume // CreateVolume
status_t status_t
HaikuKernelFileSystem::CreateVolume(Volume** volume, mount_id id) HaikuKernelFileSystem::CreateVolume(Volume** volume, dev_t id)
{ {
// check initialization and parameters // check initialization and parameters
if (!fFSModule || !volume) if (!fFSModule || !volume)
@@ -17,7 +17,7 @@ public:
status_t Init(); status_t Init();
virtual status_t CreateVolume(Volume** volume, mount_id id); virtual status_t CreateVolume(Volume** volume, dev_t id);
virtual status_t DeleteVolume(Volume* volume); virtual status_t DeleteVolume(Volume* volume);
private: private:
@@ -13,7 +13,7 @@
// constructor // constructor
HaikuKernelVolume::HaikuKernelVolume(FileSystem* fileSystem, mount_id id, HaikuKernelVolume::HaikuKernelVolume(FileSystem* fileSystem, dev_t id,
file_system_module_info* fsModule) file_system_module_info* fsModule)
: Volume(fileSystem, id), : Volume(fileSystem, id),
fFSModule(fsModule), fFSModule(fsModule),
@@ -32,7 +32,7 @@ HaikuKernelVolume::~HaikuKernelVolume()
// Mount // Mount
status_t status_t
HaikuKernelVolume::Mount(const char* device, uint32 flags, HaikuKernelVolume::Mount(const char* device, uint32 flags,
const char* parameters, vnode_id* rootID) const char* parameters, ino_t* rootID)
{ {
if (!fFSModule->mount) if (!fFSModule->mount)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -118,7 +118,7 @@ HaikuKernelVolume::GetFileMap(fs_vnode node, off_t offset, size_t size,
// Lookup // Lookup
status_t status_t
HaikuKernelVolume::Lookup(fs_vnode dir, const char* entryName, vnode_id* vnid, HaikuKernelVolume::Lookup(fs_vnode dir, const char* entryName, ino_t* vnid,
int* type) int* type)
{ {
if (!fFSModule->lookup) if (!fFSModule->lookup)
@@ -139,7 +139,7 @@ HaikuKernelVolume::GetVNodeName(fs_vnode node, char* buffer, size_t bufferSize)
// ReadVNode // ReadVNode
status_t status_t
HaikuKernelVolume::ReadVNode(vnode_id vnid, bool reenter, fs_vnode* node) HaikuKernelVolume::ReadVNode(ino_t vnid, bool reenter, fs_vnode* node)
{ {
if (!fFSModule->get_vnode) if (!fFSModule->get_vnode)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -304,7 +304,7 @@ HaikuKernelVolume::WriteStat(fs_vnode node, const struct stat *st, uint32 mask)
// Create // Create
status_t status_t
HaikuKernelVolume::Create(fs_vnode dir, const char* name, int openMode, int mode, HaikuKernelVolume::Create(fs_vnode dir, const char* name, int openMode, int mode,
fs_cookie* cookie, vnode_id* vnid) fs_cookie* cookie, ino_t* vnid)
{ {
if (!fFSModule->create) if (!fFSModule->create)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -373,7 +373,7 @@ HaikuKernelVolume::Write(fs_vnode node, fs_cookie cookie, off_t pos,
// CreateDir // CreateDir
status_t status_t
HaikuKernelVolume::CreateDir(fs_vnode dir, const char* name, int mode, HaikuKernelVolume::CreateDir(fs_vnode dir, const char* name, int mode,
vnode_id *newDir) ino_t *newDir)
{ {
if (!fFSModule->create_dir) if (!fFSModule->create_dir)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -12,13 +12,13 @@ namespace UserlandFS {
class HaikuKernelVolume : public Volume { class HaikuKernelVolume : public Volume {
public: public:
HaikuKernelVolume(FileSystem* fileSystem, HaikuKernelVolume(FileSystem* fileSystem,
mount_id id, dev_t id,
file_system_module_info* fsModule); file_system_module_info* fsModule);
virtual ~HaikuKernelVolume(); virtual ~HaikuKernelVolume();
// FS // FS
virtual status_t Mount(const char* device, uint32 flags, virtual status_t Mount(const char* device, uint32 flags,
const char* parameters, vnode_id* rootID); const char* parameters, ino_t* rootID);
virtual status_t Unmount(); virtual status_t Unmount();
virtual status_t Sync(); virtual status_t Sync();
virtual status_t ReadFSInfo(fs_info* info); virtual status_t ReadFSInfo(fs_info* info);
@@ -32,10 +32,10 @@ public:
// vnodes // vnodes
virtual status_t Lookup(fs_vnode dir, const char* entryName, virtual status_t Lookup(fs_vnode dir, const char* entryName,
vnode_id* vnid, int* type); ino_t* vnid, int* type);
virtual status_t GetVNodeName(fs_vnode node, char* buffer, virtual status_t GetVNodeName(fs_vnode node, char* buffer,
size_t bufferSize); size_t bufferSize);
virtual status_t ReadVNode(vnode_id vnid, bool reenter, virtual status_t ReadVNode(ino_t vnid, bool reenter,
fs_vnode* node); fs_vnode* node);
virtual status_t WriteVNode(fs_vnode node, bool reenter); virtual status_t WriteVNode(fs_vnode node, bool reenter);
virtual status_t RemoveVNode(fs_vnode node, bool reenter); virtual status_t RemoveVNode(fs_vnode node, bool reenter);
@@ -71,7 +71,7 @@ public:
// files // files
virtual status_t Create(fs_vnode dir, const char* name, virtual status_t Create(fs_vnode dir, const char* name,
int openMode, int mode, fs_cookie* cookie, int openMode, int mode, fs_cookie* cookie,
vnode_id* vnid); ino_t* vnid);
virtual status_t Open(fs_vnode node, int openMode, virtual status_t Open(fs_vnode node, int openMode,
fs_cookie* cookie); fs_cookie* cookie);
virtual status_t Close(fs_vnode node, fs_cookie cookie); virtual status_t Close(fs_vnode node, fs_cookie cookie);
@@ -85,7 +85,7 @@ public:
// directories // directories
virtual status_t CreateDir(fs_vnode dir, const char* name, virtual status_t CreateDir(fs_vnode dir, const char* name,
int mode, vnode_id *newDir); int mode, ino_t *newDir);
virtual status_t RemoveDir(fs_vnode dir, const char* name); virtual status_t RemoveDir(fs_vnode dir, const char* name);
virtual status_t OpenDir(fs_vnode node, fs_cookie* cookie); virtual status_t OpenDir(fs_vnode node, fs_cookie* cookie);
virtual status_t CloseDir(fs_vnode node, fs_vnode cookie); virtual status_t CloseDir(fs_vnode node, fs_vnode cookie);
@@ -234,7 +234,7 @@ UserlandRequestHandler::_HandleRequest(MountVolumeRequest* request)
result = fFileSystem->CreateVolume(&volume, request->nsid); result = fFileSystem->CreateVolume(&volume, request->nsid);
// mount it // mount it
vnode_id rootID; ino_t rootID;
if (result == B_OK) { if (result == B_OK) {
RequestThreadContext context(volume); RequestThreadContext context(volume);
result = volume->Mount(device, request->flags, result = volume->Mount(device, request->flags,
@@ -377,7 +377,7 @@ UserlandRequestHandler::_HandleRequest(LookupRequest* request)
if (!volume) if (!volume)
result = B_BAD_VALUE; result = B_BAD_VALUE;
vnode_id vnid = 0; ino_t vnid = 0;
int type = 0; int type = 0;
if (result == B_OK) { if (result == B_OK) {
RequestThreadContext context(volume); RequestThreadContext context(volume);
@@ -959,7 +959,7 @@ UserlandRequestHandler::_HandleRequest(CreateRequest* request)
if (!volume) if (!volume)
result = B_BAD_VALUE; result = B_BAD_VALUE;
vnode_id vnid; ino_t vnid;
fs_cookie fileCookie; fs_cookie fileCookie;
if (result == B_OK) { if (result == B_OK) {
RequestThreadContext context(volume); RequestThreadContext context(volume);
@@ -1159,7 +1159,7 @@ UserlandRequestHandler::_HandleRequest(CreateDirRequest* request)
if (!volume) if (!volume)
result = B_BAD_VALUE; result = B_BAD_VALUE;
vnode_id newDir = 0; ino_t newDir = 0;
if (result == B_OK) { if (result == B_OK) {
RequestThreadContext context(volume); RequestThreadContext context(volume);
result = volume->CreateDir(request->node, result = volume->CreateDir(request->node,
@@ -9,7 +9,7 @@
#include "kernel_emu.h" #include "kernel_emu.h"
// constructor // constructor
Volume::Volume(FileSystem* fileSystem, mount_id id) Volume::Volume(FileSystem* fileSystem, dev_t id)
: fFileSystem(fileSystem), : fFileSystem(fileSystem),
fID(id) fID(id)
{ {
@@ -28,7 +28,7 @@ Volume::GetFileSystem() const
} }
// GetID // GetID
mount_id dev_t
Volume::GetID() const Volume::GetID() const
{ {
return fID; return fID;
@@ -41,7 +41,7 @@ Volume::GetID() const
// Mount // Mount
status_t status_t
Volume::Mount(const char* device, uint32 flags, const char* parameters, Volume::Mount(const char* device, uint32 flags, const char* parameters,
vnode_id* rootID) ino_t* rootID)
{ {
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -80,14 +80,14 @@ Volume::WriteFSInfo(const struct fs_info* info, uint32 mask)
// Lookup // Lookup
status_t status_t
Volume::Lookup(fs_vnode dir, const char* entryName, vnode_id* vnid, int* type) Volume::Lookup(fs_vnode dir, const char* entryName, ino_t* vnid, int* type)
{ {
return B_BAD_VALUE; return B_BAD_VALUE;
} }
// LookupNoType // LookupNoType
status_t status_t
Volume::LookupNoType(fs_vnode dir, const char* entryName, vnode_id* vnid) Volume::LookupNoType(fs_vnode dir, const char* entryName, ino_t* vnid)
{ {
int type; int type;
return Lookup(dir, entryName, vnid, &type); return Lookup(dir, entryName, vnid, &type);
@@ -104,7 +104,7 @@ Volume::GetVNodeName(fs_vnode node, char* buffer, size_t bufferSize)
return error; return error;
// look up the parent directory // look up the parent directory
vnode_id parentID; ino_t parentID;
error = LookupNoType(node, "..", &parentID); error = LookupNoType(node, "..", &parentID);
if (error != B_OK) if (error != B_OK)
return error; return error;
@@ -163,7 +163,7 @@ Volume::GetVNodeName(fs_vnode node, char* buffer, size_t bufferSize)
// ReadVNode // ReadVNode
status_t status_t
Volume::ReadVNode(vnode_id vnid, bool reenter, fs_vnode* node) Volume::ReadVNode(ino_t vnid, bool reenter, fs_vnode* node)
{ {
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -289,7 +289,7 @@ Volume::WriteStat(fs_vnode node, const struct stat *st, uint32 mask)
// Create // Create
status_t status_t
Volume::Create(fs_vnode dir, const char* name, int openMode, int mode, Volume::Create(fs_vnode dir, const char* name, int openMode, int mode,
fs_cookie* cookie, vnode_id* vnid) fs_cookie* cookie, ino_t* vnid)
{ {
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -337,7 +337,7 @@ Volume::Write(fs_vnode node, fs_cookie cookie, off_t pos, const void* buffer,
// CreateDir // CreateDir
status_t status_t
Volume::CreateDir(fs_vnode dir, const char* name, int mode, vnode_id *newDir) Volume::CreateDir(fs_vnode dir, const char* name, int mode, ino_t *newDir)
{ {
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -12,15 +12,15 @@ class FileSystem;
class Volume { class Volume {
public: public:
Volume(FileSystem* fileSystem, mount_id id); Volume(FileSystem* fileSystem, dev_t id);
virtual ~Volume(); virtual ~Volume();
FileSystem* GetFileSystem() const; FileSystem* GetFileSystem() const;
mount_id GetID() const; dev_t GetID() const;
// FS // FS
virtual status_t Mount(const char* device, uint32 flags, virtual status_t Mount(const char* device, uint32 flags,
const char* parameters, vnode_id* rootID); const char* parameters, ino_t* rootID);
virtual status_t Unmount(); virtual status_t Unmount();
virtual status_t Sync(); virtual status_t Sync();
virtual status_t ReadFSInfo(fs_info* info); virtual status_t ReadFSInfo(fs_info* info);
@@ -29,13 +29,13 @@ public:
// vnodes // vnodes
virtual status_t Lookup(fs_vnode dir, const char* entryName, virtual status_t Lookup(fs_vnode dir, const char* entryName,
vnode_id* vnid, int* type); ino_t* vnid, int* type);
virtual status_t LookupNoType(fs_vnode dir, virtual status_t LookupNoType(fs_vnode dir,
const char* entryName, vnode_id* vnid); const char* entryName, ino_t* vnid);
// not required // not required
virtual status_t GetVNodeName(fs_vnode node, char* buffer, virtual status_t GetVNodeName(fs_vnode node, char* buffer,
size_t bufferSize); size_t bufferSize);
virtual status_t ReadVNode(vnode_id vnid, bool reenter, virtual status_t ReadVNode(ino_t vnid, bool reenter,
fs_vnode* node); fs_vnode* node);
virtual status_t WriteVNode(fs_vnode node, bool reenter); virtual status_t WriteVNode(fs_vnode node, bool reenter);
virtual status_t RemoveVNode(fs_vnode node, bool reenter); virtual status_t RemoveVNode(fs_vnode node, bool reenter);
@@ -71,7 +71,7 @@ public:
// files // files
virtual status_t Create(fs_vnode dir, const char* name, virtual status_t Create(fs_vnode dir, const char* name,
int openMode, int mode, fs_cookie* cookie, int openMode, int mode, fs_cookie* cookie,
vnode_id* vnid); ino_t* vnid);
virtual status_t Open(fs_vnode node, int openMode, virtual status_t Open(fs_vnode node, int openMode,
fs_cookie* cookie); fs_cookie* cookie);
virtual status_t Close(fs_vnode node, fs_cookie cookie); virtual status_t Close(fs_vnode node, fs_cookie cookie);
@@ -85,7 +85,7 @@ public:
// directories // directories
virtual status_t CreateDir(fs_vnode dir, const char* name, virtual status_t CreateDir(fs_vnode dir, const char* name,
int mode, vnode_id *newDir); int mode, ino_t *newDir);
virtual status_t RemoveDir(fs_vnode dir, const char* name); virtual status_t RemoveDir(fs_vnode dir, const char* name);
virtual status_t OpenDir(fs_vnode node, fs_cookie* cookie); virtual status_t OpenDir(fs_vnode node, fs_cookie* cookie);
virtual status_t CloseDir(fs_vnode node, fs_vnode cookie); virtual status_t CloseDir(fs_vnode node, fs_vnode cookie);
@@ -155,7 +155,7 @@ public:
protected: protected:
FileSystem* fFileSystem; FileSystem* fFileSystem;
mount_id fID; dev_t fID;
}; };
} // namespace UserlandFS } // namespace UserlandFS
@@ -74,18 +74,18 @@ typedef struct beos_index_info {
// FS interface hook types // FS interface hook types
typedef int beos_op_read_vnode(void *ns, vnode_id vnid, char r, void **node); typedef int beos_op_read_vnode(void *ns, ino_t vnid, char r, void **node);
typedef int beos_op_write_vnode(void *ns, void *node, char r); typedef int beos_op_write_vnode(void *ns, void *node, char r);
typedef int beos_op_remove_vnode(void *ns, void *node, char r); typedef int beos_op_remove_vnode(void *ns, void *node, char r);
typedef int beos_op_secure_vnode(void *ns, void *node); typedef int beos_op_secure_vnode(void *ns, void *node);
typedef int beos_op_walk(void *ns, void *base, const char *file, char **newpath, typedef int beos_op_walk(void *ns, void *base, const char *file, char **newpath,
vnode_id *vnid); ino_t *vnid);
typedef int beos_op_access(void *ns, void *node, int mode); typedef int beos_op_access(void *ns, void *node, int mode);
typedef int beos_op_create(void *ns, void *dir, const char *name, typedef int beos_op_create(void *ns, void *dir, const char *name,
int omode, int perms, vnode_id *vnid, void **cookie); int omode, int perms, ino_t *vnid, void **cookie);
typedef int beos_op_mkdir(void *ns, void *dir, const char *name, int perms); typedef int beos_op_mkdir(void *ns, void *dir, const char *name, int perms);
typedef int beos_op_symlink(void *ns, void *dir, const char *name, typedef int beos_op_symlink(void *ns, void *dir, const char *name,
const char *path); const char *path);
@@ -130,8 +130,8 @@ typedef int beos_op_deselect(void *ns, void *node, void *cookie, uint8 event,
selectsync *sync); selectsync *sync);
typedef int beos_op_initialize(const char *devname, void *parms, size_t len); typedef int beos_op_initialize(const char *devname, void *parms, size_t len);
typedef int beos_op_mount(mount_id nsid, const char *devname, ulong flags, typedef int beos_op_mount(dev_t nsid, const char *devname, ulong flags,
void *parms, size_t len, void **data, vnode_id *vnid); void *parms, size_t len, void **data, ino_t *vnid);
typedef int beos_op_unmount(void *ns); typedef int beos_op_unmount(void *ns);
typedef int beos_op_sync(void *ns); typedef int beos_op_sync(void *ns);
typedef int beos_op_rfsstat(void *ns, struct beos_fs_info *); typedef int beos_op_rfsstat(void *ns, struct beos_fs_info *);
@@ -39,8 +39,8 @@ free_path(char *p)
// notify_listener // notify_listener
int int
notify_listener(int op, nspace_id nsid, vnode_id vnida, vnode_id vnidb, notify_listener(int op, nspace_id nsid, ino_t vnida, ino_t vnidb,
vnode_id vnidc, const char *name) ino_t vnidc, const char *name)
{ {
switch (op) { switch (op) {
case B_ENTRY_CREATED: case B_ENTRY_CREATED:
@@ -88,8 +88,8 @@ notify_select_event(selectsync *sync, uint32 ref)
// send_notification // send_notification
int int
send_notification(port_id port, long token, ulong what, long op, send_notification(port_id port, long token, ulong what, long op,
nspace_id nsida, nspace_id /*nsidb*/, vnode_id vnida, vnode_id vnidb, nspace_id nsida, nspace_id /*nsidb*/, ino_t vnida, ino_t vnidb,
vnode_id vnidc, const char *name) ino_t vnidc, const char *name)
{ {
if (what != B_QUERY_UPDATE) if (what != B_QUERY_UPDATE)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -127,21 +127,21 @@ send_notification(port_id port, long token, ulong what, long op,
// get_vnode // get_vnode
int int
get_vnode(nspace_id nsid, vnode_id vnid, void **data) get_vnode(nspace_id nsid, ino_t vnid, void **data)
{ {
return UserlandFS::KernelEmu::get_vnode(nsid, vnid, data); return UserlandFS::KernelEmu::get_vnode(nsid, vnid, data);
} }
// put_vnode // put_vnode
int int
put_vnode(nspace_id nsid, vnode_id vnid) put_vnode(nspace_id nsid, ino_t vnid)
{ {
return UserlandFS::KernelEmu::put_vnode(nsid, vnid); return UserlandFS::KernelEmu::put_vnode(nsid, vnid);
} }
// new_vnode // new_vnode
int int
new_vnode(nspace_id nsid, vnode_id vnid, void *data) new_vnode(nspace_id nsid, ino_t vnid, void *data)
{ {
// The semantics of new_vnode() has changed. The new publish_vnode() // The semantics of new_vnode() has changed. The new publish_vnode()
// should work like the former new_vnode(). // should work like the former new_vnode().
@@ -150,21 +150,21 @@ new_vnode(nspace_id nsid, vnode_id vnid, void *data)
// remove_vnode // remove_vnode
int int
remove_vnode(nspace_id nsid, vnode_id vnid) remove_vnode(nspace_id nsid, ino_t vnid)
{ {
return UserlandFS::KernelEmu::remove_vnode(nsid, vnid); return UserlandFS::KernelEmu::remove_vnode(nsid, vnid);
} }
// unremove_vnode // unremove_vnode
int int
unremove_vnode(nspace_id nsid, vnode_id vnid) unremove_vnode(nspace_id nsid, ino_t vnid)
{ {
return UserlandFS::KernelEmu::unremove_vnode(nsid, vnid); return UserlandFS::KernelEmu::unremove_vnode(nsid, vnid);
} }
// is_vnode_removed // is_vnode_removed
int int
is_vnode_removed(nspace_id nsid, vnode_id vnid) is_vnode_removed(nspace_id nsid, ino_t vnid)
{ {
bool removed; bool removed;
status_t error = UserlandFS::KernelEmu::get_vnode_removed(nsid, vnid, status_t error = UserlandFS::KernelEmu::get_vnode_removed(nsid, vnid,
@@ -187,7 +187,7 @@ static status_t vfs_write_pages(int fd, off_t pos, const iovec *vecs,
static status_t vfs_get_file_map(file_cache_ref *cache, off_t offset, static status_t vfs_get_file_map(file_cache_ref *cache, off_t offset,
size_t size, struct file_io_vec *vecs, size_t *_count); size_t size, struct file_io_vec *vecs, size_t *_count);
static HaikuKernelVolume* file_cache_get_volume(mount_id mountID); static HaikuKernelVolume* file_cache_get_volume(dev_t mountID);
static status_t pages_io(file_cache_ref *ref, off_t offset, const iovec *vecs, static status_t pages_io(file_cache_ref *ref, off_t offset, const iovec *vecs,
size_t count, size_t *_numBytes, bool doWrite); size_t count, size_t *_numBytes, bool doWrite);
@@ -203,8 +203,8 @@ typedef DoublyLinkedList<vm_page,
struct file_cache_ref { struct file_cache_ref {
mutex lock; mutex lock;
mount_id mountID; dev_t mountID;
vnode_id nodeID; ino_t nodeID;
fs_vnode nodeHandle; fs_vnode nodeHandle;
int deviceFD; int deviceFD;
off_t virtual_size; off_t virtual_size;
@@ -217,7 +217,7 @@ struct file_cache_ref {
struct page_hash_key { struct page_hash_key {
page_hash_key() {} page_hash_key() {}
page_hash_key(int fd, vnode_id id, off_t offset) page_hash_key(int fd, ino_t id, off_t offset)
: deviceFD(fd), : deviceFD(fd),
nodeID(id), nodeID(id),
offset(offset) offset(offset)
@@ -225,7 +225,7 @@ struct page_hash_key {
} }
int deviceFD; int deviceFD;
vnode_id nodeID; ino_t nodeID;
off_t offset; off_t offset;
}; };
@@ -341,7 +341,7 @@ vm_page::Hash(void *_cacheEntry, const void *_key, uint32 range)
const page_hash_key *key = (const page_hash_key *)_key; const page_hash_key *key = (const page_hash_key *)_key;
int fd = (page ? page->cache->deviceFD : key->deviceFD); int fd = (page ? page->cache->deviceFD : key->deviceFD);
vnode_id id = (page ? page->cache->nodeID : key->nodeID); ino_t id = (page ? page->cache->nodeID : key->nodeID);
off_t offset = (page ? page->offset : key->offset); off_t offset = (page ? page->offset : key->offset);
uint32 value = fd; uint32 value = fd;
@@ -925,7 +925,7 @@ file_cache_unregister_volume(HaikuKernelVolume* volume)
static HaikuKernelVolume* static HaikuKernelVolume*
file_cache_get_volume(mount_id mountID) file_cache_get_volume(dev_t mountID)
{ {
MutexLocker _(sVolumeListLock); MutexLocker _(sVolumeListLock);
@@ -1818,7 +1818,7 @@ cache_io(void *_cacheRef, off_t offset, addr_t buffer, size_t *_size, bool doWri
void * void *
file_cache_create(mount_id mountID, vnode_id vnodeID, off_t size, int fd) file_cache_create(dev_t mountID, ino_t vnodeID, off_t size, int fd)
{ {
TRACE(("file_cache_create(mountID = %ld, vnodeID = %Ld, size = %Ld, fd = %d)\n", mountID, vnodeID, size, fd)); TRACE(("file_cache_create(mountID = %ld, vnodeID = %Ld, size = %Ld, fd = %d)\n", mountID, vnodeID, size, fd));
@@ -57,7 +57,7 @@ extern status_t block_cache_set_dirty(void *_cache, off_t blockNumber,
extern void block_cache_put(void *_cache, off_t blockNumber); extern void block_cache_put(void *_cache, off_t blockNumber);
/* file cache */ /* file cache */
extern void *file_cache_create(mount_id mountID, vnode_id vnodeID, off_t size, extern void *file_cache_create(dev_t mountID, ino_t vnodeID, off_t size,
int fd); int fd);
extern void file_cache_delete(void *_cacheRef); extern void file_cache_delete(void *_cacheRef);
extern status_t file_cache_set_size(void *_cacheRef, off_t size); extern status_t file_cache_set_size(void *_cacheRef, off_t size);
@@ -19,8 +19,8 @@
// notify_entry_created // notify_entry_created
status_t status_t
notify_entry_created(mount_id device, vnode_id directory, const char *name, notify_entry_created(dev_t device, ino_t directory, const char *name,
vnode_id node) ino_t node)
{ {
if (!name) if (!name)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -31,8 +31,8 @@ notify_entry_created(mount_id device, vnode_id directory, const char *name,
// notify_entry_removed // notify_entry_removed
status_t status_t
notify_entry_removed(mount_id device, vnode_id directory, const char *name, notify_entry_removed(dev_t device, ino_t directory, const char *name,
vnode_id node) ino_t node)
{ {
if (!name) if (!name)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -43,9 +43,9 @@ notify_entry_removed(mount_id device, vnode_id directory, const char *name,
// notify_entry_moved // notify_entry_moved
status_t status_t
notify_entry_moved(mount_id device, vnode_id fromDirectory, notify_entry_moved(dev_t device, ino_t fromDirectory,
const char *fromName, vnode_id toDirectory, const char *toName, const char *fromName, ino_t toDirectory, const char *toName,
vnode_id node) ino_t node)
{ {
if (!fromName || !toName) if (!fromName || !toName)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -56,7 +56,7 @@ notify_entry_moved(mount_id device, vnode_id fromDirectory,
// notify_stat_changed // notify_stat_changed
status_t status_t
notify_stat_changed(mount_id device, vnode_id node, uint32 statFields) notify_stat_changed(dev_t device, ino_t node, uint32 statFields)
{ {
return UserlandFS::KernelEmu::notify_listener(B_STAT_CHANGED, statFields, return UserlandFS::KernelEmu::notify_listener(B_STAT_CHANGED, statFields,
device, 0, 0, node, NULL, NULL); device, 0, 0, node, NULL, NULL);
@@ -64,7 +64,7 @@ notify_stat_changed(mount_id device, vnode_id node, uint32 statFields)
// notify_attribute_changed // notify_attribute_changed
status_t status_t
notify_attribute_changed(mount_id device, vnode_id node, const char *attribute, notify_attribute_changed(dev_t device, ino_t node, const char *attribute,
int32 cause) int32 cause)
{ {
if (!attribute) if (!attribute)
@@ -83,8 +83,8 @@ notify_select_event(selectsync *sync, uint32 ref, uint8 event)
// notify_query_entry_created // notify_query_entry_created
status_t status_t
notify_query_entry_created(port_id port, int32 token, mount_id device, notify_query_entry_created(port_id port, int32 token, dev_t device,
vnode_id directory, const char *name, vnode_id node) ino_t directory, const char *name, ino_t node)
{ {
if (!name) if (!name)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -95,8 +95,8 @@ notify_query_entry_created(port_id port, int32 token, mount_id device,
// notify_query_entry_removed // notify_query_entry_removed
status_t status_t
notify_query_entry_removed(port_id port, int32 token, mount_id device, notify_query_entry_removed(port_id port, int32 token, dev_t device,
vnode_id directory, const char *name, vnode_id node) ino_t directory, const char *name, ino_t node)
{ {
if (!name) if (!name)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -111,49 +111,49 @@ notify_query_entry_removed(port_id port, int32 token, mount_id device,
// new_vnode // new_vnode
status_t status_t
new_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode) new_vnode(dev_t mountID, ino_t vnodeID, fs_vnode privateNode)
{ {
return UserlandFS::KernelEmu::publish_vnode(mountID, vnodeID, privateNode); return UserlandFS::KernelEmu::publish_vnode(mountID, vnodeID, privateNode);
} }
// publish_vnode // publish_vnode
status_t status_t
publish_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode) publish_vnode(dev_t mountID, ino_t vnodeID, fs_vnode privateNode)
{ {
return UserlandFS::KernelEmu::publish_vnode(mountID, vnodeID, privateNode); return UserlandFS::KernelEmu::publish_vnode(mountID, vnodeID, privateNode);
} }
// get_vnode // get_vnode
status_t status_t
get_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode *privateNode) get_vnode(dev_t mountID, ino_t vnodeID, fs_vnode *privateNode)
{ {
return UserlandFS::KernelEmu::get_vnode(mountID, vnodeID, privateNode); return UserlandFS::KernelEmu::get_vnode(mountID, vnodeID, privateNode);
} }
// put_vnode // put_vnode
status_t status_t
put_vnode(mount_id mountID, vnode_id vnodeID) put_vnode(dev_t mountID, ino_t vnodeID)
{ {
return UserlandFS::KernelEmu::put_vnode(mountID, vnodeID); return UserlandFS::KernelEmu::put_vnode(mountID, vnodeID);
} }
// remove_vnode // remove_vnode
status_t status_t
remove_vnode(mount_id mountID, vnode_id vnodeID) remove_vnode(dev_t mountID, ino_t vnodeID)
{ {
return UserlandFS::KernelEmu::remove_vnode(mountID, vnodeID); return UserlandFS::KernelEmu::remove_vnode(mountID, vnodeID);
} }
// unremove_vnode // unremove_vnode
status_t status_t
unremove_vnode(mount_id mountID, vnode_id vnodeID) unremove_vnode(dev_t mountID, ino_t vnodeID)
{ {
return UserlandFS::KernelEmu::unremove_vnode(mountID, vnodeID); return UserlandFS::KernelEmu::unremove_vnode(mountID, vnodeID);
} }
// get_vnode_removed // get_vnode_removed
status_t status_t
get_vnode_removed(mount_id mountID, vnode_id vnodeID, bool* removed) get_vnode_removed(dev_t mountID, ino_t vnodeID, bool* removed)
{ {
return UserlandFS::KernelEmu::get_vnode_removed(mountID, vnodeID, removed); return UserlandFS::KernelEmu::get_vnode_removed(mountID, vnodeID, removed);
} }
@@ -342,7 +342,7 @@ block_cache_put(void *_cache, off_t blockNumber)
// file_cache_create // file_cache_create
void * void *
file_cache_create(mount_id mountID, vnode_id vnodeID, off_t size, int fd) file_cache_create(dev_t mountID, ino_t vnodeID, off_t size, int fd)
{ {
return UserlandFS::HaikuKernelEmu::file_cache_create(mountID, vnodeID, return UserlandFS::HaikuKernelEmu::file_cache_create(mountID, vnodeID,
size, fd); size, fd);
@@ -124,8 +124,8 @@ get_port_and_fs(RequestPort** port, FileSystem** fileSystem)
// notify_listener // notify_listener
status_t status_t
UserlandFS::KernelEmu::notify_listener(int32 operation, uint32 details, UserlandFS::KernelEmu::notify_listener(int32 operation, uint32 details,
mount_id device, vnode_id oldDirectory, vnode_id directory, dev_t device, ino_t oldDirectory, ino_t directory,
vnode_id node, const char* oldName, const char* name) ino_t node, const char* oldName, const char* name)
{ {
// get the request port and the file system // get the request port and the file system
RequestPort* port; RequestPort* port;
@@ -209,8 +209,8 @@ UserlandFS::KernelEmu::notify_select_event(selectsync *sync, uint32 ref,
// send_notification // send_notification
status_t status_t
UserlandFS::KernelEmu::notify_query(port_id targetPort, int32 token, UserlandFS::KernelEmu::notify_query(port_id targetPort, int32 token,
int32 operation, mount_id device, vnode_id directory, const char* name, int32 operation, dev_t device, ino_t directory, const char* name,
vnode_id node) ino_t node)
{ {
// get the request port and the file system // get the request port and the file system
RequestPort* port; RequestPort* port;
@@ -256,7 +256,7 @@ UserlandFS::KernelEmu::notify_query(port_id targetPort, int32 token,
// get_vnode // get_vnode
status_t status_t
UserlandFS::KernelEmu::get_vnode(mount_id nsid, vnode_id vnid, fs_vnode* data) UserlandFS::KernelEmu::get_vnode(dev_t nsid, ino_t vnid, fs_vnode* data)
{ {
// get the request port and the file system // get the request port and the file system
RequestPort* port; RequestPort* port;
@@ -292,7 +292,7 @@ UserlandFS::KernelEmu::get_vnode(mount_id nsid, vnode_id vnid, fs_vnode* data)
// put_vnode // put_vnode
status_t status_t
UserlandFS::KernelEmu::put_vnode(mount_id nsid, vnode_id vnid) UserlandFS::KernelEmu::put_vnode(dev_t nsid, ino_t vnid)
{ {
// get the request port and the file system // get the request port and the file system
RequestPort* port; RequestPort* port;
@@ -327,7 +327,7 @@ UserlandFS::KernelEmu::put_vnode(mount_id nsid, vnode_id vnid)
// new_vnode // new_vnode
status_t status_t
UserlandFS::KernelEmu::new_vnode(mount_id nsid, vnode_id vnid, fs_vnode data) UserlandFS::KernelEmu::new_vnode(dev_t nsid, ino_t vnid, fs_vnode data)
{ {
// get the request port and the file system // get the request port and the file system
RequestPort* port; RequestPort* port;
@@ -363,7 +363,7 @@ UserlandFS::KernelEmu::new_vnode(mount_id nsid, vnode_id vnid, fs_vnode data)
// publish_vnode // publish_vnode
status_t status_t
UserlandFS::KernelEmu::publish_vnode(mount_id nsid, vnode_id vnid, UserlandFS::KernelEmu::publish_vnode(dev_t nsid, ino_t vnid,
fs_vnode data) fs_vnode data)
{ {
// get the request port and the file system // get the request port and the file system
@@ -400,7 +400,7 @@ UserlandFS::KernelEmu::publish_vnode(mount_id nsid, vnode_id vnid,
// remove_vnode // remove_vnode
status_t status_t
UserlandFS::KernelEmu::remove_vnode(mount_id nsid, vnode_id vnid) UserlandFS::KernelEmu::remove_vnode(dev_t nsid, ino_t vnid)
{ {
// get the request port and the file system // get the request port and the file system
RequestPort* port; RequestPort* port;
@@ -435,7 +435,7 @@ UserlandFS::KernelEmu::remove_vnode(mount_id nsid, vnode_id vnid)
// unremove_vnode // unremove_vnode
status_t status_t
UserlandFS::KernelEmu::unremove_vnode(mount_id nsid, vnode_id vnid) UserlandFS::KernelEmu::unremove_vnode(dev_t nsid, ino_t vnid)
{ {
// get the request port and the file system // get the request port and the file system
RequestPort* port; RequestPort* port;
@@ -470,7 +470,7 @@ UserlandFS::KernelEmu::unremove_vnode(mount_id nsid, vnode_id vnid)
// get_vnode_removed // get_vnode_removed
status_t status_t
UserlandFS::KernelEmu::get_vnode_removed(mount_id nsid, vnode_id vnid, UserlandFS::KernelEmu::get_vnode_removed(dev_t nsid, ino_t vnid,
bool* removed) bool* removed)
{ {
// get the request port and the file system // get the request port and the file system
@@ -9,28 +9,26 @@ struct selectsync;
namespace UserlandFS { namespace UserlandFS {
namespace KernelEmu { namespace KernelEmu {
typedef int32 mount_id;
typedef int64 vnode_id;
typedef void* fs_vnode; typedef void* fs_vnode;
int new_path(const char *path, char **copy); int new_path(const char *path, char **copy);
void free_path(char *p); void free_path(char *p);
status_t notify_listener(int32 operation, uint32 details, mount_id device, status_t notify_listener(int32 operation, uint32 details, dev_t device,
vnode_id oldDirectory, vnode_id directory, vnode_id node, ino_t oldDirectory, ino_t directory, ino_t node,
const char* oldName, const char* name); const char* oldName, const char* name);
status_t notify_select_event(selectsync *sync, uint32 ref, uint8 event, status_t notify_select_event(selectsync *sync, uint32 ref, uint8 event,
bool unspecifiedEvent); bool unspecifiedEvent);
status_t notify_query(port_id port, int32 token, int32 operation, status_t notify_query(port_id port, int32 token, int32 operation,
mount_id device, vnode_id directory, const char* name, vnode_id node); dev_t device, ino_t directory, const char* name, ino_t node);
status_t get_vnode(mount_id nsid, vnode_id vnid, fs_vnode* data); status_t get_vnode(dev_t nsid, ino_t vnid, fs_vnode* data);
status_t put_vnode(mount_id nsid, vnode_id vnid); status_t put_vnode(dev_t nsid, ino_t vnid);
status_t new_vnode(mount_id nsid, vnode_id vnid, fs_vnode data); status_t new_vnode(dev_t nsid, ino_t vnid, fs_vnode data);
status_t publish_vnode(mount_id nsid, vnode_id vnid, fs_vnode data); status_t publish_vnode(dev_t nsid, ino_t vnid, fs_vnode data);
status_t remove_vnode(mount_id nsid, vnode_id vnid); status_t remove_vnode(dev_t nsid, ino_t vnid);
status_t unremove_vnode(mount_id nsid, vnode_id vnid); status_t unremove_vnode(dev_t nsid, ino_t vnid);
status_t get_vnode_removed(mount_id nsid, vnode_id vnid, bool* removed); status_t get_vnode_removed(dev_t nsid, ino_t vnid, bool* removed);
void kernel_debugger(const char *message); void kernel_debugger(const char *message);
void vpanic(const char *format, va_list args); void vpanic(const char *format, va_list args);
+6 -6
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1142,7 +1142,7 @@ out:
extern "C" void extern "C" void
cache_prefetch(mount_id mountID, vnode_id vnodeID, off_t offset, size_t size) cache_prefetch(dev_t mountID, ino_t vnodeID, off_t offset, size_t size)
{ {
void *vnode; void *vnode;
@@ -1160,8 +1160,8 @@ cache_prefetch(mount_id mountID, vnode_id vnodeID, off_t offset, size_t size)
extern "C" void extern "C" void
cache_node_opened(void *vnode, int32 fdType, vm_cache_ref *cache, mount_id mountID, cache_node_opened(void *vnode, int32 fdType, vm_cache_ref *cache, dev_t mountID,
vnode_id parentID, vnode_id vnodeID, const char *name) ino_t parentID, ino_t vnodeID, const char *name)
{ {
if (sCacheModule == NULL || sCacheModule->node_opened == NULL) if (sCacheModule == NULL || sCacheModule->node_opened == NULL)
return; return;
@@ -1179,7 +1179,7 @@ cache_node_opened(void *vnode, int32 fdType, vm_cache_ref *cache, mount_id mount
extern "C" void extern "C" void
cache_node_closed(void *vnode, int32 fdType, vm_cache_ref *cache, cache_node_closed(void *vnode, int32 fdType, vm_cache_ref *cache,
mount_id mountID, vnode_id vnodeID) dev_t mountID, ino_t vnodeID)
{ {
if (sCacheModule == NULL || sCacheModule->node_closed == NULL) if (sCacheModule == NULL || sCacheModule->node_closed == NULL)
return; return;
@@ -1229,7 +1229,7 @@ file_cache_init(void)
extern "C" void * extern "C" void *
file_cache_create(mount_id mountID, vnode_id vnodeID, off_t size, int fd) file_cache_create(dev_t mountID, ino_t vnodeID, off_t size, int fd)
{ {
TRACE(("file_cache_create(mountID = %ld, vnodeID = %Ld, size = %Ld, fd = %d)\n", mountID, vnodeID, size, fd)); TRACE(("file_cache_create(mountID = %ld, vnodeID = %Ld, size = %Ld, fd = %d)\n", mountID, vnodeID, size, fd));
+14 -14
View File
@@ -81,7 +81,7 @@ struct devfs_stream {
struct devfs_vnode { struct devfs_vnode {
struct devfs_vnode *all_next; struct devfs_vnode *all_next;
vnode_id id; ino_t id;
char *name; char *name;
time_t modification_time; time_t modification_time;
time_t creation_time; time_t creation_time;
@@ -95,7 +95,7 @@ struct devfs_vnode {
#define DEVFS_HASH_SIZE 16 #define DEVFS_HASH_SIZE 16
struct devfs { struct devfs {
mount_id id; dev_t id;
recursive_lock lock; recursive_lock lock;
int32 next_vnode_id; int32 next_vnode_id;
hash_table *vnode_hash; hash_table *vnode_hash;
@@ -124,8 +124,8 @@ enum {
struct driver_entry { struct driver_entry {
driver_entry *next; driver_entry *next;
const char *path; const char *path;
mount_id device; dev_t device;
vnode_id node; ino_t node;
time_t last_modified; time_t last_modified;
image_id image; image_id image;
}; };
@@ -148,7 +148,7 @@ static uint32
driver_entry_hash(void *_driver, const void *_key, uint32 range) driver_entry_hash(void *_driver, const void *_key, uint32 range)
{ {
driver_entry *driver = (driver_entry *)_driver; driver_entry *driver = (driver_entry *)_driver;
const vnode_id *key = (const vnode_id *)_key; const ino_t *key = (const ino_t *)_key;
if (driver != NULL) if (driver != NULL)
return driver->node % range; return driver->node % range;
@@ -161,7 +161,7 @@ static int
driver_entry_compare(void *_driver, const void *_key) driver_entry_compare(void *_driver, const void *_key)
{ {
driver_entry *driver = (driver_entry *)_driver; driver_entry *driver = (driver_entry *)_driver;
const vnode_id *key = (const vnode_id *)_key; const ino_t *key = (const ino_t *)_key;
if (driver->node == *key) if (driver->node == *key)
return 0; return 0;
@@ -349,7 +349,7 @@ static uint32
devfs_vnode_hash(void *_vnode, const void *_key, uint32 range) devfs_vnode_hash(void *_vnode, const void *_key, uint32 range)
{ {
struct devfs_vnode *vnode = (struct devfs_vnode *)_vnode; struct devfs_vnode *vnode = (struct devfs_vnode *)_vnode;
const vnode_id *key = (const vnode_id *)_key; const ino_t *key = (const ino_t *)_key;
if (vnode != NULL) if (vnode != NULL)
return vnode->id % range; return vnode->id % range;
@@ -362,7 +362,7 @@ static int
devfs_vnode_compare(void *_vnode, const void *_key) devfs_vnode_compare(void *_vnode, const void *_key)
{ {
struct devfs_vnode *vnode = (struct devfs_vnode *)_vnode; struct devfs_vnode *vnode = (struct devfs_vnode *)_vnode;
const vnode_id *key = (const vnode_id *)_key; const ino_t *key = (const ino_t *)_key;
if (vnode->id == *key) if (vnode->id == *key)
return 0; return 0;
@@ -968,8 +968,8 @@ dump_node(int argc, char **argv)
static status_t static status_t
devfs_mount(mount_id id, const char *devfs, uint32 flags, const char *args, devfs_mount(dev_t id, const char *devfs, uint32 flags, const char *args,
fs_volume *_fs, vnode_id *root_vnid) fs_volume *_fs, ino_t *root_vnid)
{ {
struct devfs_vnode *vnode; struct devfs_vnode *vnode;
struct devfs *fs; struct devfs *fs;
@@ -1087,7 +1087,7 @@ devfs_sync(fs_volume fs)
static status_t static status_t
devfs_lookup(fs_volume _fs, fs_vnode _dir, const char *name, vnode_id *_id, int *_type) devfs_lookup(fs_volume _fs, fs_vnode _dir, const char *name, ino_t *_id, int *_type)
{ {
struct devfs *fs = (struct devfs *)_fs; struct devfs *fs = (struct devfs *)_fs;
struct devfs_vnode *dir = (struct devfs_vnode *)_dir; struct devfs_vnode *dir = (struct devfs_vnode *)_dir;
@@ -1159,7 +1159,7 @@ devfs_get_vnode_name(fs_volume _fs, fs_vnode _vnode, char *buffer, size_t buffer
static status_t static status_t
devfs_get_vnode(fs_volume _fs, vnode_id id, fs_vnode *_vnode, bool reenter) devfs_get_vnode(fs_volume _fs, ino_t id, fs_vnode *_vnode, bool reenter)
{ {
struct devfs *fs = (struct devfs *)_fs; struct devfs *fs = (struct devfs *)_fs;
struct devfs_vnode *vnode; struct devfs_vnode *vnode;
@@ -1220,7 +1220,7 @@ devfs_remove_vnode(fs_volume _fs, fs_vnode _v, bool reenter)
static status_t static status_t
devfs_create(fs_volume _fs, fs_vnode _dir, const char *name, int openMode, int perms, devfs_create(fs_volume _fs, fs_vnode _dir, const char *name, int openMode, int perms,
fs_cookie *_cookie, vnode_id *_newVnodeID) fs_cookie *_cookie, ino_t *_newVnodeID)
{ {
struct devfs_vnode *dir = (struct devfs_vnode *)_dir; struct devfs_vnode *dir = (struct devfs_vnode *)_dir;
struct devfs *fs = (struct devfs *)_fs; struct devfs *fs = (struct devfs *)_fs;
@@ -1449,7 +1449,7 @@ devfs_write(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, off_t pos,
static status_t static status_t
devfs_create_dir(fs_volume _fs, fs_vnode _dir, const char *name, devfs_create_dir(fs_volume _fs, fs_vnode _dir, const char *name,
int perms, vnode_id *_newVnodeID) int perms, ino_t *_newVnodeID)
{ {
struct devfs *fs = (struct devfs *)_fs; struct devfs *fs = (struct devfs *)_fs;
struct devfs_vnode *dir = (struct devfs_vnode *)_dir; struct devfs_vnode *dir = (struct devfs_vnode *)_dir;
+30 -30
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2003-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -50,14 +50,14 @@ struct monitor_listener {
struct node_monitor { struct node_monitor {
node_monitor *next; node_monitor *next;
mount_id device; dev_t device;
vnode_id node; ino_t node;
struct list listeners; struct list listeners;
}; };
struct monitor_hash_key { struct monitor_hash_key {
mount_id device; dev_t device;
vnode_id node; ino_t node;
}; };
struct interested_monitor_listener_list { struct interested_monitor_listener_list {
@@ -106,7 +106,7 @@ monitor_hash(void *_monitor, const void *_key, uint32 range)
*/ */
static node_monitor * static node_monitor *
get_monitor_for(mount_id device, vnode_id node) get_monitor_for(dev_t device, ino_t node)
{ {
struct monitor_hash_key key; struct monitor_hash_key key;
key.device = device; key.device = device;
@@ -171,7 +171,7 @@ remove_listener(monitor_listener *listener)
static status_t static status_t
add_node_monitor(io_context *context, mount_id device, vnode_id node, add_node_monitor(io_context *context, dev_t device, ino_t node,
uint32 flags, port_id port, uint32 token) uint32 flags, port_id port, uint32 token)
{ {
monitor_listener *listener; monitor_listener *listener;
@@ -255,7 +255,7 @@ out:
static status_t static status_t
remove_node_monitor(struct io_context *context, mount_id device, vnode_id node, remove_node_monitor(struct io_context *context, dev_t device, ino_t node,
uint32 flags, port_id port, uint32 token) uint32 flags, port_id port, uint32 token)
{ {
monitor_listener *listener; monitor_listener *listener;
@@ -348,7 +348,7 @@ remove_node_monitors_by_target(struct io_context *context, port_id port, uint32
*/ */
static void static void
get_interested_monitor_listeners(mount_id device, vnode_id node, get_interested_monitor_listeners(dev_t device, ino_t node,
uint32 flags, interested_monitor_listener_list *interestedListeners, uint32 flags, interested_monitor_listener_list *interestedListeners,
int32 &interestedListenerCount) int32 &interestedListenerCount)
{ {
@@ -443,8 +443,8 @@ send_notification_message(KMessage &message,
*/ */
static status_t static status_t
notify_entry_created_or_removed(int32 opcode, mount_id device, notify_entry_created_or_removed(int32 opcode, dev_t device,
vnode_id directory, const char *name, vnode_id node) ino_t directory, const char *name, ino_t node)
{ {
if (!name) if (!name)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -497,7 +497,7 @@ notify_entry_created_or_removed(int32 opcode, mount_id device,
static status_t static status_t
notify_query_entry_created_or_removed(int32 opcode, port_id port, int32 token, notify_query_entry_created_or_removed(int32 opcode, port_id port, int32 token,
mount_id device, vnode_id directory, const char *name, vnode_id node) dev_t device, ino_t directory, const char *name, ino_t node)
{ {
if (!name) if (!name)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -554,7 +554,7 @@ node_monitor_init(void)
status_t status_t
notify_unmount(mount_id device) notify_unmount(dev_t device)
{ {
TRACE(("unmounted device: %ld\n", device)); TRACE(("unmounted device: %ld\n", device));
@@ -584,7 +584,7 @@ notify_unmount(mount_id device)
status_t status_t
notify_mount(mount_id device, mount_id parentDevice, vnode_id parentDirectory) notify_mount(dev_t device, dev_t parentDevice, ino_t parentDirectory)
{ {
TRACE(("mounted device: %ld, parent %ld:%Ld\n", device, parentDevice, TRACE(("mounted device: %ld, parent %ld:%Ld\n", device, parentDevice,
parentDirectory)); parentDirectory));
@@ -684,8 +684,8 @@ stop_notifying(port_id port, uint32 token)
status_t status_t
notify_listener(int op, mount_id device, vnode_id parentNode, vnode_id toParentNode, notify_listener(int op, dev_t device, ino_t parentNode, ino_t toParentNode,
vnode_id node, const char *name) ino_t node, const char *name)
{ {
TRACE(("notify_listener(op = %d, device = %ld, node = %Ld, parent = %Ld, toParent = %Ld" TRACE(("notify_listener(op = %d, device = %ld, node = %Ld, parent = %Ld, toParent = %Ld"
", name = \"%s\"\n", op, device, node, parentNode, toParentNode, name)); ", name = \"%s\"\n", op, device, node, parentNode, toParentNode, name));
@@ -732,8 +732,8 @@ notify_listener(int op, mount_id device, vnode_id parentNode, vnode_id toParentN
*/ */
status_t status_t
notify_entry_created(mount_id device, vnode_id directory, const char *name, notify_entry_created(dev_t device, ino_t directory, const char *name,
vnode_id node) ino_t node)
{ {
return notify_entry_created_or_removed(B_ENTRY_CREATED, device, return notify_entry_created_or_removed(B_ENTRY_CREATED, device,
directory, name, node); directory, name, node);
@@ -751,8 +751,8 @@ notify_entry_created(mount_id device, vnode_id directory, const char *name,
*/ */
status_t status_t
notify_entry_removed(mount_id device, vnode_id directory, const char *name, notify_entry_removed(dev_t device, ino_t directory, const char *name,
vnode_id node) ino_t node)
{ {
return notify_entry_created_or_removed(B_ENTRY_REMOVED, device, return notify_entry_created_or_removed(B_ENTRY_REMOVED, device,
directory, name, node); directory, name, node);
@@ -772,16 +772,16 @@ notify_entry_removed(mount_id device, vnode_id directory, const char *name,
*/ */
status_t status_t
notify_entry_moved(mount_id device, vnode_id fromDirectory, notify_entry_moved(dev_t device, ino_t fromDirectory,
const char *fromName, vnode_id toDirectory, const char *toName, const char *fromName, ino_t toDirectory, const char *toName,
vnode_id node) ino_t node)
{ {
if (!fromName || !toName) if (!fromName || !toName)
return B_BAD_VALUE; return B_BAD_VALUE;
// If node is a mount point, we need to resolve it to the mounted // If node is a mount point, we need to resolve it to the mounted
// volume's root node. // volume's root node.
mount_id nodeDevice = device; dev_t nodeDevice = device;
resolve_mount_point_to_volume_root(device, node, &nodeDevice, &node); resolve_mount_point_to_volume_root(device, node, &nodeDevice, &node);
MutexLocker locker(gMonitorMutex); MutexLocker locker(gMonitorMutex);
@@ -835,7 +835,7 @@ notify_entry_moved(mount_id device, vnode_id fromDirectory,
*/ */
status_t status_t
notify_stat_changed(mount_id device, vnode_id node, uint32 statFields) notify_stat_changed(dev_t device, ino_t node, uint32 statFields)
{ {
MutexLocker locker(gMonitorMutex); MutexLocker locker(gMonitorMutex);
@@ -875,7 +875,7 @@ notify_stat_changed(mount_id device, vnode_id node, uint32 statFields)
*/ */
status_t status_t
notify_attribute_changed(mount_id device, vnode_id node, const char *attribute, notify_attribute_changed(dev_t device, ino_t node, const char *attribute,
int32 cause) int32 cause)
{ {
if (!attribute) if (!attribute)
@@ -922,8 +922,8 @@ notify_attribute_changed(mount_id device, vnode_id node, const char *attribute,
*/ */
status_t status_t
notify_query_entry_created(port_id port, int32 token, mount_id device, notify_query_entry_created(port_id port, int32 token, dev_t device,
vnode_id directory, const char *name, vnode_id node) ino_t directory, const char *name, ino_t node)
{ {
return notify_query_entry_created_or_removed(B_ENTRY_CREATED, port, token, return notify_query_entry_created_or_removed(B_ENTRY_CREATED, port, token,
device, directory, name, node); device, directory, name, node);
@@ -944,8 +944,8 @@ notify_query_entry_created(port_id port, int32 token, mount_id device,
*/ */
status_t status_t
notify_query_entry_removed(port_id port, int32 token, notify_query_entry_removed(port_id port, int32 token, dev_t device,
mount_id device, vnode_id directory, const char *name, vnode_id node) ino_t directory, const char *name, ino_t node)
{ {
return notify_query_entry_created_or_removed(B_ENTRY_REMOVED, port, token, return notify_query_entry_created_or_removed(B_ENTRY_REMOVED, port, token,
device, directory, name, node); device, directory, name, node);
+18 -18
View File
@@ -94,17 +94,17 @@ typedef DoublyLinkedList<ReadRequest> RequestList;
class Volume { class Volume {
public: public:
Volume(mount_id id); Volume(dev_t id);
~Volume(); ~Volume();
status_t InitCheck(); status_t InitCheck();
mount_id ID() const { return fID; } dev_t ID() const { return fID; }
Inode &RootNode() const { return *fRootNode; } Inode &RootNode() const { return *fRootNode; }
void Lock(); void Lock();
void Unlock(); void Unlock();
Inode *Lookup(vnode_id id); Inode *Lookup(ino_t id);
Inode *Lookup(const char *name); Inode *Lookup(const char *name);
Inode *CreateNode(Inode *parent, const char *name, Inode *CreateNode(Inode *parent, const char *name,
int32 type); int32 type);
@@ -112,7 +112,7 @@ class Volume {
status_t RemoveNode(Inode *directory, const char *name); status_t RemoveNode(Inode *directory, const char *name);
status_t RemoveNode(Inode *inode); status_t RemoveNode(Inode *inode);
vnode_id GetNextNodeID() { return fNextNodeID++; } ino_t GetNextNodeID() { return fNextNodeID++; }
Inode *FirstEntry() const { return fFirstEntry; } Inode *FirstEntry() const { return fFirstEntry; }
@@ -127,9 +127,9 @@ class Volume {
status_t _InsertNode(Inode *inode); status_t _InsertNode(Inode *inode);
mutex fLock; mutex fLock;
mount_id fID; dev_t fID;
Inode *fRootNode; Inode *fRootNode;
vnode_id fNextNodeID; ino_t fNextNodeID;
hash_table *fNodeHash; hash_table *fNodeHash;
hash_table *fNameHash; hash_table *fNameHash;
@@ -145,7 +145,7 @@ class Inode {
~Inode(); ~Inode();
status_t InitCheck(); status_t InitCheck();
vnode_id ID() const { return fID; } ino_t ID() const { return fID; }
const char *Name() const { return fName; } const char *Name() const { return fName; }
int32 Type() const { return fType; } int32 Type() const { return fType; }
@@ -200,7 +200,7 @@ class Inode {
Inode *fNext; Inode *fNext;
Inode *fHashNext; Inode *fHashNext;
Inode *fNameHashNext; Inode *fNameHashNext;
vnode_id fID; ino_t fID;
int32 fType; int32 fType;
const char *fName; const char *fName;
gid_t fGroupID; gid_t fGroupID;
@@ -302,7 +302,7 @@ RingBuffer::Writable() const
// #pragma mark - // #pragma mark -
Volume::Volume(mount_id id) Volume::Volume(dev_t id)
: :
fID(id), fID(id),
fRootNode(NULL), fRootNode(NULL),
@@ -464,7 +464,7 @@ Volume::_UpdateDirCookies(Inode *inode)
Inode * Inode *
Volume::Lookup(vnode_id id) Volume::Lookup(ino_t id)
{ {
return (Inode *)hash_lookup(fNodeHash, &id); return (Inode *)hash_lookup(fNodeHash, &id);
} }
@@ -847,7 +847,7 @@ uint32
Inode::hash_func(void *_node, const void *_key, uint32 range) Inode::hash_func(void *_node, const void *_key, uint32 range)
{ {
Inode *inode = (Inode *)_node; Inode *inode = (Inode *)_node;
const vnode_id *key = (const vnode_id *)_key; const ino_t *key = (const ino_t *)_key;
if (inode != NULL) if (inode != NULL)
return inode->ID() % range; return inode->ID() % range;
@@ -860,7 +860,7 @@ int
Inode::compare_func(void *_node, const void *_key) Inode::compare_func(void *_node, const void *_key)
{ {
Inode *inode = (Inode *)_node; Inode *inode = (Inode *)_node;
const vnode_id *key = (const vnode_id *)_key; const ino_t *key = (const ino_t *)_key;
if (inode->ID() == *key) if (inode->ID() == *key)
return 0; return 0;
@@ -1059,8 +1059,8 @@ ReadRequest::PutData(const void **_buffer, size_t *_bytesLeft)
static status_t static status_t
pipefs_mount(mount_id id, const char *device, uint32 flags, const char *args, pipefs_mount(dev_t id, const char *device, uint32 flags, const char *args,
fs_volume *_volume, vnode_id *_rootVnodeID) fs_volume *_volume, ino_t *_rootVnodeID)
{ {
TRACE(("pipefs_mount: entry\n")); TRACE(("pipefs_mount: entry\n"));
@@ -1104,7 +1104,7 @@ pipefs_sync(fs_volume fs)
static status_t static status_t
pipefs_lookup(fs_volume _volume, fs_vnode _dir, const char *name, pipefs_lookup(fs_volume _volume, fs_vnode _dir, const char *name,
vnode_id *_id, int *_type) ino_t *_id, int *_type)
{ {
Volume *volume = (Volume *)_volume; Volume *volume = (Volume *)_volume;
status_t status; status_t status;
@@ -1153,7 +1153,7 @@ pipefs_get_vnode_name(fs_volume _volume, fs_vnode _node, char *buffer,
static status_t static status_t
pipefs_get_vnode(fs_volume _volume, vnode_id id, fs_vnode *_inode, pipefs_get_vnode(fs_volume _volume, ino_t id, fs_vnode *_inode,
bool reenter) bool reenter)
{ {
Volume *volume = (Volume *)_volume; Volume *volume = (Volume *)_volume;
@@ -1221,7 +1221,7 @@ pipefs_remove_vnode(fs_volume _volume, fs_vnode _node, bool reenter)
static status_t static status_t
pipefs_create(fs_volume _volume, fs_vnode _dir, const char *name, int openMode, pipefs_create(fs_volume _volume, fs_vnode _dir, const char *name, int openMode,
int mode, fs_cookie *_cookie, vnode_id *_newVnodeID) int mode, fs_cookie *_cookie, ino_t *_newVnodeID)
{ {
Volume *volume = (Volume *)_volume; Volume *volume = (Volume *)_volume;
bool wasCreated = true; bool wasCreated = true;
@@ -1434,7 +1434,7 @@ pipefs_write(fs_volume _volume, fs_vnode _node, fs_cookie _cookie,
static status_t static status_t
pipefs_create_dir(fs_volume _volume, fs_vnode _dir, const char *name, pipefs_create_dir(fs_volume _volume, fs_vnode _dir, const char *name,
int perms, vnode_id *_newID) int perms, ino_t *_newID)
{ {
TRACE(("pipefs: create directory \"%s\" requested...\n", name)); TRACE(("pipefs: create directory \"%s\" requested...\n", name));
return B_NOT_SUPPORTED; return B_NOT_SUPPORTED;
+14 -12
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -44,7 +44,7 @@ struct rootfs_stream {
struct rootfs_vnode { struct rootfs_vnode {
struct rootfs_vnode *all_next; struct rootfs_vnode *all_next;
vnode_id id; ino_t id;
char *name; char *name;
time_t modification_time; time_t modification_time;
time_t creation_time; time_t creation_time;
@@ -56,9 +56,9 @@ struct rootfs_vnode {
}; };
struct rootfs { struct rootfs {
mount_id id; dev_t id;
mutex lock; mutex lock;
vnode_id next_vnode_id; ino_t next_vnode_id;
hash_table *vnode_list_hash; hash_table *vnode_list_hash;
struct rootfs_vnode *root_vnode; struct rootfs_vnode *root_vnode;
}; };
@@ -85,7 +85,7 @@ static uint32
rootfs_vnode_hash_func(void *_v, const void *_key, uint32 range) rootfs_vnode_hash_func(void *_v, const void *_key, uint32 range)
{ {
struct rootfs_vnode *vnode = _v; struct rootfs_vnode *vnode = _v;
const vnode_id *key = _key; const ino_t *key = _key;
if (vnode != NULL) if (vnode != NULL)
return vnode->id % range; return vnode->id % range;
@@ -98,7 +98,7 @@ static int
rootfs_vnode_compare_func(void *_v, const void *_key) rootfs_vnode_compare_func(void *_v, const void *_key)
{ {
struct rootfs_vnode *v = _v; struct rootfs_vnode *v = _v;
const vnode_id *key = _key; const ino_t *key = _key;
if (v->id == *key) if (v->id == *key)
return 0; return 0;
@@ -303,8 +303,8 @@ err:
static status_t static status_t
rootfs_mount(mount_id id, const char *device, uint32 flags, const char *args, rootfs_mount(dev_t id, const char *device, uint32 flags, const char *args,
fs_volume *_fs, vnode_id *root_vnid) fs_volume *_fs, ino_t *root_vnid)
{ {
struct rootfs *fs; struct rootfs *fs;
struct rootfs_vnode *vnode; struct rootfs_vnode *vnode;
@@ -395,7 +395,7 @@ rootfs_sync(fs_volume fs)
static status_t static status_t
rootfs_lookup(fs_volume _fs, fs_vnode _dir, const char *name, vnode_id *_id, int *_type) rootfs_lookup(fs_volume _fs, fs_vnode _dir, const char *name, ino_t *_id, int *_type)
{ {
struct rootfs *fs = (struct rootfs *)_fs; struct rootfs *fs = (struct rootfs *)_fs;
struct rootfs_vnode *dir = (struct rootfs_vnode *)_dir; struct rootfs_vnode *dir = (struct rootfs_vnode *)_dir;
@@ -442,7 +442,7 @@ rootfs_get_vnode_name(fs_volume _fs, fs_vnode _vnode, char *buffer, size_t buffe
static status_t static status_t
rootfs_get_vnode(fs_volume _fs, vnode_id id, fs_vnode *_vnode, bool reenter) rootfs_get_vnode(fs_volume _fs, ino_t id, fs_vnode *_vnode, bool reenter)
{ {
struct rootfs *fs = (struct rootfs *)_fs; struct rootfs *fs = (struct rootfs *)_fs;
struct rootfs_vnode *vnode; struct rootfs_vnode *vnode;
@@ -505,7 +505,8 @@ rootfs_remove_vnode(fs_volume _fs, fs_vnode _vnode, bool reenter)
static status_t static status_t
rootfs_create(fs_volume _fs, fs_vnode _dir, const char *name, int omode, int perms, fs_cookie *_cookie, vnode_id *new_vnid) rootfs_create(fs_volume _fs, fs_vnode _dir, const char *name, int omode,
int perms, fs_cookie *_cookie, ino_t *new_vnid)
{ {
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -568,7 +569,8 @@ rootfs_write(fs_volume fs, fs_vnode vnode, fs_cookie cookie,
static status_t static status_t
rootfs_create_dir(fs_volume _fs, fs_vnode _dir, const char *name, int mode, vnode_id *_newID) rootfs_create_dir(fs_volume _fs, fs_vnode _dir, const char *name, int mode,
ino_t *_newID)
{ {
struct rootfs *fs = _fs; struct rootfs *fs = _fs;
struct rootfs_vnode *dir = _dir; struct rootfs_vnode *dir = _dir;
+61 -59
View File
@@ -6,7 +6,8 @@
* Distributed under the terms of the NewOS License. * Distributed under the terms of the NewOS License.
*/ */
/* Virtual File System and File System Interface Layer */ /*! Virtual File System and File System Interface Layer */
#include <OS.h> #include <OS.h>
#include <StorageDefs.h> #include <StorageDefs.h>
@@ -65,10 +66,10 @@ const static uint32 kMaxUnusedVnodes = 8192;
struct vnode { struct vnode {
struct vnode *next; struct vnode *next;
vm_cache_ref *cache; vm_cache_ref *cache;
mount_id device; dev_t device;
list_link mount_link; list_link mount_link;
list_link unused_link; list_link unused_link;
vnode_id id; ino_t id;
fs_vnode private_node; fs_vnode private_node;
struct fs_mount *mount; struct fs_mount *mount;
struct vnode *covered_by; struct vnode *covered_by;
@@ -81,8 +82,8 @@ struct vnode {
}; };
struct vnode_hash_key { struct vnode_hash_key {
mount_id device; dev_t device;
vnode_id vnode; ino_t vnode;
}; };
#define FS_CALL(vnode, op) (vnode->mount->fs->op) #define FS_CALL(vnode, op) (vnode->mount->fs->op)
@@ -103,7 +104,7 @@ struct vnode_hash_key {
struct fs_mount { struct fs_mount {
struct fs_mount *next; struct fs_mount *next;
file_system_module_info *fs; file_system_module_info *fs;
mount_id id; dev_t id;
void *cookie; void *cookie;
char *device_name; char *device_name;
char *fs_name; char *fs_name;
@@ -186,7 +187,7 @@ static struct vnode *sRoot;
#define MOUNTS_HASH_TABLE_SIZE 16 #define MOUNTS_HASH_TABLE_SIZE 16
static hash_table *sMountsTable; static hash_table *sMountsTable;
static mount_id sNextMountID = 1; static dev_t sNextMountID = 1;
mode_t __gUmask = 022; mode_t __gUmask = 022;
@@ -232,10 +233,10 @@ static status_t common_read_stat(struct file_descriptor *, struct stat *);
static status_t common_write_stat(struct file_descriptor *, const struct stat *, int statMask); static status_t common_write_stat(struct file_descriptor *, const struct stat *, int statMask);
static status_t vnode_path_to_vnode(struct vnode *vnode, char *path, static status_t vnode_path_to_vnode(struct vnode *vnode, char *path,
bool traverseLeafLink, int count, struct vnode **_vnode, vnode_id *_parentID, int *_type); bool traverseLeafLink, int count, struct vnode **_vnode, ino_t *_parentID, int *_type);
static status_t dir_vnode_to_path(struct vnode *vnode, char *buffer, size_t bufferSize); static status_t dir_vnode_to_path(struct vnode *vnode, char *buffer, size_t bufferSize);
static status_t fd_and_path_to_vnode(int fd, char *path, bool traverseLeafLink, static status_t fd_and_path_to_vnode(int fd, char *path, bool traverseLeafLink,
struct vnode **_vnode, vnode_id *_parentID, bool kernel); struct vnode **_vnode, ino_t *_parentID, bool kernel);
static void inc_vnode_ref_count(struct vnode *vnode); static void inc_vnode_ref_count(struct vnode *vnode);
static status_t dec_vnode_ref_count(struct vnode *vnode, bool reenter); static status_t dec_vnode_ref_count(struct vnode *vnode, bool reenter);
static inline void put_vnode(struct vnode *vnode); static inline void put_vnode(struct vnode *vnode);
@@ -430,7 +431,7 @@ static int
mount_compare(void *_m, const void *_key) mount_compare(void *_m, const void *_key)
{ {
struct fs_mount *mount = (fs_mount *)_m; struct fs_mount *mount = (fs_mount *)_m;
const mount_id *id = (mount_id *)_key; const dev_t *id = (dev_t *)_key;
if (mount->id == *id) if (mount->id == *id)
return 0; return 0;
@@ -443,7 +444,7 @@ static uint32
mount_hash(void *_m, const void *_key, uint32 range) mount_hash(void *_m, const void *_key, uint32 range)
{ {
struct fs_mount *mount = (fs_mount *)_m; struct fs_mount *mount = (fs_mount *)_m;
const mount_id *id = (mount_id *)_key; const dev_t *id = (dev_t *)_key;
if (mount) if (mount)
return mount->id % range; return mount->id % range;
@@ -457,7 +458,7 @@ mount_hash(void *_m, const void *_key, uint32 range)
*/ */
static struct fs_mount * static struct fs_mount *
find_mount(mount_id id) find_mount(dev_t id)
{ {
ASSERT_LOCKED_MUTEX(&sMountMutex); ASSERT_LOCKED_MUTEX(&sMountMutex);
@@ -466,7 +467,7 @@ find_mount(mount_id id)
static status_t static status_t
get_mount(mount_id id, struct fs_mount **_mount) get_mount(dev_t id, struct fs_mount **_mount)
{ {
struct fs_mount *mount; struct fs_mount *mount;
status_t status; status_t status;
@@ -626,7 +627,7 @@ remove_vnode_from_mount_list(struct vnode *vnode, struct fs_mount *mount)
static status_t static status_t
create_new_vnode(struct vnode **_vnode, mount_id mountID, vnode_id vnodeID) create_new_vnode(struct vnode **_vnode, dev_t mountID, ino_t vnodeID)
{ {
FUNCTION(("create_new_vnode()\n")); FUNCTION(("create_new_vnode()\n"));
@@ -787,7 +788,7 @@ inc_vnode_ref_count(struct vnode *vnode)
*/ */
static struct vnode * static struct vnode *
lookup_vnode(mount_id mountID, vnode_id vnodeID) lookup_vnode(dev_t mountID, ino_t vnodeID)
{ {
struct vnode_hash_key key; struct vnode_hash_key key;
@@ -814,7 +815,7 @@ lookup_vnode(mount_id mountID, vnode_id vnodeID)
*/ */
static status_t static status_t
get_vnode(mount_id mountID, vnode_id vnodeID, struct vnode **_vnode, int reenter) get_vnode(dev_t mountID, ino_t vnodeID, struct vnode **_vnode, int reenter)
{ {
FUNCTION(("get_vnode: mountid %ld vnid 0x%Lx %p\n", mountID, vnodeID, _vnode)); FUNCTION(("get_vnode: mountid %ld vnid 0x%Lx %p\n", mountID, vnodeID, _vnode));
@@ -1413,8 +1414,8 @@ resolve_mount_point_to_volume_root(struct vnode *vnode)
*/ */
status_t status_t
resolve_mount_point_to_volume_root(mount_id mountID, vnode_id nodeID, resolve_mount_point_to_volume_root(dev_t mountID, ino_t nodeID,
mount_id *resolvedMountID, vnode_id *resolvedNodeID) dev_t *resolvedMountID, ino_t *resolvedNodeID)
{ {
// get the node // get the node
struct vnode *node; struct vnode *node;
@@ -1518,7 +1519,7 @@ get_dir_path_and_leaf(char *path, char *filename)
static status_t static status_t
entry_ref_to_vnode(mount_id mountID, vnode_id directoryID, const char *name, struct vnode **_vnode) entry_ref_to_vnode(dev_t mountID, ino_t directoryID, const char *name, struct vnode **_vnode)
{ {
char clonedName[B_FILE_NAME_LENGTH + 1]; char clonedName[B_FILE_NAME_LENGTH + 1];
if (strlcpy(clonedName, name, B_FILE_NAME_LENGTH) >= B_FILE_NAME_LENGTH) if (strlcpy(clonedName, name, B_FILE_NAME_LENGTH) >= B_FILE_NAME_LENGTH)
@@ -1545,10 +1546,10 @@ entry_ref_to_vnode(mount_id mountID, vnode_id directoryID, const char *name, str
static status_t static status_t
vnode_path_to_vnode(struct vnode *vnode, char *path, bool traverseLeafLink, vnode_path_to_vnode(struct vnode *vnode, char *path, bool traverseLeafLink,
int count, struct vnode **_vnode, vnode_id *_parentID, int *_type) int count, struct vnode **_vnode, ino_t *_parentID, int *_type)
{ {
status_t status = 0; status_t status = 0;
vnode_id lastParentID = vnode->id; ino_t lastParentID = vnode->id;
int type = 0; int type = 0;
FUNCTION(("vnode_path_to_vnode(vnode = %p, path = %s)\n", vnode, path)); FUNCTION(("vnode_path_to_vnode(vnode = %p, path = %s)\n", vnode, path));
@@ -1560,7 +1561,7 @@ vnode_path_to_vnode(struct vnode *vnode, char *path, bool traverseLeafLink,
while (true) { while (true) {
struct vnode *nextVnode; struct vnode *nextVnode;
vnode_id vnodeID; ino_t vnodeID;
char *nextPath; char *nextPath;
TRACE(("vnode_path_to_vnode: top of loop. p = %p, p = '%s'\n", path, path)); TRACE(("vnode_path_to_vnode: top of loop. p = %p, p = '%s'\n", path, path));
@@ -1715,7 +1716,7 @@ vnode_path_to_vnode(struct vnode *vnode, char *path, bool traverseLeafLink,
static status_t static status_t
path_to_vnode(char *path, bool traverseLink, struct vnode **_vnode, path_to_vnode(char *path, bool traverseLink, struct vnode **_vnode,
vnode_id *_parentID, bool kernel) ino_t *_parentID, bool kernel)
{ {
struct vnode *start = NULL; struct vnode *start = NULL;
@@ -1943,7 +1944,7 @@ dir_vnode_to_path(struct vnode *vnode, char *buffer, size_t bufferSize)
char nameBuffer[sizeof(struct dirent) + B_FILE_NAME_LENGTH]; char nameBuffer[sizeof(struct dirent) + B_FILE_NAME_LENGTH];
char *name = &((struct dirent *)nameBuffer)->d_name[0]; char *name = &((struct dirent *)nameBuffer)->d_name[0];
struct vnode *parentVnode; struct vnode *parentVnode;
vnode_id parentID; ino_t parentID;
int type; int type;
// lookup the parent vnode // lookup the parent vnode
@@ -2121,7 +2122,7 @@ get_vnode_from_fd(int fd, bool kernel)
static status_t static status_t
fd_and_path_to_vnode(int fd, char *path, bool traverseLeafLink, fd_and_path_to_vnode(int fd, char *path, bool traverseLeafLink,
struct vnode **_vnode, vnode_id *_parentID, bool kernel) struct vnode **_vnode, ino_t *_parentID, bool kernel)
{ {
if (fd < 0 && !path) if (fd < 0 && !path)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -2288,7 +2289,7 @@ dump_mount(int argc, char **argv)
return 0; return 0;
} }
} else { } else {
mount_id id = atoll(argv[1]); dev_t id = atoll(argv[1]);
mount = (fs_mount *)hash_lookup(sMountsTable, (void *)&id); mount = (fs_mount *)hash_lookup(sMountsTable, (void *)&id);
if (mount == NULL) { if (mount == NULL) {
kprintf("fs_mount not found\n"); kprintf("fs_mount not found\n");
@@ -2342,8 +2343,8 @@ dump_vnode(int argc, char **argv)
} }
struct hash_iterator iterator; struct hash_iterator iterator;
mount_id device = -1; dev_t device = -1;
vnode_id id; ino_t id;
if (argc > 2) { if (argc > 2) {
device = atoi(argv[1]); device = atoi(argv[1]);
id = atoll(argv[2]); id = atoll(argv[2]);
@@ -2367,7 +2368,7 @@ static int
dump_vnodes(int argc, char **argv) dump_vnodes(int argc, char **argv)
{ {
// restrict dumped nodes to a certain device if requested // restrict dumped nodes to a certain device if requested
mount_id device = -1; dev_t device = -1;
if (argc > 1) if (argc > 1)
device = atoi(argv[1]); device = atoi(argv[1]);
@@ -2399,7 +2400,7 @@ dump_vnode_caches(int argc, char **argv)
struct vnode *vnode; struct vnode *vnode;
// restrict dumped nodes to a certain device if requested // restrict dumped nodes to a certain device if requested
mount_id device = -1; dev_t device = -1;
if (argc > 1) if (argc > 1)
device = atoi(argv[1]); device = atoi(argv[1]);
@@ -2506,7 +2507,7 @@ dump_vnode_usage(int argc, char **argv)
extern "C" status_t extern "C" status_t
new_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode) new_vnode(dev_t mountID, ino_t vnodeID, fs_vnode privateNode)
{ {
FUNCTION(("new_vnode(mountID = %ld, vnodeID = %Ld, node = %p)\n", FUNCTION(("new_vnode(mountID = %ld, vnodeID = %Ld, node = %p)\n",
mountID, vnodeID, privateNode)); mountID, vnodeID, privateNode));
@@ -2541,7 +2542,7 @@ new_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode)
extern "C" status_t extern "C" status_t
publish_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode) publish_vnode(dev_t mountID, ino_t vnodeID, fs_vnode privateNode)
{ {
FUNCTION(("publish_vnode()\n")); FUNCTION(("publish_vnode()\n"));
@@ -2569,7 +2570,7 @@ publish_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode)
extern "C" status_t extern "C" status_t
get_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode *_fsNode) get_vnode(dev_t mountID, ino_t vnodeID, fs_vnode *_fsNode)
{ {
struct vnode *vnode; struct vnode *vnode;
@@ -2583,7 +2584,7 @@ get_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode *_fsNode)
extern "C" status_t extern "C" status_t
put_vnode(mount_id mountID, vnode_id vnodeID) put_vnode(dev_t mountID, ino_t vnodeID)
{ {
struct vnode *vnode; struct vnode *vnode;
@@ -2599,7 +2600,7 @@ put_vnode(mount_id mountID, vnode_id vnodeID)
extern "C" status_t extern "C" status_t
remove_vnode(mount_id mountID, vnode_id vnodeID) remove_vnode(dev_t mountID, ino_t vnodeID)
{ {
struct vnode *vnode; struct vnode *vnode;
bool remove = false; bool remove = false;
@@ -2635,7 +2636,7 @@ remove_vnode(mount_id mountID, vnode_id vnodeID)
extern "C" status_t extern "C" status_t
unremove_vnode(mount_id mountID, vnode_id vnodeID) unremove_vnode(dev_t mountID, ino_t vnodeID)
{ {
struct vnode *vnode; struct vnode *vnode;
@@ -2651,7 +2652,7 @@ unremove_vnode(mount_id mountID, vnode_id vnodeID)
extern "C" status_t extern "C" status_t
get_vnode_removed(mount_id mountID, vnode_id vnodeID, bool* removed) get_vnode_removed(dev_t mountID, ino_t vnodeID, bool* removed)
{ {
mutex_lock(&sVnodeMutex); mutex_lock(&sVnodeMutex);
@@ -2741,7 +2742,7 @@ vfs_get_vnode_from_path(const char *path, bool kernel, void **_vnode)
extern "C" status_t extern "C" status_t
vfs_get_vnode(mount_id mountID, vnode_id vnodeID, void **_vnode) vfs_get_vnode(dev_t mountID, ino_t vnodeID, void **_vnode)
{ {
struct vnode *vnode; struct vnode *vnode;
@@ -2755,7 +2756,7 @@ vfs_get_vnode(mount_id mountID, vnode_id vnodeID, void **_vnode)
extern "C" status_t extern "C" status_t
vfs_entry_ref_to_vnode(mount_id mountID, vnode_id directoryID, vfs_entry_ref_to_vnode(dev_t mountID, ino_t directoryID,
const char *name, void **_vnode) const char *name, void **_vnode)
{ {
return entry_ref_to_vnode(mountID, directoryID, name, (struct vnode **)_vnode); return entry_ref_to_vnode(mountID, directoryID, name, (struct vnode **)_vnode);
@@ -2763,7 +2764,7 @@ vfs_entry_ref_to_vnode(mount_id mountID, vnode_id directoryID,
extern "C" void extern "C" void
vfs_vnode_to_node_ref(void *_vnode, mount_id *_mountID, vnode_id *_vnodeID) vfs_vnode_to_node_ref(void *_vnode, dev_t *_mountID, ino_t *_vnodeID)
{ {
struct vnode *vnode = (struct vnode *)_vnode; struct vnode *vnode = (struct vnode *)_vnode;
@@ -2779,7 +2780,7 @@ vfs_vnode_to_node_ref(void *_vnode, mount_id *_mountID, vnode_id *_vnodeID)
*/ */
extern "C" status_t extern "C" status_t
vfs_lookup_vnode(mount_id mountID, vnode_id vnodeID, void **_vnode) vfs_lookup_vnode(dev_t mountID, ino_t vnodeID, void **_vnode)
{ {
mutex_lock(&sVnodeMutex); mutex_lock(&sVnodeMutex);
struct vnode *vnode = lookup_vnode(mountID, vnodeID); struct vnode *vnode = lookup_vnode(mountID, vnodeID);
@@ -2794,7 +2795,7 @@ vfs_lookup_vnode(mount_id mountID, vnode_id vnodeID, void **_vnode)
extern "C" status_t extern "C" status_t
vfs_get_fs_node_from_path(mount_id mountID, const char *path, bool kernel, void **_node) vfs_get_fs_node_from_path(dev_t mountID, const char *path, bool kernel, void **_node)
{ {
TRACE(("vfs_get_fs_node_from_path(mountID = %ld, path = \"%s\", kernel %d)\n", TRACE(("vfs_get_fs_node_from_path(mountID = %ld, path = \"%s\", kernel %d)\n",
mountID, path, kernel)); mountID, path, kernel));
@@ -3018,7 +3019,7 @@ vfs_put_vnode(void *_vnode)
extern "C" status_t extern "C" status_t
vfs_get_cwd(mount_id *_mountID, vnode_id *_vnodeID) vfs_get_cwd(dev_t *_mountID, ino_t *_vnodeID)
{ {
// Get current working directory from io context // Get current working directory from io context
struct io_context *context = get_current_io_context(false); struct io_context *context = get_current_io_context(false);
@@ -3038,7 +3039,7 @@ vfs_get_cwd(mount_id *_mountID, vnode_id *_vnodeID)
extern "C" status_t extern "C" status_t
vfs_disconnect_vnode(mount_id mountID, vnode_id vnodeID) vfs_disconnect_vnode(dev_t mountID, ino_t vnodeID)
{ {
struct vnode *vnode; struct vnode *vnode;
@@ -3563,7 +3564,7 @@ create_vnode(struct vnode *directory, const char *name, int openMode,
{ {
struct vnode *vnode; struct vnode *vnode;
fs_cookie cookie; fs_cookie cookie;
vnode_id newID; ino_t newID;
int status; int status;
if (FS_CALL(directory, create) == NULL) if (FS_CALL(directory, create) == NULL)
@@ -3679,7 +3680,8 @@ open_attr_dir_vnode(struct vnode *vnode, bool kernel)
static int static int
file_create_entry_ref(mount_id mountID, vnode_id directoryID, const char *name, int openMode, int perms, bool kernel) file_create_entry_ref(dev_t mountID, ino_t directoryID, const char *name,
int openMode, int perms, bool kernel)
{ {
struct vnode *directory; struct vnode *directory;
int status; int status;
@@ -3720,7 +3722,7 @@ file_create(int fd, char *path, int openMode, int perms, bool kernel)
static int static int
file_open_entry_ref(mount_id mountID, vnode_id directoryID, const char *name, int openMode, bool kernel) file_open_entry_ref(dev_t mountID, ino_t directoryID, const char *name, int openMode, bool kernel)
{ {
struct vnode *vnode; struct vnode *vnode;
int status; int status;
@@ -3756,7 +3758,7 @@ file_open(int fd, char *path, int openMode, bool kernel)
// get the vnode matching the vnode + path combination // get the vnode matching the vnode + path combination
struct vnode *vnode = NULL; struct vnode *vnode = NULL;
vnode_id parentID; ino_t parentID;
status = fd_and_path_to_vnode(fd, path, traverse, &vnode, &parentID, kernel); status = fd_and_path_to_vnode(fd, path, traverse, &vnode, &parentID, kernel);
if (status != B_OK) if (status != B_OK)
return status; return status;
@@ -3905,10 +3907,10 @@ file_deselect(struct file_descriptor *descriptor, uint8 event,
static status_t static status_t
dir_create_entry_ref(mount_id mountID, vnode_id parentID, const char *name, int perms, bool kernel) dir_create_entry_ref(dev_t mountID, ino_t parentID, const char *name, int perms, bool kernel)
{ {
struct vnode *vnode; struct vnode *vnode;
vnode_id newID; ino_t newID;
status_t status; status_t status;
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
@@ -3935,7 +3937,7 @@ dir_create(int fd, char *path, int perms, bool kernel)
{ {
char filename[B_FILE_NAME_LENGTH]; char filename[B_FILE_NAME_LENGTH];
struct vnode *vnode; struct vnode *vnode;
vnode_id newID; ino_t newID;
status_t status; status_t status;
FUNCTION(("dir_create: path '%s', perms %d, kernel %d\n", path, perms, kernel)); FUNCTION(("dir_create: path '%s', perms %d, kernel %d\n", path, perms, kernel));
@@ -3955,7 +3957,7 @@ dir_create(int fd, char *path, int perms, bool kernel)
static int static int
dir_open_entry_ref(mount_id mountID, vnode_id parentID, const char *name, bool kernel) dir_open_entry_ref(dev_t mountID, ino_t parentID, const char *name, bool kernel)
{ {
struct vnode *vnode; struct vnode *vnode;
int status; int status;
@@ -3991,7 +3993,7 @@ dir_open(int fd, char *path, bool kernel)
// get the vnode matching the vnode + path combination // get the vnode matching the vnode + path combination
struct vnode *vnode = NULL; struct vnode *vnode = NULL;
vnode_id parentID; ino_t parentID;
status = fd_and_path_to_vnode(fd, path, true, &vnode, &parentID, kernel); status = fd_and_path_to_vnode(fd, path, true, &vnode, &parentID, kernel);
if (status != B_OK) if (status != B_OK)
return status; return status;
@@ -4956,7 +4958,7 @@ err:
static status_t static status_t
index_dir_open(mount_id mountID, bool kernel) index_dir_open(dev_t mountID, bool kernel)
{ {
struct fs_mount *mount; struct fs_mount *mount;
fs_cookie cookie; fs_cookie cookie;
@@ -5043,7 +5045,7 @@ index_dir_rewind(struct file_descriptor *descriptor)
static status_t static status_t
index_create(mount_id mountID, const char *name, uint32 type, uint32 flags, bool kernel) index_create(dev_t mountID, const char *name, uint32 type, uint32 flags, bool kernel)
{ {
FUNCTION(("index_create(mountID = %ld, name = %s, kernel = %d)\n", mountID, name, kernel)); FUNCTION(("index_create(mountID = %ld, name = %s, kernel = %d)\n", mountID, name, kernel));
@@ -5095,7 +5097,7 @@ index_free_fd(struct file_descriptor *descriptor)
static status_t static status_t
index_name_read_stat(mount_id mountID, const char *name, struct stat *stat, bool kernel) index_name_read_stat(dev_t mountID, const char *name, struct stat *stat, bool kernel)
{ {
FUNCTION(("index_remove(mountID = %ld, name = %s, kernel = %d)\n", mountID, name, kernel)); FUNCTION(("index_remove(mountID = %ld, name = %s, kernel = %d)\n", mountID, name, kernel));
@@ -5118,7 +5120,7 @@ out:
static status_t static status_t
index_remove(mount_id mountID, const char *name, bool kernel) index_remove(dev_t mountID, const char *name, bool kernel)
{ {
FUNCTION(("index_remove(mountID = %ld, name = %s, kernel = %d)\n", mountID, name, kernel)); FUNCTION(("index_remove(mountID = %ld, name = %s, kernel = %d)\n", mountID, name, kernel));
@@ -5396,7 +5398,7 @@ fs_mount(char *path, const char *device, const char *fsName, uint32 flags,
hash_insert(sMountsTable, mount); hash_insert(sMountsTable, mount);
mutex_unlock(&sMountMutex); mutex_unlock(&sMountMutex);
vnode_id rootID; ino_t rootID;
if (!sRoot) { if (!sRoot) {
// we haven't mounted anything yet // we haven't mounted anything yet
@@ -5693,7 +5695,7 @@ fs_sync(dev_t device)
struct vnode *vnode = (struct vnode *)list_get_next_item(&mount->vnodes, struct vnode *vnode = (struct vnode *)list_get_next_item(&mount->vnodes,
previousVnode); previousVnode);
vnode_id id = -1; ino_t id = -1;
if (vnode != NULL) if (vnode != NULL)
id = vnode->id; id = vnode->id;
+3 -2
View File
@@ -1,12 +1,12 @@
/* /*
* Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the NewOS License. * Distributed under the terms of the NewOS License.
*/ */
/* This is main - initializes processors and starts init */ /*! This is main - initializes processors and starts init */
#include <OS.h> #include <OS.h>
@@ -56,6 +56,7 @@ static uint32 sCpuRendezvous2;
static int32 main2(void *); static int32 main2(void *);
int _start(kernel_args *bootKernelArgs, int cpu); /* keep compiler happy */ int _start(kernel_args *bootKernelArgs, int cpu); /* keep compiler happy */
int int
_start(kernel_args *bootKernelArgs, int currentCPU) _start(kernel_args *bootKernelArgs, int currentCPU)
{ {