本文整理汇总了C++中Inode::AddReadRequest方法的典型用法代码示例。如果您正苦于以下问题:C++ Inode::AddReadRequest方法的具体用法?C++ Inode::AddReadRequest怎么用?C++ Inode::AddReadRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inode
的用法示例。
在下文中一共展示了Inode::AddReadRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: locker
static status_t
fifo_read(fs_volume* _volume, fs_vnode* _node, void* _cookie,
off_t /*pos*/, void* buffer, size_t* _length)
{
file_cookie* cookie = (file_cookie*)_cookie;
Inode* inode = (Inode*)_node->private_node;
TRACE("fifo_read(vnode = %p, cookie = %p, length = %lu, mode = %d)\n",
inode, cookie, *_length, cookie->open_mode);
MutexLocker locker(inode->RequestLock());
if ((cookie->open_mode & O_RWMASK) != O_RDONLY)
return B_NOT_ALLOWED;
if (inode->IsActive() && inode->WriterCount() == 0) {
// as long there is no writer, and the pipe is empty,
// we always just return 0 to indicate end of file
if (inode->BytesAvailable() == 0) {
*_length = 0;
return B_OK;
}
}
// issue read request
ReadRequest request(cookie);
inode->AddReadRequest(request);
TRACE(" issue read request %p\n", &request);
size_t length = *_length;
status_t status = inode->ReadDataFromBuffer(buffer, &length,
(cookie->open_mode & O_NONBLOCK) != 0, is_called_via_syscall(),
request);
inode->RemoveReadRequest(request);
inode->NotifyReadDone();
TRACE(" done reading request %p, length %zu\n", &request, length);
if (length > 0)
status = B_OK;
*_length = length;
return status;
}