Remove the additional fs_vnode_ops arugment from get_vnode() again as it's not

needed at all when used as intended. Thanks Ingo for the explanation on how this
is intended to work. Adjusted the overlay fs accordingly and updated/reverted
the changes to the other filesystems.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29250 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2009-02-19 18:13:01 +00:00
parent ef38aa7efc
commit 49004dc730
18 changed files with 69 additions and 68 deletions
+1 -1
View File
@@ -310,7 +310,7 @@ extern status_t publish_vnode(fs_volume *volume, ino_t vnodeID,
void *privateNode, fs_vnode_ops *ops, int type,
uint32 flags);
extern status_t get_vnode(fs_volume *volume, ino_t vnodeID,
void **_privateNode, fs_vnode_ops **_vnodeOps);
void **_privateNode);
extern status_t put_vnode(fs_volume *volume, ino_t vnodeID);
extern status_t acquire_vnode(fs_volume *volume, ino_t vnodeID);
extern status_t remove_vnode(fs_volume *volume, ino_t vnodeID);
+1 -2
View File
@@ -344,8 +344,7 @@ extern fssh_status_t fssh_publish_vnode(fssh_fs_volume *volume,
fssh_vnode_id vnodeID, void *privateNode,
fssh_fs_vnode_ops *ops, int type, uint32_t flags);
extern fssh_status_t fssh_get_vnode(fssh_fs_volume *volume,
fssh_vnode_id vnodeID, void **_privateNode,
fssh_fs_vnode_ops **_vnodeOps);
fssh_vnode_id vnodeID, void **_privateNode);
extern fssh_status_t fssh_put_vnode(fssh_fs_volume *volume,
fssh_vnode_id vnodeID);
extern fssh_status_t fssh_acquire_vnode(fssh_fs_volume *volume,
@@ -2701,7 +2701,7 @@ AttributeIterator::GetNext(char* name, size_t* _length, uint32* _type,
// if you haven't yet access to the attributes directory, get it
if (fAttributes == NULL) {
if (get_vnode(volume->FSVolume(), volume->ToVnode(fInode->Attributes()),
(void**)&fAttributes, NULL) != B_OK) {
(void**)&fAttributes) != B_OK) {
FATAL(("get_vnode() failed in AttributeIterator::GetNext(ino_t"
" = %Ld,name = \"%s\")\n", fInode->ID(), name));
return B_ENTRY_NOT_FOUND;
+1 -2
View File
@@ -354,8 +354,7 @@ public:
{
Unset();
return fStatus = get_vnode(volume->FSVolume(), id, (void**)&fInode,
NULL);
return fStatus = get_vnode(volume->FSVolume(), id, (void**)&fInode);
}
status_t SetTo(Volume* volume, block_run run)
@@ -556,7 +556,7 @@ bfs_lookup(fs_volume* _volume, fs_vnode* _directory, const char* file,
locker.Unlock();
Inode* inode;
status = get_vnode(volume->FSVolume(), *_vnodeID, (void**)&inode, NULL);
status = get_vnode(volume->FSVolume(), *_vnodeID, (void**)&inode);
if (status != B_OK) {
REPORT_ERROR(status);
return B_ENTRY_NOT_FOUND;
@@ -1493,7 +1493,7 @@ cdda_lookup(fs_volume* _volume, fs_vnode* _dir, const char* name, ino_t* _id)
if (inode == NULL)
return B_ENTRY_NOT_FOUND;
status = get_vnode(volume->FSVolume(), inode->ID(), NULL, NULL);
status = get_vnode(volume->FSVolume(), inode->ID(), NULL);
if (status < B_OK)
return status;
@@ -310,7 +310,7 @@ Volume::Mount(const char* deviceName, uint32 flags)
if ((fBlockCache = opener.InitCache(NumBlocks(), fBlockSize)) == NULL)
return B_ERROR;
status = get_vnode(fFSVolume, EXT2_ROOT_NODE, (void**)&fRootNode, NULL);
status = get_vnode(fFSVolume, EXT2_ROOT_NODE, (void**)&fRootNode);
if (status != B_OK) {
TRACE("could not create root node: get_vnode() failed!\n");
return status;
@@ -319,7 +319,7 @@ ext2_lookup(fs_volume* _volume, fs_vnode* _directory, const char* name,
break;
}
return get_vnode(volume->FSVolume(), *_vnodeID, NULL, NULL);
return get_vnode(volume->FSVolume(), *_vnodeID, NULL);
}
+1 -1
View File
@@ -433,7 +433,7 @@ findfile(nspace *vol, vnode *dir, const char *file, ino_t *vnid,
if (vnid)
*vnid = found_vnid;
if (node)
result = get_vnode(vol->volume, found_vnid, (void **)node, NULL);
result = get_vnode(vol->volume, found_vnid, (void **)node);
result = B_OK;
} else {
result = ENOENT;
+2 -2
View File
@@ -890,7 +890,7 @@ dosfs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode,
*vnid = dummy.vnid;
dummy.magic = ~VNODE_MAGIC;
result = get_vnode(_vol, *vnid, (void **)&file, NULL);
result = get_vnode(_vol, *vnid, (void **)&file);
if (result < B_OK) {
if (vol->fs_flags & FS_FLAGS_OP_SYNC)
_dosfs_sync(vol);
@@ -1155,7 +1155,7 @@ dosfs_rename(fs_volume *_vol, fs_vnode *_odir, const char *oldname,
if (vnid == vol->root_vnode.vnid)
break;
result = get_vnode(_vol, vnid, (void **)&dir, NULL);
result = get_vnode(_vol, vnid, (void **)&dir);
if (result < B_OK)
goto bi1;
parent = dir->dir_vnid;
@@ -225,12 +225,12 @@ fs_walk(fs_volume *_vol, fs_vnode *_base, const char *file, ino_t *_vnodeID)
// base directory
TRACE(("fs_walk - found \".\" file.\n"));
*_vnodeID = baseNode->id;
return get_vnode(_vol, *_vnodeID, NULL, NULL);
return get_vnode(_vol, *_vnodeID, NULL);
} else if (strcmp(file, "..") == 0) {
// parent directory
TRACE(("fs_walk - found \"..\" file.\n"));
*_vnodeID = baseNode->parID;
return get_vnode(_vol, *_vnodeID, NULL, NULL);
return get_vnode(_vol, *_vnodeID, NULL);
}
// look up file in the directory
@@ -273,7 +273,7 @@ fs_walk(fs_volume *_vol, fs_vnode *_base, const char *file, ino_t *_vnodeID)
TRACE(("fs_walk - New vnode id is %Ld\n", *_vnodeID));
result = get_vnode(_vol, *_vnodeID,
(void **)&newNode, NULL);
(void **)&newNode);
if (result == B_OK) {
newNode->parID = baseNode->id;
done = true;
@@ -898,7 +898,7 @@ fs_walk(fs_volume *_volume, fs_vnode *_base, const char *file, ino_t *vnid)
isLink=S_ISLNK(st.st_mode);
}
if ((result=get_vnode (_volume,*vnid,(void **)&dummy,NULL))<B_OK)
if ((result=get_vnode (_volume,*vnid,(void **)&dummy))<B_OK)
return result;
return B_OK;
@@ -1755,7 +1755,7 @@ fs_create(fs_volume *_volume, fs_vnode *_dir, const char *name, int omode, int p
*vnid=st.st_ino;
if ((result=get_vnode(_volume,*vnid,&dummy,NULL))<B_OK)
if ((result=get_vnode(_volume,*vnid,&dummy))<B_OK)
return result;
if (S_ISDIR(st.st_mode))
@@ -1901,7 +1901,7 @@ fs_unlink(fs_volume *_volume, fs_vnode *_dir, const char *name)
insert_node (ns,newNode);
if ((result=get_vnode(_volume,st.st_ino,(void **)&dummy,NULL))<B_OK)
if ((result=get_vnode(_volume,st.st_ino,(void **)&dummy))<B_OK)
{
XDRInPacketDestroy (&reply);
XDROutPacketDestroy (&call);
@@ -2195,7 +2195,7 @@ fs_rmdir(fs_volume *_volume, fs_vnode *_dir, const char *name)
insert_node (ns,newNode);
if ((result=get_vnode(_volume,st.st_ino,(void **)&dummy,NULL))<B_OK)
if ((result=get_vnode(_volume,st.st_ino,(void **)&dummy))<B_OK)
{
XDRInPacketDestroy(&reply);
XDROutPacketDestroy(&call);
@@ -2341,7 +2341,7 @@ fs_symlink(fs_volume *_volume, fs_vnode *_dir, const char *name, const char *pat
if (result==B_OK)
{
void *dummy;
if ((result=get_vnode(_volume,st.st_ino,&dummy,NULL))<B_OK)
if ((result=get_vnode(_volume,st.st_ino,&dummy))<B_OK)
return result;
XDRInPacketDestroy (&reply);
@@ -65,6 +65,7 @@ public:
status_t AllLayersMounted();
fs_volume * Volume() { return fVolume; }
fs_volume * SuperVolume() { return fVolume->super_volume; }
bool WriteSupport() { return fWriteSupport; }
@@ -83,6 +84,7 @@ public:
status_t InitCheck();
fs_volume * Volume() { return fVolume->Volume(); }
fs_volume * SuperVolume() { return fVolume->SuperVolume(); }
fs_vnode * SuperVnode() { return &fSuperVnode; }
ino_t InodeNumber() { return fInodeNumber; }
@@ -114,7 +116,8 @@ private:
class AttributeFile {
public:
AttributeFile(fs_volume *volume, fs_vnode *vnode);
AttributeFile(fs_volume *overlay, fs_volume *volume,
fs_vnode *vnode);
~AttributeFile();
status_t InitCheck() { return fStatus; }
@@ -123,8 +126,8 @@ public:
ino_t FileInode() { return fFileInode; }
status_t CreateEmpty();
status_t WriteAttributeFile(fs_volume *volume,
fs_vnode *vnode);
status_t WriteAttributeFile(fs_volume *overlay,
fs_volume *volume, fs_vnode *vnode);
status_t ReadAttributeDir(struct dirent *dirent,
size_t bufferSize, uint32 *numEntries,
@@ -286,8 +289,8 @@ status_t
OverlayInode::GetAttributeFile(AttributeFile **attributeFile)
{
if (fAttributeFile == NULL) {
fAttributeFile = new(std::nothrow) AttributeFile(SuperVolume(),
&fSuperVnode);
fAttributeFile = new(std::nothrow) AttributeFile(Volume(),
SuperVolume(), &fSuperVnode);
if (fAttributeFile == NULL) {
TRACE_ALWAYS("no memory to allocate attribute file\n");
return B_NO_MEMORY;
@@ -321,7 +324,8 @@ OverlayInode::WriteAttributeFile()
if (result != B_OK)
return result;
return fAttributeFile->WriteAttributeFile(SuperVolume(), &fSuperVnode);
return fAttributeFile->WriteAttributeFile(Volume(), SuperVolume(),
&fSuperVnode);
}
@@ -553,7 +557,8 @@ OverlayInode::Write(void *_cookie, off_t position, const void *buffer,
// #pragma mark AttributeFile
AttributeFile::AttributeFile(fs_volume *volume, fs_vnode *vnode)
AttributeFile::AttributeFile(fs_volume *overlay, fs_volume *volume,
fs_vnode *vnode)
: fStatus(B_NO_INIT),
fVolumeID(volume->id),
fFileInode(0),
@@ -633,13 +638,14 @@ AttributeFile::AttributeFile(fs_volume *volume, fs_vnode *vnode)
else if (i == 2)
fAttributeFileInode = inodeNumber;
fStatus = get_vnode(volume, inodeNumber, &currentVnode.private_node,
&currentVnode.ops);
OverlayInode *overlayInode = NULL;
fStatus = get_vnode(overlay, inodeNumber, (void **)&overlayInode);
if (fStatus != B_OK) {
TRACE_ALWAYS("getting vnode failed: %s\n", strerror(fStatus));
return;
}
currentVnode = *overlayInode->SuperVnode();
lastInodeNumber = inodeNumber;
}
@@ -767,7 +773,8 @@ AttributeFile::CreateEmpty()
status_t
AttributeFile::WriteAttributeFile(fs_volume *volume, fs_vnode *vnode)
AttributeFile::WriteAttributeFile(fs_volume *overlay, fs_volume *volume,
fs_vnode *vnode)
{
if (fFile == NULL)
return B_NO_INIT;
@@ -787,15 +794,17 @@ AttributeFile::WriteAttributeFile(fs_volume *volume, fs_vnode *vnode)
}
fs_vnode currentVnode;
OverlayInode *overlayInode = NULL;
if (fAttributeDirInode == 0) {
result = get_vnode(volume, fDirectoryInode,
&currentVnode.private_node, &currentVnode.ops);
result = get_vnode(overlay, fDirectoryInode, (void **)&overlayInode);
if (result != B_OK) {
TRACE_ALWAYS("failed to get directory vnode: %s\n",
strerror(result));
return result;
}
currentVnode = *overlayInode->SuperVnode();
// create the attribute directory
result = currentVnode.ops->create_dir(volume, &currentVnode,
ATTRIBUTE_OVERLAY_ATTRIBUTE_DIR_NAME, S_IRWXU | S_IRWXG | S_IRWXO,
@@ -813,14 +822,15 @@ AttributeFile::WriteAttributeFile(fs_volume *volume, fs_vnode *vnode)
void *attrFileCookie = NULL;
if (fAttributeFileInode == 0) {
result = get_vnode(volume, fAttributeDirInode,
&currentVnode.private_node, &currentVnode.ops);
result = get_vnode(overlay, fAttributeDirInode, (void **)&overlayInode);
if (result != B_OK) {
TRACE_ALWAYS("failed to get attribute directory vnode: %s\n",
strerror(result));
return result;
}
currentVnode = *overlayInode->SuperVnode();
// create the attribute file
result = currentVnode.ops->create(volume, &currentVnode,
nameBuffer, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP
@@ -835,22 +845,24 @@ AttributeFile::WriteAttributeFile(fs_volume *volume, fs_vnode *vnode)
return result;
}
result = get_vnode(volume, fAttributeFileInode,
&currentVnode.private_node, &currentVnode.ops);
result = get_vnode(overlay, fAttributeFileInode, (void **)&overlayInode);
if (result != B_OK) {
TRACE_ALWAYS("getting attribute file vnode after create failed: %s\n",
strerror(result));
return result;
}
currentVnode = *overlayInode->SuperVnode();
} else {
result = get_vnode(volume, fAttributeFileInode,
&currentVnode.private_node, &currentVnode.ops);
result = get_vnode(overlay, fAttributeFileInode, (void **)&overlayInode);
if (result != B_OK) {
TRACE_ALWAYS("getting attribute file vnode failed: %s\n",
strerror(result));
return result;
}
currentVnode = *overlayInode->SuperVnode();
// open the attribute file
result = currentVnode.ops->open(volume, &currentVnode, O_RDWR | O_TRUNC,
&attrFileCookie);
@@ -1296,6 +1308,11 @@ static status_t
overlay_get_super_vnode(fs_volume *volume, fs_vnode *vnode,
fs_volume *superVolume, fs_vnode *_superVnode)
{
if (volume == superVolume) {
*_superVnode = *vnode;
return B_OK;
}
OverlayInode *node = (OverlayInode *)vnode->private_node;
fs_vnode *superVnode = node->SuperVnode();
@@ -294,7 +294,7 @@ Volume::GetKeyOffsetForName(const char *name, int len, uint64 *result)
status_t
Volume::GetVNode(ino_t id, VNode **node)
{
return get_vnode(GetFSVolume(), id, (void**)node, NULL);
return get_vnode(GetFSVolume(), id, (void**)node);
}
// PutVNode
+4 -5
View File
@@ -407,8 +407,7 @@ add_partition(struct devfs* fs, struct devfs_vnode* device, const char* name,
// increase reference count of raw device -
// the partition device really needs it
status = get_vnode(fs->volume, device->id, (void**)&partition->raw_device,
NULL);
status = get_vnode(fs->volume, device->id, (void**)&partition->raw_device);
if (status < B_OK)
goto err1;
@@ -959,7 +958,7 @@ devfs_lookup(fs_volume *_volume, fs_vnode *_dir, const char *name, ino_t *_id)
return B_ENTRY_NOT_FOUND;
}
status = get_vnode(fs->volume, vnode->id, NULL, NULL);
status = get_vnode(fs->volume, vnode->id, NULL);
if (status < B_OK)
return status;
@@ -1063,7 +1062,7 @@ devfs_create(fs_volume* _volume, fs_vnode* _dir, const char* name, int openMode,
if (openMode & O_EXCL)
return B_FILE_EXISTS;
status = get_vnode(fs->volume, vnode->id, NULL, NULL);
status = get_vnode(fs->volume, vnode->id, NULL);
if (status < B_OK)
return status;
@@ -2092,7 +2091,7 @@ devfs_unpublish_device(BaseDevice* device, bool disconnect)
{
devfs_vnode* node;
status_t status = get_vnode(sDeviceFileSystem->volume, device->ID(),
(void**)&node, NULL);
(void**)&node);
if (status != B_OK)
return status;
+2 -2
View File
@@ -284,7 +284,7 @@ remove_node(struct rootfs *fs, struct rootfs_vnode *directory,
{
// schedule this vnode to be removed when it's ref goes to zero
bool gotNode = (get_vnode(fs->volume, vnode->id, NULL, NULL) == B_OK);
bool gotNode = (get_vnode(fs->volume, vnode->id, NULL) == B_OK);
status_t status = B_OK;
if (gotNode)
@@ -447,7 +447,7 @@ rootfs_lookup(fs_volume *_volume, fs_vnode *_dir, const char *name, ino_t *_id)
goto err;
}
status = get_vnode(fs->volume, vnode->id, NULL, NULL);
status = get_vnode(fs->volume, vnode->id, NULL);
if (status < B_OK)
goto err;
+4 -11
View File
@@ -3626,8 +3626,7 @@ publish_vnode(fs_volume *volume, ino_t vnodeID, void *privateNode,
extern "C" status_t
get_vnode(fs_volume *volume, ino_t vnodeID, void **_privateNode,
fs_vnode_ops **_vnodeOps)
get_vnode(fs_volume *volume, ino_t vnodeID, void **_privateNode)
{
struct vnode *vnode;
@@ -3653,14 +3652,8 @@ get_vnode(fs_volume *volume, ino_t vnodeID, void **_privateNode,
if (_privateNode != NULL)
*_privateNode = resolvedNode.private_node;
if (_vnodeOps != NULL)
*_vnodeOps = resolvedNode.ops;
} else {
if (_privateNode != NULL)
*_privateNode = vnode->private_node;
if (_vnodeOps != NULL)
*_vnodeOps = vnode->ops;
}
} else if (_privateNode != NULL)
*_privateNode = vnode->private_node;
return B_OK;
}
@@ -4054,7 +4047,7 @@ vfs_get_fs_node_from_path(fs_volume *volume, const char *path, bool kernel,
}
// Use get_vnode() to resolve the cookie for the right layer.
status = get_vnode(volume, vnode->id, _node, NULL);
status = get_vnode(volume, vnode->id, _node);
put_vnode(vnode);
return status;
+4 -10
View File
@@ -1986,7 +1986,7 @@ fssh_publish_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID,
extern "C" fssh_status_t
fssh_get_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID,
void **privateNode, fssh_fs_vnode_ops **vnodeOps)
void **privateNode)
{
struct vnode *vnode;
@@ -2012,14 +2012,8 @@ fssh_get_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID,
if (privateNode != NULL)
*privateNode = resolvedNode.private_node;
if (vnodeOps != NULL)
*vnodeOps = resolvedNode.ops;
} else {
if (privateNode != NULL)
*privateNode = vnode->private_node;
if (vnodeOps != NULL)
*vnodeOps = vnode->ops;
}
} else if (privateNode != NULL)
*privateNode = vnode->private_node;
return FSSH_B_OK;
}
@@ -2451,7 +2445,7 @@ vfs_get_fs_node_from_path(fssh_fs_volume *volume, const char *path, bool kernel,
}
// Use get_vnode() to resolve the cookie for the right layer.
status = ::fssh_get_vnode(volume, vnode->id, _node, NULL);
status = ::fssh_get_vnode(volume, vnode->id, _node);
put_vnode(vnode);
return FSSH_B_OK;