* revert r32999 and adjusted each filesystem to return B_NOT_A_DIRECTORY in

its open_dir() implementation instead (as suggested by Ingo).
-alphabranch (it's only a cleanup)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33025 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2009-09-09 13:45:12 +00:00
parent 30fd88d297
commit 425cb3d716
7 changed files with 8 additions and 11 deletions

View File

@ -1576,7 +1576,7 @@ bfs_open_dir(fs_volume* _volume, fs_vnode* _node, void** _cookie)
// we don't ask here for directories only, because the bfs_open_index_dir()
// function utilizes us (so we must be able to open indices as well)
if (!inode->IsContainer())
RETURN_ERROR(B_BAD_VALUE);
RETURN_ERROR(B_NOT_A_DIRECTORY);
BPlusTree* tree = inode->Tree();
if (tree == NULL)

View File

@ -1785,7 +1785,7 @@ cdda_open_dir(fs_volume* _volume, fs_vnode* _node, void** _cookie)
Inode* inode = (Inode*)_node->private_node;
if (!S_ISDIR(inode->Type()))
return B_BAD_VALUE;
return B_NOT_A_DIRECTORY;
if (inode != &volume->RootNode())
panic("pipefs: found directory that's not the root!");

View File

@ -437,7 +437,7 @@ ext2_open_dir(fs_volume *_volume, fs_vnode *_node, void **_cookie)
return status;
if (!inode->IsDirectory())
return B_BAD_VALUE;
return B_NOT_A_DIRECTORY;
DirectoryIterator* iterator = new(std::nothrow) DirectoryIterator(inode);
if (iterator == NULL)

View File

@ -1180,14 +1180,14 @@ ramfs_open_dir(fs_volume /*fs*/, fs_vnode _node, fs_cookie *_cookie)
Node *node = (Node*)_node;
FUNCTION(("dir: (%Lu)\n", node->GetID()));
// get the Directory
status_t error = (node->IsDirectory() ? B_OK : B_BAD_VALUE);
status_t error = (node->IsDirectory() ? B_OK : B_NOT_A_DIRECTORY);
Directory *dir = NULL;
if (error == B_OK) {
dir = dynamic_cast<Directory*>(node);
if (!dir) {
FATAL(("Node %Ld pretends to be a Directory, but isn't!\n",
node->GetID()));
error = B_BAD_VALUE;
error = B_NOT_A_DIRECTORY;
}
}
// create a DirectoryCookie

View File

@ -510,7 +510,7 @@ reiserfs_open_dir(fs_volume *fs, fs_vnode *_node, void **cookie)
VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(),
node->GetObjectID()));
status_t error = (node->IsDir() ? B_OK : B_BAD_VALUE);
status_t error = (node->IsDir() ? B_OK : B_NOT_A_DIRECTORY);
if (error == B_OK) {
DirectoryCookie *iterator = new(nothrow) DirectoryCookie(
volume->GetTree(), node->GetDirID(), node->GetObjectID());

View File

@ -310,7 +310,7 @@ udf_open_dir(fs_volume *volume, fs_vnode *vnode, void **cookie)
if (!dir->IsDirectory()) {
TRACE_ERROR(("udf_open_dir: given Icb is not a directory (type: %d)\n",
dir->Type()));
return B_BAD_VALUE;
return B_NOT_A_DIRECTORY;
}
DirectoryIterator *iterator = NULL;

View File

@ -123,10 +123,7 @@ opendir(const char* path)
int fd = _kern_open_dir(-1, path);
if (fd < 0) {
if (fd == B_BAD_VALUE)
errno = B_NOT_A_DIRECTORY;
else
errno = fd;
errno = fd;
return NULL;
}