本文整理汇总了C++中Signal::getDataPtrSend方法的典型用法代码示例。如果您正苦于以下问题:C++ Signal::getDataPtrSend方法的具体用法?C++ Signal::getDataPtrSend怎么用?C++ Signal::getDataPtrSend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal::getDataPtrSend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openReq
//.........这里部分代码省略.........
{
new_flags &= ~O_DIRECT;
goto no_odirect;
}
#endif
else
{
request->error = errno;
return;
}
}
if (flags & FsOpenReq::OM_CHECK_SIZE)
{
struct stat buf;
if ((fstat(theFd, &buf) == -1))
{
request->error = errno;
}
else if((Uint64)buf.st_size != request->par.open.file_size)
{
request->error = FsRef::fsErrInvalidFileSize;
}
if (request->error)
return;
}
if (flags & FsOpenReq::OM_INIT)
{
off_t off = 0;
const off_t sz = request->par.open.file_size;
Uint32 tmp[sizeof(SignalHeader)+25];
Signal * signal = (Signal*)(&tmp[0]);
FsReadWriteReq* req = (FsReadWriteReq*)signal->getDataPtrSend();
Uint32 index = 0;
Uint32 block = refToBlock(request->theUserReference);
#ifdef HAVE_XFS_XFS_H
if(platform_test_xfs_fd(theFd))
{
ndbout_c("Using xfsctl(XFS_IOC_RESVSP64) to allocate disk space");
xfs_flock64_t fl;
fl.l_whence= 0;
fl.l_start= 0;
fl.l_len= (off64_t)sz;
if(xfsctl(NULL, theFd, XFS_IOC_RESVSP64, &fl) < 0)
ndbout_c("failed to optimally allocate disk space");
}
#endif
#ifdef HAVE_POSIX_FALLOCATE
posix_fallocate(theFd, 0, sz);
#endif
while(off < sz)
{
req->filePointer = 0; // DATA 0
req->userPointer = request->theUserPointer; // DATA 2
req->numberOfPages = 1; // DATA 5
req->varIndex = index++;
req->data.pageData[0] = m_page_ptr.i;
m_fs.EXECUTE_DIRECT(block, GSN_FSWRITEREQ, signal,
FsReadWriteReq::FixedLength + 1);
retry:
Uint32 size = request->par.open.page_size;
示例2: if
//.........这里部分代码省略.........
if(INVALID_HANDLE_VALUE == hFile)
request->error = GetLastError();
else
request->error = 0;
}
}
else {
request->error = 0;
}
if (flags & FsOpenReq::OM_INIT)
{
LARGE_INTEGER off;
off.QuadPart= 0;
LARGE_INTEGER sz;
sz.QuadPart= request->par.open.file_size;
char buf[4096];
bzero(buf,sizeof(buf));
while(off.QuadPart < sz.QuadPart)
{
BOOL r= SetFilePointerEx(hFile, off, NULL, FILE_BEGIN);
if(r==0)
{
request->error= GetLastError();
return;
}
DWORD dwWritten;
BOOL bWrite= WriteFile(hFile, buf, sizeof(buf), &dwWritten, 0);
if(!bWrite || dwWritten!=sizeof(buf))
{
request->error= GetLastError();
}
off.QuadPart+=sizeof(buf);
}
off.QuadPart= 0;
BOOL r= SetFilePointerEx(hFile, off, NULL, FILE_BEGIN);
if(r==0)
{
request->error= GetLastError();
return;
}
/* Write initial data */
SignalT<25> tmp;
Signal * signal = (Signal*)(&tmp);
bzero(signal, sizeof(tmp));
FsReadWriteReq* req = (FsReadWriteReq*)signal->getDataPtrSend();
Uint32 index = 0;
Uint32 block = refToMain(request->theUserReference);
Uint32 instance = refToInstance(request->theUserReference);
off.QuadPart= 0;
sz.QuadPart= request->par.open.file_size;
while(off.QuadPart < sz.QuadPart)
{
req->filePointer = 0; // DATA 0
req->userPointer = request->theUserPointer; // DATA 2
req->numberOfPages = 1; // DATA 5
req->varIndex = index++;
req->data.pageData[0] = m_page_ptr.i;
m_fs.EXECUTE_DIRECT(block, GSN_FSWRITEREQ, signal,
FsReadWriteReq::FixedLength + 1,
instance // wl4391_todo This EXECUTE_DIRECT is thread safe
);
Uint32 size = request->par.open.page_size;
char* buf = (char*)m_page_ptr.p;
DWORD dwWritten;
while(size > 0){
BOOL bWrite= WriteFile(hFile, buf, size, &dwWritten, 0);
if(!bWrite || dwWritten!=size)
{
request->error= GetLastError();
}
size -= dwWritten;
buf += dwWritten;
}
if(size != 0)
{
int err = errno;
/* close(theFd);
unlink(theFileName.c_str());*/
request->error = err;
return;
}
off.QuadPart += request->par.open.page_size;
}
off.QuadPart= 0;
r= SetFilePointerEx(hFile, off, NULL, FILE_BEGIN);
if(r==0)
{
request->error= GetLastError();
return;
}
}
return;
}