本文整理汇总了C++中Inode::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ Inode::Create方法的具体用法?C++ Inode::Create怎么用?C++ Inode::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inode
的用法示例。
在下文中一共展示了Inode::Create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _
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;
}