📄 rcb.h
字号:
/* *---------------------------------------------------------------------- * T-Kernel / Standard Extension * * Copyright (C) 2006 by Ken Sakamura. All rights reserved. * T-Kernel / Standard Extension is distributed * under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * * Version: 1.00.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* * rcb.h (file) * * File management * Record control block */#ifndef _FM_RCB_H_#define _FM_RCB_H_/* * RCBs are created as many as the number of records included in the file when * it is opened, and are linked in the order of the record number. Just after * the creation, the record type (rtype) is set to invalid flag (RCB_Invalid) to show that * the contents are invalid. When a certain record is accessed, the RCB * corresponding to the record is set to the information read from a disk. */#define RCB_Invalid 0x8000U /* RCB invalid flag */#define isInvalidRCB(rcb) ( (rcb)->rtype == RCB_Invalid )#define setInvalidRCB(rcb) ( (rcb)->rtype = RCB_Invalid )/* * Record control block */typedef struct RCB { QUEUE q; /* For connection of record control block */ /* Record information */ UH rtype; /* Record type */ UH stype; /* Record subtype */ W rsize; /* Record size */ W recnum; /* Record number */ /* Record index information */ IdxAdr idxadr; /* Location of the record index */ /* Record management information */ W ref; /* Reference count of this record */ struct FD *lkfd; /* Locked FD (NULL = unlocked) */ QUEUE lkwait; /* Queue for requests waiting for record lock */ QUEUE mcbq; /* Queue of record map information */} RCB;/* * Previous/Next records */#define prevRCB(rcb) ( (RCB*)(rcb)->q.prev )#define nextRCB(rcb) ( (RCB*)(rcb)->q.next )/* * Virtual end record */#define EndRCB(ofcb) ( (RCB*)&(ofcb)->rcb )#define isEndRCB(rcb, ofcb) ( (rcb) == EndRCB(ofcb) )/* * First record */#define RCBQue(ofcb) ( (RCB*)&(ofcb)->rcb )#define FirstRCB(ofcb) ( nextRCB(RCBQue(ofcb)) )#define isFirstRCB(rcb, ofcb) ( (rcb) == FirstRCB(ofcb) )/* * TRUE when locked. */#define isLockRecord(fd, rcb) ( ((rcb)->lkfd != NULL) && ((rcb)->lkfd != (fd)) )/* * TRUE when record mapped. */#define isMapRecord(rcb) ( !isQueEmpty(&(rcb)->mcbq) )IMPORT ER fmpNewRCB( RCB *currcb );IMPORT void fmpDeleteRCB( RCB *rcb, OFCB *ofcb );IMPORT void fmpDeleteAllRCB( OFCB *ofcb );IMPORT ER fmpSetRCB( RCB *rcb, OFCB *ofcb );IMPORT void fmpSetInvalidAllRCB( OFCB *ofcb );IMPORT void fmpSetInvalidRCB( RCB *rcb, W top, W end );IMPORT void fmpShiftIdxAdrRCB( RCB *rcb, W lv, W top, W end, W shift );IMPORT void fmpExpandIndexLevelRCB( OFCB *ofcb );IMPORT void fmpIncRNoRCB( RCB *rcb, OFCB *ofcb );IMPORT RCB* fmpSetCurRCB( RCB *rcb, OFCB *ofcb );IMPORT void fmpClearCurRCB( RCB *rcb, OFCB *ofcb );#include "ridxio.h"IMPORT ER fmpAppendBlockRCB( RCB *rcb, RIdx *ri, LogBlk new );IMPORT ER fmpAddRSizeRCB( RCB *rcb, W addsize, OFCB *ofcb );IMPORT ER fmpSetSubtypeRCB( RCB *rcb, UH subtype, OFCB *ofcb );#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -