#include <llvfs.h>
Collaboration diagram for LLVFS:
Definition at line 77 of file llvfs.h.
typedef std::multimap<S32, LLVFSBlock*> LLVFS::blocks_length_map_t [protected] |
typedef std::multimap<U32, LLVFSBlock*> LLVFS::blocks_location_map_t [protected] |
typedef std::map<LLVFSFileSpecifier, LLVFSFileBlock*> LLVFS::fileblock_map [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, count, LLVFSFileBlock::deserialize(), end, FALSE, LLFile::fopen(), i, llendl, llerrs, llinfos, llwarns, 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 615 of file llvfs.cpp.
References LLMutex::isLocked(), llendl, llerrs, mDataFilename, mDataFP, mDataMutex, mFileBlocks, mFreeBlocksByLength, mFreeBlocksByLocation, mIndexFilename, mIndexFP, mReadOnly, mRemoveAfterCrash, NULL, LLFile::remove(), and unlockAndClose().
void LLVFS::addFreeBlock | ( | LLVFSBlock * | block | ) | [protected] |
Definition at line 1336 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::audit | ( | ) |
Definition at line 1725 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 cleanup_app().
Definition at line 768 of file llvfs.cpp.
References FALSE, mFreeBlocksByLength, and TRUE.
Referenced by LLVFile::setMaxSize().
void LLVFS::checkMem | ( | ) |
Definition at line 1868 of file llvfs.cpp.
References LLAssetType::AT_COUNT, LLAssetType::AT_NONE, llassert, llendl, llinfos, llwarns, lockData(), mFileBlocks, mIndexHoles, LLUUID::null, S32, and unlockData().
void LLVFS::decLock | ( | const LLUUID & | file_id, | |
const LLAssetType::EType | file_type, | |||
EVFSLock | lock | |||
) |
Definition at line 1251 of file llvfs.cpp.
References llendl, llwarns, lockData(), mFileBlocks, mLockCounts, and unlockData().
Referenced by LLVFSThread::Request::finishRequest(), LLVFile::rename(), and LLVFile::~LLVFile().
void LLVFS::dumpFiles | ( | ) |
Definition at line 2099 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, S32, size, type, and unlockData().
void LLVFS::dumpLockCounts | ( | ) |
Definition at line 1895 of file llvfs.cpp.
References i, llendl, llinfos, mLockCounts, S32, and VFSLOCK_COUNT.
Referenced by findFreeBlock().
void LLVFS::dumpMap | ( | ) |
Definition at line 1704 of file llvfs.cpp.
References end, llendl, llinfos, mFileBlocks, and mFreeBlocksByLocation.
void LLVFS::dumpStatistics | ( | ) |
Definition at line 1904 of file llvfs.cpp.
References BLOCK_LENGTH_INVALID, end, f, LLAssetType::getDesc(), llendl, llformat(), llinfos, llwarns, lockData(), mFileBlocks, mFreeBlocksByLength, mFreeBlocksByLocation, LLVFSBlock::mLength, LLVFSBlock::mLocation, S32, size, and unlockData().
Referenced by setMaxSize().
void LLVFS::eraseBlock | ( | LLVFSBlock * | block | ) | [protected] |
Definition at line 1325 of file llvfs.cpp.
References eraseBlockLength(), llverify, mFreeBlocksByLocation, and LLVFSBlock::mLocation.
Referenced by addFreeBlock(), and useFreeSpace().
void LLVFS::eraseBlockLength | ( | LLVFSBlock * | block | ) | [protected] |
Definition at line 1298 of file llvfs.cpp.
References end, llassert, llendl, llwarns, mFreeBlocksByLength, LLVFSBlock::mLength, and S32.
Referenced by addFreeBlock(), and eraseBlock().
LLVFSBlock * LLVFS::findFreeBlock | ( | S32 | size, | |
LLVFSFileBlock * | immune = NULL | |||
) | [protected] |
Definition at line 1563 of file llvfs.cpp.
References dumpLockCounts(), f, FALSE, LLTimer::getElapsedTimeF32(), isValid(), llendl, llerrs, llinfos, llwarns, mFileBlocks, LLVFSFileSpecifier::mFileID, LLVFSFileSpecifier::mFileType, mFreeBlocksByLength, LLVFSBlock::mLength, NULL, removeFileBlock(), S32, TRUE, VFS_CLEANUP_SIZE, VFSLOCK_APPEND, VFSLOCK_OPEN, and VFSLOCK_READ.
Referenced by setMaxSize().
S32 LLVFS::getData | ( | const LLUUID & | file_id, | |
const LLAssetType::EType | file_type, | |||
U8 * | buffer, | |||
S32 | location, | |||
S32 | length | |||
) |
Definition at line 1087 of file llvfs.cpp.
References FALSE, isValid(), llassert, llendl, llerrs, llwarns, lockData(), mDataFP, mFileBlocks, NULL, S32, TRUE, and unlockData().
Referenced by dumpFiles(), and LLVFSThread::Request::processRequest().
BOOL LLVFS::getExists | ( | const LLUUID & | file_id, | |
const LLAssetType::EType | file_type | |||
) |
Definition at line 689 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::getMaxSize | ( | const LLUUID & | file_id, | |
const LLAssetType::EType | file_type | |||
) |
Definition at line 742 of file llvfs.cpp.
References isValid(), llendl, llerrs, lockData(), mFileBlocks, NULL, S32, size, and unlockData().
Referenced by LLVFile::getMaxSize(), and LLVFSThread::Request::Request().
S32 LLVFS::getSize | ( | const LLUUID & | file_id, | |
const LLAssetType::EType | file_type | |||
) |
Definition at line 715 of file llvfs.cpp.
References isValid(), llendl, llerrs, lockData(), mFileBlocks, NULL, S32, size, and unlockData().
Referenced by LLVFile::getSize().
EVFSValid LLVFS::getValidState | ( | ) | const [inline] |
void LLVFS::incLock | ( | const LLUUID & | file_id, | |
const LLAssetType::EType | file_type, | |||
EVFSLock | lock | |||
) |
Definition at line 1225 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().
BOOL LLVFS::isLocked | ( | const LLUUID & | file_id, | |
const LLAssetType::EType | file_type, | |||
EVFSLock | lock | |||
) |
Definition at line 1275 of file llvfs.cpp.
References FALSE, lockData(), mFileBlocks, and unlockData().
Referenced by LLVFile::isLocked().
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(), init_cache(), pokeFiles(), removeFile(), renameFile(), setMaxSize(), storeData(), and sync().
void LLVFS::listFiles | ( | ) |
Definition at line 2074 of file llvfs.cpp.
References BLOCK_LENGTH_INVALID, get_extension(), LLAssetType::getDesc(), llendl, llinfos, lockData(), mFileBlocks, S32, size, and unlockData().
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().
FILE * LLVFS::openAndLock | ( | const char * | filename, | |
const char * | mode, | |||
BOOL | read_lock | |||
) | [static, protected] |
Definition at line 2137 of file llvfs.cpp.
References LLFile::_fsopen(), LLFile::fopen(), and NULL.
Referenced by LLVFS().
void LLVFS::pokeFiles | ( | ) |
void LLVFS::removeFile | ( | const LLUUID & | file_id, | |
const LLAssetType::EType | file_type | |||
) |
Definition at line 1058 of file llvfs.cpp.
References isValid(), llendl, llerrs, llwarns, lockData(), mFileBlocks, mReadOnly, removeFileBlock(), and unlockData().
Referenced by LLVFile::remove(), LLUpdateTaskInventoryResponder::uploadComplete(), and LLUpdateAgentInventoryResponder::uploadComplete().
void LLVFS::removeFileBlock | ( | LLVFSFileBlock * | fileblock | ) | [protected] |
Definition at line 1036 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::renameFile | ( | const LLUUID & | file_id, | |
const LLAssetType::EType | file_type, | |||
const LLUUID & | new_id, | |||
const LLAssetType::EType & | new_type | |||
) |
Definition at line 969 of file llvfs.cpp.
References i, isValid(), llendl, llerrs, lockData(), mFileBlocks, mReadOnly, NULL, removeFileBlock(), S32, sync(), and VFSLOCK_COUNT.
Referenced by LLVFSThread::Request::processRequest(), LLVFile::rename(), and LLAssetUploadResponder::result().
BOOL LLVFS::setMaxSize | ( | const LLUUID & | file_id, | |
const LLAssetType::EType | file_type, | |||
S32 | max_size | |||
) |
Definition at line 774 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().
S32 LLVFS::storeData | ( | const LLUUID & | file_id, | |
const LLAssetType::EType | file_type, | |||
const U8 * | buffer, | |||
S32 | location, | |||
S32 | length | |||
) |
Definition at line 1136 of file llvfs.cpp.
References BLOCK_LENGTH_INVALID, isValid(), llassert, llendl, llerrs, llformat(), llwarns, lockData(), mDataFP, mFileBlocks, mReadOnly, NULL, S32, sync(), and unlockData().
Referenced by LLVFSThread::Request::processRequest().
void LLVFS::sync | ( | LLVFSFileBlock * | block, | |
BOOL | remove = FALSE | |||
) | [protected] |
Definition at line 1478 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::unlockAndClose | ( | FILE * | fp | ) | [static, protected] |
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(), setMaxSize(), storeData(), and sync().
void LLVFS::useFreeSpace | ( | LLVFSBlock * | free_block, | |
S32 | length | |||
) | [protected] |
Definition at line 1457 of file llvfs.cpp.
References addFreeBlock(), eraseBlock(), LLVFSBlock::mLength, and LLVFSBlock::mLocation.
Referenced by setMaxSize().
char* LLVFS::mDataFilename [protected] |
FILE* LLVFS::mDataFP [protected] |
Definition at line 156 of file llvfs.h.
Referenced by audit(), getData(), LLVFS(), pokeFiles(), presizeDataFile(), setMaxSize(), storeData(), and ~LLVFS().
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().
char* LLVFS::mIndexFilename [protected] |
FILE* LLVFS::mIndexFP [protected] |
std::deque<S32> LLVFS::mIndexHoles [protected] |
S32 LLVFS::mLockCounts[VFSLOCK_COUNT] [protected] |
BOOL LLVFS::mReadOnly [protected] |
Definition at line 163 of file llvfs.h.
Referenced by LLVFS(), removeFile(), renameFile(), setMaxSize(), storeData(), sync(), and ~LLVFS().
BOOL LLVFS::mRemoveAfterCrash [protected] |
EVFSValid LLVFS::mValid [protected] |