LCOV - differential code coverage report
Current view: top level - src/include/storage - block.h (source / functions) Coverage Total Hit GNC ECB DCB
Current: Differential Code Coverage HEAD vs 15 Lines: 100.0 % 8 8 8 3 5
Current Date: 2023-04-08 17:13:01 Functions: 100.0 % 3 3 3 2 1
Baseline: 15 Line coverage date bins:
Baseline Date: 2023-04-08 15:09:40 (240..) days: 100.0 % 8 8 8 3
Legend: Lines: hit not hit Function coverage date bins:
(240..) days: 60.0 % 5 3 3 2

 Age         Owner                  TLA  Line data    Source code
                                  1                 : /*-------------------------------------------------------------------------
                                  2                 :  *
                                  3                 :  * block.h
                                  4                 :  *    POSTGRES disk block definitions.
                                  5                 :  *
                                  6                 :  *
                                  7                 :  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
                                  8                 :  * Portions Copyright (c) 1994, Regents of the University of California
                                  9                 :  *
                                 10                 :  * src/include/storage/block.h
                                 11                 :  *
                                 12                 :  *-------------------------------------------------------------------------
                                 13                 :  */
                                 14                 : #ifndef BLOCK_H
                                 15                 : #define BLOCK_H
                                 16                 : 
                                 17                 : /*
                                 18                 :  * BlockNumber:
                                 19                 :  *
                                 20                 :  * each data file (heap or index) is divided into postgres disk blocks
                                 21                 :  * (which may be thought of as the unit of i/o -- a postgres buffer
                                 22                 :  * contains exactly one disk block).  the blocks are numbered
                                 23                 :  * sequentially, 0 to 0xFFFFFFFE.
                                 24                 :  *
                                 25                 :  * InvalidBlockNumber is the same thing as P_NEW in bufmgr.h.
                                 26                 :  *
                                 27                 :  * the access methods, the buffer manager and the storage manager are
                                 28                 :  * more or less the only pieces of code that should be accessing disk
                                 29                 :  * blocks directly.
                                 30                 :  */
                                 31                 : typedef uint32 BlockNumber;
                                 32                 : 
                                 33                 : #define InvalidBlockNumber      ((BlockNumber) 0xFFFFFFFF)
                                 34                 : 
                                 35                 : #define MaxBlockNumber          ((BlockNumber) 0xFFFFFFFE)
                                 36                 : 
                                 37                 : /*
                                 38                 :  * BlockId:
                                 39                 :  *
                                 40                 :  * this is a storage type for BlockNumber.  in other words, this type
                                 41                 :  * is used for on-disk structures (e.g., in HeapTupleData) whereas
                                 42                 :  * BlockNumber is the type on which calculations are performed (e.g.,
                                 43                 :  * in access method code).
                                 44                 :  *
                                 45                 :  * there doesn't appear to be any reason to have separate types except
                                 46                 :  * for the fact that BlockIds can be SHORTALIGN'd (and therefore any
                                 47                 :  * structures that contains them, such as ItemPointerData, can also be
                                 48                 :  * SHORTALIGN'd).  this is an important consideration for reducing the
                                 49                 :  * space requirements of the line pointer (ItemIdData) array on each
                                 50                 :  * page and the header of each heap or index tuple, so it doesn't seem
                                 51                 :  * wise to change this without good reason.
                                 52                 :  */
                                 53                 : typedef struct BlockIdData
                                 54                 : {
                                 55                 :     uint16      bi_hi;
                                 56                 :     uint16      bi_lo;
                                 57                 : } BlockIdData;
                                 58                 : 
                                 59                 : typedef BlockIdData *BlockId;   /* block identifier */
                                 60                 : 
                                 61                 : /* ----------------
                                 62                 :  *      support functions
                                 63                 :  * ----------------
                                 64                 :  */
                                 65                 : 
                                 66                 : /*
                                 67                 :  * BlockNumberIsValid
                                 68                 :  *      True iff blockNumber is valid.
                                 69                 :  */
                                 70                 : static inline bool
  276 peter                      71 GNC   168154934 : BlockNumberIsValid(BlockNumber blockNumber)
                                 72                 : {
                                 73       168154934 :     return blockNumber != InvalidBlockNumber;
                                 74                 : }
                                 75                 : 
                                 76                 : /*
 8720 bruce                      77 ECB             :  * BlockIdSet
                                 78                 :  *      Sets a block identifier to the specified value.
 9720 scrappy                    79                 :  */
                                 80                 : static inline void
  276 peter                      81 GNC   690697407 : BlockIdSet(BlockIdData *blockId, BlockNumber blockNumber)
                                 82                 : {
                                 83       690697407 :     blockId->bi_hi = blockNumber >> 16;
                                 84       690697407 :     blockId->bi_lo = blockNumber & 0xffff;
                                 85       690697407 : }
                                 86                 : 
                                 87                 : /*
                                 88                 :  * BlockIdEquals
                                 89                 :  *      Check for block number equality.
 9720 scrappy                    90 ECB             :  */
                                 91                 : static inline bool
                                 92                 : BlockIdEquals(const BlockIdData *blockId1, const BlockIdData *blockId2)
                                 93                 : {
                                 94                 :     return (blockId1->bi_hi == blockId2->bi_hi &&
                                 95                 :             blockId1->bi_lo == blockId2->bi_lo);
                                 96                 : }
                                 97                 : 
                                 98                 : /*
                                 99                 :  * BlockIdGetBlockNumber
                                100                 :  *      Retrieve the block number from a block identifier.
                                101                 :  */
                                102                 : static inline BlockNumber
  276 peter                     103 GNC   420768848 : BlockIdGetBlockNumber(const BlockIdData *blockId)
                                104                 : {
                                105       420768848 :     return (((BlockNumber) blockId->bi_hi) << 16) | ((BlockNumber) blockId->bi_lo);
                                106                 : }
                                107                 : 
                                108                 : #endif                          /* BLOCK_H */
        

Generated by: LCOV version v1.16-55-g56c0a2a