Fairport  v1.0.38
fairport/disk/disk.h File Reference

Disk data structure definitions. More...

#include <cstddef>
#include "fairport/util/primitives.h"
+ Include dependency graph for disk.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fairport::disk::block_reference< T >
 The combination of the id and physical location of a block or page. More...
struct  fairport::disk::root< T >
 The root of the database. More...
struct  fairport::disk::header< ulonglong >
 The Unicode header structure. More...
struct  fairport::disk::header< ulong >
 The ANSI header structure. More...
struct  fairport::disk::header_crc_locations< ulong >
 The byte offsets used to calculate the CRCs in an ANSI PST. More...
struct  fairport::disk::header_crc_locations< ulonglong >
 The byte offsets used to calculate the CRCs in a Unicode PST file. More...
struct  fairport::disk::page_trailer< ulonglong >
 The Unicode store version of the page trailer. More...
struct  fairport::disk::page_trailer< ulong >
 The ANSI store version of the page trailer. More...
struct  fairport::disk::page< T >
 Generic page structure. More...
struct  fairport::disk::amap_page< T >
 The authoritative source of free space in the file. More...
struct  fairport::disk::pmap_page< T >
 An old allocation system optimized for pages. More...
struct  fairport::disk::fmap_page< T >
 A deprecated allocation system optimized for AMap page searching. More...
struct  fairport::disk::fpmap_page< T >
 A deprecated allocation system optimized for PMap page searching. More...
struct  fairport::disk::dlist_page< T >
 A metapage holding information about AMap pages. More...
struct  fairport::disk::bt_entry< T >
 BTree Entry. More...
struct  fairport::disk::nbt_leaf_entry< T >
 NBT Leaf Entry. More...
struct  fairport::disk::bbt_leaf_entry< T >
 BBT Leaf Entry. More...
struct  fairport::disk::bt_page< T, EntryType >
 The fundamental page structure which forms the basis of the two BTrees. More...
struct  fairport::disk::nbt_nonleaf_page< T >
 NBT non-leaf page. More...
struct  fairport::disk::bbt_nonleaf_page< T >
 BBT non-leaf page. More...
struct  fairport::disk::nbt_leaf_page< T >
 NBT leaf page. More...
struct  fairport::disk::bbt_leaf_page< T >
 BBT leaf page. More...
struct  fairport::disk::block_trailer< ulonglong >
 Unicode store version of the block trailer. More...
struct  fairport::disk::block_trailer< ulong >
 ANSI store version of the block trailer. More...
struct  fairport::disk::external_block< T >
 External block definition. More...
struct  fairport::disk::extended_block< ulonglong >
 Unicode store version of the extended block. More...
struct  fairport::disk::extended_block< ulong >
 ANSI store version of the extended block. More...
struct  fairport::disk::sub_leaf_entry< T >
 Entries on a leaf sub_block. More...
struct  fairport::disk::sub_nonleaf_entry< T >
 Entries on a nonleaf sub_block. More...
struct  fairport::disk::sub_block< T, EntryType >
 Subnode Blocks. More...
struct  fairport::disk::sub_nonleaf_block< T >
 Subnode non-leaf block. More...
struct  fairport::disk::sub_leaf_block< T >
 Subnode leaf block. More...
struct  fairport::disk::heap_first_header
 Header structure on the first heap block. More...
struct  fairport::disk::heap_page_header
 Header structure on non-first/non-fill blocks. More...
struct  fairport::disk::heap_page_fill_header
 Header structure on non-first/fill blocks. More...
struct  fairport::disk::heap_page_map
 Provides a map of the allocations on a heap block. More...
struct  fairport::disk::bth_header
 Describes the BTH, including the size of the keys/values and the heap_id of the root allocation. More...
struct  fairport::disk::bth_nonleaf_entry< K >
 Entries which make up a "non-leaf" BTH allocation. More...
struct  fairport::disk::bth_leaf_entry< K, V >
 Entries which make up a "leaf" BTH allocation. More...
struct  fairport::disk::bth_node< EntryType >
 BTH node. More...
struct  fairport::disk::bth_leaf_node< K, V >
 BTH Leaf node. More...
struct  fairport::disk::bth_nonleaf_node< K >
 BTH Nonleaf node. More...
struct  fairport::disk::prop_entry
 The value type of the BTH backing a pc. More...
struct  fairport::disk::sub_object
 Sub object. More...
struct  fairport::disk::mv_toc
 Multi-valued, variable length property TOC. More...
struct  fairport::disk::column_description
 Describes a column. More...
struct  fairport::disk::gust_column_description
 GUST Column description structure. More...
struct  fairport::disk::tc_header
 The root_id allocation out of the Heap of a TC node. More...
struct  fairport::disk::gust_header
 GUST TC Header. More...
struct  fairport::disk::nameid
 Defines a id to name mapping. More...
struct  fairport::disk::nameid_hash_entry
 A modified nameid structure used in the hash buckets. More...

Namespaces

namespace  fairport
 

Contains the definition of all in memory representations of disk structures.


namespace  fairport::disk
 

Contains the definition of all structures as persisted to disk.


Enumerations

enum  fairport::disk::database_format { fairport::disk::database_format_ansi_min = 14, fairport::disk::database_format_ansi = 15, fairport::disk::database_format_unicode_min = 20, fairport::disk::database_format_unicode = 23 }
 Valid database format values (ANSI vs. Unicode) More...
enum  fairport::disk::database_type { fairport::disk::database_ost = 12, fairport::disk::database_pst = 19 }
 Vaild database types (OST vs. PST) More...
enum  fairport::disk::crypt_method { fairport::disk::crypt_method_none = 0, fairport::disk::crypt_method_permute = 1, fairport::disk::crypt_method_cyclic = 2 }
 Valid "encryption" methods. More...
enum  fairport::disk::page_type {
  fairport::disk::page_type_bbt = 0x80, fairport::disk::page_type_nbt = 0x81, fairport::disk::page_type_fmap = 0x82, fairport::disk::page_type_pmap = 0x83,
  fairport::disk::page_type_amap = 0x84, fairport::disk::page_type_fpmap = 0x85, fairport::disk::page_type_dlist = 0x86
}
 Valid page types. More...
enum  fairport::disk::block_types { fairport::disk::block_type_external = 0x00, fairport::disk::block_type_extended = 0x01, fairport::disk::block_type_sub = 0x02 }
 The different block types. More...
enum  fairport::disk::heap_client_signature {
  fairport::disk::heap_sig_gmp = 0x6C, fairport::disk::heap_sig_tc = 0x7C, fairport::disk::heap_sig_smp = 0x8C, fairport::disk::heap_sig_hmp = 0x9C,
  fairport::disk::heap_sig_ch = 0xA5, fairport::disk::heap_sig_chtc = 0xAC, fairport::disk::heap_sig_bth = 0xB5, fairport::disk::heap_sig_pc = 0xBC
}
 Different heap client signature types. More...
enum  fairport::disk::heap_fill_level {
  fairport::disk::heap_fill_empty, fairport::disk::heap_fill_1, fairport::disk::heap_fill_2, fairport::disk::heap_fill_3,
  fairport::disk::heap_fill_4, fairport::disk::heap_fill_5, fairport::disk::heap_fill_6, fairport::disk::heap_fill_7,
  fairport::disk::heap_fill_8, fairport::disk::heap_fill_9, fairport::disk::heap_fill_10, fairport::disk::heap_fill_11,
  fairport::disk::heap_fill_12, fairport::disk::heap_fill_13, fairport::disk::heap_fill_14, fairport::disk::heap_fill_full
}
enum  fairport::disk::tc_offsets {
  fairport::disk::tc_offsets_four, fairport::disk::tc_offsets_two, fairport::disk::tc_offsets_one, fairport::disk::tc_offsets_bitmap,
  fairport::disk::tc_offsets_max
}
 Indices into the size offsets array. More...

Functions

template<typename T >
ushort fairport::disk::compute_signature (T id, T address)
 Calculate the signature of an item.
template<typename T >
ushort fairport::disk::compute_signature (const block_reference< T > &reference)
 Calculate the signature of an item.
ulong fairport::disk::compute_crc (const void *pdata, ulong cb)
 Compute the CRC of a block of data.
void fairport::disk::permute (void *pdata, ulong cb, bool encrypt)
 Modifies the data block in place, according to the permute method.
void fairport::disk::cyclic (void *pdata, ulong cb, ulong key)
 Modifies the data block in place, according to the cyclic method.
ulong fairport::disk::dlist_get_page_num (ulong entry)
 Get a amap page number (ordinal) from a DLIST entry.
ulong fairport::disk::dlist_get_slots (ulong entry)
 Get the number of free slots from a DLIST entry.
template<typename T >
size_t fairport::disk::align_disk (size_t size)
 Aligns a block size to the size on disk.
size_t fairport::disk::align_slot (size_t size)
 Aligns a block size to the slot size.
template<typename T >
bool fairport::disk::bid_is_external (T bid)
 Determines if a block is external or not.
template<typename T >
bool fairport::disk::bid_is_internal (T bid)
 Determines if a block is internal or not.
ushort fairport::disk::nameid_get_prop_index (const nameid &n)
 Returns the index of a given nameid structure.
ushort fairport::disk::nameid_get_guid_index (const nameid &n)
 Returns the index into the guid stream of the guid of a given nameid structure.
bool fairport::disk::nameid_is_string (const nameid &n)
 Returns true if the nameid structure is named by a string.
ushort fairport::disk::nameid_get_prop_index (const nameid_hash_entry &n)
 Returns the index of a given nameid_hash_entry structure.
ushort fairport::disk::nameid_get_guid_index (const nameid_hash_entry &n)
 Returns the index into the guid stream of the guid of a given nameid_hash_entry structure.
bool fairport::disk::nameid_is_string (const nameid_hash_entry &n)
 Returns true if the nameid_hash_entry structure is named by a string.

Variables

const size_t fairport::disk::header_fmap_entries = 128
 The number of entries in the header's fmap structure.
const size_t fairport::disk::header_fpmap_size = 128
 The number of entries in the header's fpmap structure.
const size_t fairport::disk::header_lock_entries = 32
 The number of entries in the header's lock structure.
const ushort fairport::disk::pst_magic = 0x4D53
 PST Magic number.
const ushort fairport::disk::ost_magic = 0x4F53
 OST Magic number.
const uint fairport::disk::hlmagic = 0x4e444221
 High/Low magic number.
const ulong fairport::disk::crc_table []
 Precalulated CRC table, used by compute_crc.
const byte fairport::disk::table1 []
 Data table1 used by permute and cyclic.
const byte fairport::disk::table2 []
 Data table2 used by permute and cyclic.
const byte fairport::disk::table3 []
 Data table3 used by permute and cyclic.
const size_t fairport::disk::page_size = 512
 Size of all pages in the file in bytes, including the page trailer.
const size_t fairport::disk::bytes_per_slot = 64
 Number of bytes each slot (bit) in an AMap page refers to.
const size_t fairport::disk::first_amap_page_location = 0x4400
 The location of the first AMap page in the file.
const size_t fairport::disk::dlist_page_location = 0x4200
 The location of the only DList page in the file.
const ulong fairport::disk::dlist_page_num_mask = 0x0000FFFF
 The portion of the dlist entry which refers to the amap page number.
const ulong fairport::disk::dlist_slots_shift = 20
 The bits to shift a dlist entry to get the slots on that amap page.
const size_t fairport::disk::max_block_disk_size = 8 * 1024
 The maximum individual block size.
const uint fairport::disk::block_id_attached_bit = 0x1
 The attached bit indicates a block is referenced in memory This is an implementation detail, and this bit should be ignored.
const uint fairport::disk::block_id_internal_bit = 0x2
 The internal bit indicates a block is an extended_block or a subnode_block.
const uint fairport::disk::block_id_increment = 0x4
 The block id counter in the header is incremented by this amount for each block.
const byte fairport::disk::heap_signature = 0xEC
 Signature of a heap.
const uint fairport::disk::heap_max_alloc_size = 3580
 Maximum allocation size in a heap.
const uint fairport::disk::heap_max_alloc_size_wver_14 = 3068
 Maximum allocation size in a heap in a version 14 ANSI file.

Detailed Description

Disk data structure definitions.

Author:
Terry Mahaffey

This file contains the data structure definitions as well as utility functions described in the MS-PST documentation.

Definition in file disk.h.