LCOV - code coverage report
Current view: top level - fsck - block_list.c (source / functions) Coverage Total Hit
Test: gfs2-utils.info Lines: 29.2 % 24 7
Test Date: 2024-03-07 16:24:06 Functions: 50.0 % 4 2

            Line data    Source code
       1              : #include "clusterautoconfig.h"
       2              : 
       3              : #include <inttypes.h>
       4              : #include <unistd.h>
       5              : #include <stdio.h>
       6              : #include <stdint.h>
       7              : #include <stdlib.h>
       8              : #include <string.h>
       9              : #include <errno.h>
      10              : 
      11              : #include "fsck.h"
      12              : 
      13            4 : void special_free(struct special_blocks *blist)
      14              : {
      15              :         struct special_blocks *f;
      16              : 
      17            4 :         while(!osi_list_empty(&blist->list)) {
      18            0 :                 f = osi_list_entry(blist->list.next, struct special_blocks,
      19              :                                    list);
      20            0 :                 osi_list_del(&f->list);
      21            0 :                 free(f);
      22              :         }
      23            4 : }
      24              : 
      25      4152432 : struct special_blocks *blockfind(struct special_blocks *blist, uint64_t num)
      26              : {
      27      4152432 :         osi_list_t *head = &blist->list;
      28              :         osi_list_t *tmp;
      29              :         struct special_blocks *b;
      30              : 
      31      4152432 :         for (tmp = head->next; tmp != head; tmp = tmp->next) {
      32            0 :                 b = osi_list_entry(tmp, struct special_blocks, list);
      33            0 :                 if (b->block == num)
      34            0 :                         return b;
      35              :         }
      36      4152432 :         return NULL;
      37              : }
      38              : 
      39            0 : static void special_add(struct special_blocks *blocklist, uint64_t block)
      40              : {
      41              :         struct special_blocks *b;
      42              : 
      43            0 :         b = malloc(sizeof(struct special_blocks));
      44            0 :         if (b) {
      45            0 :                 memset(b, 0, sizeof(*b));
      46            0 :                 b->block = block;
      47            0 :                 osi_list_add_prev(&b->list, &blocklist->list);
      48              :         }
      49            0 : }
      50              : 
      51            0 : void special_set(struct special_blocks *blocklist, uint64_t block)
      52              : {
      53            0 :         if (blockfind(blocklist, block))
      54            0 :                 return;
      55            0 :         special_add(blocklist, block);
      56              : }
        

Generated by: LCOV version 2.0-1