static status_t nfs4_create(fs_volume* volume, fs_vnode* dir, const char* name, int openMode, int perms, void** _cookie, ino_t* _newVnodeID) { FileSystem* fs = reinterpret_cast<FileSystem*>(volume->private_volume); OpenFileCookie* cookie = new OpenFileCookie(fs); if (cookie == NULL) return B_NO_MEMORY; *_cookie = cookie; VnodeToInode* vti = reinterpret_cast<VnodeToInode*>(dir->private_node); TRACE("volume = %p, dir = %" B_PRIi64 ", name = %s, openMode = %d," \ " perms = %d", volume, vti->ID(), name, openMode, perms); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); if (inode == NULL) return B_ENTRY_NOT_FOUND; MutexLocker createLocker(fs->CreateFileLock()); OpenDelegationData data; status_t result = inode->Create(name, openMode, perms, cookie, &data, _newVnodeID); if (result != B_OK) { delete cookie; return result; } result = get_new_vnode(volume, *_newVnodeID, &vti); if (result != B_OK) { delete cookie; return result; } VnodeToInodeLocker _child(vti); Inode* child = vti->Get(); if (child == NULL) { delete cookie; put_vnode(volume, *_newVnodeID); return B_ENTRY_NOT_FOUND; } child->SetOpenState(cookie->fOpenState); if (data.fType != OPEN_DELEGATE_NONE) { Delegation* delegation = new(std::nothrow) Delegation(data, child, cookie->fOpenState->fClientID); if (delegation != NULL) { delegation->fInfo = cookie->fOpenState->fInfo; delegation->fFileSystem = child->GetFileSystem(); child->SetDelegation(delegation); } } TRACE("*cookie = %p, *newVnodeID = %" B_PRIi64, *_cookie, *_newVnodeID); return result; }