#include <llvfs.h>

Public Member Functions | |
| LLVFS (const char *index_filename, const char *data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash) | |
| ~LLVFS () | |
| BOOL | isValid () const |
| EVFSValid | getValidState () const |
| BOOL | getExists (const LLUUID &file_id, const LLAssetType::EType file_type) |
| S32 | getSize (const LLUUID &file_id, const LLAssetType::EType file_type) |
| BOOL | checkAvailable (S32 max_size) |
| S32 | getMaxSize (const LLUUID &file_id, const LLAssetType::EType file_type) |
| BOOL | setMaxSize (const LLUUID &file_id, const LLAssetType::EType file_type, S32 max_size) |
| void | renameFile (const LLUUID &file_id, const LLAssetType::EType file_type, const LLUUID &new_id, const LLAssetType::EType &new_type) |
| void | removeFile (const LLUUID &file_id, const LLAssetType::EType file_type) |
| S32 | getData (const LLUUID &file_id, const LLAssetType::EType file_type, U8 *buffer, S32 location, S32 length) |
| S32 | storeData (const LLUUID &file_id, const LLAssetType::EType file_type, const U8 *buffer, S32 location, S32 length) |
| void | incLock (const LLUUID &file_id, const LLAssetType::EType file_type, EVFSLock lock) |
| void | decLock (const LLUUID &file_id, const LLAssetType::EType file_type, EVFSLock lock) |
| BOOL | isLocked (const LLUUID &file_id, const LLAssetType::EType file_type, EVFSLock lock) |
| void | pokeFiles () |
| void | audit () |
| void | checkMem () |
| void | dumpMap () |
| void | dumpLockCounts () |
| void | dumpStatistics () |
| void | listFiles () |
| void | dumpFiles () |
Protected Types | |
| typedef std::map < LLVFSFileSpecifier, LLVFSFileBlock * > | fileblock_map |
| typedef std::multimap< S32, LLVFSBlock * > | blocks_length_map_t |
| typedef std::multimap< U32, LLVFSBlock * > | blocks_location_map_t |
Protected Member Functions | |
| void | removeFileBlock (LLVFSFileBlock *fileblock) |
| void | eraseBlockLength (LLVFSBlock *block) |
| void | eraseBlock (LLVFSBlock *block) |
| void | addFreeBlock (LLVFSBlock *block) |
| void | useFreeSpace (LLVFSBlock *free_block, S32 length) |
| void | sync (LLVFSFileBlock *block, BOOL remove=FALSE) |
| void | presizeDataFile (const U32 size) |
| LLVFSBlock * | findFreeBlock (S32 size, LLVFSFileBlock *immune=NULL) |
| void | lockData () |
| void | unlockData () |
Static Protected Member Functions | |
| static LLFILE * | openAndLock (const char *filename, const char *mode, BOOL read_lock) |
| static void | unlockAndClose (LLFILE *fp) |
Protected Attributes | |
| LLMutex * | mDataMutex |
| fileblock_map | mFileBlocks |
| blocks_length_map_t | mFreeBlocksByLength |
| blocks_location_map_t | mFreeBlocksByLocation |
| LLFILE * | mDataFP |
| LLFILE * | mIndexFP |
| std::deque< S32 > | mIndexHoles |
| char * | mIndexFilename |
| char * | mDataFilename |
| BOOL | mReadOnly |
| EVFSValid | mValid |
| S32 | mLockCounts [VFSLOCK_COUNT] |
| BOOL | mRemoveAfterCrash |
Definition at line 77 of file llvfs.h.
typedef std::map<LLVFSFileSpecifier, LLVFSFileBlock*> LLVFS::fileblock_map [protected] |
typedef std::multimap<S32, LLVFSBlock*> LLVFS::blocks_length_map_t [protected] |
typedef std::multimap<U32, LLVFSBlock*> LLVFS::blocks_location_map_t [protected] |
| LLVFS::LLVFS | ( | const char * | index_filename, | |
| const char * | data_filename, | |||
| const BOOL | read_only, | |||
| const U32 | presize, | |||
| const BOOL | remove_after_crash | |||
| ) |
Definition at line 235 of file llvfs.cpp.
References addFreeBlock(), LLAssetType::AT_COUNT, LLAssetType::AT_NONE, LLVFSFileBlock::deserialize(), FALSE, LLFile::fopen(), i, LL_ENDL, LL_ERRS, LL_WARNS, LLVFSBlock::locationSortPredicate(), lockData(), mDataFilename, mDataFP, mDataMutex, mFileBlocks, LLVFSFileSpecifier::mFileID, LLVFSFileSpecifier::mFileType, mIndexFilename, mIndexFP, mIndexHoles, LLVFSFileBlock::mIndexLocation, LLVFSBlock::mLength, LLVFSBlock::mLocation, mLockCounts, mReadOnly, mRemoveAfterCrash, LLVFSFileBlock::mSize, mValid, NULL, openAndLock(), presizeDataFile(), LLFile::remove(), S32, LLVFSFileBlock::SERIAL_SIZE, LLFile::stat(), sync(), TRUE, unlockAndClose(), unlockData(), VFSLOCK_COUNT, VFSVALID_BAD_CANNOT_CREATE, VFSVALID_BAD_CANNOT_OPEN_READONLY, VFSVALID_BAD_CORRUPT, and VFSVALID_OK.

| LLVFS::~LLVFS | ( | ) |
Definition at line 616 of file llvfs.cpp.
References LLMutex::isLocked(), LL_ENDL, LL_ERRS, mDataFilename, mDataFP, mDataMutex, mFileBlocks, mFreeBlocksByLength, mFreeBlocksByLocation, mIndexFilename, mIndexFP, mReadOnly, mRemoveAfterCrash, NULL, LLFile::remove(), and unlockAndClose().

| BOOL LLVFS::isValid | ( | ) | const [inline] |
Definition at line 84 of file llvfs.h.
References mValid, and VFSVALID_OK.
Referenced by findFreeBlock(), getData(), getExists(), getMaxSize(), getSize(), LLAppViewer::initCache(), pokeFiles(), removeFile(), renameFile(), setMaxSize(), storeData(), and sync().

| EVFSValid LLVFS::getValidState | ( | ) | const [inline] |
Definition at line 85 of file llvfs.h.
References mValid.
Referenced by LLAppViewer::initCache().

| BOOL LLVFS::getExists | ( | const LLUUID & | file_id, | |
| const LLAssetType::EType | file_type | |||
| ) |
Definition at line 690 of file llvfs.cpp.
References FALSE, isValid(), llendl, llerrs, lockData(), LLVFSFileBlock::mAccessTime, mFileBlocks, LLVFSBlock::mLength, NULL, TRUE, and unlockData().
Referenced by LLAssetStorage::getEstateAsset(), LLAssetStorage::getInvItemAsset(), LLAssetStorage::hasLocalAsset(), LLAudioEngine::hasLocalFile(), LLAssetUploadResponder::LLAssetUploadResponder(), LLXfer_VFile::startSend(), and LLViewerAssetStorage::storeAssetData().


| S32 LLVFS::getSize | ( | const LLUUID & | file_id, | |
| const LLAssetType::EType | file_type | |||
| ) |
Definition at line 716 of file llvfs.cpp.
References isValid(), llendl, llerrs, lockData(), LLVFSFileBlock::mAccessTime, mFileBlocks, LLVFSFileBlock::mSize, NULL, S32, and unlockData().
Referenced by LLVFile::getSize(), and LLViewerAssetStorage::storeAssetData().


Definition at line 769 of file llvfs.cpp.
References FALSE, mFreeBlocksByLength, and TRUE.
Referenced by LLVFile::setMaxSize().

| S32 LLVFS::getMaxSize | ( | const LLUUID & | file_id, | |
| const LLAssetType::EType | file_type | |||
| ) |
Definition at line 743 of file llvfs.cpp.
References isValid(), llendl, llerrs, lockData(), LLVFSFileBlock::mAccessTime, mFileBlocks, LLVFSBlock::mLength, NULL, S32, and unlockData().
Referenced by LLVFile::getMaxSize(), and LLVFSThread::Request::Request().


| BOOL LLVFS::setMaxSize | ( | const LLUUID & | file_id, | |
| const LLAssetType::EType | file_type, | |||
| S32 | max_size | |||
| ) |
Definition at line 775 of file llvfs.cpp.
References addFreeBlock(), LLAssetType::AT_TEXTURE, dumpStatistics(), FALSE, FILE_BLOCK_MASK, findFreeBlock(), isValid(), llendl, llerrs, llwarns, lockData(), LLVFSFileBlock::mAccessTime, mDataFP, mFileBlocks, mFreeBlocksByLocation, LLVFSBlock::mLength, LLVFSBlock::mLocation, mReadOnly, LLVFSFileBlock::mSize, NULL, S32, sync(), TRUE, unlockData(), and useFreeSpace().
Referenced by LLVFile::setMaxSize().


| void LLVFS::renameFile | ( | const LLUUID & | file_id, | |
| const LLAssetType::EType | file_type, | |||
| const LLUUID & | new_id, | |||
| const LLAssetType::EType & | new_type | |||
| ) |
Definition at line 970 of file llvfs.cpp.
References i, isValid(), llendl, llerrs, llwarns, lockData(), LLVFSFileBlock::mAccessTime, mFileBlocks, LLVFSFileSpecifier::mFileID, LLVFSFileSpecifier::mFileType, LLVFSFileBlock::mLocks, mReadOnly, NULL, removeFileBlock(), S32, sync(), unlockData(), and VFSLOCK_COUNT.
Referenced by LLVFSThread::Request::processRequest(), LLVFile::rename(), and LLAssetUploadResponder::result().


| void LLVFS::removeFile | ( | const LLUUID & | file_id, | |
| const LLAssetType::EType | file_type | |||
| ) |
Definition at line 1059 of file llvfs.cpp.
References isValid(), llendl, llerrs, llwarns, lockData(), mFileBlocks, mReadOnly, removeFileBlock(), and unlockData().
Referenced by LLVFile::remove(), LLUpdateTaskInventoryResponder::uploadComplete(), and LLUpdateAgentInventoryResponder::uploadComplete().


| S32 LLVFS::getData | ( | const LLUUID & | file_id, | |
| const LLAssetType::EType | file_type, | |||
| U8 * | buffer, | |||
| S32 | location, | |||
| S32 | length | |||
| ) |
Definition at line 1088 of file llvfs.cpp.
References FALSE, isValid(), llassert, llendl, llerrs, llwarns, lockData(), LLVFSFileBlock::mAccessTime, mDataFP, mFileBlocks, LLVFSBlock::mLocation, LLVFSFileBlock::mSize, NULL, S32, TRUE, and unlockData().
Referenced by dumpFiles(), and LLVFSThread::Request::processRequest().


| S32 LLVFS::storeData | ( | const LLUUID & | file_id, | |
| const LLAssetType::EType | file_type, | |||
| const U8 * | buffer, | |||
| S32 | location, | |||
| S32 | length | |||
| ) |
Definition at line 1137 of file llvfs.cpp.
References BLOCK_LENGTH_INVALID, isValid(), llassert, llendl, llerrs, llformat(), llwarns, lockData(), LLVFSFileBlock::mAccessTime, mDataFP, mFileBlocks, LLVFSBlock::mLength, LLVFSBlock::mLocation, mReadOnly, LLVFSFileBlock::mSize, NULL, S32, sync(), and unlockData().
Referenced by LLVFSThread::Request::processRequest().


| void LLVFS::incLock | ( | const LLUUID & | file_id, | |
| const LLAssetType::EType | file_type, | |||
| EVFSLock | lock | |||
| ) |
Definition at line 1226 of file llvfs.cpp.
References BLOCK_LENGTH_INVALID, lockData(), LLVFSFileBlock::mAccessTime, mFileBlocks, mLockCounts, LLVFSFileBlock::mLocks, NULL, and unlockData().
Referenced by LLVFile::LLVFile(), LLVFile::rename(), and LLVFSThread::Request::Request().


| void LLVFS::decLock | ( | const LLUUID & | file_id, | |
| const LLAssetType::EType | file_type, | |||
| EVFSLock | lock | |||
| ) |
Definition at line 1252 of file llvfs.cpp.
References llendl, llwarns, lockData(), mFileBlocks, mLockCounts, LLVFSFileBlock::mLocks, and unlockData().
Referenced by LLVFSThread::Request::finishRequest(), LLVFile::rename(), and LLVFile::~LLVFile().


| BOOL LLVFS::isLocked | ( | const LLUUID & | file_id, | |
| const LLAssetType::EType | file_type, | |||
| EVFSLock | lock | |||
| ) |
Definition at line 1276 of file llvfs.cpp.
References FALSE, lockData(), mFileBlocks, LLVFSFileBlock::mLocks, and unlockData().
Referenced by LLVFile::isLocked().


| void LLVFS::pokeFiles | ( | ) |
| void LLVFS::audit | ( | ) |
Definition at line 1726 of file llvfs.cpp.
References LLAssetType::AT_COUNT, LLAssetType::AT_NONE, LLVFSFileBlock::deserialize(), FALSE, llendl, llinfos, llwarns, LLVFSFileBlock::mAccessTime, mDataFP, mDataMutex, mFileBlocks, LLVFSFileSpecifier::mFileID, LLVFSFileSpecifier::mFileType, mIndexFP, LLVFSFileBlock::mIndexLocation, LLVFSBlock::mLength, LLVFSBlock::mLocation, LLVFSFileBlock::mSize, LLUUID::null, NULL, S32, LLVFSFileBlock::SERIAL_SIZE, TRUE, and unlockAndClose().
Referenced by LLAppViewer::cleanup().


| void LLVFS::checkMem | ( | ) |
Definition at line 1869 of file llvfs.cpp.
References LLAssetType::AT_COUNT, LLAssetType::AT_NONE, llassert, llendl, llinfos, llwarns, lockData(), mFileBlocks, LLVFSFileSpecifier::mFileID, LLVFSFileSpecifier::mFileType, mIndexHoles, LLVFSFileBlock::mIndexLocation, LLUUID::null, S32, and unlockData().

| void LLVFS::dumpMap | ( | ) |
Definition at line 1705 of file llvfs.cpp.
References llendl, llinfos, mFileBlocks, LLVFSFileSpecifier::mFileID, LLVFSFileSpecifier::mFileType, mFreeBlocksByLocation, LLVFSBlock::mLength, and LLVFSBlock::mLocation.
| void LLVFS::dumpLockCounts | ( | ) |
Definition at line 1896 of file llvfs.cpp.
References i, llendl, llinfos, mLockCounts, S32, and VFSLOCK_COUNT.
Referenced by findFreeBlock().

| void LLVFS::dumpStatistics | ( | ) |
Definition at line 1905 of file llvfs.cpp.
References BLOCK_LENGTH_INVALID, LLAssetType::getDesc(), llendl, llformat(), llinfos, llwarns, lockData(), mFileBlocks, LLVFSFileSpecifier::mFileID, LLVFSFileSpecifier::mFileType, mFreeBlocksByLength, mFreeBlocksByLocation, LLVFSBlock::mLength, LLVFSBlock::mLocation, S32, and unlockData().
Referenced by setMaxSize().


| void LLVFS::listFiles | ( | ) |
Definition at line 2075 of file llvfs.cpp.
References BLOCK_LENGTH_INVALID, get_extension(), LLAssetType::getDesc(), llendl, llinfos, lockData(), mFileBlocks, LLVFSFileSpecifier::mFileID, LLVFSFileSpecifier::mFileType, LLVFSBlock::mLength, LLVFSFileBlock::mSize, S32, and unlockData().

| void LLVFS::dumpFiles | ( | ) |
Definition at line 2100 of file llvfs.cpp.
References BLOCK_LENGTH_INVALID, get_extension(), getData(), ll_apr_file_open(), ll_apr_file_write(), LL_APR_WB, llendl, llinfos, lockData(), mFileBlocks, LLVFSFileSpecifier::mFileID, LLVFSFileSpecifier::mFileType, LLVFSBlock::mLength, LLVFSFileBlock::mSize, S32, and unlockData().

| void LLVFS::removeFileBlock | ( | LLVFSFileBlock * | fileblock | ) | [protected] |
Definition at line 1037 of file llvfs.cpp.
References addFreeBlock(), BLOCK_LENGTH_INVALID, LLVFSFileBlock::mIndexLocation, LLVFSBlock::mLength, LLVFSBlock::mLocation, LLVFSFileBlock::mSize, sync(), and TRUE.
Referenced by findFreeBlock(), removeFile(), and renameFile().


| void LLVFS::eraseBlockLength | ( | LLVFSBlock * | block | ) | [protected] |
Definition at line 1299 of file llvfs.cpp.
References llassert, llendl, llwarns, mFreeBlocksByLength, LLVFSBlock::mLength, and S32.
Referenced by addFreeBlock(), and eraseBlock().

| void LLVFS::eraseBlock | ( | LLVFSBlock * | block | ) | [protected] |
Definition at line 1326 of file llvfs.cpp.
References eraseBlockLength(), llverify, mFreeBlocksByLocation, and LLVFSBlock::mLocation.
Referenced by addFreeBlock(), and useFreeSpace().


| void LLVFS::addFreeBlock | ( | LLVFSBlock * | block | ) | [protected] |
Definition at line 1337 of file llvfs.cpp.
References eraseBlock(), eraseBlockLength(), llendl, llerrs, mFreeBlocksByLength, mFreeBlocksByLocation, LLVFSBlock::mLength, LLVFSBlock::mLocation, and NULL.
Referenced by LLVFS(), removeFileBlock(), setMaxSize(), and useFreeSpace().


| void LLVFS::useFreeSpace | ( | LLVFSBlock * | free_block, | |
| S32 | length | |||
| ) | [protected] |
Definition at line 1458 of file llvfs.cpp.
References addFreeBlock(), eraseBlock(), LLVFSBlock::mLength, and LLVFSBlock::mLocation.
Referenced by setMaxSize().


| void LLVFS::sync | ( | LLVFSFileBlock * | block, | |
| BOOL | remove = FALSE | |||
| ) | [protected] |
Definition at line 1479 of file llvfs.cpp.
References BLOCK_LENGTH_INVALID, FALSE, isValid(), llendl, llerrs, llwarns, lockData(), mIndexFP, mIndexHoles, LLVFSFileBlock::mIndexLocation, LLVFSBlock::mLength, mReadOnly, LLVFSFileBlock::SERIAL_SIZE, LLVFSFileBlock::serialize(), TRUE, and unlockData().
Referenced by LLVFS(), removeFileBlock(), renameFile(), setMaxSize(), and storeData().


| void LLVFS::presizeDataFile | ( | const U32 | size | ) | [protected] |
| LLFILE * LLVFS::openAndLock | ( | const char * | filename, | |
| const char * | mode, | |||
| BOOL | read_lock | |||
| ) | [static, protected] |
Definition at line 2138 of file llvfs.cpp.
References LLFile::_fsopen(), LLFile::fopen(), and NULL.
Referenced by LLVFS().


| void LLVFS::unlockAndClose | ( | LLFILE * | fp | ) | [static, protected] |
| LLVFSBlock * LLVFS::findFreeBlock | ( | S32 | size, | |
| LLVFSFileBlock * | immune = NULL | |||
| ) | [protected] |
Definition at line 1564 of file llvfs.cpp.
References dumpLockCounts(), FALSE, LLTimer::getElapsedTimeF32(), isValid(), llendl, llerrs, llinfos, llwarns, mFileBlocks, LLVFSFileSpecifier::mFileID, LLVFSFileSpecifier::mFileType, mFreeBlocksByLength, LLVFSBlock::mLength, LLVFSFileBlock::mLocks, NULL, removeFileBlock(), S32, TRUE, VFS_CLEANUP_SIZE, VFSLOCK_APPEND, VFSLOCK_OPEN, and VFSLOCK_READ.
Referenced by setMaxSize().


| void LLVFS::lockData | ( | ) | [inline, protected] |
Definition at line 142 of file llvfs.h.
References LLMutex::lock(), and mDataMutex.
Referenced by checkMem(), decLock(), dumpFiles(), dumpStatistics(), getData(), getExists(), getMaxSize(), getSize(), incLock(), isLocked(), listFiles(), LLVFS(), removeFile(), renameFile(), setMaxSize(), storeData(), and sync().


| void LLVFS::unlockData | ( | ) | [inline, protected] |
Definition at line 143 of file llvfs.h.
References mDataMutex, and LLMutex::unlock().
Referenced by checkMem(), decLock(), dumpFiles(), dumpStatistics(), getData(), getExists(), getMaxSize(), getSize(), incLock(), isLocked(), listFiles(), LLVFS(), removeFile(), renameFile(), setMaxSize(), storeData(), and sync().


LLMutex* LLVFS::mDataMutex [protected] |
Definition at line 146 of file llvfs.h.
Referenced by audit(), LLVFS(), lockData(), unlockData(), and ~LLVFS().
fileblock_map LLVFS::mFileBlocks [protected] |
Definition at line 149 of file llvfs.h.
Referenced by audit(), checkMem(), decLock(), dumpFiles(), dumpMap(), dumpStatistics(), findFreeBlock(), getData(), getExists(), getMaxSize(), getSize(), incLock(), isLocked(), listFiles(), LLVFS(), removeFile(), renameFile(), setMaxSize(), storeData(), and ~LLVFS().
blocks_length_map_t LLVFS::mFreeBlocksByLength [protected] |
Definition at line 152 of file llvfs.h.
Referenced by addFreeBlock(), checkAvailable(), dumpStatistics(), eraseBlockLength(), findFreeBlock(), and ~LLVFS().
blocks_location_map_t LLVFS::mFreeBlocksByLocation [protected] |
Definition at line 154 of file llvfs.h.
Referenced by addFreeBlock(), dumpMap(), dumpStatistics(), eraseBlock(), setMaxSize(), and ~LLVFS().
LLFILE* LLVFS::mDataFP [protected] |
Definition at line 156 of file llvfs.h.
Referenced by audit(), getData(), LLVFS(), pokeFiles(), presizeDataFile(), setMaxSize(), storeData(), and ~LLVFS().
LLFILE* LLVFS::mIndexFP [protected] |
std::deque<S32> LLVFS::mIndexHoles [protected] |
char* LLVFS::mIndexFilename [protected] |
char* LLVFS::mDataFilename [protected] |
BOOL LLVFS::mReadOnly [protected] |
Definition at line 163 of file llvfs.h.
Referenced by LLVFS(), removeFile(), renameFile(), setMaxSize(), storeData(), sync(), and ~LLVFS().
EVFSValid LLVFS::mValid [protected] |
S32 LLVFS::mLockCounts[VFSLOCK_COUNT] [protected] |
BOOL LLVFS::mRemoveAfterCrash [protected] |
1.5.5