Switched from Inode::IsDirectory() to Inode::IsContainer() where necessary.

Now makes use of the changed Inode::Create() logic.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2031 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2002-11-20 01:52:03 +00:00
parent 52fafe627e
commit 68ca164dc3
3 changed files with 7 additions and 18 deletions

View File

@ -353,7 +353,7 @@ BPlusTree::SetTo(Inode *stream)
if (fHeader->data_type > BPLUSTREE_DOUBLE_TYPE
|| (stream->Mode() & S_INDEX_DIR) && toMode[fHeader->data_type] != mode
|| !stream->IsDirectory()) {
|| !stream->IsContainer()) {
D( dump_bplustree_header(fHeader);
dump_inode(stream->Node());
);

View File

@ -176,15 +176,9 @@ Index::Create(Transaction *transaction,const char *name,uint32 type)
RETURN_ERROR(status);
}
vnode_id id;
status = Inode::Create(transaction,fVolume->IndicesNode(),name,S_INDEX_DIR | S_DIRECTORY | mode,0,type,&id);
if (status == B_OK) {
// since Inode::Create() lets the created inode open if "id" is specified,
// we don't need to call Vnode::Keep() here
Vnode vnode(fVolume,id);
return vnode.Get(&fNode);
}
return status;
// Inode::Create() will keep the inode locked for us
return Inode::Create(transaction, fVolume->IndicesNode(), name,
S_INDEX_DIR | S_DIRECTORY | mode, 0, type, NULL, &fNode);
}

View File

@ -141,7 +141,7 @@ Volume::Mount(const char *deviceName, uint32 flags)
fIndicesNode = new Inode(this, ToVnode(Indices()));
if (fIndicesNode == NULL
|| fIndicesNode->InitCheck() < B_OK
|| !fIndicesNode->IsDirectory()) {
|| !fIndicesNode->IsContainer()) {
INFORM(("bfs: volume doesn't have indices!\n"));
if (fIndicesNode) {
@ -236,17 +236,12 @@ Volume::CreateIndicesRoot(Transaction *transaction)
{
off_t id;
status_t status = Inode::Create(transaction, NULL, NULL,
S_INDEX_DIR | S_STR_INDEX | S_DIRECTORY | 0700, 0, 0, &id);
S_INDEX_DIR | S_STR_INDEX | S_DIRECTORY | 0700, 0, 0, &id, &fIndicesNode);
if (status < B_OK)
RETURN_ERROR(status);
fSuperBlock.indices = ToBlockRun(id);
WriteSuperBlock();
// The Vnode destructor will unlock the inode, but it has already been
// locked by the Inode::Create() call.
Vnode vnode(this,id);
return vnode.Get(&fIndicesNode);
return WriteSuperBlock();
}