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