Author: Marc Munro Copyright (c) 2005 - 2010 Marc Munro License: BSD $Id: veil_datatypes.h,v 1.7 2008/07/31 19:34:13 bloodnok Exp $
Definition in file veil_datatypes.h.
#include "utils/hsearch.h"
#include "storage/lwlock.h"
Go to the source code of this file.
Data Structures | |
struct | MemChunk |
Chunks provide a linked list of dynamically allocated shared memory segments, with the most recently allocated chunk at the tail. More... | |
struct | Object |
General purpose object-type. More... | |
struct | ShmemCtl |
The ShmemCtl structure is the first object allocated from the first chunk of shared memory in context 0. More... | |
struct | Int4Var |
Subtype of Object for storing simple int4 values. More... | |
struct | Range |
Subtype of Object for storing range values. More... | |
struct | Bitmap |
Subtype of Object for storing bitmaps. More... | |
struct | BitmapRef |
Subtype of Object for storing bitmap refs. More... | |
struct | BitmapArray |
Subtype of Object for storing bitmap arrays. More... | |
struct | BitmapHash |
Subtype of Object for storing bitmap hashes. More... | |
struct | Int4Array |
Subtype of Object for storing arrays of integers. More... | |
struct | VarEntry |
A Veil variable. More... | |
struct | veil_variable_t |
Describes a veil shared or session variable. More... | |
Defines | |
#define | VEIL_DATATYPES 1 |
#define | VEIL_DEBUG 1 |
Enables various debugging constructs, such as canaries, in code and data structures. | |
#define | DBG_CANARY 0xca96ca96 |
Value to be set in sacrificial "canary" fields. | |
#define | DBG_CANARY_ENTRY int32 canary; |
Defines a canary element in a data structure. | |
#define | DBG_ELEMS_ENTRY int32 dbgelems; |
Field to record the size of an array so that its canary element can be found. | |
#define | DBG_SET_ELEMS(x, y) (x).dbgelems = y |
Code to records the size of an array so that its canary element can be found. | |
#define | DBG_SET_CANARY(x) (x).canary = DBG_CANARY |
Code to initialise a canary. | |
#define | DBG_TEST_CANARY(x) |
Code to test for a canary having been overwritten. | |
#define | EMPTY 1 |
Base size for an array containing a canary. | |
#define | DBG_SET_TRAILER(x, y) (x).y[(x).dbgelems] = DBG_CANARY; |
Set a trailing canary in an array. | |
#define | DBG_TEST_TRAILER(x, y) |
Test the trailing canary in an array. | |
#define | DBG_CHECK_INDEX(x, i) |
Check whether an array index is in bounds. | |
#define | HASH_KEYLEN 60 |
The key length for veil hash types. | |
#define | BITZERO(x) (x & 0xffffffe0) |
Gives the bitmask index for the bitzero value of a Bitmap. | |
#define | BITMAX(x) (x | 0x1f) |
Gives the bitmask index for the bitmax value of a bitmap. | |
#define | BITSET_ELEM(x) (x >> 5) |
Gives the index of a bit within the array of 32-bit words that comprise the bitmap. | |
#define | BITSET_BIT(x) (x & 0x1f) |
Gives the index into bitmasks for the bit specified in x. | |
#define | ARRAYELEMS(min, max) (((max - BITZERO(min)) >> 5) + 1) |
Gives the number of array elements in a Bitmap that runs from element min to element max. | |
#define | MIN(a, b) ((a < b)? a: b) |
Return the smaller of a or b. | |
Enumerations | |
enum | ObjType { OBJ_UNDEFINED = 0, OBJ_SHMEMCTL, OBJ_INT4, OBJ_RANGE, OBJ_BITMAP, OBJ_BITMAP_ARRAY, OBJ_BITMAP_HASH, OBJ_BITMAP_REF, OBJ_INT4_ARRAY, OBJ_UNDEFINED = 0, OBJ_SHMEMCTL, OBJ_INT4, OBJ_RANGE, OBJ_BITMAP, OBJ_BITMAP_ARRAY, OBJ_BITMAP_HASH, OBJ_BITMAP_REF, OBJ_INT4_ARRAY } |
Describes the type of an Object record or one of its subtypes. |
#define VEIL_DEBUG 1 |
Enables various debugging constructs, such as canaries, in code and data structures.
If such debugging is required, define VEIL_DEBUG in the make invocation, eg: "make VEIL_DEBUG=1".
Definition at line 23 of file veil_datatypes.h.
#define DBG_CANARY 0xca96ca96 |
Value to be set in sacrificial "canary" fields.
If this value is not as expected, the canaryu has been killed by something inappropriately stomping on memory.
Definition at line 32 of file veil_datatypes.h.
#define DBG_TEST_CANARY | ( | x | ) |
Value:
if ((x).canary != DBG_CANARY) {\ elog(ERROR, "canary fault"); }
Definition at line 59 of file veil_datatypes.h.
Referenced by vl_BitmapSetbit(), vl_ClearBitmapArray(), and vl_NewBitmap().
#define EMPTY 1 |
Base size for an array containing a canary.
This is zero if VEIL_DEBUG is not defined, when this is defined arrays will be one element longer to allow a canary to be placed at the end of the array.
Definition at line 67 of file veil_datatypes.h.
#define DBG_TEST_TRAILER | ( | x, | |||
y | ) |
Value:
if ((x).y[(x).dbgelems] != DBG_CANARY) {\ elog(ERROR, "trailing canary fault"); }
Definition at line 77 of file veil_datatypes.h.
Referenced by vl_BitmapSetbit(), and vl_NewBitmap().
#define DBG_CHECK_INDEX | ( | x, | |||
i | ) |
Value:
if (i >= (x).dbgelems) {\ elog(ERROR, "Element index out of range %d", i); }
Definition at line 83 of file veil_datatypes.h.
Referenced by vl_BitmapSetbit().
#define BITZERO | ( | x | ) | (x & 0xffffffe0) |
Gives the bitmask index for the bitzero value of a Bitmap.
This is part of the "normalisation" process for bitmap ranges. This process allows unlike bitmaps to be more easily compared by forcing bitmap indexes to be normalised around 32-bit word boundaries. Eg, 2 bitmaps with domains 1 to 50 and 3 to 55, will have identical bit patterns for bits 3 to 50.
x | The bitzero value of a bitmap |
Definition at line 205 of file veil_datatypes.h.
Referenced by vl_BitmapSetbit().
#define BITMAX | ( | x | ) | (x | 0x1f) |
Gives the bitmask index for the bitmax value of a bitmap.
See BITZERO() for more information.
x | The bitmax value of a bitmap |
Definition at line 215 of file veil_datatypes.h.
#define BITSET_ELEM | ( | x | ) | (x >> 5) |
Gives the index of a bit within the array of 32-bit words that comprise the bitmap.
x | The bit in question |
Definition at line 225 of file veil_datatypes.h.
Referenced by vl_BitmapSetbit().
#define BITSET_BIT | ( | x | ) | (x & 0x1f) |
Gives the index into bitmasks for the bit specified in x.
x | The bit in question |
Definition at line 234 of file veil_datatypes.h.
Referenced by vl_BitmapSetbit().
#define ARRAYELEMS | ( | min, | |||
max | ) | (((max - BITZERO(min)) >> 5) + 1) |
Gives the number of array elements in a Bitmap that runs from element min to element max.
min | ||
max |
Definition at line 245 of file veil_datatypes.h.
Referenced by vl_ClearBitmap(), vl_ClearBitmapArray(), and vl_NewBitmap().
#define MIN | ( | a, | |||
b | ) | ((a < b)? a: b) |
Return the smaller of a or b.
Note that expressions a and b may be evaluated more than once.
a | ||
b |
Definition at line 257 of file veil_datatypes.h.