#ifndef h_disk #define h_disk /****************************************************************************** * * Declarations for UniVerse Database disk i/o functions * * Module %M% Version %I% Date %H% * * (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved * This is unpublished proprietary source code of Ardent Software Inc. * The copyright notice above does not evidence any actual or intented * publication of such source code. * ******************************************************************************* * * Maintenence log - insert most recent change descriptions at top * * Date.... GTAR# WHO Description......................................... * 04/12/99 24729 LPC Add addr_support flag to T30infonew structure. * 03/27/99 24729 RGA Create new T30TABNEW struct with T30infonew. * 03/18/99 24480 RGA Change Ihead64 to reflect new size. * 02/01/99 24414 LPC Ihead changed to support 32-bit and 64-bit files. * 12/14/98 23910 DTM Correct GET_NUM_UV_USERS to initialize value. * 10/14/98 23801 SAP Change copyrights. * 10/08/98 23765 CSM remove package count array from license table * 10/02/98 23765 CSM Add license structure to disk SM segment * 05/20/98 21718 LPC/WSM Add support for file suspension * 05/20/98 22647 LPC Move filehdr.h to bottom of list of include files * 05/12/98 22647 LPC Moved file header masks and offsets to filehdr.h * 04/16/98 22807 CSM New DBscan mode to release latch held by the scan * 12/19/97 22373 CSM New DBscanhash mode and return val for select-update * 09/16/97 19940 GMH Mark featr5 as in use * 05/29/97 20606 LAG Added UDRcontrol to DBsegment definition. Added * UDRflags and UDRunique for replication * 04/25/97 20510 AGM Add performance counters to DBsegment * 04/03/97 20380 DTM Bump up file rev for NLSsortmap/NLSsortcksum * 09/10/96 19161 CSM Bump up file rev for freechain freeflag check * 06/13/96 18582 CSM Bump up sica rev for Cascades * 05/30/96 18321 MGM Added Idx_multpart for SQL index type 25 files. * 05/22/96 18423 GMM Added inclusion of iflags.h * 05/20/96 18403 DTM Added information for deadlock detection * 05/12/96 18403 DTM Added information for deadlock/latch daemon * 03/11/96 18125 GMH Add bit tags for idxoff word * 01/19/96 17832 HSB Added SQLidxmap for SQL index type 25 files. * 08/23/95 17242 AGM Replace COMPUTER==WINNT test by MSWIN test * 05/26/95 15077 GMM Used up two spare slots from DBsegment * 06/01/95 16615 PVW Move lock related defines into LOCK.h * 05/26/95 16490 FRA Port to SGI (cleanup warnings) * 05/26/95 16538 DTM Made DBlk_copy/DBlk_init macros * 04/18/95 16490 FRA Port to SGI * 04/18/95 16489 FRA Port to IBM * 04/10/95 16244 GMM Changed ino_t to uv_ino_t * 04/11/95 15958 PVW Change LOCK_WAIT,NOWAIT and add LOCK_DEMOTE * 03/31/95 16221 AGM Rename LOG.h again! * 03/30/95 14633 DTM Added macros for semset/semclr operations * 03/03/95 15757 FRA Remove EXTERN DBSHMSZ and fix FCNTRL_H include * 02/27/95 16051 AGM Revert clog.h to LOG.h * 11/08/94 15741 EAP Added NLSmapcsum & NLSmapname header offsets * 12/05/94 15335 FRA Port to R60000 add SMP file locking * 12/01/94 15406 PVW Remove references to debug[rgf]lock * 11/16/94 15328 PVW Implement exclusive group latches * 11/17/94 15078 SJM Change include of LOG.h to clog.h * 10/21/94 15166 GMM Added USE_SELECT type 3 for NT, ifdefed out sem decs * 10/26/94 14073 TMC change comments reserving featr3 and featr4 * 10/25/94 15040 PVW Add DBlatch structure * 10/06/94 15067 PVW Change definition of Pend_table elements * 08/24/94 14762 CSM Remove old logging system variables, replace staletbl * 08/22/94 14718 RM Added ISOWRITE latches which block on RU locks * 08/17/94 14623 PVW Add additional LOCKFAIL_ERRORS * 08/12/94 14656 JWT Increase readu entries to 64 bytes * 08/10/94 14623 RM Add DBlock_error * 08/05/94 14606 PVW Change file,group,record lock structures * 08/04/94 14519 PVW Implement group shared latch * 08/04/94 14582 PVW Change type argument in DBrsemv() call * 07/26/94 13897 SHK Port to RS6000 * 07/21/94 13286 DTM Modified DBFLOGV to avoid conflicts with uvbackup/restore * 07/06/94 14371 RM Added MAXRLOCK * 07/01/94 14362 RM Added LOCK_ANYRL * 06/30/94 14312 PVW Changed DBrsemp() interface * 06/28/94 14239 WLG Added comments for the DB*MASK constants * 06/24/94 13837 PVW Correct define for LIST_DEADLOCK * 06/07/94 14173 CSM Add lsn,chkpoint,tlnum,inconsistent flag to hdr/desc * 05/26/94 13836 PVW Add defines for DBrecordlocked() * 05/25/94 13837 PVW Implement Release 8 Lock Manager changes * 05/09/94 13837 PVW Add defines for other filelock types * 03/28/94 13179 JKW Initialize R8 Logging * 04/01/94 12303 WLG Fix DBFMASK to be same as highest rev stamp. * 03/15/94 12303 ALC Bumped file rev for PI/open converted files * 03/15/94 12406 GMM Put in change to allow multi uniVerses * 03/01/94 13167 JWT Integrate Pyramid O_SYNC change * 01/06/94 12807 CSM Add a sica Revision constant DBFSICA * 09/15/93 10922 FAI Changed inode to type ino_t. * 09/10/93 12230 RM Bumped file revision level for item padding * 08/02/93 10978 SHK Port to DEC AXP * 07/31/93 11923 LPC Add defines for Distributed Files * 07/22/93 11853 RM Added DBscan defines * 03/09/93 11180 DPB Move UVschema to 524 * 12/14/92 10716 LPC Add Partblock offset to file header * 09/28/92 10291 GMH Moved location of Bakoffset * 08/11/92 8806 JKW add log variables * 08/05/92 9956 RM Newstyle item padding changes * 07/29/92 6818 GMH Add bak locations. * 06/30/92 8806 JKW Add tx counter * 03/26/92 9341 RM Add read only files * 03/23/92 8802 JKW Add readl functionality * 03/18/92 8989 LPC New file revision level for improved dynamic files. * 03/17/92 9296 DPB added support for SQL SICAs. * 11/15/91 8348 JWT detect resize operational error * 11/14/91 8907 TMC use poll for microsec sleep (USE_SELECT==2) * 06/17/91 8485 JWT fix syntax error * 05/22/91 8376 JWT new authorization * 04/10/91 8220 KIS Change semaphore count to continue from 0s base. * 04/09/91 8214 FAI Add signature_table[] for LONG_pid. * 01/10/91 7868 TMC Allow network debugging to be turned on and off * 09/25/90 4944 TMC Change semaphore number to be same as shared memory * 08/29/90 7025 KIS Changed names of featrx vars & add TLOGSEM semaphore * 08/28/90 7025 KIS Reserve featr4 for logging, if I/Os allowed * 08/14/90 7025 KIS Reserve featr3 for logging roll forward active * 07/19/90 7025 KIS Reserve featr2 for logging active * 05/04/90 5192 JWT New pstat interface * 04/17/90 7025 KIS Add for transaction logger magic# * 04/10/90 7010 JWT Critical error handling improvments * 03/29/90 6972 JWT new semset logic * 01/04/89 6758 JWT HP ASM_sem support * 09/28/89 6342 JWT Lessen file descriptor overhead * 09/27/89 6318 JWT fix large record handling * 08/24/89 6072 JWT tunable disk locking * 04/12/89 5927 TJR alignment for seqioua * 03/03/89 5751 JWT Implement onsite tunable parameters * 12/05/88 5590 DTW add flag for catalog shared memory * 11/28/88 5208 JWT Multi-thread READU * 10/05/88 5234 TJR user configurable wide zero * 07/25/88 - - Maintenence log purged at 5.2.1, see release 5.1.10. * *****************************************************************************/ #include "iflags.h" #include FCNTL_H #include "MFILE.h" #include "DBFILE.h" #include "PFILE.h" #include "plock.h" #include "btree.h" #include "tunables.h" #include "portstat.h" #include "c_LOG.h" #include "LOCK.h" #include "perfdata.h" #include "UDR_include.h" /****************************************************************************** * * NOTE: filehdr.h MUST be the last header file included in the list. * *****************************************************************************/ #include "filehdr.h" /****************************************************************************** * * NOTE: All file header information (offsets, masks and macros) have * been moved to filehdr.h, which is included from this file. * *****************************************************************************/ #ifdef MSWIN /* * do nothing for SYNC_ON. For SYNC_OFF decrement the fdesc sync flag * as this is usually called in a loop involving the sync flag */ #define F_SYNC_ON(mf) \ { \ } #define F_SYNC_OFF(mf) \ if (((MFILE*)mf)->sync_on) \ { \ ((MFILE*)mf)->sync_on -= 1; \ } #else #define F_SYNC_ON(mf) \ if (DBshmseg->tune_vals.syncalloc)\ { if(((MFILE*)mf)->sync_on == 0)\ { ((MFILE*)mf)->EBWSsave = fcntl(((MFILE*)mf)->fp,\ F_GETFL, 0);\ (void) fcntl(((MFILE*)mf)->fp, F_SETFL,\ ((MFILE*)mf)->EBWSsave | O_SYNC);\ }\ ((MFILE*)mf)->sync_on++;\ } #define F_SYNC_OFF(mf) \ if (((MFILE*)mf)->sync_on && --((MFILE*)mf)->sync_on <= 0)\ { (void) fcntl(((MFILE*)mf)->fp, F_SETFL,\ ((MFILE*)mf)->EBWSsave & ~O_SYNC);\ } #endif #if defined(UV_MULTI_INSTALL) extern int p_home_inode(); #endif /* opcodes for DBscan */ #define SCANinit 1 #define SCANread 0 #define SCANterm -1 #define SCANrestart -2 #define SCANgrpsync -5 #define SCANrellatch -6 /* return values for DBscanhash */ #define SCANatgrpend -8 #define Sector DISKBLK /* Physical disk sector size */ #define _ALIGN W_ALIGN /* Word alignment mask (Boundary-1)*/ #define absaddr 0 /* Specifies seek relative to base of file */ #define filend 2 /* specifies seek relative to end of file */ #define HASHES 19 #define _SHMrev UVREV #if defined(UV_MULTI_INSTALL) #define _SHMKEY (0xacec0000 | (p_home_inode())) #else #define _SHMKEY (0xacec0000 | (_SHMrev)) #endif #if defined(UV_MULTI_INSTALL) #define _DUMBKEY (0xace01234 | (p_home_inode())) #else #define _DUMBKEY 0xace01234 #endif #define _USMFKEY _SHMKEY /* file lock semaphore unique key */ struct t30table { int dev; uv_ino_t inode; int refs; struct T30info filedata; }; #define T30TAB struct t30table struct t30tablenew { int dev; uv_ino_t inode; int refs; int addr_support; T30INFONEW filedata; }; #define T30TABNEW struct t30tablenew #define JAVACLT 0x1 #define MAXCONNPERUSR 10 struct pidpkg { pid_t srvpid; /* pid of srvr handling conn */ unsigned int packages; /* packages in use */ }; #define PIDPKG struct pidpkg struct uvseat { BITMAP spares:(8*sizeof(BITMAP)-5), /* Flags */ conninuse:4, /* connectons in use for seat */ objcrtdst:1; /* seat created by Obj server */ char macaddr[13]; /* MacAddress of PC */ char devname[25]; /* device name on LAN */ char devsubkey[25]; /* device sub-key for N-tier */ u_long ipaddr; /* IP address */ int pkgsused; /* bitmap of packages used */ }; #define UVSEAT struct uvseat #define GET_NUM_UV_USERS(result) \ { \ int nseat; \ UVSEAT *lictbl; \ /* make sure we start at 0 */ \ result = 0;\ lictbl = (UVSEAT*)((char*)DBshmseg + (int)DBshmseg->lic_table);\ for (nseat=0; nseat < DBshmseg->tune_vals.max_logins; nseat++) \ result += lictbl[nseat].conninuse; \ } #define _UVXDT 12 #define _UVCDT 12 #define _UVRSZ 128 #define _PTRBUF 128 struct DBsegment { /* These items are used to control access to universe */ /* at startup time */ int logcur; /* current login count */ int logpk[MAX_PACKAGES]; /* # active users of each pkg */ #if COMPUTER == SEQUOIA char fill[ 128 - (((MAX_PACKAGES+1)*sizeof(int)) % 128)]; #endif /* Next are some global parameters for universe jobs */ UVTUNE tune_vals; /* universe tunables */ char *psegaddr; /* base addr for Pseg */ char uvhome[_UVRSZ]; /* home directory of uv */ #if COMPUTER == SEQUOIA char fill1[128 - (sizeof(UVTUNE) + sizeof(char*) + (_UVRSZ * sizeof(char))) %128]; #endif Pblock Gprtblk; /* Global pblk template */ char Gpbuf[_PTRBUF]; /* Work area for above */ #if COMPUTER == SEQUOIA char fill2[128 - (sizeof(Pblock) + (_PTRBUF * sizeof(char))) % 128]; #endif struct LG_data LGcontrol; struct UDR_data UDRcontrol; int shm; /* true if using shared catalog */ int txid; /* unique tx id counter */ int nt_svc_pid; /* pid of the NT UV service */ int nt_svc_thread; /* NT service remote thread routine*/ int uvdlockd_pid; /* pid of the deadlock daemon */ int spare7, /* Reserved for future use... */ spare8, /* Reserved for future use... */ spare9, /* Reserved for future use... */ spare10, /* Reserved for future use... */ spare11, /* Reserved for future use... */ spare12, /* Reserved for future use... */ spare13, /* Reserved for future use... */ spare14, /* Reserved for future use... */ featr1, /* Semaphore debugging feature */ featr2, /* uvnetd debugging feature */ featr3, /* uvnetlicd debugging feature */ featr4, /* uvnetlicd watchdog feature */ featr5, /* rpc debugging feature */ featr6, /* File suspension toggle */ featr7, /* Reserved for future use... */ featr8, /* Reserved for future use... */ featr9, /* Reserved for future use... */ featr10, /* Reserved for future use... */ featr11, /* Reserved for future use... */ featr12, /* Reserved for future use... */ featr13, /* Reserved for future use... */ featr14, /* Reserved for future use... */ featr15, /* Reserved for future use... */ featr16; /* Reserved for future use... */ #if COMPUTER == SEQUOIA char fill3[128 - (34 * sizeof(int)) % 128]; #endif struct Pstat pstatbuf; #if COMPUTER == SEQUOIA char fill3[128 - sizeof(struct Pstat) % 128]; #endif #ifdef LONG_pid long signature_table[SIG_TAB_SIZ]; /* Table for hashed signatures*/ #endif /* sems is a pointer to an array of ints used for test */ /* and set assembly code semaphores. They are allocated */ /* with single statement to stress the fact that they */ /* must be contiguously allocated. The number semaphores */ /* is a tunable parameter. The first PSEMNUM of these */ /* are used for controlling access to the system filelock */ /* table. The next GSEMNUM are used to control access to */ /* the group and readu lock tables. The next PSEMNUM are */ /* for the BASIC user process locks. Three extra */ /* semaphores are allocated. The first is used for login */ /* limiting. The second is for the external Pstat process*/ /* feature. The third is for type 30 file support */ /* The fourth is for transaction loggint support. */ DBSEM *sems; /* Next is a data area use for the BASIC process locks */ short *usrldat; /* The remainer is made up of structures used for disk */ /* I/O concurrency control. */ SGPLCK *grpslot; /* group lock tables */ SFLLCK *filslot; /* file lock tables */ FS_OWNERS *fsoslot; /* FS lock owners */ WAITERS *fswaiters; /* FS lock waiters */ SRULCK *rduslot; /* readu table chunks */ READL_OWNERS *rdlslot; /* owners of shared locks */ WAITERS *rdlwaiters; /* RU lock waiters */ char *LG_data_buffer; /* buffer for log messages */ char *UDR_data_buffer; /* buffer for data replication messages */ UVSEAT *lic_table; /* licenses */ PIDPKG *pidpkglst; /* pid, package list */ pid_t *uvnetd_pids; /* uvnetd pids */ T30TABNEW *t30data; /* type 30 FCBs */ #ifdef UV_PERFORMANCE_DATA PERF_DATA perfdata; /* Performance data */ #endif }; /* Old Ihead define */ /* #define Ihead (sizeof(DBDADDR)+sizeof(DBDADDR)+sizeof(DBFLAGW)) */ /* New Ihead definitions */ /* Ihead32 - Record block size for a UniVerse 32-bit file: */ /* 4 byte forward link, 4 byte backward link, 4 byte flagword */ /* Ihead64 - Record block size for a UniVerse 64-bit file: */ /* 8 byte forward link, 8 byte backward link, 4 byte flagword,*/ /* 4 byte pads (alignment) */ #define Ihead32 12 #define Ihead64 24 #define keymrk (uchar) CHR_377 #define DBilen(x) (*((int *) (x-sizeof(DBFLAGW)))^blink) #endif /* end of disk.h */