Coverage Report

Created: 2025-06-13 06:36

/src/util-linux/libblkid/src/superblocks/vxfs.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (C) 2008 Karel Zak <kzak@redhat.com>
3
 *
4
 * This file may be redistributed under the terms of the
5
 * GNU Lesser General Public License.
6
 */
7
8
#include <stdio.h>
9
10
#include "superblocks.h"
11
12
struct vxfs_super_block {
13
  uint32_t    vs_magic;
14
  int32_t     vs_version;
15
  uint32_t    vs_ctime;
16
  uint32_t    vs_cutime;
17
  uint32_t    __unused1;
18
  uint32_t    __unused2;
19
  uint32_t    vs_old_logstart;
20
  uint32_t    vs_old_logend;
21
  uint32_t    vs_bsize;
22
  uint32_t    vs_size;
23
  uint32_t    vs_dsize;
24
};
25
26
static int probe_vxfs(blkid_probe pr, const struct blkid_idmag *mag)
27
147
{
28
147
  const struct vxfs_super_block *vxs;
29
147
  enum blkid_endianness e = mag->hint;
30
31
147
  vxs = blkid_probe_get_sb(pr, mag, struct vxfs_super_block);
32
147
  if (!vxs)
33
0
    return errno ? -errno : 1;
34
35
147
  blkid_probe_sprintf_version(pr, "%d",
36
147
            (unsigned int)blkid32_to_cpu(e, vxs->vs_version));
37
147
  blkid_probe_set_fsblocksize(pr, blkid32_to_cpu(e, vxs->vs_bsize));
38
147
  blkid_probe_set_block_size(pr, blkid32_to_cpu(e, vxs->vs_bsize));
39
147
  blkid_probe_set_fsendianness(pr, e);
40
41
147
  return 0;
42
147
}
43
44
45
const struct blkid_idinfo vxfs_idinfo =
46
{
47
  .name   = "vxfs",
48
  .usage    = BLKID_USAGE_FILESYSTEM,
49
  .probefunc  = probe_vxfs,
50
  .magics   =
51
  {
52
    { .magic = "\xf5\xfc\x01\xa5", .len = 4, .kboff = 1,
53
      .hint = BLKID_ENDIANNESS_LITTLE },
54
    { .magic = "\xa5\x01\xfc\xf5", .len = 4, .kboff = 8,
55
      .hint = BLKID_ENDIANNESS_BIG },
56
    { NULL }
57
  }
58
};
59