/**************************************************************** * * * Copyright 2001, 2012 Fidelity Information Services, Inc * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * * under a license. If you do not know the terms of * * the license, please stop and do not read further. * * * ****************************************************************/ #ifndef GDSROOT_H #define GDSROOT_H #include #define DIR_ROOT 1 #define CDB_STAGNATE 3 #define CDB_MAX_TRIES (CDB_STAGNATE + 2) /* used in defining arrays, usage requires it must be at least 1 more than CSB_STAGNATE*/ #define T_FAIL_HIST_DBG_SIZE 32 #define MAX_BT_DEPTH 7 #define GLO_NAME_MAXLEN 33 /* 1 for length, 4 for prefix, 15 for dvi, 1 for $, 12 for fid */ #define MAX_NUM_SUBSC_LEN 10 /* one for exponent, nine for the 18 significant digits */ /* Define padding in a gv_key structure to hold * 1) A number : This way we are ensured a key buffer overflow will never occur while converting a number * from mval representation to subscript representation. * 2) 16 byte of a string : This way if we are about to overflow the max-key-size, we are more likely to fit the * overflowing key in the padding space and so can give a more user-friendly GVSUBOFLOW message which * includes the overflowing subscript in most practical situations. */ #define MAX_GVKEY_PADDING_LEN (MAX_NUM_SUBSC_LEN + 16) #define EXTEND_WARNING_FACTOR 3 /* Define macro to compute the maximum key size required in the gv_key structure based on the database's maximum key size. * Align it to 4-byte boundary as this macro is mostly used by targ_alloc which allocates 3 keys one for gv_target->clue, * one for gv_target->first_rec and one for gv_target->last_rec. The alignment ensures all 3 fields start at aligned boundary. * In the following macro, we can ideally use the ROUND_UP2 macro but since this is used in a typedef (of "key_cum_value") * in gdscc.h, we cannot use that macro as it contains GTMASSERT expressions to do the 2-power check. To avoid this, * we use the ROUND_UP macro (which has no checks). It is ok to do that instead of the more-efficient ROUND_UP2 macro * as the second parameter is a constant so all this should get evaluated at compile-time itself. */ #define DBKEYSIZE(KSIZE) (ROUND_UP((KSIZE + MAX_GVKEY_PADDING_LEN), 4)) typedef gtm_uint64_t trans_num; typedef uint4 trans_num_4byte; typedef int4 block_id; /* allows for GDS block #s to have 32 bits but see GDS_MAX_BLK_BITS below */ #define GDS_MAX_BLK_BITS 30 /* see blk_ident structure in gdskill.h for why this cannot be any greater */ #define GDS_MAX_VALID_BLK (1<inode != (B)->inode) \ ? ((A)->inode > (B)->inode ? 1 : -1) \ : ((A)->device != (B)->device) \ ? ((A)->device > (B)->device ? 1 : -1) \ : ((A)->st_gen != (B)->st_gen) \ ? ((A)->st_gen > (B)->st_gen ? 1 : -1) \ : 0) #else #define gdid_cmp(A, B) \ (((A)->inode != (B)->inode) \ ? ((A)->inode > (B)->inode ? 1 : -1) \ : ((A)->device != (B)->device) \ ? ((A)->device > (B)->device ? 1 : -1) \ : 0) #endif #define is_gdid_gdid_identical(A, B) (0 == gdid_cmp(A, B) ? TRUE: FALSE) #endif #define VALFIRSTCHAR(X) (ISALPHA_ASCII(X) || ('%' == X)) #define VALFIRSTCHAR_WITH_TRIG(X) (ISALPHA_ASCII(X) || ('%' == X) GTMTRIG_ONLY(|| (HASHT_GBL_CHAR1 == X))) #define VALKEY(X) (ISALPHA_ASCII(X) || ISDIGIT_ASCII(X)) /* Prototypes below */ block_id get_dir_root(void); boolean_t get_full_path(char *orig_fn, unsigned int orig_len, char *full_fn, unsigned int *full_len, int max_len, uint4 *status); void gvinit(void); #ifdef VMS void global_name(unsigned char prefix[], gds_file_id *fil, unsigned char *buff); #endif #endif