2 * Copyright (C) 2009 Corentin Chary <corentincj@iksaif.net>
4 * This file may be redistributed under the terms of the
5 * GNU Lesser General Public License.
13 #include "superblocks.h"
16 * struct ubifs_ch - common header node.
17 * @magic: UBIFS node magic number (%UBIFS_NODE_MAGIC)
18 * @crc: CRC-32 checksum of the node header
19 * @sqnum: sequence number
20 * @len: full node length
21 * @node_type: node type
22 * @group_type: node group type
23 * @padding: reserved for future, zeroes
25 * Every UBIFS node starts with this common part. If the node has a key, the
26 * key always goes next.
36 } __attribute__ ((packed
));
39 * struct ubifs_sb_node - superblock node.
41 * @padding: reserved for future, zeroes
42 * @key_hash: type of hash function used in keys
43 * @key_fmt: format of the key
44 * @flags: file-system flags (%UBIFS_FLG_BIGLPT, etc)
45 * @min_io_size: minimal input/output unit size
46 * @leb_size: logical eraseblock size in bytes
47 * @leb_cnt: count of LEBs used by file-system
48 * @max_leb_cnt: maximum count of LEBs used by file-system
49 * @max_bud_bytes: maximum amount of data stored in buds
50 * @log_lebs: log size in logical eraseblocks
51 * @lpt_lebs: number of LEBs used for lprops table
52 * @orph_lebs: number of LEBs used for recording orphans
53 * @jhead_cnt: count of journal heads
54 * @fanout: tree fanout (max. number of links per indexing node)
55 * @lsave_cnt: number of LEB numbers in LPT's save table
56 * @fmt_version: UBIFS on-flash format version
57 * @default_compr: default compression algorithm (%UBIFS_COMPR_LZO, etc)
58 * @padding1: reserved for future, zeroes
59 * @rp_uid: reserve pool UID
60 * @rp_gid: reserve pool GID
61 * @rp_size: size of the reserved pool in bytes
62 * @padding2: reserved for future, zeroes
63 * @time_gran: time granularity in nanoseconds
64 * @uuid: UUID generated when the file system image was created
65 * @ro_compat_version: UBIFS R/O compatibility version
67 struct ubifs_sb_node
{
77 uint64_t max_bud_bytes
;
85 uint16_t default_compr
;
92 uint32_t ro_compat_version
;
93 uint8_t padding2
[3968];
94 } __attribute__ ((packed
));
96 static int probe_ubifs(blkid_probe pr
, const struct blkid_idmag
*mag
)
98 struct ubifs_sb_node
*sb
;
100 sb
= blkid_probe_get_sb(pr
, mag
, struct ubifs_sb_node
);
102 return errno
? -errno
: 1;
104 blkid_probe_set_uuid(pr
, sb
->uuid
);
105 blkid_probe_sprintf_version(pr
, "w%dr%d",
106 le32_to_cpu(sb
->fmt_version
),
107 le32_to_cpu(sb
->ro_compat_version
));
111 const struct blkid_idinfo ubifs_idinfo
=
114 .usage
= BLKID_USAGE_FILESYSTEM
,
115 .probefunc
= probe_ubifs
,
118 { .magic
= "\x31\x18\x10\x06", .len
= 4 },