LLVFS Class Reference

#include <llvfs.h>

Collaboration diagram for LLVFS:

Collaboration graph
[legend]

List of all members.

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)
LLVFSBlockfindFreeBlock (S32 size, LLVFSFileBlock *immune=NULL)
void lockData ()
void unlockData ()

Static Protected Member Functions

static LLFILEopenAndLock (const char *filename, const char *mode, BOOL read_lock)
static void unlockAndClose (LLFILE *fp)

Protected Attributes

LLMutexmDataMutex
fileblock_map mFileBlocks
blocks_length_map_t mFreeBlocksByLength
blocks_location_map_t mFreeBlocksByLocation
LLFILEmDataFP
LLFILEmIndexFP
std::deque< S32mIndexHoles
char * mIndexFilename
char * mDataFilename
BOOL mReadOnly
EVFSValid mValid
S32 mLockCounts [VFSLOCK_COUNT]
BOOL mRemoveAfterCrash


Detailed Description

Definition at line 77 of file llvfs.h.


Member Typedef Documentation

typedef std::map<LLVFSFileSpecifier, LLVFSFileBlock*> LLVFS::fileblock_map [protected]

Definition at line 148 of file llvfs.h.

typedef std::multimap<S32, LLVFSBlock*> LLVFS::blocks_length_map_t [protected]

Definition at line 151 of file llvfs.h.

typedef std::multimap<U32, LLVFSBlock*> LLVFS::blocks_location_map_t [protected]

Definition at line 153 of file llvfs.h.


Constructor & Destructor Documentation

LLVFS::LLVFS ( const char *  index_filename,
const char *  data_filename,
const BOOL  read_only,
const U32  presize,
const BOOL  remove_after_crash 
)

LLVFS::~LLVFS (  ) 


Member Function Documentation

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().

Here is the caller graph for this function:

EVFSValid LLVFS::getValidState (  )  const [inline]

Definition at line 85 of file llvfs.h.

References mValid.

Referenced by LLAppViewer::initCache().

Here is the caller graph for this function:

BOOL LLVFS::getExists ( const LLUUID file_id,
const LLAssetType::EType  file_type 
)

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().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL LLVFS::checkAvailable ( S32  max_size  ) 

Definition at line 769 of file llvfs.cpp.

References FALSE, mFreeBlocksByLength, and TRUE.

Referenced by LLVFile::setMaxSize().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL LLVFS::setMaxSize ( const LLUUID file_id,
const LLAssetType::EType  file_type,
S32  max_size 
)

void LLVFS::renameFile ( const LLUUID file_id,
const LLAssetType::EType  file_type,
const LLUUID new_id,
const LLAssetType::EType new_type 
)

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void LLVFS::pokeFiles (  ) 

Definition at line 1671 of file llvfs.cpp.

References isValid(), llendl, llerrs, llwarns, mDataFP, and mIndexFP.

Referenced by idle_startup().

Here is the call graph for this function:

Here is the caller graph for this function:

void LLVFS::audit (  ) 

void LLVFS::checkMem (  ) 

void LLVFS::dumpMap (  ) 

void LLVFS::dumpLockCounts (  ) 

Definition at line 1896 of file llvfs.cpp.

References i, llendl, llinfos, mLockCounts, S32, and VFSLOCK_COUNT.

Referenced by findFreeBlock().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void LLVFS::listFiles (  ) 

void LLVFS::dumpFiles (  ) 

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void LLVFS::presizeDataFile ( const U32  size  )  [protected]

Definition at line 663 of file llvfs.cpp.

References llendl, llerrs, llinfos, llwarns, mDataFP, mIndexFilename, LLFile::remove(), and S32.

Referenced by LLVFS().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void LLVFS::unlockAndClose ( LLFILE fp  )  [static, protected]

Definition at line 2196 of file llvfs.cpp.

Referenced by audit(), LLVFS(), and ~LLVFS().

Here is the caller graph for this function:

LLVFSBlock * LLVFS::findFreeBlock ( S32  size,
LLVFSFileBlock immune = NULL 
) [protected]

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

LLMutex* LLVFS::mDataMutex [protected]

Definition at line 146 of file llvfs.h.

Referenced by audit(), LLVFS(), lockData(), unlockData(), and ~LLVFS().

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]

Definition at line 157 of file llvfs.h.

Referenced by audit(), LLVFS(), pokeFiles(), sync(), and ~LLVFS().

std::deque<S32> LLVFS::mIndexHoles [protected]

Definition at line 159 of file llvfs.h.

Referenced by checkMem(), LLVFS(), and sync().

char* LLVFS::mIndexFilename [protected]

Definition at line 161 of file llvfs.h.

Referenced by LLVFS(), presizeDataFile(), and ~LLVFS().

char* LLVFS::mDataFilename [protected]

Definition at line 162 of file llvfs.h.

Referenced by LLVFS(), and ~LLVFS().

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]

Definition at line 165 of file llvfs.h.

Referenced by getValidState(), isValid(), and LLVFS().

S32 LLVFS::mLockCounts[VFSLOCK_COUNT] [protected]

Definition at line 167 of file llvfs.h.

Referenced by decLock(), dumpLockCounts(), incLock(), and LLVFS().

Definition at line 168 of file llvfs.h.

Referenced by LLVFS(), and ~LLVFS().


The documentation for this class was generated from the following files:

Generated on Fri May 16 09:23:12 2008 for SecondLife by  doxygen 1.5.5