2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
24 /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
25 /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
26 /*%% (c) Copyright 1993, 1994 Novell, Inc. */
27 /*%% $TOG: isam_impl.h /main/4 1998/03/16 14:41:21 mgreess $ */
28 /* @(#)isam_impl.h 1.11 93/09/07 */
31 * Copyright (c) 1988 by Sun Microsystems, Inc.
38 * NetISAM implementation specific definitions
51 #include <sys/types.h>
52 #include <sys/param.h>
54 /* AIX does not define FD_SETSIZE in sys/types.h. */
55 #if !defined(FD_SETSIZE)
56 #include <sys/select.h>
60 * #include sys/types.h is to get u_long, u_short, dev_t
62 * #include sys/param.h is to get MAXHOSTNAMELEN
68 * Static is used in definitions of local functions. It is defined to
69 * "static" normally, but to an empty string when compiled for profiling
70 * purposes (-p or -pg options to the cc compiler). If a function is
71 * defined as static, then the profiling tools account the time spent in
72 * this function to the physically previous global function which is
73 * incorrect and makes the output of the profiler tools useless.
75 #if defined(PROF) || defined(GPROF)
83 typedef long Recno; /* record numbers */
84 typedef long Blkno; /* block numbers */
85 typedef long Time; /* standard UNIX time */
86 typedef int Isfd; /* ISAM file descriptor */
94 #define ISOPENMODE 0xff /* Mask to get ISINPUT/ISOUTPUT */
96 #define ISLOCKMODE 0xff00 /* Mask to get lock mode */
97 #define ISREADMODE 0xff /* Mask to get ISFIRST, etc. */
99 #define ISLENMODE 0x10000 /* Mask to get FIX/VAR length */
101 #define ISPAGESIZE 1024 /* page size */
103 #define N_CNTL_PAGES 2 /*
104 * Number of control pages
105 * at the beg. of .rec file
107 #define ISCNTLSIZE (ISPAGESIZE * N_CNTL_PAGES)
110 #define ISMAGIC "NetISAM" /* 'magic number' in ISAM files */
113 #define ISVERSION "Unknown"
116 #define MAXFCB_UNIXFD 30 /* Maximum number of UNIX fd
117 * used by the FCB module
120 #define ISLEAFSLACK 10 /* Default slack in leaves */
122 /* Default RPC timeout values */
123 #define ISRPCS_TO_DEF 60 /* secs for short oper. */
124 #define ISRPCL_TO_DEF (120 * 60) /* secs for long oper. */
125 #define ISTCP_TO_DEF (3 * 60) /* secs to reconnect TCP/IP */
126 #define ISRPC_POLL_TO_DEF 30 /* interval to hear from polled client */
127 #define ISTCP_RETRY_SLEEP 5 /* time between tries to
128 * establish a connection
132 * The X/OPEN ISAM internal data representations.
133 * The #define statements are used to declare type lengths and offsets
134 * in structures in order for the definitions to be compiler independent.
137 #define TIMETYPE LONGTYPE /* standard UNIX time */
138 #define TIMESIZE LONGSIZE
140 #define BLKNOTYPE LONGTYPE /* block (page) numbers */
141 #define BLKNOSIZE LONGSIZE
143 #define RECNOTYPE LONGTYPE /* record numbers */
144 #define RECNOSIZE LONGSIZE
147 * SHORTTYPE is a safeguard - if the X/OPEN ISAM changes INTTYPE to 4 bytes
148 * all the internals of NetISAM will work. The only change will be
149 * re-defining SHORTTYPE.
152 #define SHORTTYPE INTTYPE
153 #define SHORTSIZE INTSIZE
155 /* The following defines are used in isstart() */
157 #define USE_PHYS_ORDER(keydesc) (keydesc->k_nparts == 0)
159 /* Structure for storing and passing variable length byte array data */
160 typedef struct bytearray {
165 extern Bytearray _bytearr_getempty(), _bytearr_dup();
166 extern Bytearray _bytearr_new(u_short len, char *data);
167 extern void _bytearr_free();
170 /* Client identification - used to identify owners of locks */
175 /* Definitions related to ISAM file descriptor (isfd.c file) */
176 #define MAXISFD FD_SETSIZE
177 #define NOISFD (-1) /* Not a valid file descriptor */
179 extern struct fab *_isfd_find();
180 extern void _isfd_delete();
181 extern Isfd _isfd_insert();
183 /* Definitions related to File access block (isfab.c file */
186 enum openmode { OM_INPUT = 0, OM_OUTPUT = 1, OM_INOUT = 2, OM_BADMODE = 3};
187 enum lockmode { LM_FAST = 0, LM_EXCL = 1, LM_AUTOMATIC = 2, LM_MANUAL = 3, LM_BADMODE = 4};
189 /* isread() read modes */
190 enum readmode { RM_FIRST = 0, RM_LAST = 1, RM_NEXT = 2, RM_PREV = 3,
191 RM_CURR = 4, RM_EQUAL = 5, RM_GREAT = 6, RM_GTEQ = 7,
192 RM_LESS = 8, RM_LTEQ = 9, RM_BADMODE = 10 };
194 /* lock flag is passed to Access Method module for every record oriented op. */
195 /* Bit position in the lock flag: */
197 enum openmode _getopenmode();
198 enum readmode _getreadmode();
200 /* Error code structure */
207 Isfd isfd; /* ISAM file descriptor */
208 enum openmode openmode; /* File access mode */
209 enum lockmode lockmode; /* File lock mode */
210 Bool locked; /* TRUE if file is locked */
211 Bool varlength; /* TRUE if variable length records
212 * supported by this ISAM file */
213 int minreclen; /* Minimum record length */
214 int maxreclen; /* Maximum record length */
215 char *isamhost; /* IP host name */
216 char *isfname; /* ISAM file local pathname */
217 Bytearray isfhandle; /* ISAM file handle */
218 Bytearray curpos; /* Current record position */
219 struct errcode errcode; /* Error codes structure */
222 /* values for filemode */
224 #define REMOTE_FILE 1
225 #define NFS_FILE 2 /* File is remote, but is
229 #define FAB_ISFDSET(fab, isfd) (fab->isfd = isfd)
231 extern Fab *_fab_new();
234 /* ISAM file identification for locking purposes. */
235 typedef struct lckfid {
236 dev_t diskid; /* Disk device id */
237 ino_t inode; /* .rec file inode number */
240 /* File Control Block */
242 char *isfname; /* ISAM file name */
243 int blocksize; /* Block size */
244 Bool rdonly; /* file is read-only */
245 Lckfid lckfid; /* File id for locking */
246 int datfd; /* UNIX file descr. of .rec file */
247 int indfd; /* UNIX file descr. of .ind file */
248 int varfd; /* UNIX file descr. of .var file */
249 Blkno datsize; /* dat file size in blocks */
250 Blkno indsize; /* ind file size in blocks */
251 Blkno varsize; /* var file size in blocks */
252 Bool varflag; /* TRUE if variable length*/
253 long nrecords; /* Number of records */
254 int minreclen; /* Minimum record length */
255 int maxreclen; /* Maximum record length */
256 Recno lastrecno; /* Last recno in use */
257 Recno freerecno; /* Pointer to first free record */
258 int lastkeyid; /* Last key identifier used */
259 int changestamp1; /* Stamp 1 of last change */
260 int changestamp2; /* Stamp 2 of last change */
261 Blkno indfreelist; /* Head of freepage list of .ind */
263 int nkeys; /* Number of keys */
264 struct keydesc2 *keys; /* Key descriptors */
265 long varend; /* Offset of the last byte */
267 int lockfd; /* lock file fd for locking .rec for 5.0 */
270 #define FCB_NOPRIMARY_KEY(fcb) ((fcb)->keys[0].k2_nparts == 0)
272 /* Current Record Position (interpreted only by Access Method) */
273 enum crpflag { CRP_UNDEF = 0, CRP_ON = 1, CRP_AFTER = 2, CRP_BEFORE = 3,
274 CRP_BEFOREANY = 4, CRP_AFTERANY = 5};
276 int keyid; /* Key index */
277 enum crpflag flag; /* ON/BEFORE/AFTER/UNDEF */
278 Recno recno; /* Record number */
279 int matchkeylen; /* match so many bytes of key */
280 char key[1]; /* Index position */
283 #define PHYS_ORDER (-1) /* value for keyid when physical
287 * keydesc2 is the 'internal copy'of keydesc.
288 * keydesc2 contains all information needed by internally by NetISAM,
289 * whereas keydesc conforms to the X/OPEN ISAM.
292 #define NPARTS2 (NPARTS+2) /* duplid and recno */
293 #define DUPSMASK 001 /* Mask to get ISDUPS/ISNODUPS */
294 #define ISPRIMKEY 040 /* this is primary key */
295 #define ALLOWS_DUPS2(pkdesc2) (((pkdesc2)->k2_flags & DUPSMASK) == ISDUPS)
296 #define ALLOWS_DUPS(pkdesc) (((pkdesc)->k_flags & DUPSMASK) == ISDUPS)
298 /* serial number of duplicate keys */
299 #define DUPIDTYPE LONGTYPE
300 #define DUPIDSIZE LONGSIZE
302 #define KEY_RECNO_OFF 0
303 #define KEY_DUPS_OFF RECNOSIZE
305 #define stdupser(n, b) stlong((long)(n), (b))
306 #define lddupser(b) ((int)ldlong(b))
309 u_short kp2_start; /* starting byte of key part */
310 short kp2_leng; /* length in bytes */
311 short kp2_type; /* type of key part */
312 u_short kp2_offset; /* offset in key buffer */
315 typedef struct keydesc2 {
316 short k2_flags; /* flags */
317 short k2_nparts; /* number of parts in key */
318 short k2_len; /* length of the whole key */
319 Blkno k2_rootnode; /* pointer to root node */
320 int k2_keyid; /* Key identifier */
321 struct keypart2 k2_part[NPARTS2]; /* each part */
324 typedef unsigned long rel_addr;
325 /* Double linked list element */
327 rel_addr dln_forward; /* Forward link */
328 rel_addr dln_backward; /* Backward link */
331 /* Disk buffer management definitions */
333 /* cache buffer header */
334 typedef struct bufhdr {
335 Fcb *isb_fcb; /* Pointer to FCB */
336 int isb_unixfd; /* UNIX file descriptor */
337 Blkno isb_blkno; /* block number */
338 struct dlink isb_hash; /* hashed list*/
339 struct dlink isb_aclist; /* available or changed list */
340 struct dlink isb_flist; /* list of fixed blocks */
341 char *isb_buf_w; /* malloc() buffer with dirty data */
342 char *isb_buf_r; /* points to mapped segment */
343 char *isb_buffer; /* set to isb_buf_r or isb_buf_w */
344 char isb_flags; /* flags - defs. see below */
345 struct bufhdr *isb_oldcopy; /* pointer to old copy */
348 /* mapped segment header */
349 typedef struct maphdr {
350 Fcb *m_fcb; /* Pointer to FCB */
351 int m_unixfd; /* UNIX file descriptor */
352 char *m_addr; /* Pointer to beginning of seg. */
353 int m_segm_num; /* Segment number in the file */
354 unsigned long m_stamp; /* Assigned when touched */
358 /* values of isb_flags */
359 #define ISB_NODATA 00 /* block has no data */
360 #define ISB_READ 01 /* page has valid data */
361 #define ISB_CHANGE 02 /* page must be flushed */
362 #define ISB_RFIXED 04 /* block is fixed for read*/
363 #define ISB_WFIXED 010 /* block is fixed for write*/
364 #define ISB_OLDCOPY 020 /* block is old copy */
366 /* mode values to is__cache_fix() */
367 #define ISFIXREAD 1 /* fix for read */
368 #define ISFIXWRITE 2 /* fix for update */
369 #define ISFIXNOREAD 3 /* fix for update, don't read */
373 * Macro to get pointer to structure if pointer to some element is known
375 #define GETBASE(p,s,e) ((struct s *) ((char *)(p) - (char *)&((struct s *)0)->e))
377 /* In memory sorting object */
378 typedef struct issort {
379 int ist_reclength; /* record length in bytes */
380 int ist_allocrecs; /* memory allocated for so */
382 int ist_nrecs; /* number of records inserted */
383 int ist_currec; /* current position */
384 int (*ist_compf) (); /* comparison function */
385 char *ist_array; /* array of records */
389 /* btree is object used for processing B-tree operations */
391 #define ISMAXBTRLEVEL 12 /* Maximum level of B-tree */
393 typedef struct btree {
396 int depth; /* depth of the B-tree */
397 Bufhdr *bufhdr[ISMAXBTRLEVEL]; /* fixed blocks buf. headers */
398 int curpos[ISMAXBTRLEVEL]; /* current position on block */
401 /* Lock manager related definitions. */
402 /* Entry in lock table */
404 /* Number of buckets for hashing by clientid. Must be a power of 2*/
406 #define HASHPROCSIZE 64
410 * Number of buckets for hashing by record number and fileid.
411 * Must be a power of 2
414 #define HASHENTSIZE 1024
417 /* Pseudo record numbers used by file locking. */
418 #define AVAIL_RECNO (0L) /* Entry is available */
419 #define ALLFILE_RECNO (-1L) /* Entire file lock */
420 #define OPENFILE_RECNO (-2L) /* Used by isopen() */
422 /* Lock table file header */
424 int size; /* size of LOCKTABLEFILE
425 * set to 0 forces reinitialization
426 * at next lock request.
428 int prochdsn; /* Number of lists hashed by
430 int enthdsn; /* Number of list hashed by
432 int lockentriesn; /* total number of lock entries */
433 struct dlink avail; /* Double linked list of
434 * available lock entries */
437 /* Exported filesystem options structure and constants*/
439 #define RW_CLIENTS_SIZE 1 /* Not currently needed */
440 #define UID_SIZE 10 /* Big enough to hold a Unix UID */
441 #define ROOT_OPT_SIZE 240 /* List of hosts for which root access
442 is allowed -- can be quite long */
443 #define SHARE_BUFFER_SIZE 400
446 int read_write; /* 0 => read-only, 1 => read/write */
447 char rw_clients[1]; /* Not interesting, len=1 to save space */
448 char export_dir[1]; /* ditto here */
450 char root[ROOT_OPT_SIZE];
451 int secure; /* RPC authentication flag: 0 => AUTH_UNIX, 1 => AUTH_DES */
456 #define DAT_SUFFIX ".rec"
457 #define IND_SUFFIX ".ind"
458 #define VAR_SUFFIX ".var"
459 #define LOCK_SUFFIX ".lock" /* yh: lock file for .rec to solve mmap in 5.0 */
461 /* Values of deleted flag for fixed length records */
462 #define FL_RECDELETED 0
463 #define FL_RECEXISTS 1
465 /* Special values of tail pointer for variable length records */
466 #define VL_RECDELETED ((long ) -1L)
467 #define VL_RECNOTAIL ((long ) -2L)
469 /*------------ Prototype definitions ---------------------------------------*/
470 #include "isam_prototypes.h"
472 #define stshort(n,p) stint((n), (p))
473 #define ldshort(p) ldint(p)
475 #define strecno(n,p) stlong((long)(n), (p))
476 #define ldrecno(p) ((Recno)ldlong(p))
478 #define stblkno(n,p) stlong((long)(n), (p))
479 #define ldblkno(p) ((Blkno)ldlong(p))
482 /*------------ UNIX file formats ---------------------------------------------*/
484 #define ISCNTLPGOFF ((Blkno) 0) /* offset of Control Page */
486 /* internal key descriptor */
488 #define KP2_START_OFF 0 /* see struct keypart2 */
489 #define KP2_LENGTH_OFF SHORTSIZE
490 #define KP2_TYPE_OFF (2*SHORTSIZE)
491 #define KP2_OFFSET_OFF (3*SHORTSIZE)
492 #define KP2_LEN (4*SHORTSIZE)
494 #define K2_FLAGS_OFF 0 /* see struct keydesc2 */
495 #define K2_NPARTS_OFF SHORTSIZE
496 #define K2_LEN_OFF (2*SHORTSIZE)
497 #define K2_ROOT_OFF (3*SHORTSIZE)
498 #define K2_KEYID_OFF (3*SHORTSIZE+BLKNOSIZE)
499 #define K2_KEYPART_OFF (3*SHORTSIZE+2*BLKNOSIZE)
500 #define K2_LEN (3*SHORTSIZE+2*BLKNOSIZE+ NPARTS2*KP2_LEN)
502 #define NULL_BLKNO 0L
503 #define NULL_RECNO 0L
504 #define PAGE1_BLKNO 0 /* Block number of control page */
505 /*------------------------- Control Page layout -----------------------------*/
507 /* Magic number (must be equal to "NetISAM") */
508 #define CP_MAGIC_OFF 0
509 #define CP_MAGIC_LEN 8
512 #define CP_VERSION_OFF (CP_MAGIC_OFF+CP_MAGIC_LEN)
513 #define CP_VERSION_LEN 8
515 /* Application stamp */
516 #define CP_APPLMAGIC_OFF (CP_VERSION_OFF+ CP_VERSION_LEN)
517 #define CP_APPLMAGIC_LEN ISAPPLMAGICLEN
520 #define CP_BLOCKSIZE_OFF (CP_APPLMAGIC_OFF+CP_APPLMAGIC_LEN)
521 #define CP_BLOCKSIZE_LEN SHORTSIZE
523 /* file size in blocks */
524 #define CP_DATSIZE_OFF (CP_BLOCKSIZE_OFF+CP_BLOCKSIZE_LEN)
525 #define CP_DATSIZE_LEN BLKNOSIZE
527 /* file size in blocks */
528 #define CP_INDSIZE_OFF (CP_DATSIZE_OFF+CP_DATSIZE_LEN)
529 #define CP_INDSIZE_LEN BLKNOSIZE
531 /* file size in blocks */
532 #define CP_VARSIZE_OFF (CP_INDSIZE_OFF+CP_INDSIZE_LEN)
533 #define CP_VARSIZE_LEN BLKNOSIZE
535 /* 0/1 flag telling whether file supports variable length records. */
536 #define CP_VARFLAG_OFF (CP_VARSIZE_OFF+CP_VARSIZE_LEN)
537 #define CP_VARFLAG_LEN SHORTSIZE
539 /* number of record in the file */
540 #define CP_NRECORDS_OFF (CP_VARFLAG_OFF+CP_VARFLAG_LEN)
541 #define CP_NRECORDS_LEN LONGSIZE
543 /* minimum record length */
544 #define CP_MINRECLEN_OFF (CP_NRECORDS_OFF+CP_NRECORDS_LEN)
545 #define CP_MINRECLEN_LEN SHORTSIZE
547 /* maximum record length */
548 #define CP_MAXRECLEN_OFF (CP_MINRECLEN_OFF+CP_MINRECLEN_LEN)
549 #define CP_MAXRECLEN_LEN SHORTSIZE
552 * Left 0 and not used in NetISAM 1.0.
553 * Will be set at restructuring to some optimal value x
554 * (minreclen <= x <= maxreclen).
555 * Record with length will be stored in .rec file only.
556 * In NetISAM 1.0 x == minreclen.
558 /* split record record length */
559 #define CP_SPLITRECLEN_OFF (CP_MAXRECLEN_OFF+CP_MAXRECLEN_LEN)
560 #define CP_SPLITRECLEN_LEN SHORTSIZE
562 /* Recno of last record */
563 #define CP_LASTRECNO_OFF (CP_SPLITRECLEN_OFF+CP_SPLITRECLEN_LEN)
564 #define CP_LASTRECNO_LEN RECNOSIZE
566 /* Head of deleted records list */
567 #define CP_FREERECNO_OFF (CP_LASTRECNO_OFF+CP_LASTRECNO_LEN)
568 #define CP_FREERECNO_LEN RECNOSIZE
570 /* 0/1 flag telling whether file has a primary key */
571 #define CP_HASPRIMKEY_OFF (CP_FREERECNO_OFF+CP_FREERECNO_LEN)
572 #define CP_HASPRIMKEY_LEN SHORTSIZE
574 /* Last key indentifier. */
575 #define CP_LASTKEYID_OFF (CP_HASPRIMKEY_OFF+CP_HASPRIMKEY_LEN)
576 #define CP_LASTKEYID_LEN LONGSIZE
578 /* Stamp 1 of last change */
579 #define CP_CHANGESTAMP1_OFF (CP_LASTKEYID_OFF+CP_LASTKEYID_LEN)
580 #define CP_CHANGESTAMP1_LEN LONGSIZE
582 /* Stamp 2 of last change */
583 #define CP_CHANGESTAMP2_OFF (CP_CHANGESTAMP1_OFF+CP_CHANGESTAMP1_LEN)
584 #define CP_CHANGESTAMP2_LEN LONGSIZE
586 /* .ind file free list */
587 #define CP_INDFREELIST_OFF (CP_CHANGESTAMP2_OFF+CP_CHANGESTAMP2_LEN)
588 #define CP_INDFREELIST_LEN BLKNOSIZE
591 #define CP_NKEYS_OFF (CP_INDFREELIST_OFF+CP_INDFREELIST_LEN)
592 #define CP_NKEYS_LEN SHORTSIZE
594 /* use 4 bytes of reserved space */
595 #define CP_VAREND_OFF (CP_NKEYS_OFF+CP_NKEYS_LEN)
596 #define CP_VAREND_LEN LONGSIZE
598 /* use 4 bytes of reserved space for time stamp*/
599 #define CP_UNIQUE_OFF (CP_VAREND_OFF+CP_VAREND_LEN)
600 #define CP_UNIQUE_LEN LONGSIZE
602 /* reserve some space for future */
603 #define CP_RESERVE_OFF (CP_UNIQUE_OFF+CP_UNIQUE_LEN)
604 #define CP_RESERVE_LEN 120 /* 128 was reserved originally */
606 /* table of key descriptors */
607 #define CP_KEYS_OFF (CP_RESERVE_OFF+CP_RESERVE_LEN)
609 #define MAXNKEYS2 ((ISCNTLSIZE - CP_KEYS_OFF) / K2_LEN)
612 #if (MAXNKEYS2 < MAXNKEYS)
613 Cause a compiler error here. There is not enought space in the control
614 page to hold MAXNKEYS.
617 /*------ page type indicator values -------------*/
618 #define PT_INDEX 1 /* B-tree page */
619 #define PT_FREELIST 2 /* free list */
621 /*-------------- B-Tree page layout -----------------------------------*/
623 #define BT_TYPE_OFF 0
624 #define BT_TYPE_LEN SHORTSIZE
626 /* level (leaves have level 0) */
627 #define BT_LEVEL_OFF (BT_TYPE_OFF+BT_TYPE_LEN)
628 #define BT_LEVEL_LEN SHORTSIZE
631 #define BT_CAPAC_OFF (BT_LEVEL_OFF+BT_LEVEL_LEN)
632 #define BT_CAPAC_LEN SHORTSIZE
634 /* current number of keys */
635 #define BT_NKEYS_OFF (BT_CAPAC_OFF+BT_CAPAC_LEN)
636 #define BT_NKEYS_LEN SHORTSIZE
638 /* array of key entries */
639 #define BT_KEYS_OFF (BT_NKEYS_OFF+BT_NKEYS_LEN)
641 /* down pointers are stored at the end of the page */
643 /*----------- Free List Page Layout --------------------------------------*/
645 #define FL_TYPE_OFF 0
646 #define FL_TYPE_LEN SHORTSIZE
648 /* pointer to next block in the list */
649 #define FL_NEXT_OFF (FL_TYPE_OFF + FL_TYPE_LEN)
650 #define FL_NEXT_LEN BLKNOSIZE
652 /* number of free page pointers */
653 #define FL_NPOINTERS_OFF (FL_NEXT_OFF + FL_NEXT_LEN)
654 #define FL_NPOINTERS_LEN SHORTSIZE
656 /* free page pointers table */
657 #define FL_POINTERS_OFF (FL_NPOINTERS_OFF + FL_NPOINTERS_LEN)
659 /* maximum number of pointers that can be stored in a page */
660 #define FL_MAXNPOINTERS ((ISPAGESIZE - FL_POINTERS_OFF) / BLKNOSIZE)
662 #define FREELIST_NOPAGE ((Blkno) -1)
664 /* .var file related defines */
665 #define VR_FRAMELEN_OFF 0
666 #define VR_TAILLEN_OFF 2
669 /* maximum and minimum values are in B-tree seaches */
671 #define ISMAXLONG { 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }
672 #define ISMINLONG { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
674 #define ISMAXLONG { 0x7f, 0xff, 0xff, 0xff }
675 #define ISMINLONG { 0x80, 0x00, 0x00, 0x00 }
678 #define ISMAXSHORT { 0x7f, 0xff }
679 #define ISMINSHORT { 0x80, 0x00 }
681 #define ISMINCHAR ('\0')
682 #define ISMAXCHAR ('\377')
684 #define ISMINBIN ('\0')
685 #define ISMAXBIN ('\377')
687 /* double and float are declared using IEEE bit paterns */
689 #define ISMAXDOUBLE { 0x7f, 0xf0, 0, /* rest is 0 */ }
690 #define ISMINDOUBLE { 0xff, 0xf0, 0, /* rest is 0 */ }
692 #define ISMAXFLOAT { 0x7f, 0x80, 0, /* rest is 0 */ }
693 #define ISMINFLOAT { 0xff, 0x80, 0, /* rest is 0 */ }
696 /* Hide these from user till we return error code */