summaryrefslogtreecommitdiff
path: root/indra/llvfs/lllfsthread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llvfs/lllfsthread.cpp')
-rw-r--r--indra/llvfs/lllfsthread.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/indra/llvfs/lllfsthread.cpp b/indra/llvfs/lllfsthread.cpp
index a55b5402ed..704e1ab142 100644
--- a/indra/llvfs/lllfsthread.cpp
+++ b/indra/llvfs/lllfsthread.cpp
@@ -73,6 +73,10 @@ LLLFSThread::LLLFSThread(bool threaded) :
LLQueuedThread("LFS", threaded),
mPriorityCounter(PRIORITY_LOWBITS)
{
+ if(!mLocalAPRFilePoolp)
+ {
+ mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
+ }
}
LLLFSThread::~LLLFSThread()
@@ -184,8 +188,9 @@ bool LLLFSThread::Request::processRequest()
if (mOperation == FILE_READ)
{
llassert(mOffset >= 0);
- apr_file_t* filep = ll_apr_file_open(mFileName, LL_APR_RB, mThread->mAPRPoolp);
- if (!filep)
+ LLAPRFile infile ;
+ infile.open(mThread->getLocalAPRFilePool(), mFileName, LL_APR_RB);
+ if (!infile.getFileHandle())
{
llwarns << "LLLFS: Unable to read file: " << mFileName << llendl;
mBytesRead = 0; // fail
@@ -193,13 +198,13 @@ bool LLLFSThread::Request::processRequest()
}
S32 off;
if (mOffset < 0)
- off = ll_apr_file_seek(filep, APR_END, 0);
+ off = infile.seek(APR_END, 0);
else
- off = ll_apr_file_seek(filep, APR_SET, mOffset);
+ off = infile.seek(APR_SET, mOffset);
llassert_always(off >= 0);
- mBytesRead = ll_apr_file_read(filep, mBuffer, mBytes );
- apr_file_close(filep);
+ mBytesRead = infile.read(mBuffer, mBytes );
complete = true;
+ infile.close() ;
// llinfos << "LLLFSThread::READ:" << mFileName << " Bytes: " << mBytesRead << llendl;
}
else if (mOperation == FILE_WRITE)
@@ -207,8 +212,9 @@ bool LLLFSThread::Request::processRequest()
apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY;
if (mOffset < 0)
flags |= APR_APPEND;
- apr_file_t* filep = ll_apr_file_open(mFileName, flags, mThread->mAPRPoolp);
- if (!filep)
+ LLAPRFile outfile ;
+ outfile.open(mThread->getLocalAPRFilePool(), mFileName, flags);
+ if (!outfile.getFileHandle())
{
llwarns << "LLLFS: Unable to write file: " << mFileName << llendl;
mBytesRead = 0; // fail
@@ -216,18 +222,17 @@ bool LLLFSThread::Request::processRequest()
}
if (mOffset >= 0)
{
- S32 seek = ll_apr_file_seek(filep, APR_SET, mOffset);
+ S32 seek = outfile.seek(APR_SET, mOffset);
if (seek < 0)
{
- apr_file_close(filep);
llwarns << "LLLFS: Unable to write file (seek failed): " << mFileName << llendl;
mBytesRead = 0; // fail
return true;
}
}
- mBytesRead = ll_apr_file_write(filep, mBuffer, mBytes );
+ mBytesRead = outfile.write(mBuffer, mBytes );
complete = true;
- apr_file_close(filep);
+
// llinfos << "LLLFSThread::WRITE:" << mFileName << " Bytes: " << mBytesRead << "/" << mBytes << " Offset:" << mOffset << llendl;
}
else