2 * volume_id - reads filesystem label and uuid
4 * Copyright (C) 2012 S-G Bergh <sgb@systemasis.org>
6 * Licensed under GPLv2, see file LICENSE in this source tree.
9 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_UBIFS) += ubifs.o
11 //config:config FEATURE_VOLUMEID_UBIFS
12 //config: bool "UBIFS filesystem"
14 //config: depends on VOLUMEID
16 //config: UBIFS (Unsorted Block Image File System) is a file
17 //config: system for use with raw flash memory media.
19 #include "volume_id_internal.h"
21 #define UBIFS_NODE_MAGIC 0x06101831
24 * struct ubifs_ch - common header node.
25 * @magic: UBIFS node magic number (%UBIFS_NODE_MAGIC)
26 * @crc: CRC-32 checksum of the node header
27 * @sqnum: sequence number
28 * @len: full node length
29 * @node_type: node type
30 * @group_type: node group type
31 * @padding: reserved for future, zeroes
33 * Every UBIFS node starts with this common part. If the node has a key, the
34 * key always goes next.
47 * struct ubifs_sb_node - superblock node.
49 * @padding: reserved for future, zeroes
50 * @key_hash: type of hash function used in keys
51 * @key_fmt: format of the key
52 * @flags: file-system flags (%UBIFS_FLG_BIGLPT, etc)
53 * @min_io_size: minimal input/output unit size
54 * @leb_size: logical eraseblock size in bytes
55 * @leb_cnt: count of LEBs used by file-system
56 * @max_leb_cnt: maximum count of LEBs used by file-system
57 * @max_bud_bytes: maximum amount of data stored in buds
58 * @log_lebs: log size in logical eraseblocks
59 * @lpt_lebs: number of LEBs used for lprops table
60 * @orph_lebs: number of LEBs used for recording orphans
61 * @jhead_cnt: count of journal heads
62 * @fanout: tree fanout (max. number of links per indexing node)
63 * @lsave_cnt: number of LEB numbers in LPT's save table
64 * @fmt_version: UBIFS on-flash format version
65 * @default_compr: default compression algorithm (%UBIFS_COMPR_LZO, etc)
66 * @padding1: reserved for future, zeroes
67 * @rp_uid: reserve pool UID
68 * @rp_gid: reserve pool GID
69 * @rp_size: size of the reserved pool in bytes
70 * @padding2: reserved for future, zeroes
71 * @time_gran: time granularity in nanoseconds
72 * @uuid: UUID generated when the file system image was created
73 * @ro_compat_version: UBIFS R/O compatibility version
75 struct ubifs_sb_node {
85 uint64_t max_bud_bytes;
93 uint16_t default_compr;
100 uint32_t ro_compat_version;
102 uint8_t padding2[3968];
106 int FAST_FUNC volume_id_probe_ubifs(struct volume_id *id /*,uint64_t off*/)
108 #define off ((uint64_t)0)
109 struct ubifs_sb_node *sb;
111 dbg("UBIFS: probing at offset 0x%llx", (unsigned long long) off);
112 sb = volume_id_get_buffer(id, off, sizeof(struct ubifs_sb_node));
116 if (le32_to_cpu(sb->ch.magic) != UBIFS_NODE_MAGIC)
119 IF_FEATURE_BLKID_TYPE(id->type = "ubifs";)
120 volume_id_set_uuid(id, sb->uuid, UUID_DCE);