LibreOffice Module store (master) 1
storbios.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21
22#include "storbios.hxx"
23
24#include <sal/types.h>
25#include <sal/log.hxx>
26
27#include <rtl/alloc.h>
28#include <rtl/ref.hxx>
29
30#include <osl/diagnose.h>
31#include <osl/mutex.hxx>
32
33#include <store/types.h>
34#include "lockbyte.hxx"
35#include "storcach.hxx"
36
37using namespace store;
38
39constexpr sal_uInt32 STORE_MAGIC_SUPERBLOCK = 0x484D5343;
40
41namespace {
42
43struct OStoreSuperBlock
44{
45 typedef OStorePageGuard G;
46 typedef OStorePageDescriptor D;
47 typedef OStorePageLink L;
48
49 G m_aGuard;
50 D m_aDescr;
51 sal_uInt32 m_nMarked;
52 L m_aMarked;
53 sal_uInt32 m_nUnused;
54 L m_aUnused;
55
56 static const size_t theSize = sizeof(G) + sizeof(D) + 2 * (sizeof(L) + sizeof(sal_uInt32));
57
58 explicit OStoreSuperBlock (sal_uInt16 nPageSize)
60 m_aDescr (nPageSize, nPageSize, STORE_MINIMUM_PAGESIZE),
61 m_nMarked (store::htonl(0)),
62 m_aMarked (0),
63 m_nUnused (store::htonl(0)),
64 m_aUnused (0)
65 {}
66
67 bool operator== (const OStoreSuperBlock & rhs) const
68 {
69 return ((m_aGuard == rhs.m_aGuard ) &&
70 (m_aDescr == rhs.m_aDescr ) &&
71 (m_nMarked == rhs.m_nMarked) &&
72 (m_aMarked == rhs.m_aMarked) &&
73 (m_nUnused == rhs.m_nUnused) &&
74 (m_aUnused == rhs.m_aUnused) );
75 }
76
77 sal_uInt32 unusedCount() const
78 {
79 return store::ntohl(m_nUnused);
80 }
81
82 const L& unusedHead() const
83 {
84 return m_aUnused;
85 }
86
87 void unusedInsert (const L& rLink)
88 {
89 sal_uInt32 nUnused = unusedCount();
90 m_nUnused = store::htonl(nUnused + 1);
91 m_aUnused = rLink;
92 }
93
94 void unusedRemove (const L& rLink)
95 {
96 sal_uInt32 nUnused = unusedCount();
97 m_nUnused = store::htonl(nUnused - 1);
98 m_aUnused = rLink;
99 }
100
101 void unusedReset()
102 {
103 m_nUnused = store::htonl(0);
104 m_aUnused = L(0);
105 }
106
107 void guard()
108 {
109 sal_uInt32 nCRC32 = rtl_crc32 (0, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
110 nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, static_cast<sal_uInt32>(theSize - sizeof(G)));
111 m_aGuard.m_nCRC32 = store::htonl(nCRC32);
112 }
113
114 storeError verify() const
115 {
116 sal_uInt32 nMagic = store::ntohl(m_aGuard.m_nMagic);
118 return store_E_WrongFormat;
119
120 sal_uInt32 nCRC32 = rtl_crc32 (0, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
121 nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, static_cast<sal_uInt32>(theSize - sizeof(G)));
122 if (m_aGuard.m_nCRC32 != store::htonl(nCRC32))
124 else
125 return store_E_None;
126 }
127};
128
129}
130
131namespace store
132{
133
135{
136 typedef OStoreSuperBlock SuperBlock;
137
140
141 static const size_t theSize = 2 * SuperBlock::theSize;
142 static const sal_uInt16 thePageSize = theSize;
143 static_assert(STORE_MINIMUM_PAGESIZE >= thePageSize, "must be at least thePageSize");
144
145 static void * operator new (size_t n)
146 {
147 return std::malloc(sal::static_int_cast<sal_Size>(n));
148 }
149
150 static void operator delete (void * p)
151 {
152 std::free (p);
153 }
154
155 static void * operator new (SAL_UNUSED_PARAMETER size_t, sal_uInt16 nPageSize)
156 {
157 return rtl_allocateZeroMemory (sal::static_int_cast<sal_Size>(nPageSize));
158 }
159
160 static void operator delete (void * p, SAL_UNUSED_PARAMETER sal_uInt16)
161 {
162 std::free (p);
163 }
164
165 explicit SuperBlockPage (sal_uInt16 nPageSize = thePageSize)
166 : m_aSuperOne(nPageSize),
167 m_aSuperTwo(nPageSize)
168 {}
169
170 storeError save (OStorePageBIOS const & rBIOS, sal_uInt32 nSize = theSize)
171 {
172 m_aSuperOne.guard();
174 return rBIOS.write (0, this, nSize);
175 }
176
180 OStorePageBIOS const & rBIOS,
181 PageData & rPageHead);
182
184 OStorePageBIOS const & rBIOS,
185 PageData const & rPageHead);
186
188 OStorePageBIOS const & rBIOS,
189 sal_uInt32 nAddr);
190
191 storeError verify (OStorePageBIOS const & rBIOS);
192};
193
194} // namespace store
195
199storeError SuperBlockPage::unusedHead (OStorePageBIOS const & rBIOS, PageData & rPageHead)
200{
201 storeError eErrCode = verify (rBIOS);
202 if (eErrCode != store_E_None)
203 return eErrCode;
204
205 // Check freelist head.
206 OStorePageLink const aListHead (m_aSuperOne.unusedHead());
207 if (aListHead.location() == 0)
208 {
209 // Freelist empty, see SuperBlock::ctor().
210 rPageHead.location (STORE_PAGE_NULL);
211 return store_E_None;
212 }
213
214 // Load PageHead.
215 eErrCode = rBIOS.read (aListHead.location(), &rPageHead, PageData::theSize);
216 if (eErrCode != store_E_None)
217 return eErrCode;
218
219 eErrCode = rPageHead.verify (aListHead.location());
220 if (eErrCode != store_E_None)
221 return eErrCode;
222
223 // Verify page is unused.
224 sal_uInt32 const nAddr = rPageHead.m_aUnused.location();
225 if (nAddr == STORE_PAGE_NULL)
226 {
227 SAL_WARN("store", "store::SuperBlock::unusedHead(): page not free");
228
229 // Page in use.
230 rPageHead.location (STORE_PAGE_NULL);
231
232 // Recovery: Reset freelist to empty.
233 m_aSuperOne.unusedReset();
234 eErrCode = save (rBIOS);
235 }
236 return eErrCode;
237}
238
243{
244 sal_uInt32 const nAddr = rPageHead.m_aUnused.location();
245 OSL_PRECOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedPop(): page not free");
246 if (nAddr == STORE_PAGE_NULL)
247 return store_E_CantSeek;
248
249 // Pop from FreeList.
250 OStorePageLink const aListHead (nAddr);
251 m_aSuperOne.unusedRemove (aListHead);
252 return save (rBIOS);
253}
254
258storeError SuperBlockPage::unusedPush (OStorePageBIOS const & rBIOS, sal_uInt32 nAddr)
259{
260 storeError eErrCode = verify (rBIOS);
261 if (eErrCode != store_E_None)
262 return eErrCode;
263
264 PageData aPageHead;
265 eErrCode = rBIOS.read (nAddr, &aPageHead, PageData::theSize);
266 if (eErrCode != store_E_None)
267 return eErrCode;
268
269 eErrCode = aPageHead.verify (nAddr);
270 if (eErrCode != store_E_None)
271 return eErrCode;
272
273 aPageHead.m_aUnused = m_aSuperOne.unusedHead();
274 aPageHead.guard (nAddr);
275
276 eErrCode = rBIOS.write (nAddr, &aPageHead, PageData::theSize);
277 if (eErrCode != store_E_None)
278 return eErrCode;
279
280 OStorePageLink const aListHead (nAddr);
281 m_aSuperOne.unusedInsert(aListHead);
282 return save (rBIOS);
283}
284
289{
290 // Verify 1st copy.
291 storeError eErrCode = m_aSuperOne.verify();
292 if (eErrCode == store_E_None)
293 {
294 // Ok. Verify 2nd copy.
295 eErrCode = m_aSuperTwo.verify();
296 if (eErrCode == store_E_None)
297 {
298 // Ok. Ensure identical copies (1st copy wins).
299 if (!(m_aSuperOne == m_aSuperTwo))
300 {
301 // Different. Replace 2nd copy with 1st copy.
303
304 // Write back.
305 if (rBIOS.isWriteable())
306 eErrCode = rBIOS.write (0, this, theSize);
307 else
308 eErrCode = store_E_None;
309 }
310 }
311 else
312 {
313 // Failure. Replace 2nd copy with 1st copy.
315
316 // Write back.
317 if (rBIOS.isWriteable())
318 eErrCode = rBIOS.write (0, this, theSize);
319 else
320 eErrCode = store_E_None;
321 }
322 }
323 else
324 {
325 // Failure. Verify 2nd copy.
326 eErrCode = m_aSuperTwo.verify();
327 if (eErrCode == store_E_None)
328 {
329 // Ok. Replace 1st copy with 2nd copy.
331
332 // Write back.
333 if (rBIOS.isWriteable())
334 eErrCode = rBIOS.write (0, this, theSize);
335 else
336 eErrCode = store_E_None;
337 }
338 else
339 {
340 // Double Failure.
341 SAL_WARN("store", "OStoreSuperBlockPage::verify(): double failure.");
342 }
343 }
344
345 // Done.
346 return eErrCode;
347}
348
350 : m_next (this), m_prev (this), m_addr (STORE_PAGE_NULL), m_used (0)
351{}
352
354{
355 m_next->m_prev = m_prev;
356 m_prev->m_next = m_next;
357}
358
359int
361 void * obj, SAL_UNUSED_PARAMETER void*)
362{
363 Ace * ace = static_cast<Ace*>(obj);
364 ace->m_next = ace->m_prev = ace;
365 return 1;
366}
367
370{
371 OStorePageBIOS::Ace * entry;
372 for (entry = head->m_next; entry != head; entry = entry->m_next)
373 {
374 if (entry->m_addr >= addr)
375 return entry;
376 }
377 return head;
378}
379
380void
382{
383 // insert entry at queue tail (before head).
384 entry->m_next = head;
385 entry->m_prev = head->m_prev;
386 head->m_prev = entry;
387 entry->m_prev->m_next = entry;
388}
389
390namespace store
391{
392
394{
395 rtl_cache_type * m_ace_cache;
396
397public:
398 static AceCache & get();
399
401 create (sal_uInt32 addr);
402
403 void
404 destroy (OStorePageBIOS::Ace * ace);
405
406protected:
407 AceCache();
408 ~AceCache();
409};
410
411} // namespace store
412
415{
416 static AceCache g_ace_cache;
417 return g_ace_cache;
418}
419
421{
422 m_ace_cache = rtl_cache_create (
423 "store_ace_cache",
424 sizeof (OStorePageBIOS::Ace),
425 0, // objalign
427 nullptr, // destructor,
428 nullptr, // reclaim,
429 nullptr, // userarg,
430 nullptr, // default source,
431 0 // flags
432 );
433}
434
436{
437 rtl_cache_destroy (m_ace_cache);
438 m_ace_cache = nullptr;
439}
440
443{
444 Ace * ace = static_cast<Ace*>(rtl_cache_alloc (m_ace_cache));
445 if (ace != nullptr)
446 {
447 // verify invariant state.
448 OSL_ASSERT((ace->m_next == ace) && (ace->m_prev == ace));
449
450 // initialize.
451 ace->m_addr = addr;
452 ace->m_used = 1;
453 }
454 return ace;
455}
456
457void
459{
460 if (ace != nullptr)
461 {
462 // remove from queue (if any).
463 ace->m_next->m_prev = ace->m_prev;
464 ace->m_prev->m_next = ace->m_next;
465
466 // restore invariant state.
467 ace->m_next = ace->m_prev = ace;
468
469 // return to cache.
470 rtl_cache_free (m_ace_cache, ace);
471 }
472}
473
475 : m_bWriteable (false)
476{
477}
478
480{
481 cleanup_Impl();
482}
483
485 ILockBytes * pLockBytes,
486 storeAccessMode eAccessMode,
487 sal_uInt16 & rnPageSize)
488{
489 // Acquire exclusive access.
490 osl::MutexGuard aGuard (m_aMutex);
491
492 // Initialize.
493 storeError eErrCode = initialize_Impl (pLockBytes, eAccessMode, rnPageSize);
494 if (eErrCode != store_E_None)
495 {
496 // Cleanup.
497 cleanup_Impl();
498 }
499 return eErrCode;
500}
501
507 ILockBytes * pLockBytes,
508 storeAccessMode eAccessMode,
509 sal_uInt16 & rnPageSize)
510{
511 // Cleanup.
512 cleanup_Impl();
513
514 // Initialize.
515 m_xLockBytes = pLockBytes;
516 if (!m_xLockBytes.is())
518 m_bWriteable = (eAccessMode != storeAccessMode::ReadOnly);
519
520 // Check access mode.
521 storeError eErrCode = store_E_None;
522 if (eAccessMode != storeAccessMode::Create)
523 {
524 // Load SuperBlock page.
525 m_pSuper.reset(new SuperBlockPage());
526
527 eErrCode = read (0, m_pSuper.get(), SuperBlockPage::theSize);
528 if (eErrCode == store_E_None)
529 {
530 // Verify SuperBlock page (with repair).
531 eErrCode = m_pSuper->verify (*this);
532 }
533 }
534 else
535 {
536 // Truncate to zero length.
537 eErrCode = m_xLockBytes->setSize(0);
538 if (eErrCode != store_E_None)
539 return eErrCode;
540
541 // Mark as not existing.
542 eErrCode = store_E_NotExists;
543 }
544
545 if (eErrCode != store_E_None)
546 {
547 // Check reason.
548 if (eErrCode != store_E_NotExists)
549 return eErrCode;
550
551 // Check mode.
552 if (eAccessMode == storeAccessMode::ReadOnly)
553 return store_E_NotExists;
554 if (eAccessMode == storeAccessMode::ReadWrite)
555 return store_E_NotExists;
556
557 // Check PageSize.
558 if ((STORE_MINIMUM_PAGESIZE > rnPageSize) || (rnPageSize > STORE_MAXIMUM_PAGESIZE))
560 rnPageSize = ((rnPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1));
561
562 // Create initial page (w/ SuperBlock).
563 m_pSuper.reset(new(rnPageSize) SuperBlockPage(rnPageSize));
564 eErrCode = m_pSuper->save (*this, rnPageSize);
565 }
566 if (eErrCode == store_E_None)
567 {
568 // Obtain page size.
569 rnPageSize = store::ntohs(m_pSuper->m_aSuperOne.m_aDescr.m_nSize);
570
571 // Create page allocator.
572 eErrCode = m_xLockBytes->initialize (m_xAllocator, rnPageSize);
573 if (eErrCode != store_E_None)
574 return eErrCode;
575
576 // Create page cache.
577 eErrCode = PageCache_createInstance (m_xCache, rnPageSize);
578 }
579 return eErrCode;
580}
581
582/*
583 @pre exclusive access.
584 */
586{
587 // Check referer count.
588 if (m_ace_head.m_used > 0)
589 {
590 // Report remaining referer count.
591 SAL_INFO("store", "referer count: " << m_ace_head.m_used);
592 for (Ace * ace = m_ace_head.m_next; ace != &m_ace_head; ace = m_ace_head.m_next)
593 {
594 m_ace_head.m_used -= ace->m_used;
595 AceCache::get().destroy (ace);
596 }
597 OSL_ENSURE(m_ace_head.m_used == 0, "store::PageBIOS::cleanup_Impl(): logic error");
598 }
599
600 // Release SuperBlock page.
601 m_pSuper.reset();
602
603 // Release PageCache.
604 m_xCache.clear();
605
606 // Release PageAllocator.
607 m_xAllocator.clear();
608
609 // Release LockBytes.
610 m_xLockBytes.clear();
611}
612
617 sal_uInt32 nAddr, void *pData, sal_uInt32 nSize) const
618{
619 // Check precond.
620 if (!m_xLockBytes.is())
622
623 // Read Data.
624 return m_xLockBytes->readAt (nAddr, pData, nSize);
625}
626
631 sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize) const
632{
633 // Check precond.
634 if (!m_xLockBytes.is())
636 if (!m_bWriteable)
638
639 // Write Data.
640 return m_xLockBytes->writeAt (nAddr, pData, nSize);
641}
642
647 const OStorePageDescriptor& rDescr, storeAccessMode eMode)
648{
649 // Acquire exclusive access.
650 osl::MutexGuard aGuard (m_aMutex);
651
652 // Check precond.
653 if (!m_xLockBytes.is())
655
656 // Check access mode.
659
660 // Find access control list entry.
661 Ace * ace = Ace::find (&m_ace_head, rDescr.m_nAddr);
662 if (ace->m_addr == rDescr.m_nAddr)
663 {
664 // Acquire existing entry (with ShareDenyWrite).
666 ace->m_used += 1;
667 else
669 }
670 else
671 {
672 // Insert new entry.
673 Ace * entry = AceCache::get().create (rDescr.m_nAddr);
674 if (!entry)
675 return store_E_OutOfMemory;
676 Ace::insert (ace, entry);
677 }
678
679 // Increment total referer count and finish.
680 m_ace_head.m_used += 1;
681 return store_E_None;
682}
683
688{
689 // Acquire exclusive access.
690 osl::MutexGuard aGuard (m_aMutex);
691
692 // Check precond.
693 if (!m_xLockBytes.is())
695
696 // Find access control list entry.
697 Ace * ace = Ace::find (&m_ace_head, rDescr.m_nAddr);
698 if (ace->m_addr != rDescr.m_nAddr)
699 return store_E_NotExists;
700
701 // Release existing entry.
702 if (ace->m_used > 1)
703 ace->m_used -= 1;
704 else
705 AceCache::get().destroy (ace);
706
707 // Decrement total referer count and finish.
708 m_ace_head.m_used -= 1;
709 return store_E_None;
710}
711
716 OStorePageObject& rPage)
717{
718 // Acquire exclusive access.
719 osl::MutexGuard aGuard (m_aMutex);
720
721 // Check precond.
722 if (!m_xLockBytes.is())
724 if (!m_bWriteable)
726
727 // Check allocation type.
728 storeError eErrCode = store_E_None;
729 // Try freelist head.
730 PageData aPageHead;
731 eErrCode = m_pSuper->unusedHead (*this, aPageHead);
732 if (eErrCode != store_E_None)
733 return eErrCode;
734
735 sal_uInt32 const nAddr = aPageHead.location();
736 if (nAddr != STORE_PAGE_NULL)
737 {
738 // Save page.
739 eErrCode = saveObjectAt_Impl (rPage, nAddr);
740 if (eErrCode != store_E_None)
741 return eErrCode;
742
743 // Pop freelist head and finish.
744 return m_pSuper->unusedPop (*this, aPageHead);
745 }
746
747 // Allocate from EOF. Determine current size.
748 sal_uInt32 nSize = STORE_PAGE_NULL;
749 eErrCode = m_xLockBytes->getSize (nSize);
750 if (eErrCode != store_E_None)
751 return eErrCode;
752
753 // Save page at current EOF.
754 return saveObjectAt_Impl (rPage, nSize);
755}
756
761{
762 // Acquire exclusive access.
763 osl::MutexGuard aGuard (m_aMutex);
764
765 // Check precond.
766 if (!m_xLockBytes.is())
768 if (!m_bWriteable)
770
771 // Invalidate cache.
772 (void) m_xCache->removePageAt (nAddr);
773
774 // Push onto freelist.
775 return m_pSuper->unusedPush (*this, nAddr);
776}
777
782{
783 // Acquire exclusive access.
784 osl::MutexGuard aGuard (m_aMutex);
785
786 // Check precond.
787 if (!m_xLockBytes.is())
789
790 return loadObjectAt_Impl (rPage, nAddr);
791}
792
797{
798 storeError eErrCode = m_xCache->lookupPageAt (rPage.get(), nAddr);
799 if (eErrCode != store_E_NotExists)
800 return eErrCode;
801
802 // Read page.
803 eErrCode = m_xLockBytes->readPageAt (rPage.get(), nAddr);
804 if (eErrCode != store_E_None)
805 return eErrCode;
806
807 // Verify page.
808 eErrCode = rPage.verify (nAddr);
809 if (eErrCode != store_E_None)
810 return eErrCode;
811
812 // Mark page as clean.
813 rPage.clean();
814
815 // Cache page.
816 return m_xCache->insertPageAt (rPage.get(), nAddr);
817}
818
823{
824 // Acquire exclusive access.
825 osl::MutexGuard aGuard (m_aMutex);
826
827 // Check precond.
828 if (!m_xLockBytes.is())
830 if (!m_bWriteable)
832
833 // Save Page.
834 return saveObjectAt_Impl (rPage, nAddr);
835}
836
841{
842 // Guard page (incl. set location).
843 storeError eErrCode = rPage.guard (nAddr);
844 if (eErrCode != store_E_None)
845 return eErrCode;
846
847 // Write page.
848 eErrCode = m_xLockBytes->writePageAt(rPage.get(), nAddr);
849 if (eErrCode != store_E_None)
850 return eErrCode;
851
852 // Mark page as clean.
853 rPage.clean();
854
855 // Cache page.
856 return m_xCache->updatePageAt (rPage.get(), nAddr);
857}
858
863{
864 // Acquire exclusive access.
865 osl::MutexGuard aGuard (m_aMutex);
866
867 // Cleanup.
868 cleanup_Impl();
869
870 // Done.
871 return store_E_None;
872}
873
878{
879 // Acquire exclusive access.
880 osl::MutexGuard aGuard (m_aMutex);
881
882 // Check precond.
883 if (!m_xLockBytes.is())
885
886 // Flush LockBytes and finish.
887 return m_xLockBytes->flush();
888}
889
890/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
rtl_cache_type * m_ace_cache
Definition: storbios.cxx:395
static AceCache & get()
Definition: storbios.cxx:414
void destroy(OStorePageBIOS::Ace *ace)
Definition: storbios.cxx:458
OStorePageBIOS::Ace * create(sal_uInt32 addr)
Definition: storbios.cxx:442
storeError write(sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize) const
Definition: storbios.cxx:630
storeError acquirePage(const OStorePageDescriptor &rDescr, storeAccessMode eMode)
Definition: storbios.cxx:646
storeError loadObjectAt_Impl(OStorePageObject &rPage, sal_uInt32 nAddr) const
Definition: storbios.cxx:796
storeError saveObjectAt(OStorePageObject &rPage, sal_uInt32 nAddr)
Definition: storbios.cxx:822
storeError read(sal_uInt32 nAddr, void *pData, sal_uInt32 nSize) const
Definition: storbios.cxx:616
storeError loadObjectAt(OStorePageObject &rPage, sal_uInt32 nAddr)
Page I/O.
Definition: storbios.cxx:781
rtl::Reference< ILockBytes > m_xLockBytes
Definition: storbios.hxx:103
storeError free(sal_uInt32 nAddr)
Definition: storbios.cxx:760
std::unique_ptr< SuperBlockPage > m_pSuper
Definition: storbios.hxx:106
storeError saveObjectAt_Impl(OStorePageObject &rPage, sal_uInt32 nAddr) const
Definition: storbios.cxx:840
virtual ~OStorePageBIOS() override
Definition: storbios.cxx:479
storeError allocate(OStorePageObject &rPage)
Definition: storbios.cxx:715
bool isWriteable() const
Definition: storbios.hxx:158
storeError flush()
flush.
Definition: storbios.cxx:877
storeError close()
close.
Definition: storbios.cxx:862
storeError releasePage(const OStorePageDescriptor &rDescr)
Definition: storbios.cxx:687
storeError initialize_Impl(ILockBytes *pLockBytes, storeAccessMode eAccessMode, sal_uInt16 &rnPageSize)
initialize_Impl.
Definition: storbios.cxx:506
virtual storeError initialize(ILockBytes *pLockBytes, storeAccessMode eAccessMode, sal_uInt16 &rnPageSize)
Initialization.
Definition: storbios.cxx:484
rtl::Reference< PageCache > m_xCache
Definition: storbios.hxx:111
rtl::Reference< PageData::Allocator > m_xAllocator
Definition: storbios.hxx:110
virtual storeError guard(sal_uInt32 nAddr)=0
virtual storeError verify(sal_uInt32 nAddr) const =0
std::shared_ptr< PageData > & get()
Definition: storbase.hxx:580
osl::ClearableMutexGuard m_aGuard
Mode eMode
void * p
sal_Int64 n
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
Old OStorePageCache implementation.
Definition: lockbyte.cxx:133
sal_uInt32 htonl(sal_uInt32 h)
Definition: storbase.hxx:69
sal_uInt16 ntohs(sal_uInt16 n)
Definition: storbase.hxx:67
sal_uInt32 ntohl(sal_uInt32 n)
Definition: storbase.hxx:70
storeError PageCache_createInstance(rtl::Reference< store::PageCache > &rxCache, sal_uInt16 nPageSize)
Definition: storcach.cxx:401
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
const sal_uInt16 nMagic
#define STORE_PAGE_NULL
Definition: storbase.hxx:114
constexpr sal_uInt32 STORE_MAGIC_SUPERBLOCK
Definition: storbios.cxx:39
Page Access (control).
Definition: storbios.hxx:117
static Ace * find(Ace *head, sal_uInt32 addr)
Definition: storbios.cxx:369
static void insert(Ace *head, Ace *entry)
Definition: storbios.cxx:381
static int SAL_CALL constructor(void *obj, void *arg)
Definition: storbios.cxx:360
sal_uInt32 m_nAddr
Representation.
Definition: storbase.hxx:120
void guard(sal_uInt32 nAddr)
guard (external representation).
Definition: storbase.hxx:368
storeError verify(sal_uInt32 nAddr) const
verify (external representation).
Definition: storbase.hxx:378
sal_uInt32 location() const
location.
Definition: storbase.hxx:256
static const size_t theSize
theSize.
Definition: storbase.hxx:250
storeError save(OStorePageBIOS const &rBIOS, sal_uInt32 nSize=theSize)
Definition: storbios.cxx:170
SuperBlockPage(sal_uInt16 nPageSize=thePageSize)
Definition: storbios.cxx:165
SuperBlock m_aSuperOne
Definition: storbios.cxx:138
OStoreSuperBlock SuperBlock
Definition: storbios.cxx:136
storeError unusedPush(OStorePageBIOS const &rBIOS, sal_uInt32 nAddr)
Push new freelist head.
Definition: storbios.cxx:258
storeError unusedHead(OStorePageBIOS const &rBIOS, PageData &rPageHead)
Page allocation.
Definition: storbios.cxx:199
storeError verify(OStorePageBIOS const &rBIOS)
Verify (with repair).
Definition: storbios.cxx:288
static const sal_uInt16 thePageSize
Definition: storbios.cxx:142
static const size_t theSize
Definition: storbios.cxx:141
SuperBlock m_aSuperTwo
Definition: storbios.cxx:139
storeError unusedPop(OStorePageBIOS const &rBIOS, PageData const &rPageHead)
Pop freelist head (alloc page, step 2).
Definition: storbios.cxx:242
storeAccessMode
Access Mode enumeration.
Definition: types.h:62
constexpr sal_uInt16 STORE_MINIMUM_PAGESIZE
PageSize (enforced) limits.
Definition: types.h:37
storeError
Error Code enumeration.
Definition: types.h:73
@ store_E_InvalidParameter
Definition: types.h:82
@ store_E_OutOfMemory
Definition: types.h:90
@ store_E_None
Definition: types.h:74
@ store_E_InvalidAccess
Definition: types.h:80
@ store_E_CantSeek
Definition: types.h:77
@ store_E_AccessViolation
Definition: types.h:75
@ store_E_NotExists
Definition: types.h:85
@ store_E_InvalidChecksum
Definition: types.h:83
@ store_E_WrongFormat
Definition: types.h:93
constexpr sal_uInt16 STORE_MAXIMUM_PAGESIZE
Definition: types.h:38