rem: status = tree->Remove(&transaction, (const uint8 *)oldName, strlen(oldName), id);
add: status = tree->Remove(transaction, (const uint8 *)oldName, strlen(oldName), id);
context: bfs_rename(void *_ns, void *_oldDir, const char *oldName, void *_newDir, const char *newName){	FUNCTION_START(("oldDir = %p, oldName = \"%s\", newDir = %p, newName = \"%s\"\n", _oldDir, oldName, _newDir, newName));	// there might be some more tests needed?!	if (_ns == NULL || _oldDir == NULL || _newDir == NULL		|| oldName == NULL || *oldName == '\0'		|| newName == NULL || *newName == '\0'		|| !strcmp(oldName, ".") || !strcmp(oldName, "..")		|| !strcmp(newName, ".") || !strcmp(newName, "..")		|| strchr(newName, '/') != NULL)		RETURN_ERROR(B_BAD_VALUE);	Volume *volume = (Volume *)_ns;	Inode *oldDirectory = (Inode *)_oldDir;	Inode *newDirectory = (Inode *)_newDir;	// are we already done?	if (oldDirectory == newDirectory && !strcmp(oldName, newName))		return B_OK;	RecursiveLocker locker(volume->Lock());	// get the directory's tree, and a pointer to the inode which should be changed	BPlusTree *tree;	status_t status = oldDirectory->GetTree(&tree);	if (status < B_OK)		RETURN_ERROR(status);	off_t id;	status = tree->Find((const uint8 *)oldName, strlen(oldName), &id);	if (status < B_OK)		RETURN_ERROR(status);	Vnode vnode(volume, id);	Inode *inode;	if (vnode.Get(&inode) < B_OK)		return B_IO_ERROR;	// Don't move a directory into one of its children - we soar up	// from the newDirectory to either the root node or the old	// directory, whichever comes first.	// If we meet our inode on that way, we have to bail out.	if (oldDirectory != newDirectory) {		vnode_id parent = volume->ToVnode(newDirectory->Parent());		vnode_id root = volume->RootNode()->ID();		while (true) {			if (parent == id)				return B_BAD_VALUE;			else if (parent == root || parent == oldDirectory->ID())				break;			Vnode vnode(volume, parent);			Inode *parentNode;			if (vnode.Get(&parentNode) < B_OK)				return B_ERROR;			parent = volume->ToVnode(parentNode->Parent());		}	}	// Everything okay? Then lets get to work...	Transaction transaction(volume, oldDirectory->BlockNumber());	// First, try to make sure there is nothing that will stop us in	// the target directory - since this is the only non-critical	// failure, we will test this case first	BPlusTree *newTree = tree;	if (newDirectory != oldDirectory) {		status = newDirectory->GetTree(&newTree);		if (status < B_OK)			RETURN_ERROR(status);	}	status = newTree->Insert(&transaction, (const uint8 *)newName, strlen(newName), id);	if (status == B_NAME_IN_USE) {		// If there is already a file with that name, we have to remove		// it, as long it's not a directory with files in it		off_t clobber;		if (newTree->Find((const uint8 *)newName, strlen(newName), &clobber) < B_OK)			return B_NAME_IN_USE;		if (clobber == id)			return B_BAD_VALUE;		Vnode vnode(volume, clobber);		Inode *other;		if (vnode.Get(&other) < B_OK)			return B_NAME_IN_USE;		status = newDirectory->Remove(&transaction, newName, NULL, other->IsDirectory());		if (status < B_OK)			return status;		notify_listener(B_ENTRY_REMOVED, volume->ID(), newDirectory->ID(), 0, clobber, NULL);		status = newTree->Insert(&transaction, (const uint8 *)newName, strlen(newName), id);	}	if (status < B_OK)		return status;	// If anything fails now, we have to remove the inode from the	// new directory in any case to restore the previous state	status_t bailStatus = B_OK;	// update the name only when they differ	bool nameUpdated = false;	if (strcmp(oldName, newName)) {		status = inode->SetName(&transaction, newName);		if (status == B_OK) {			Index index(volume);			index.UpdateName(&transaction, oldName, newName, inode);			nameUpdated = true;		}	}	if (status == B_OK) {		status = tree->Remove(&transaction, (const uint8 *)oldName, strlen(oldName), id);		if (status == B_OK) {			inode->Node()->parent = newDirectory->BlockRun();			// if it's a directory, update the parent directory pointer			// in its tree if necessary			BPlusTree *movedTree = NULL;			if (oldDirectory != newDirectory				&& inode->IsDirectory()				&& (status = inode->GetTree(&movedTree)) == B_OK)				status = movedTree->Replace(&transaction, (const uint8 *)"..", 2, newDirectory->ID());			if (status == B_OK) {				status = inode->WriteBack(&transaction);				if (status == B_OK)	{					transaction.Done();					notify_listener(B_ENTRY_MOVED, volume->ID(), oldDirectory->ID(),						newDirectory->ID(), id, newName);					return B_OK;				}			}			// If we get here, something has gone wrong already!			// Those better don't fail, or we switch to a read-only			// device for safety reasons (Volume::Panic() does this			// for us)			// Anyway, if we overwrote a file in the target directory			// this is lost now (only in-memory, not on-disk)...			bailStatus = tree->Insert(&transaction, (const uint8 *)oldName, strlen(oldName), id);			if (movedTree != NULL)				movedTree->Replace(&transaction, (const uint8 *)"..", 2, oldDirectory->ID());		}	}	if (bailStatus == B_OK && nameUpdated) {		bailStatus = inode->SetName(&transaction, oldName);		if (status == B_OK) {			// update inode and index			inode->WriteBack(&transaction);			Index index(volume);			index.UpdateName(&transaction, newName, oldName, inode);		}	}	if (bailStatus == B_OK)		bailStatus = newTree->Remove(&transaction, (const uint8 *)newName, strlen(newName), id);	if (bailStatus < B_OK)		volume->Panic();	return status;}