LCOV - code coverage report
Current view: top level - fsck - util.h (source / functions) Coverage Total Hit
Test: gfs2-utils.info Lines: 96.2 % 26 25
Test Date: 2024-03-07 16:24:06 Functions: 100.0 % 6 6

            Line data    Source code
       1              : #ifndef __UTIL_H__
       2              : #define __UTIL_H__
       3              : 
       4              : #include <sys/stat.h>
       5              : 
       6              : #include "fsck.h"
       7              : #include "libgfs2.h"
       8              : 
       9              : #define INODE_VALID 1
      10              : #define INODE_INVALID 0
      11              : 
      12              : struct di_info *search_list(osi_list_t *list, uint64_t addr);
      13              : void big_file_comfort(struct fsck_cx *cx, struct lgfs2_inode *ip, uint64_t blks_checked);
      14              : void display_progress(uint64_t block);
      15              : int add_duplicate_ref(struct fsck_cx *cx, struct lgfs2_inode *ip, uint64_t block,
      16              :                       enum dup_ref_type reftype, int first, int inode_valid);
      17              : extern struct inode_with_dups *find_dup_ref_inode(struct duptree *dt,
      18              :                                                   struct lgfs2_inode *ip);
      19              : extern void dup_listent_delete(struct duptree *dt, struct inode_with_dups *id);
      20              : extern int count_dup_meta_refs(struct duptree *dt);
      21              : extern const char *reftypes[REF_TYPES + 1];
      22              : 
      23              : #define BLOCKMAP_SIZE1(size) ((size) >> 3)
      24              : #define BLOCKMAP_SIZE2(size) ((size) >> 2)
      25              : #define BLOCKMAP_BYTE_OFFSET2(x) ((x & 0x0000000000000003) << 1)
      26              : #define BLOCKMAP_BYTE_OFFSET1(x) (x & 0x0000000000000007)
      27              : #define BLOCKMAP_MASK2 (0x3)
      28              : #define BLOCKMAP_MASK1 (1)
      29              : 
      30              : struct fsck_pass {
      31              :         const char *name;
      32              :         int (*f)(struct fsck_cx *cx);
      33              : };
      34              : 
      35    486740344 : static inline int block_type(struct bmap *bl, uint64_t bblock)
      36              : {
      37              :         static unsigned char *byte;
      38              :         static uint64_t b;
      39              :         static int btype;
      40              : 
      41    486740344 :         byte = bl->map + BLOCKMAP_SIZE2(bblock);
      42    486740344 :         b = BLOCKMAP_BYTE_OFFSET2(bblock);
      43    486740344 :         btype = (*byte & (BLOCKMAP_MASK2 << b )) >> b;
      44    486740344 :         return btype;
      45              : }
      46              : 
      47    482882844 : static inline int link1_type(struct bmap *bl, uint64_t bblock)
      48              : {
      49              :         static unsigned char *byte;
      50              :         static uint64_t b;
      51              :         static int btype;
      52              : 
      53    482882844 :         byte = bl->map + BLOCKMAP_SIZE1(bblock);
      54    482882844 :         b = BLOCKMAP_BYTE_OFFSET1(bblock);
      55    482882844 :         btype = (*byte & (BLOCKMAP_MASK1 << b )) >> b;
      56    482882844 :         return btype;
      57              : }
      58              : 
      59          114 : static inline void link1_destroy(struct bmap *bmap)
      60              : {
      61          114 :         if (bmap->map)
      62          114 :                 free(bmap->map);
      63          114 :         bmap->size = 0;
      64          114 :         bmap->mapsize = 0;
      65          114 : }
      66              : 
      67         1396 : static inline int bitmap_type(struct lgfs2_sbd *sdp, uint64_t bblock)
      68              : {
      69              :         struct lgfs2_rgrp_tree *rgd;
      70              : 
      71         1396 :         rgd = lgfs2_blk2rgrpd(sdp, bblock);
      72         1396 :         return lgfs2_get_bitmap(sdp, bblock, rgd);
      73              : }
      74              : 
      75        65668 : static const inline char *block_type_string(int q)
      76              : {
      77        65668 :         const char *blktyp[] = {"free", "data", "other", "inode", "invalid"};
      78        65668 :         if (q >= GFS2_BLKST_FREE && q <= GFS2_BLKST_DINODE)
      79        65668 :                 return (blktyp[q]);
      80            0 :         return blktyp[4];
      81              : }
      82              : 
      83        11695 : static inline int is_dir(struct lgfs2_inode *ip)
      84              : {
      85        11695 :         return S_ISDIR(ip->i_mode);
      86              : }
      87              : 
      88              : extern enum dup_ref_type get_ref_type(struct inode_with_dups *id);
      89              : extern char generic_interrupt(const char *caller, const char *where,
      90              :                        const char *progress, const char *question,
      91              :                        const char *answers);
      92              : extern char fsck_getch(void);
      93              : extern uint64_t find_free_blk(struct lgfs2_sbd *sdp);
      94              : extern __be64 *get_dir_hash(struct lgfs2_inode *ip);
      95              : extern void delete_all_dups(struct fsck_cx *cx, struct lgfs2_inode *ip);
      96              : extern void print_pass_duration(const char *name, struct timeval *start);
      97              : 
      98              : #define stack log_debug("<backtrace> - %s()\n", __func__)
      99              : 
     100              : #endif /* __UTIL_H__ */
        

Generated by: LCOV version 2.0-1