store: remove useless comments from store
Change-Id: I4b2582d3a7314d8752a56e83a4af7618b053abb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128170 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
committed by
Stephan Bergmann
parent
1b7a4ea1d5
commit
983aa4a107
@@ -30,22 +30,16 @@ namespace store
|
||||
class OStoreStream
|
||||
{
|
||||
public:
|
||||
/** Construction.
|
||||
*/
|
||||
OStoreStream()
|
||||
: m_hImpl (nullptr)
|
||||
{}
|
||||
|
||||
/** Destruction.
|
||||
*/
|
||||
~OStoreStream()
|
||||
{
|
||||
if (m_hImpl)
|
||||
(void) store_releaseHandle (m_hImpl);
|
||||
}
|
||||
|
||||
/** Copy construction.
|
||||
*/
|
||||
OStoreStream (OStoreStream const & rhs)
|
||||
: m_hImpl (rhs.m_hImpl)
|
||||
{
|
||||
@@ -53,8 +47,6 @@ public:
|
||||
(void) store_acquireHandle (m_hImpl);
|
||||
}
|
||||
|
||||
/** Assignment.
|
||||
*/
|
||||
OStoreStream & operator= (OStoreStream const & rhs)
|
||||
{
|
||||
if (rhs.m_hImpl)
|
||||
@@ -113,30 +105,22 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
/** Representation.
|
||||
*/
|
||||
storeStreamHandle m_hImpl;
|
||||
};
|
||||
|
||||
class OStoreDirectory
|
||||
{
|
||||
public:
|
||||
/** Construction.
|
||||
*/
|
||||
OStoreDirectory()
|
||||
: m_hImpl (nullptr)
|
||||
{}
|
||||
|
||||
/** Destruction.
|
||||
*/
|
||||
~OStoreDirectory()
|
||||
{
|
||||
if (m_hImpl)
|
||||
(void) store_releaseHandle (m_hImpl);
|
||||
}
|
||||
|
||||
/** Copy construction.
|
||||
*/
|
||||
OStoreDirectory (OStoreDirectory const & rhs)
|
||||
: m_hImpl (rhs.m_hImpl)
|
||||
{
|
||||
@@ -144,16 +128,12 @@ public:
|
||||
(void) store_acquireHandle (m_hImpl);
|
||||
}
|
||||
|
||||
/** Move construction.
|
||||
*/
|
||||
OStoreDirectory (OStoreDirectory && rhs) noexcept
|
||||
: m_hImpl (rhs.m_hImpl)
|
||||
{
|
||||
rhs.m_hImpl = nullptr;
|
||||
}
|
||||
|
||||
/** Assignment.
|
||||
*/
|
||||
OStoreDirectory & operator= (OStoreDirectory const & rhs)
|
||||
{
|
||||
if (rhs.m_hImpl)
|
||||
@@ -164,8 +144,6 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Move assignment.
|
||||
*/
|
||||
OStoreDirectory & operator= (OStoreDirectory && rhs) noexcept
|
||||
{
|
||||
if (m_hImpl)
|
||||
@@ -221,30 +199,22 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
/** Representation.
|
||||
*/
|
||||
storeDirectoryHandle m_hImpl;
|
||||
};
|
||||
|
||||
class OStoreFile
|
||||
{
|
||||
public:
|
||||
/** Construction.
|
||||
*/
|
||||
OStoreFile()
|
||||
: m_hImpl (nullptr)
|
||||
{}
|
||||
|
||||
/** Destruction.
|
||||
*/
|
||||
~OStoreFile()
|
||||
{
|
||||
if (m_hImpl)
|
||||
(void) store_releaseHandle (m_hImpl);
|
||||
}
|
||||
|
||||
/** Copy construction.
|
||||
*/
|
||||
OStoreFile (OStoreFile const & rhs)
|
||||
: m_hImpl (rhs.m_hImpl)
|
||||
{
|
||||
@@ -252,8 +222,6 @@ public:
|
||||
(void) store_acquireHandle (m_hImpl);
|
||||
}
|
||||
|
||||
/** Assignment.
|
||||
*/
|
||||
OStoreFile & operator= (OStoreFile const & rhs)
|
||||
{
|
||||
if (rhs.m_hImpl)
|
||||
@@ -264,8 +232,6 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Conversion into File Handle.
|
||||
*/
|
||||
operator storeFileHandle() const
|
||||
{
|
||||
return m_hImpl;
|
||||
@@ -343,8 +309,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
/** Representation.
|
||||
*/
|
||||
storeFileHandle m_hImpl;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,12 +34,6 @@
|
||||
|
||||
using namespace store;
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* ILockBytes (non-virtual interface) implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
|
||||
storeError ILockBytes::initialize (rtl::Reference< PageData::Allocator > & rxAllocator, sal_uInt16 nPageSize)
|
||||
{
|
||||
OSL_PRECOND((STORE_MINIMUM_PAGESIZE <= nPageSize) && (nPageSize <= STORE_MAXIMUM_PAGESIZE), "invalid PageSize");
|
||||
@@ -135,11 +129,6 @@ storeError ILockBytes::flush()
|
||||
return flush_Impl();
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* FileLockBytes implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
namespace store
|
||||
{
|
||||
|
||||
@@ -641,11 +630,6 @@ storeError MappedLockBytes::flush_Impl()
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* MemoryLockBytes implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
namespace store
|
||||
{
|
||||
|
||||
@@ -685,8 +669,6 @@ public:
|
||||
MemoryLockBytes& operator=(const MemoryLockBytes&) = delete;
|
||||
|
||||
protected:
|
||||
/** Destruction.
|
||||
*/
|
||||
virtual ~MemoryLockBytes() override;
|
||||
};
|
||||
|
||||
@@ -808,11 +790,8 @@ storeError MemoryLockBytes::flush_Impl()
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* ILockBytes factory implementations.
|
||||
*
|
||||
*======================================================================*/
|
||||
// ILockBytes factory implementations.
|
||||
|
||||
namespace store
|
||||
{
|
||||
|
||||
|
||||
@@ -23,16 +23,8 @@
|
||||
|
||||
namespace store
|
||||
{
|
||||
/*========================================================================
|
||||
*
|
||||
* OStoreObject implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
const sal_uInt32 OStoreObject::m_nTypeId = sal_uInt32(0x58190322);
|
||||
|
||||
/*
|
||||
* isKindOf.
|
||||
*/
|
||||
bool OStoreObject::isKindOf(sal_uInt32 nTypeId) { return (nTypeId == m_nTypeId); }
|
||||
|
||||
} // namespace store
|
||||
|
||||
@@ -28,8 +28,6 @@ namespace store
|
||||
class OStoreObject : public virtual salhelper::SimpleReferenceObject
|
||||
{
|
||||
public:
|
||||
/** Construction.
|
||||
*/
|
||||
OStoreObject() {}
|
||||
|
||||
/** Replaces dynamic_cast type checking.
|
||||
@@ -37,8 +35,6 @@ public:
|
||||
virtual bool isKindOf(sal_uInt32 nTypeId);
|
||||
|
||||
protected:
|
||||
/** Destruction.
|
||||
*/
|
||||
virtual ~OStoreObject() override {}
|
||||
|
||||
private:
|
||||
|
||||
@@ -31,11 +31,8 @@
|
||||
|
||||
using namespace store;
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* PageData::Allocator_Impl (default allocator).
|
||||
*
|
||||
*======================================================================*/
|
||||
// PageData::Allocator_Impl (default allocator).
|
||||
|
||||
namespace store
|
||||
{
|
||||
|
||||
@@ -54,13 +51,9 @@ public:
|
||||
storeError initialize (sal_uInt16 nPageSize);
|
||||
|
||||
protected:
|
||||
/** Destruction.
|
||||
*/
|
||||
virtual ~Allocator_Impl() override;
|
||||
|
||||
private:
|
||||
/** Representation.
|
||||
*/
|
||||
rtl_cache_type * m_page_cache;
|
||||
sal_uInt16 m_page_size;
|
||||
|
||||
@@ -113,12 +106,6 @@ void PageData::Allocator_Impl::deallocate_Impl (void * pPage)
|
||||
rtl_cache_free(m_page_cache, pPage);
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* PageData::Allocator factory.
|
||||
*
|
||||
*======================================================================*/
|
||||
|
||||
storeError
|
||||
PageData::Allocator::createInstance (rtl::Reference< PageData::Allocator > & rxAllocator, sal_uInt16 nPageSize)
|
||||
{
|
||||
@@ -130,14 +117,6 @@ PageData::Allocator::createInstance (rtl::Reference< PageData::Allocator > & rxA
|
||||
return xAllocator->initialize (nPageSize);
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStorePageObject.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* ~OStorePageObject.
|
||||
*/
|
||||
OStorePageObject::~OStorePageObject()
|
||||
{
|
||||
}
|
||||
|
||||
+43
-122
@@ -36,11 +36,6 @@
|
||||
|
||||
using namespace store;
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStoreSuperBlock.
|
||||
*
|
||||
*======================================================================*/
|
||||
constexpr sal_uInt32 STORE_MAGIC_SUPERBLOCK = 0x484D5343;
|
||||
|
||||
namespace {
|
||||
@@ -51,8 +46,6 @@ struct OStoreSuperBlock
|
||||
typedef OStorePageDescriptor D;
|
||||
typedef OStorePageLink L;
|
||||
|
||||
/** Representation.
|
||||
*/
|
||||
G m_aGuard;
|
||||
D m_aDescr;
|
||||
sal_uInt32 m_nMarked;
|
||||
@@ -60,12 +53,8 @@ struct OStoreSuperBlock
|
||||
sal_uInt32 m_nUnused;
|
||||
L m_aUnused;
|
||||
|
||||
/** theSize.
|
||||
*/
|
||||
static const size_t theSize = sizeof(G) + sizeof(D) + 2 * (sizeof(L) + sizeof(sal_uInt32));
|
||||
|
||||
/** Construction.
|
||||
*/
|
||||
explicit OStoreSuperBlock (sal_uInt16 nPageSize)
|
||||
: m_aGuard (STORE_MAGIC_SUPERBLOCK),
|
||||
m_aDescr (nPageSize, nPageSize, STORE_MINIMUM_PAGESIZE),
|
||||
@@ -75,8 +64,6 @@ struct OStoreSuperBlock
|
||||
m_aUnused (0)
|
||||
{}
|
||||
|
||||
/** Comparison.
|
||||
*/
|
||||
bool operator== (const OStoreSuperBlock & rhs) const
|
||||
{
|
||||
return ((m_aGuard == rhs.m_aGuard ) &&
|
||||
@@ -87,36 +74,36 @@ struct OStoreSuperBlock
|
||||
(m_aUnused == rhs.m_aUnused) );
|
||||
}
|
||||
|
||||
/** unused(Count|Head|Insert|Remove|Reset).
|
||||
*/
|
||||
sal_uInt32 unusedCount() const
|
||||
{
|
||||
return store::ntohl(m_nUnused);
|
||||
}
|
||||
|
||||
const L& unusedHead() const
|
||||
{
|
||||
return m_aUnused;
|
||||
}
|
||||
|
||||
void unusedInsert (const L& rLink)
|
||||
{
|
||||
sal_uInt32 nUnused = unusedCount();
|
||||
m_nUnused = store::htonl(nUnused + 1);
|
||||
m_aUnused = rLink;
|
||||
}
|
||||
|
||||
void unusedRemove (const L& rLink)
|
||||
{
|
||||
sal_uInt32 nUnused = unusedCount();
|
||||
m_nUnused = store::htonl(nUnused - 1);
|
||||
m_aUnused = rLink;
|
||||
}
|
||||
|
||||
void unusedReset()
|
||||
{
|
||||
m_nUnused = store::htonl(0);
|
||||
m_aUnused = L(0);
|
||||
}
|
||||
|
||||
/** guard (external representation).
|
||||
*/
|
||||
void guard()
|
||||
{
|
||||
sal_uInt32 nCRC32 = rtl_crc32 (0, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
|
||||
@@ -124,8 +111,6 @@ struct OStoreSuperBlock
|
||||
m_aGuard.m_nCRC32 = store::htonl(nCRC32);
|
||||
}
|
||||
|
||||
/** verify (external representation).
|
||||
*/
|
||||
storeError verify() const
|
||||
{
|
||||
sal_uInt32 nMagic = store::ntohl(m_aGuard.m_nMagic);
|
||||
@@ -143,11 +128,6 @@ struct OStoreSuperBlock
|
||||
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* SuperBlockPage interface.
|
||||
*
|
||||
*======================================================================*/
|
||||
namespace store
|
||||
{
|
||||
|
||||
@@ -155,23 +135,18 @@ struct SuperBlockPage
|
||||
{
|
||||
typedef OStoreSuperBlock SuperBlock;
|
||||
|
||||
/** Representation.
|
||||
*/
|
||||
SuperBlock m_aSuperOne;
|
||||
SuperBlock m_aSuperTwo;
|
||||
|
||||
/** theSize.
|
||||
*/
|
||||
static const size_t theSize = 2 * SuperBlock::theSize;
|
||||
static const sal_uInt16 thePageSize = theSize;
|
||||
static_assert(STORE_MINIMUM_PAGESIZE >= thePageSize, "must be at least thePageSize");
|
||||
|
||||
/** Allocation.
|
||||
*/
|
||||
static void * operator new (size_t n)
|
||||
{
|
||||
return std::malloc(sal::static_int_cast<sal_Size>(n));
|
||||
}
|
||||
|
||||
static void operator delete (void * p)
|
||||
{
|
||||
std::free (p);
|
||||
@@ -181,20 +156,17 @@ struct SuperBlockPage
|
||||
{
|
||||
return rtl_allocateZeroMemory (sal::static_int_cast<sal_Size>(nPageSize));
|
||||
}
|
||||
|
||||
static void operator delete (void * p, SAL_UNUSED_PARAMETER sal_uInt16)
|
||||
{
|
||||
std::free (p);
|
||||
}
|
||||
|
||||
/** Construction.
|
||||
*/
|
||||
explicit SuperBlockPage (sal_uInt16 nPageSize = thePageSize)
|
||||
: m_aSuperOne(nPageSize),
|
||||
m_aSuperTwo(nPageSize)
|
||||
{}
|
||||
|
||||
/** save.
|
||||
*/
|
||||
storeError save (OStorePageBIOS const & rBIOS, sal_uInt32 nSize = theSize)
|
||||
{
|
||||
m_aSuperOne.guard();
|
||||
@@ -216,20 +188,13 @@ struct SuperBlockPage
|
||||
OStorePageBIOS const & rBIOS,
|
||||
sal_uInt32 nAddr);
|
||||
|
||||
/** verify (with repair).
|
||||
*/
|
||||
storeError verify (OStorePageBIOS const & rBIOS);
|
||||
};
|
||||
|
||||
} // namespace store
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* SuperBlockPage implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* unusedHead(): get freelist head (alloc page, step 1).
|
||||
/**
|
||||
Get freelist head (alloc page, step 1).
|
||||
*/
|
||||
storeError SuperBlockPage::unusedHead (OStorePageBIOS const & rBIOS, PageData & rPageHead)
|
||||
{
|
||||
@@ -271,8 +236,8 @@ storeError SuperBlockPage::unusedHead (OStorePageBIOS const & rBIOS, PageData &
|
||||
return eErrCode;
|
||||
}
|
||||
|
||||
/*
|
||||
* unusedPop(): pop freelist head (alloc page, step 2).
|
||||
/**
|
||||
Pop freelist head (alloc page, step 2).
|
||||
*/
|
||||
storeError SuperBlockPage::unusedPop (OStorePageBIOS const & rBIOS, PageData const & rPageHead)
|
||||
{
|
||||
@@ -287,8 +252,8 @@ storeError SuperBlockPage::unusedPop (OStorePageBIOS const & rBIOS, PageData con
|
||||
return save (rBIOS);
|
||||
}
|
||||
|
||||
/*
|
||||
* unusedPush(): push new freelist head.
|
||||
/**
|
||||
Push new freelist head.
|
||||
*/
|
||||
storeError SuperBlockPage::unusedPush (OStorePageBIOS const & rBIOS, sal_uInt32 nAddr)
|
||||
{
|
||||
@@ -317,8 +282,8 @@ storeError SuperBlockPage::unusedPush (OStorePageBIOS const & rBIOS, sal_uInt32
|
||||
return save (rBIOS);
|
||||
}
|
||||
|
||||
/*
|
||||
* verify (with repair).
|
||||
/**
|
||||
Verify (with repair).
|
||||
*/
|
||||
storeError SuperBlockPage::verify (OStorePageBIOS const & rBIOS)
|
||||
{
|
||||
@@ -381,11 +346,6 @@ storeError SuperBlockPage::verify (OStorePageBIOS const & rBIOS)
|
||||
return eErrCode;
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStorePageBIOS::Ace implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
OStorePageBIOS::Ace::Ace()
|
||||
: m_next (this), m_prev (this), m_addr (STORE_PAGE_NULL), m_used (0)
|
||||
{}
|
||||
@@ -398,7 +358,7 @@ OStorePageBIOS::Ace::~Ace()
|
||||
|
||||
int
|
||||
SAL_CALL OStorePageBIOS::Ace::constructor (
|
||||
void * obj, SAL_UNUSED_PARAMETER void * /* arg */)
|
||||
void * obj, SAL_UNUSED_PARAMETER void*)
|
||||
{
|
||||
Ace * ace = static_cast<Ace*>(obj);
|
||||
ace->m_next = ace->m_prev = ace;
|
||||
@@ -427,11 +387,6 @@ OStorePageBIOS::Ace::insert (OStorePageBIOS::Ace * head, OStorePageBIOS::Ace * e
|
||||
entry->m_prev->m_next = entry;
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStorePageBIOS::AceCache interface.
|
||||
*
|
||||
*======================================================================*/
|
||||
namespace store
|
||||
{
|
||||
|
||||
@@ -455,12 +410,6 @@ protected:
|
||||
|
||||
} // namespace store
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStorePageBIOS::AceCache implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
|
||||
OStorePageBIOS::AceCache &
|
||||
OStorePageBIOS::AceCache::get()
|
||||
{
|
||||
@@ -522,31 +471,16 @@ OStorePageBIOS::AceCache::destroy (OStorePageBIOS::Ace * ace)
|
||||
}
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStorePageBIOS implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* OStorePageBIOS.
|
||||
*/
|
||||
OStorePageBIOS::OStorePageBIOS()
|
||||
: m_bWriteable (false)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* ~OStorePageBIOS.
|
||||
*/
|
||||
OStorePageBIOS::~OStorePageBIOS()
|
||||
{
|
||||
cleanup_Impl();
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize.
|
||||
* Precond: none.
|
||||
*/
|
||||
storeError OStorePageBIOS::initialize (
|
||||
ILockBytes * pLockBytes,
|
||||
storeAccessMode eAccessMode,
|
||||
@@ -565,9 +499,9 @@ storeError OStorePageBIOS::initialize (
|
||||
return eErrCode;
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize_Impl.
|
||||
* Internal: Precond: exclusive access.
|
||||
/**
|
||||
initialize_Impl.
|
||||
@pre exclusive access
|
||||
*/
|
||||
storeError OStorePageBIOS::initialize_Impl (
|
||||
ILockBytes * pLockBytes,
|
||||
@@ -646,8 +580,7 @@ storeError OStorePageBIOS::initialize_Impl (
|
||||
}
|
||||
|
||||
/*
|
||||
* cleanup_Impl.
|
||||
* Internal: Precond: exclusive access.
|
||||
@pre exclusive access.
|
||||
*/
|
||||
void OStorePageBIOS::cleanup_Impl()
|
||||
{
|
||||
@@ -677,9 +610,8 @@ void OStorePageBIOS::cleanup_Impl()
|
||||
m_xLockBytes.clear();
|
||||
}
|
||||
|
||||
/*
|
||||
* read.
|
||||
* Low Level: Precond: initialized, exclusive access.
|
||||
/**
|
||||
@pre initialized, exclusive access.
|
||||
*/
|
||||
storeError OStorePageBIOS::read (
|
||||
sal_uInt32 nAddr, void *pData, sal_uInt32 nSize) const
|
||||
@@ -692,9 +624,8 @@ storeError OStorePageBIOS::read (
|
||||
return m_xLockBytes->readAt (nAddr, pData, nSize);
|
||||
}
|
||||
|
||||
/*
|
||||
* write.
|
||||
* Low Level: Precond: initialized, writeable, exclusive access.
|
||||
/**
|
||||
@pre initialized, writeable, exclusive access.
|
||||
*/
|
||||
storeError OStorePageBIOS::write (
|
||||
sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize) const
|
||||
@@ -709,9 +640,8 @@ storeError OStorePageBIOS::write (
|
||||
return m_xLockBytes->writeAt (nAddr, pData, nSize);
|
||||
}
|
||||
|
||||
/*
|
||||
* acquirePage.
|
||||
* Precond: initialized.
|
||||
/**
|
||||
@pre initialized.
|
||||
*/
|
||||
storeError OStorePageBIOS::acquirePage (
|
||||
const OStorePageDescriptor& rDescr, storeAccessMode eMode)
|
||||
@@ -751,9 +681,8 @@ storeError OStorePageBIOS::acquirePage (
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* releasePage.
|
||||
* Precond: initialized.
|
||||
/**
|
||||
@pre initialized.
|
||||
*/
|
||||
storeError OStorePageBIOS::releasePage (const OStorePageDescriptor& rDescr)
|
||||
{
|
||||
@@ -780,9 +709,8 @@ storeError OStorePageBIOS::releasePage (const OStorePageDescriptor& rDescr)
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* allocate.
|
||||
* Precond: initialized, writeable.
|
||||
/**
|
||||
@pre initialized, writeable.
|
||||
*/
|
||||
storeError OStorePageBIOS::allocate (
|
||||
OStorePageObject& rPage)
|
||||
@@ -826,9 +754,8 @@ storeError OStorePageBIOS::allocate (
|
||||
return saveObjectAt_Impl (rPage, nSize);
|
||||
}
|
||||
|
||||
/*
|
||||
* free.
|
||||
* Precond: initialized, writeable.
|
||||
/**
|
||||
@pre initialized, writeable.
|
||||
*/
|
||||
storeError OStorePageBIOS::free (sal_uInt32 nAddr)
|
||||
{
|
||||
@@ -848,9 +775,8 @@ storeError OStorePageBIOS::free (sal_uInt32 nAddr)
|
||||
return m_pSuper->unusedPush (*this, nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* loadObjectAt.
|
||||
* Precond: initialized, readable.
|
||||
/**
|
||||
@pre initialized, readable.
|
||||
*/
|
||||
storeError OStorePageBIOS::loadObjectAt (OStorePageObject & rPage, sal_uInt32 nAddr)
|
||||
{
|
||||
@@ -864,9 +790,8 @@ storeError OStorePageBIOS::loadObjectAt (OStorePageObject & rPage, sal_uInt32 nA
|
||||
return loadObjectAt_Impl (rPage, nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* loadObjectAt_Impl.
|
||||
* Internal: Precond: initialized, readable, exclusive access.
|
||||
/**
|
||||
@pre initialized, readable, exclusive access.
|
||||
*/
|
||||
storeError OStorePageBIOS::loadObjectAt_Impl (OStorePageObject & rPage, sal_uInt32 nAddr) const
|
||||
{
|
||||
@@ -891,9 +816,8 @@ storeError OStorePageBIOS::loadObjectAt_Impl (OStorePageObject & rPage, sal_uInt
|
||||
return m_xCache->insertPageAt (rPage.get(), nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* saveObjectAt.
|
||||
* Precond: initialized, writeable.
|
||||
/**
|
||||
@pre initialized, writeable.
|
||||
*/
|
||||
storeError OStorePageBIOS::saveObjectAt (OStorePageObject & rPage, sal_uInt32 nAddr)
|
||||
{
|
||||
@@ -910,9 +834,8 @@ storeError OStorePageBIOS::saveObjectAt (OStorePageObject & rPage, sal_uInt32 nA
|
||||
return saveObjectAt_Impl (rPage, nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* saveObjectAt_Impl.
|
||||
* Internal: Precond: initialized, writeable, exclusive access.
|
||||
/**
|
||||
@pre initialized, writeable, exclusive access.
|
||||
*/
|
||||
storeError OStorePageBIOS::saveObjectAt_Impl (OStorePageObject & rPage, sal_uInt32 nAddr) const
|
||||
{
|
||||
@@ -933,9 +856,8 @@ storeError OStorePageBIOS::saveObjectAt_Impl (OStorePageObject & rPage, sal_uInt
|
||||
return m_xCache->updatePageAt (rPage.get(), nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* close.
|
||||
* Precond: none.
|
||||
/**
|
||||
@pre none.
|
||||
*/
|
||||
storeError OStorePageBIOS::close()
|
||||
{
|
||||
@@ -949,9 +871,8 @@ storeError OStorePageBIOS::close()
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* flush.
|
||||
* Precond: initialized.
|
||||
/**
|
||||
@pre initialized.
|
||||
*/
|
||||
storeError OStorePageBIOS::flush()
|
||||
{
|
||||
|
||||
@@ -37,8 +37,6 @@ struct SuperBlockPage;
|
||||
class OStorePageBIOS : public store::OStoreObject
|
||||
{
|
||||
public:
|
||||
/** Construction.
|
||||
*/
|
||||
OStorePageBIOS();
|
||||
|
||||
/** Conversion into Mutex&
|
||||
@@ -61,26 +59,16 @@ public:
|
||||
return m_xAllocator;
|
||||
}
|
||||
|
||||
/** read.
|
||||
*/
|
||||
storeError read (
|
||||
sal_uInt32 nAddr, void *pData, sal_uInt32 nSize) const;
|
||||
|
||||
/** write.
|
||||
*/
|
||||
storeError write (
|
||||
sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize) const;
|
||||
|
||||
/** isWriteable.
|
||||
*/
|
||||
inline bool isWriteable() const;
|
||||
|
||||
/** isValid.
|
||||
*/
|
||||
inline bool isValid() const;
|
||||
|
||||
/** Page Access.
|
||||
*/
|
||||
storeError acquirePage (
|
||||
const OStorePageDescriptor& rDescr, storeAccessMode eMode);
|
||||
|
||||
@@ -99,23 +87,19 @@ public:
|
||||
OStorePageObject& rPage, sal_uInt32 nAddr);
|
||||
|
||||
/** close.
|
||||
* @return store_E_None upon success.
|
||||
@return store_E_None upon success.
|
||||
*/
|
||||
storeError close();
|
||||
|
||||
/** flush.
|
||||
* @return store_E_None upon success.
|
||||
@return store_E_None upon success.
|
||||
*/
|
||||
storeError flush();
|
||||
|
||||
protected:
|
||||
/** Destruction (OReference).
|
||||
*/
|
||||
virtual ~OStorePageBIOS() override;
|
||||
|
||||
private:
|
||||
/** Representation.
|
||||
*/
|
||||
rtl::Reference<ILockBytes> m_xLockBytes;
|
||||
osl::Mutex m_aMutex;
|
||||
|
||||
@@ -126,9 +110,9 @@ private:
|
||||
rtl::Reference< PageData::Allocator > m_xAllocator;
|
||||
rtl::Reference< PageCache > m_xCache;
|
||||
|
||||
public:
|
||||
/** Page Access (control).
|
||||
*/
|
||||
public:
|
||||
struct Ace
|
||||
{
|
||||
Ace * m_next;
|
||||
@@ -151,16 +135,12 @@ private:
|
||||
|
||||
class AceCache;
|
||||
|
||||
/** Initialization.
|
||||
*/
|
||||
storeError initialize_Impl (
|
||||
ILockBytes * pLockBytes,
|
||||
storeAccessMode eAccessMode,
|
||||
sal_uInt16 & rnPageSize);
|
||||
void cleanup_Impl();
|
||||
|
||||
/** Page Maintenance.
|
||||
*/
|
||||
storeError loadObjectAt_Impl (
|
||||
OStorePageObject & rPage, sal_uInt32 nAddr) const;
|
||||
storeError saveObjectAt_Impl (
|
||||
@@ -174,10 +154,12 @@ inline OStorePageBIOS::operator osl::Mutex& (void) const
|
||||
{
|
||||
return const_cast<osl::Mutex&>(m_aMutex);
|
||||
}
|
||||
|
||||
inline bool OStorePageBIOS::isWriteable() const
|
||||
{
|
||||
return m_bWriteable;
|
||||
}
|
||||
|
||||
inline bool OStorePageBIOS::isValid() const
|
||||
{
|
||||
return m_xLockBytes.is();
|
||||
|
||||
@@ -35,28 +35,22 @@
|
||||
|
||||
using namespace store;
|
||||
|
||||
// Entry
|
||||
|
||||
namespace store {
|
||||
struct Entry
|
||||
{
|
||||
// Representation
|
||||
std::shared_ptr<PageData> m_xPage;
|
||||
sal_uInt32 m_nOffset;
|
||||
Entry * m_pNext;
|
||||
|
||||
// Allocation
|
||||
static void * operator new (size_t, void * p) { return p; }
|
||||
static void operator delete (void *, void *) {}
|
||||
|
||||
// Construction
|
||||
explicit Entry (std::shared_ptr<PageData> const & rxPage, sal_uInt32 nOffset)
|
||||
: m_xPage(rxPage), m_nOffset(nOffset), m_pNext(nullptr)
|
||||
{}
|
||||
};
|
||||
};
|
||||
|
||||
// EntryCache interface
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -78,7 +72,6 @@ protected:
|
||||
|
||||
} // namespace
|
||||
|
||||
// EntryCache implementation
|
||||
EntryCache & EntryCache::get()
|
||||
{
|
||||
static EntryCache g_entry_cache;
|
||||
@@ -394,20 +387,14 @@ storeError PageCache::removePageAt (sal_uInt32 nOffset)
|
||||
return store_E_NotExists;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Old OStorePageCache implementation.
|
||||
*
|
||||
* (two-way association (sorted address array, LRU chain)).
|
||||
* (external PageData representation).
|
||||
*
|
||||
/**
|
||||
|
||||
Old OStorePageCache implementation.
|
||||
|
||||
(two-way association (sorted address array, LRU chain)).
|
||||
(external PageData representation).
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* PageCache factory implementation.
|
||||
*
|
||||
*/
|
||||
namespace store {
|
||||
|
||||
storeError
|
||||
|
||||
@@ -39,7 +39,6 @@ struct Entry;
|
||||
class PageCache :
|
||||
public store::OStoreObject
|
||||
{
|
||||
// Representation
|
||||
static size_t const theTableSize = 32;
|
||||
static_assert((theTableSize & (theTableSize-1)) == 0, "table size should be a power of 2");
|
||||
|
||||
@@ -71,26 +70,18 @@ public:
|
||||
PageCache(const PageCache&) = delete;
|
||||
PageCache& operator=(const PageCache&) = delete;
|
||||
|
||||
/** load.
|
||||
*/
|
||||
storeError lookupPageAt (
|
||||
std::shared_ptr<PageData> & rxPage,
|
||||
sal_uInt32 nOffset);
|
||||
|
||||
/** insert.
|
||||
*/
|
||||
storeError insertPageAt (
|
||||
std::shared_ptr<PageData> const & rxPage,
|
||||
sal_uInt32 nOffset);
|
||||
|
||||
/** update, or insert.
|
||||
*/
|
||||
storeError updatePageAt (
|
||||
std::shared_ptr<PageData> const & rxPage,
|
||||
sal_uInt32 nOffset);
|
||||
|
||||
/** remove (invalidate).
|
||||
*/
|
||||
storeError removePageAt (
|
||||
sal_uInt32 nOffset);
|
||||
|
||||
|
||||
@@ -28,34 +28,18 @@
|
||||
|
||||
using namespace store;
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStoreDataPageObject implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* guard.
|
||||
*/
|
||||
storeError OStoreDataPageObject::guard (sal_uInt32 nAddr)
|
||||
{
|
||||
return PageHolderObject< page >::guard (m_xPage, nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* verify.
|
||||
*/
|
||||
storeError OStoreDataPageObject::verify (sal_uInt32 nAddr) const
|
||||
{
|
||||
return PageHolderObject< page >::verify (m_xPage, nAddr);
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStoreIndirectionPageObject implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* store_truncate_Impl (single indirect page).
|
||||
/**
|
||||
store_truncate_Impl (single indirect page).
|
||||
*/
|
||||
static storeError store_truncate_Impl (
|
||||
sal_uInt32 nAddr,
|
||||
@@ -166,9 +150,6 @@ static storeError store_truncate_Impl (
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* loadOrCreate.
|
||||
*/
|
||||
storeError OStoreIndirectionPageObject::loadOrCreate (
|
||||
sal_uInt32 nAddr,
|
||||
OStorePageBIOS & rBIOS)
|
||||
@@ -189,25 +170,16 @@ storeError OStoreIndirectionPageObject::loadOrCreate (
|
||||
return rBIOS.loadObjectAt (*this, nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* guard.
|
||||
*/
|
||||
storeError OStoreIndirectionPageObject::guard (sal_uInt32 nAddr)
|
||||
{
|
||||
return PageHolderObject< page >::guard (m_xPage, nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* verify.
|
||||
*/
|
||||
storeError OStoreIndirectionPageObject::verify (sal_uInt32 nAddr) const
|
||||
{
|
||||
return PageHolderObject< page >::verify (m_xPage, nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* read (single indirect).
|
||||
*/
|
||||
storeError OStoreIndirectionPageObject::read (
|
||||
sal_uInt16 nSingle,
|
||||
OStoreDataPageObject &rData,
|
||||
@@ -558,31 +530,16 @@ storeError OStoreIndirectionPageObject::truncate (
|
||||
return eErrCode;
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStoreDirectoryPageObject implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* guard.
|
||||
*/
|
||||
storeError OStoreDirectoryPageObject::guard (sal_uInt32 nAddr)
|
||||
{
|
||||
return PageHolderObject< page >::guard (m_xPage, nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* verify.
|
||||
*/
|
||||
storeError OStoreDirectoryPageObject::verify (sal_uInt32 nAddr) const
|
||||
{
|
||||
return PageHolderObject< page >::verify (m_xPage, nAddr);
|
||||
// OLD: m_rPage.verifyVersion (STORE_MAGIC_DIRECTORYPAGE);
|
||||
}
|
||||
|
||||
/*
|
||||
* scope (external data page; private).
|
||||
*/
|
||||
OStoreDirectoryPageData::ChunkScope
|
||||
OStoreDirectoryPageObject::scope (
|
||||
sal_uInt32 nPage,
|
||||
@@ -717,9 +674,6 @@ OStoreDirectoryPageObject::scope (
|
||||
return page::SCOPE_UNREACHABLE;
|
||||
}
|
||||
|
||||
/*
|
||||
* read (external data page).
|
||||
*/
|
||||
storeError OStoreDirectoryPageObject::read (
|
||||
sal_uInt32 nPage,
|
||||
OStoreDataPageObject &rData,
|
||||
@@ -793,9 +747,6 @@ storeError OStoreDirectoryPageObject::read (
|
||||
return eErrCode;
|
||||
}
|
||||
|
||||
/*
|
||||
* write (external data page).
|
||||
*/
|
||||
storeError OStoreDirectoryPageObject::write (
|
||||
sal_uInt32 nPage,
|
||||
OStoreDataPageObject &rData,
|
||||
@@ -880,9 +831,6 @@ storeError OStoreDirectoryPageObject::write (
|
||||
return eErrCode;
|
||||
}
|
||||
|
||||
/*
|
||||
* truncate (external data page).
|
||||
*/
|
||||
storeError OStoreDirectoryPageObject::truncate (
|
||||
sal_uInt32 nPage,
|
||||
OStorePageBIOS &rBIOS)
|
||||
|
||||
@@ -35,14 +35,6 @@
|
||||
|
||||
using namespace store;
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStore... internals.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* convertTextToUnicode.
|
||||
*/
|
||||
static sal_Size convertTextToUnicode (
|
||||
rtl_TextToUnicodeConverter hConverter,
|
||||
const char *pSrcBuffer, sal_Size nSrcLength,
|
||||
@@ -58,25 +50,14 @@ static sal_Size convertTextToUnicode (
|
||||
&nCvtInfo, &nCvtBytes);
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStoreDirectory_Impl implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
const sal_uInt32 OStoreDirectory_Impl::m_nTypeId(0x89191107);
|
||||
|
||||
/*
|
||||
* OStoreDirectory_Impl.
|
||||
*/
|
||||
OStoreDirectory_Impl::OStoreDirectory_Impl()
|
||||
: m_aDescr (0, 0, 0),
|
||||
m_nPath (0),
|
||||
m_hTextCvt (nullptr)
|
||||
{}
|
||||
|
||||
/*
|
||||
* ~OStoreDirectory_Impl.
|
||||
*/
|
||||
OStoreDirectory_Impl::~OStoreDirectory_Impl()
|
||||
{
|
||||
if (m_xManager.is())
|
||||
@@ -87,17 +68,11 @@ OStoreDirectory_Impl::~OStoreDirectory_Impl()
|
||||
rtl_destroyTextToUnicodeConverter (m_hTextCvt);
|
||||
}
|
||||
|
||||
/*
|
||||
* isKindOf.
|
||||
*/
|
||||
bool OStoreDirectory_Impl::isKindOf (sal_uInt32 nTypeId)
|
||||
{
|
||||
return (nTypeId == m_nTypeId);
|
||||
}
|
||||
|
||||
/*
|
||||
* create.
|
||||
*/
|
||||
storeError OStoreDirectory_Impl::create (
|
||||
OStorePageManager *pManager,
|
||||
rtl_String const *pPath,
|
||||
@@ -137,9 +112,6 @@ storeError OStoreDirectory_Impl::create (
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* iterate.
|
||||
*/
|
||||
storeError OStoreDirectory_Impl::iterate (storeFindData &rFindData)
|
||||
{
|
||||
if (!m_xManager.is())
|
||||
|
||||
@@ -37,8 +37,6 @@ struct OStoreDirectoryPageData;
|
||||
class OStoreDirectory_Impl : public store::OStoreObject
|
||||
{
|
||||
public:
|
||||
/** Construction.
|
||||
*/
|
||||
OStoreDirectory_Impl();
|
||||
|
||||
/** create (two-phase construction).
|
||||
@@ -62,13 +60,9 @@ public:
|
||||
storeError iterate (
|
||||
storeFindData &rFindData);
|
||||
|
||||
/** IStoreHandle.
|
||||
*/
|
||||
virtual bool isKindOf (sal_uInt32 nTypeId) override;
|
||||
|
||||
protected:
|
||||
/** Destruction.
|
||||
*/
|
||||
virtual ~OStoreDirectory_Impl() override;
|
||||
|
||||
private:
|
||||
@@ -81,8 +75,6 @@ private:
|
||||
friend OStoreDirectory_Impl*
|
||||
SAL_CALL query<> (OStoreObject *pHandle, OStoreDirectory_Impl*);
|
||||
|
||||
/** Representation.
|
||||
*/
|
||||
typedef OStoreDirectoryPageData inode;
|
||||
typedef PageHolderObject< inode > inode_holder_type;
|
||||
|
||||
|
||||
@@ -62,14 +62,6 @@ public:
|
||||
|
||||
using namespace store;
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* storeHandle implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* store_acquireHandle.
|
||||
*/
|
||||
storeError store_acquireHandle (
|
||||
storeHandle Handle
|
||||
) SAL_THROW_EXTERN_C()
|
||||
@@ -82,9 +74,6 @@ storeError store_acquireHandle (
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* store_releaseHandle.
|
||||
*/
|
||||
storeError store_releaseHandle (
|
||||
storeHandle Handle
|
||||
) SAL_THROW_EXTERN_C()
|
||||
@@ -97,14 +86,6 @@ storeError store_releaseHandle (
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* storeFileHandle implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* store_createMemoryFile.
|
||||
*/
|
||||
storeError store_createMemoryFile (
|
||||
sal_uInt16 nPageSize,
|
||||
storeFileHandle *phFile
|
||||
@@ -136,9 +117,6 @@ storeError store_createMemoryFile (
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* store_openFile.
|
||||
*/
|
||||
storeError store_openFile (
|
||||
rtl_uString *pFilename,
|
||||
storeAccessMode eAccessMode,
|
||||
@@ -191,9 +169,6 @@ storeError store_closeFile (
|
||||
return eErrCode;
|
||||
}
|
||||
|
||||
/*
|
||||
* store_flushFile.
|
||||
*/
|
||||
storeError store_flushFile (
|
||||
storeFileHandle Handle
|
||||
) SAL_THROW_EXTERN_C()
|
||||
@@ -206,14 +181,6 @@ storeError store_flushFile (
|
||||
return xManager->flush();
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* storeDirectoryHandle implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* store_openDirectory.
|
||||
*/
|
||||
storeError store_openDirectory (
|
||||
storeFileHandle hFile,
|
||||
rtl_uString const *pPath,
|
||||
@@ -251,9 +218,6 @@ storeError store_openDirectory (
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* store_findFirst.
|
||||
*/
|
||||
storeError store_findFirst (
|
||||
storeDirectoryHandle Handle,
|
||||
storeFindData *pFindData
|
||||
@@ -275,9 +239,6 @@ storeError store_findFirst (
|
||||
return xDirectory->iterate (*pFindData);
|
||||
}
|
||||
|
||||
/*
|
||||
* store_findNext.
|
||||
*/
|
||||
storeError store_findNext (
|
||||
storeDirectoryHandle Handle,
|
||||
storeFindData *pFindData
|
||||
@@ -300,14 +261,6 @@ storeError store_findNext (
|
||||
return xDirectory->iterate (*pFindData);
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* storeStreamHandle implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* store_openStream
|
||||
*/
|
||||
storeError store_openStream (
|
||||
storeFileHandle hFile,
|
||||
rtl_uString const *pPath,
|
||||
@@ -367,9 +320,6 @@ storeError store_readStream (
|
||||
return xLockBytes->readAt (nOffset, pBuffer, nBytes, *pnDone);
|
||||
}
|
||||
|
||||
/*
|
||||
* store_writeStream.
|
||||
*/
|
||||
storeError store_writeStream (
|
||||
storeStreamHandle Handle,
|
||||
sal_uInt32 nOffset,
|
||||
@@ -389,9 +339,6 @@ storeError store_writeStream (
|
||||
return xLockBytes->writeAt (nOffset, pBuffer, nBytes, *pnDone);
|
||||
}
|
||||
|
||||
/*
|
||||
* store_remove.
|
||||
*/
|
||||
storeError store_remove (
|
||||
storeFileHandle Handle,
|
||||
rtl_uString const *pPath,
|
||||
|
||||
@@ -32,24 +32,13 @@
|
||||
|
||||
using namespace store;
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStoreLockBytes implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
const sal_uInt32 OStoreLockBytes::m_nTypeId(0x94190310);
|
||||
|
||||
/*
|
||||
* OStoreLockBytes.
|
||||
*/
|
||||
OStoreLockBytes::OStoreLockBytes()
|
||||
: m_bWriteable (false)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* ~OStoreLockBytes.
|
||||
*/
|
||||
OStoreLockBytes::~OStoreLockBytes()
|
||||
{
|
||||
if (m_xManager.is() && m_xNode.is())
|
||||
@@ -58,17 +47,11 @@ OStoreLockBytes::~OStoreLockBytes()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* isKindOf.
|
||||
*/
|
||||
bool OStoreLockBytes::isKindOf (sal_uInt32 nTypeId)
|
||||
{
|
||||
return (nTypeId == m_nTypeId);
|
||||
}
|
||||
|
||||
/*
|
||||
* create.
|
||||
*/
|
||||
storeError OStoreLockBytes::create (
|
||||
OStorePageManager *pManager,
|
||||
rtl_String const *pPath,
|
||||
@@ -117,9 +100,6 @@ storeError OStoreLockBytes::create (
|
||||
return eErrCode;
|
||||
}
|
||||
|
||||
/*
|
||||
* readAt.
|
||||
*/
|
||||
storeError OStoreLockBytes::readAt (
|
||||
sal_uInt32 nOffset,
|
||||
void *pBuffer,
|
||||
@@ -217,9 +197,6 @@ storeError OStoreLockBytes::readAt (
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* writeAt.
|
||||
*/
|
||||
storeError OStoreLockBytes::writeAt (
|
||||
sal_uInt32 nOffset,
|
||||
const void *pBuffer,
|
||||
@@ -290,7 +267,6 @@ storeError OStoreLockBytes::writeAt (
|
||||
if ((aDescr.m_nOffset > 0) || (nBytes < nLength))
|
||||
{
|
||||
// Unaligned. Need to load/create data page.
|
||||
// @@@ loadOrCreate()
|
||||
eErrCode = aPage.read (aDescr.m_nPage, aData, *m_xManager);
|
||||
if (eErrCode != store_E_None)
|
||||
{
|
||||
@@ -344,9 +320,6 @@ storeError OStoreLockBytes::writeAt (
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* setSize.
|
||||
*/
|
||||
storeError OStoreLockBytes::setSize (sal_uInt32 nSize)
|
||||
{
|
||||
if (!m_xManager.is())
|
||||
|
||||
@@ -37,8 +37,6 @@ struct OStoreDirectoryPageData;
|
||||
class OStoreLockBytes : public store::OStoreObject
|
||||
{
|
||||
public:
|
||||
/** Construction.
|
||||
*/
|
||||
OStoreLockBytes();
|
||||
|
||||
/** create (two-phase construction).
|
||||
@@ -91,8 +89,6 @@ public:
|
||||
virtual bool isKindOf (sal_uInt32 nMagic) override;
|
||||
|
||||
protected:
|
||||
/** Destruction (OReference).
|
||||
*/
|
||||
virtual ~OStoreLockBytes() override;
|
||||
|
||||
private:
|
||||
@@ -105,8 +101,6 @@ private:
|
||||
friend OStoreLockBytes*
|
||||
SAL_CALL query<> (OStoreObject *pHandle, OStoreLockBytes*);
|
||||
|
||||
/** Representation.
|
||||
*/
|
||||
rtl::Reference<OStorePageManager> m_xManager;
|
||||
|
||||
typedef OStoreDataPageData data;
|
||||
|
||||
@@ -32,30 +32,16 @@
|
||||
|
||||
using namespace store;
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStorePageManager implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
const sal_uInt32 OStorePageManager::m_nTypeId = sal_uInt32(0x62190120);
|
||||
|
||||
/*
|
||||
* OStorePageManager.
|
||||
*/
|
||||
OStorePageManager::OStorePageManager()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* ~OStorePageManager.
|
||||
*/
|
||||
OStorePageManager::~OStorePageManager()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* isKindOf.
|
||||
*/
|
||||
bool OStorePageManager::isKindOf (sal_uInt32 nTypeId)
|
||||
{
|
||||
return (nTypeId == m_nTypeId);
|
||||
@@ -505,5 +491,4 @@ storeError OStorePageManager::remove (const OStorePageKey &rKey)
|
||||
return remove_Impl (e);
|
||||
}
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -53,7 +53,8 @@ public:
|
||||
*/
|
||||
inline bool isValid() const;
|
||||
|
||||
/** DirectoryPage I/O (managed).
|
||||
/**
|
||||
DirectoryPage I/O (managed).
|
||||
*/
|
||||
static storeError namei (
|
||||
const rtl_String *pPath,
|
||||
|
||||
@@ -35,14 +35,6 @@
|
||||
|
||||
using namespace store;
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStoreBTreeNodeData implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* OStoreBTreeNodeData.
|
||||
*/
|
||||
OStoreBTreeNodeData::OStoreBTreeNodeData (sal_uInt16 nPageSize)
|
||||
: PageData (nPageSize)
|
||||
{
|
||||
@@ -87,9 +79,6 @@ sal_uInt16 OStoreBTreeNodeData::find (const T& t) const
|
||||
return k;
|
||||
}
|
||||
|
||||
/*
|
||||
* insert.
|
||||
*/
|
||||
void OStoreBTreeNodeData::insert (sal_uInt16 i, const T& t)
|
||||
{
|
||||
sal_uInt16 const n = usageCount();
|
||||
@@ -105,9 +94,6 @@ void OStoreBTreeNodeData::insert (sal_uInt16 i, const T& t)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* remove.
|
||||
*/
|
||||
void OStoreBTreeNodeData::remove (sal_uInt16 i)
|
||||
{
|
||||
sal_uInt16 const n = usageCount();
|
||||
@@ -132,9 +118,6 @@ void OStoreBTreeNodeData::split (const self& rPageL)
|
||||
truncate (h);
|
||||
}
|
||||
|
||||
/*
|
||||
* truncate.
|
||||
*/
|
||||
void OStoreBTreeNodeData::truncate (sal_uInt16 n)
|
||||
{
|
||||
sal_uInt16 const m = capacityCount();
|
||||
@@ -145,30 +128,16 @@ void OStoreBTreeNodeData::truncate (sal_uInt16 n)
|
||||
usageCount (n);
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStoreBTreeNodeObject implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* guard.
|
||||
*/
|
||||
storeError OStoreBTreeNodeObject::guard (sal_uInt32 nAddr)
|
||||
{
|
||||
return PageHolderObject< page >::guard (m_xPage, nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* verify.
|
||||
*/
|
||||
storeError OStoreBTreeNodeObject::verify (sal_uInt32 nAddr) const
|
||||
{
|
||||
return PageHolderObject< page >::verify (m_xPage, nAddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* split.
|
||||
*/
|
||||
storeError OStoreBTreeNodeObject::split (
|
||||
sal_uInt16 nIndexL,
|
||||
PageHolderObject< page > & rxPageL,
|
||||
@@ -293,11 +262,6 @@ storeError OStoreBTreeNodeObject::remove (
|
||||
return eErrCode;
|
||||
}
|
||||
|
||||
/*========================================================================
|
||||
*
|
||||
* OStoreBTreeRootObject implementation.
|
||||
*
|
||||
*======================================================================*/
|
||||
/*
|
||||
* testInvariant.
|
||||
* Precond: root node page loaded.
|
||||
@@ -308,9 +272,6 @@ void OStoreBTreeRootObject::testInvariant (char const * message) const
|
||||
SAL_WARN_IF( (m_xPage->location() - m_xPage->size()) != 0, "store", message);
|
||||
}
|
||||
|
||||
/*
|
||||
* loadOrCreate.
|
||||
*/
|
||||
storeError OStoreBTreeRootObject::loadOrCreate (
|
||||
sal_uInt32 nAddr,
|
||||
OStorePageBIOS & rBIOS)
|
||||
@@ -332,9 +293,6 @@ storeError OStoreBTreeRootObject::loadOrCreate (
|
||||
return store_E_Pending;
|
||||
}
|
||||
|
||||
/*
|
||||
* change.
|
||||
*/
|
||||
storeError OStoreBTreeRootObject::change (
|
||||
PageHolderObject< page > & rxPageL,
|
||||
OStorePageBIOS & rBIOS)
|
||||
|
||||
@@ -40,14 +40,10 @@ struct OStoreBTreeEntry
|
||||
typedef OStorePageKey K;
|
||||
typedef OStorePageLink L;
|
||||
|
||||
/** Representation.
|
||||
*/
|
||||
K m_aKey;
|
||||
L m_aLink;
|
||||
sal_uInt32 m_nAttrib;
|
||||
|
||||
/** Construction.
|
||||
*/
|
||||
explicit OStoreBTreeEntry (
|
||||
K const & rKey = K(),
|
||||
L const & rLink = L())
|
||||
@@ -56,8 +52,6 @@ struct OStoreBTreeEntry
|
||||
m_nAttrib (store::htonl(0))
|
||||
{}
|
||||
|
||||
/** Comparison.
|
||||
*/
|
||||
enum CompareResult
|
||||
{
|
||||
COMPARE_LESS = -1,
|
||||
@@ -86,23 +80,15 @@ struct OStoreBTreeNodeData : public store::PageData
|
||||
typedef OStorePageGuard G;
|
||||
typedef OStoreBTreeEntry T;
|
||||
|
||||
/** Representation.
|
||||
*/
|
||||
G m_aGuard;
|
||||
T m_pData[1];
|
||||
|
||||
/** type.
|
||||
*/
|
||||
static const sal_uInt32 theTypeId = STORE_MAGIC_BTREENODE;
|
||||
|
||||
/** theSize.
|
||||
*/
|
||||
static const size_t theSize = sizeof(G);
|
||||
static const sal_uInt16 thePageSize = base::theSize + self::theSize;
|
||||
static_assert(STORE_MINIMUM_PAGESIZE >= self::thePageSize, "got to be at least equal in size");
|
||||
|
||||
/** capacity.
|
||||
*/
|
||||
sal_uInt16 capacity() const
|
||||
{
|
||||
return static_cast<sal_uInt16>(store::ntohs(base::m_aDescr.m_nSize) - self::thePageSize);
|
||||
@@ -115,15 +101,11 @@ struct OStoreBTreeNodeData : public store::PageData
|
||||
return sal_uInt16(capacity() / sizeof(T));
|
||||
}
|
||||
|
||||
/** usage.
|
||||
*/
|
||||
sal_uInt16 usage() const
|
||||
{
|
||||
return static_cast<sal_uInt16>(store::ntohs(base::m_aDescr.m_nUsed) - self::thePageSize);
|
||||
}
|
||||
|
||||
/** usageCount.
|
||||
*/
|
||||
sal_uInt16 usageCount() const
|
||||
{
|
||||
return sal_uInt16(usage() / sizeof(T));
|
||||
@@ -134,12 +116,8 @@ struct OStoreBTreeNodeData : public store::PageData
|
||||
base::m_aDescr.m_nUsed = store::htons(sal::static_int_cast< sal_uInt16 >(nBytes));
|
||||
}
|
||||
|
||||
/** Construction.
|
||||
*/
|
||||
explicit OStoreBTreeNodeData (sal_uInt16 nPageSize);
|
||||
|
||||
/** guard (external representation).
|
||||
*/
|
||||
void guard()
|
||||
{
|
||||
sal_uInt32 nCRC32 = rtl_crc32 (0, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
|
||||
@@ -147,8 +125,6 @@ struct OStoreBTreeNodeData : public store::PageData
|
||||
m_aGuard.m_nCRC32 = store::htonl(nCRC32);
|
||||
}
|
||||
|
||||
/** verify (external representation).
|
||||
*/
|
||||
storeError verify() const
|
||||
{
|
||||
sal_uInt32 nCRC32 = rtl_crc32 (0, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
|
||||
@@ -159,8 +135,6 @@ struct OStoreBTreeNodeData : public store::PageData
|
||||
return store_E_None;
|
||||
}
|
||||
|
||||
/** depth.
|
||||
*/
|
||||
sal_uInt32 depth() const
|
||||
{
|
||||
return store::ntohl(self::m_aGuard.m_nMagic);
|
||||
@@ -170,15 +144,11 @@ struct OStoreBTreeNodeData : public store::PageData
|
||||
self::m_aGuard.m_nMagic = store::htonl(nDepth);
|
||||
}
|
||||
|
||||
/** querySplit.
|
||||
*/
|
||||
bool querySplit() const
|
||||
{
|
||||
return usageCount() >= capacityCount();
|
||||
}
|
||||
|
||||
/** Operation.
|
||||
*/
|
||||
sal_uInt16 find (const T& t) const;
|
||||
void insert (sal_uInt16 i, const T& t);
|
||||
void remove (sal_uInt16 i);
|
||||
@@ -201,14 +171,10 @@ class OStoreBTreeNodeObject : public store::OStorePageObject
|
||||
typedef OStoreBTreeEntry T;
|
||||
|
||||
public:
|
||||
/** Construction.
|
||||
*/
|
||||
explicit OStoreBTreeNodeObject (std::shared_ptr<PageData> const & rxPage = std::shared_ptr<PageData>())
|
||||
: OStorePageObject (rxPage)
|
||||
{}
|
||||
|
||||
/** External representation.
|
||||
*/
|
||||
virtual storeError guard (sal_uInt32 nAddr) override;
|
||||
virtual storeError verify (sal_uInt32 nAddr) const override;
|
||||
|
||||
@@ -237,8 +203,6 @@ class OStoreBTreeRootObject : public store::OStoreBTreeNodeObject
|
||||
typedef OStoreBTreeEntry T;
|
||||
|
||||
public:
|
||||
/** Construction.
|
||||
*/
|
||||
explicit OStoreBTreeRootObject (std::shared_ptr<PageData> const & rxPage = std::shared_ptr<PageData>())
|
||||
: OStoreBTreeNodeObject (rxPage)
|
||||
{}
|
||||
|
||||
Reference in New Issue
Block a user