Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * This file is part of UBIFS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2006-2008 Nokia Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Authors: Artem Bityutskiy (Битюцкий Артём)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *          Adrian Hunter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * This file describes UBIFS on-flash format and contains definitions of all the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * relevant data structures and constants.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * All UBIFS on-flash objects are stored in the form of nodes. All nodes start
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * with the UBIFS node magic number and have the same common header. Nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * always sit at 8-byte aligned positions on the media and node header sizes are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * also 8-byte aligned (except for the indexing node and the padding node).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #ifndef __UBIFS_MEDIA_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define __UBIFS_MEDIA_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) /* UBIFS node magic number (must not have the padding byte first or last) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define UBIFS_NODE_MAGIC  0x06101831
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * UBIFS on-flash format version. This version is increased when the on-flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * format is changing. If this happens, UBIFS is will support older versions as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * well. But older UBIFS code will not support newer formats. Format changes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * will be rare and only when absolutely necessary, e.g. to fix a bug or to add
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * a new feature.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * UBIFS went into mainline kernel with format version 4. The older formats
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * were development formats.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define UBIFS_FORMAT_VERSION 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * Read-only compatibility version. If the UBIFS format is changed, older UBIFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  * implementations will not be able to mount newer formats in read-write mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * However, depending on the change, it may be possible to mount newer formats
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * in R/O mode. This is indicated by the R/O compatibility version which is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * stored in the super-block.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  * This is needed to support boot-loaders which only need R/O mounting. With
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * this flag it is possible to do UBIFS format changes without a need to update
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * boot-loaders.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define UBIFS_RO_COMPAT_VERSION 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) /* Minimum logical eraseblock size in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #define UBIFS_MIN_LEB_SZ (15*1024)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) /* Initial CRC32 value used when calculating CRC checksums */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #define UBIFS_CRC32_INIT 0xFFFFFFFFU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  * UBIFS does not try to compress data if its length is less than the below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * constant.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #define UBIFS_MIN_COMPR_LEN 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * If compressed data length is less than %UBIFS_MIN_COMPRESS_DIFF bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  * shorter than uncompressed data length, UBIFS prefers to leave this data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  * node uncompress, because it'll be read faster.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #define UBIFS_MIN_COMPRESS_DIFF 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) /* Root inode number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) #define UBIFS_ROOT_INO 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) /* Lowest inode number used for regular inodes (not UBIFS-only internal ones) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) #define UBIFS_FIRST_INO 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  * Maximum file name and extended attribute length (must be a multiple of 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  * minus 1).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) #define UBIFS_MAX_NLEN 255
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) /* Maximum number of data journal heads */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #define UBIFS_MAX_JHEADS 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * Size of UBIFS data block. Note, UBIFS is not a block oriented file-system,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * which means that it does not treat the underlying media as consisting of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * blocks like in case of hard drives. Do not be confused. UBIFS block is just
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * the maximum amount of data which one data node can have or which can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  * attached to an inode node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) #define UBIFS_BLOCK_SIZE  4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #define UBIFS_BLOCK_SHIFT 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) /* UBIFS padding byte pattern (must not be first or last byte of node magic) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #define UBIFS_PADDING_BYTE 0xCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) /* Maximum possible key length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define UBIFS_MAX_KEY_LEN 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) /* Key length ("simple" format) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define UBIFS_SK_LEN 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /* Minimum index tree fanout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #define UBIFS_MIN_FANOUT 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) /* Maximum number of levels in UBIFS indexing B-tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #define UBIFS_MAX_LEVELS 512
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) /* Maximum amount of data attached to an inode in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #define UBIFS_MAX_INO_DATA UBIFS_BLOCK_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) /* LEB Properties Tree fanout (must be power of 2) and fanout shift */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #define UBIFS_LPT_FANOUT 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #define UBIFS_LPT_FANOUT_SHIFT 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /* LEB Properties Tree bit field sizes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #define UBIFS_LPT_CRC_BITS 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #define UBIFS_LPT_CRC_BYTES 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #define UBIFS_LPT_TYPE_BITS 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) /* The key is always at the same position in all keyed nodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define UBIFS_KEY_OFFSET offsetof(struct ubifs_ino_node, key)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) /* Garbage collector journal head number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define UBIFS_GC_HEAD   0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) /* Base journal head number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #define UBIFS_BASE_HEAD 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) /* Data journal head number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #define UBIFS_DATA_HEAD 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * LEB Properties Tree node types.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * UBIFS_LPT_PNODE: LPT leaf node (contains LEB properties)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  * UBIFS_LPT_NNODE: LPT internal node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)  * UBIFS_LPT_LTAB: LPT's own lprops table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  * UBIFS_LPT_LSAVE: LPT's save table (big model only)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  * UBIFS_LPT_NODE_CNT: count of LPT node types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  * UBIFS_LPT_NOT_A_NODE: all ones (15 for 4 bits) is never a valid node type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	UBIFS_LPT_PNODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	UBIFS_LPT_NNODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	UBIFS_LPT_LTAB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	UBIFS_LPT_LSAVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	UBIFS_LPT_NODE_CNT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	UBIFS_LPT_NOT_A_NODE = (1 << UBIFS_LPT_TYPE_BITS) - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)  * UBIFS inode types.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)  * UBIFS_ITYPE_REG: regular file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)  * UBIFS_ITYPE_DIR: directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)  * UBIFS_ITYPE_LNK: soft link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  * UBIFS_ITYPE_BLK: block device node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * UBIFS_ITYPE_CHR: character device node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  * UBIFS_ITYPE_FIFO: fifo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  * UBIFS_ITYPE_SOCK: socket
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  * UBIFS_ITYPES_CNT: count of supported file types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	UBIFS_ITYPE_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	UBIFS_ITYPE_DIR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	UBIFS_ITYPE_LNK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	UBIFS_ITYPE_BLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	UBIFS_ITYPE_CHR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	UBIFS_ITYPE_FIFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	UBIFS_ITYPE_SOCK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	UBIFS_ITYPES_CNT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  * Supported key hash functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)  * UBIFS_KEY_HASH_R5: R5 hash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)  * UBIFS_KEY_HASH_TEST: test hash which just returns first 4 bytes of the name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	UBIFS_KEY_HASH_R5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	UBIFS_KEY_HASH_TEST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)  * Supported key formats.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  * UBIFS_SIMPLE_KEY_FMT: simple key format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	UBIFS_SIMPLE_KEY_FMT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)  * The simple key format uses 29 bits for storing UBIFS block number and hash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)  * value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) #define UBIFS_S_KEY_BLOCK_BITS 29
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #define UBIFS_S_KEY_BLOCK_MASK 0x1FFFFFFF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #define UBIFS_S_KEY_HASH_BITS  UBIFS_S_KEY_BLOCK_BITS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #define UBIFS_S_KEY_HASH_MASK  UBIFS_S_KEY_BLOCK_MASK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  * Key types.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  * UBIFS_INO_KEY: inode node key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * UBIFS_DATA_KEY: data node key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  * UBIFS_DENT_KEY: directory entry node key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * UBIFS_XENT_KEY: extended attribute entry key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  * UBIFS_KEY_TYPES_CNT: number of supported key types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	UBIFS_INO_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	UBIFS_DATA_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	UBIFS_DENT_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	UBIFS_XENT_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	UBIFS_KEY_TYPES_CNT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) /* Count of LEBs reserved for the superblock area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) #define UBIFS_SB_LEBS 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) /* Count of LEBs reserved for the master area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) #define UBIFS_MST_LEBS 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) /* First LEB of the superblock area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) #define UBIFS_SB_LNUM 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) /* First LEB of the master area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) #define UBIFS_MST_LNUM (UBIFS_SB_LNUM + UBIFS_SB_LEBS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) /* First LEB of the log area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) #define UBIFS_LOG_LNUM (UBIFS_MST_LNUM + UBIFS_MST_LEBS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  * The below constants define the absolute minimum values for various UBIFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  * media areas. Many of them actually depend of flash geometry and the FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)  * configuration (number of journal heads, orphan LEBs, etc). This means that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)  * the smallest volume size which can be used for UBIFS cannot be pre-defined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)  * by these constants. The file-system that meets the below limitation will not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  * necessarily mount. UBIFS does run-time calculations and validates the FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  * size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) /* Minimum number of logical eraseblocks in the log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #define UBIFS_MIN_LOG_LEBS 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) /* Minimum number of bud logical eraseblocks (one for each head) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) #define UBIFS_MIN_BUD_LEBS 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) /* Minimum number of journal logical eraseblocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) #define UBIFS_MIN_JNL_LEBS (UBIFS_MIN_LOG_LEBS + UBIFS_MIN_BUD_LEBS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) /* Minimum number of LPT area logical eraseblocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) #define UBIFS_MIN_LPT_LEBS 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /* Minimum number of orphan area logical eraseblocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) #define UBIFS_MIN_ORPH_LEBS 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)  * Minimum number of main area logical eraseblocks (buds, 3 for the index, 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)  * for GC, 1 for deletions, and at least 1 for committed data).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) #define UBIFS_MIN_MAIN_LEBS (UBIFS_MIN_BUD_LEBS + 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) /* Minimum number of logical eraseblocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) #define UBIFS_MIN_LEB_CNT (UBIFS_SB_LEBS + UBIFS_MST_LEBS + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 			   UBIFS_MIN_LOG_LEBS + UBIFS_MIN_LPT_LEBS + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 			   UBIFS_MIN_ORPH_LEBS + UBIFS_MIN_MAIN_LEBS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) /* Node sizes (N.B. these are guaranteed to be multiples of 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) #define UBIFS_CH_SZ        sizeof(struct ubifs_ch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) #define UBIFS_INO_NODE_SZ  sizeof(struct ubifs_ino_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) #define UBIFS_DATA_NODE_SZ sizeof(struct ubifs_data_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) #define UBIFS_DENT_NODE_SZ sizeof(struct ubifs_dent_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) #define UBIFS_TRUN_NODE_SZ sizeof(struct ubifs_trun_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) #define UBIFS_PAD_NODE_SZ  sizeof(struct ubifs_pad_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) #define UBIFS_SB_NODE_SZ   sizeof(struct ubifs_sb_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) #define UBIFS_MST_NODE_SZ  sizeof(struct ubifs_mst_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) #define UBIFS_REF_NODE_SZ  sizeof(struct ubifs_ref_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) #define UBIFS_IDX_NODE_SZ  sizeof(struct ubifs_idx_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) #define UBIFS_CS_NODE_SZ   sizeof(struct ubifs_cs_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) #define UBIFS_ORPH_NODE_SZ sizeof(struct ubifs_orph_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) #define UBIFS_AUTH_NODE_SZ sizeof(struct ubifs_auth_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) #define UBIFS_SIG_NODE_SZ  sizeof(struct ubifs_sig_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) /* Extended attribute entry nodes are identical to directory entry nodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) #define UBIFS_XENT_NODE_SZ UBIFS_DENT_NODE_SZ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) /* Only this does not have to be multiple of 8 bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) #define UBIFS_BRANCH_SZ    sizeof(struct ubifs_branch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) /* Maximum node sizes (N.B. these are guaranteed to be multiples of 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) #define UBIFS_MAX_DATA_NODE_SZ  (UBIFS_DATA_NODE_SZ + UBIFS_BLOCK_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) #define UBIFS_MAX_INO_NODE_SZ   (UBIFS_INO_NODE_SZ + UBIFS_MAX_INO_DATA)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) #define UBIFS_MAX_DENT_NODE_SZ  (UBIFS_DENT_NODE_SZ + UBIFS_MAX_NLEN + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) #define UBIFS_MAX_XENT_NODE_SZ  UBIFS_MAX_DENT_NODE_SZ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) /* The largest UBIFS node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) #define UBIFS_MAX_NODE_SZ UBIFS_MAX_INO_NODE_SZ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) /* The maxmimum size of a hash, enough for sha512 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) #define UBIFS_MAX_HASH_LEN 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) /* The maxmimum size of a hmac, enough for hmac(sha512) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) #define UBIFS_MAX_HMAC_LEN 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)  * xattr name of UBIFS encryption context, we don't use a prefix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)  * nor a long name to not waste space on the flash.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) #define UBIFS_XATTR_NAME_ENCRYPTION_CONTEXT "c"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) /* Type field in ubifs_sig_node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) #define UBIFS_SIGNATURE_TYPE_PKCS7	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)  * On-flash inode flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  * UBIFS_COMPR_FL: use compression for this inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)  * UBIFS_SYNC_FL:  I/O on this inode has to be synchronous
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)  * UBIFS_IMMUTABLE_FL: inode is immutable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)  * UBIFS_APPEND_FL: writes to the inode may only append data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)  * UBIFS_DIRSYNC_FL: I/O on this directory inode has to be synchronous
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)  * UBIFS_XATTR_FL: this inode is the inode for an extended attribute value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)  * UBIFS_CRYPT_FL: use encryption for this inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)  * Note, these are on-flash flags which correspond to ioctl flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)  * (@FS_COMPR_FL, etc). They have the same values now, but generally, do not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)  * have to be the same.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	UBIFS_COMPR_FL     = 0x01,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	UBIFS_SYNC_FL      = 0x02,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	UBIFS_IMMUTABLE_FL = 0x04,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	UBIFS_APPEND_FL    = 0x08,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 	UBIFS_DIRSYNC_FL   = 0x10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	UBIFS_XATTR_FL     = 0x20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	UBIFS_CRYPT_FL     = 0x40,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) /* Inode flag bits used by UBIFS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) #define UBIFS_FL_MASK 0x0000001F
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)  * UBIFS compression algorithms.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)  * UBIFS_COMPR_NONE: no compression
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)  * UBIFS_COMPR_LZO: LZO compression
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)  * UBIFS_COMPR_ZLIB: ZLIB compression
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)  * UBIFS_COMPR_ZSTD: ZSTD compression
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)  * UBIFS_COMPR_TYPES_CNT: count of supported compression types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	UBIFS_COMPR_NONE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	UBIFS_COMPR_LZO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	UBIFS_COMPR_ZLIB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	UBIFS_COMPR_ZSTD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	UBIFS_COMPR_TYPES_CNT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)  * UBIFS node types.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)  * UBIFS_INO_NODE: inode node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)  * UBIFS_DATA_NODE: data node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)  * UBIFS_DENT_NODE: directory entry node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)  * UBIFS_XENT_NODE: extended attribute node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)  * UBIFS_TRUN_NODE: truncation node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)  * UBIFS_PAD_NODE: padding node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)  * UBIFS_SB_NODE: superblock node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)  * UBIFS_MST_NODE: master node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)  * UBIFS_REF_NODE: LEB reference node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)  * UBIFS_IDX_NODE: index node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)  * UBIFS_CS_NODE: commit start node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)  * UBIFS_ORPH_NODE: orphan node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)  * UBIFS_AUTH_NODE: authentication node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)  * UBIFS_SIG_NODE: signature node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)  * UBIFS_NODE_TYPES_CNT: count of supported node types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)  * Note, we index arrays by these numbers, so keep them low and contiguous.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)  * Node type constants for inodes, direntries and so on have to be the same as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)  * corresponding key type constants.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	UBIFS_INO_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	UBIFS_DATA_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	UBIFS_DENT_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	UBIFS_XENT_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	UBIFS_TRUN_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	UBIFS_PAD_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	UBIFS_SB_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	UBIFS_MST_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	UBIFS_REF_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	UBIFS_IDX_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	UBIFS_CS_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	UBIFS_ORPH_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	UBIFS_AUTH_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	UBIFS_SIG_NODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	UBIFS_NODE_TYPES_CNT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)  * Master node flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)  * UBIFS_MST_DIRTY: rebooted uncleanly - master node is dirty
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)  * UBIFS_MST_NO_ORPHS: no orphan inodes present
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)  * UBIFS_MST_RCVRY: written by recovery
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	UBIFS_MST_DIRTY = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	UBIFS_MST_NO_ORPHS = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	UBIFS_MST_RCVRY = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)  * Node group type (used by recovery to recover whole group or none).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)  * UBIFS_NO_NODE_GROUP: this node is not part of a group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)  * UBIFS_IN_NODE_GROUP: this node is a part of a group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)  * UBIFS_LAST_OF_NODE_GROUP: this node is the last in a group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	UBIFS_NO_NODE_GROUP = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	UBIFS_IN_NODE_GROUP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	UBIFS_LAST_OF_NODE_GROUP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)  * Superblock flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)  * UBIFS_FLG_BIGLPT: if "big" LPT model is used if set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)  * UBIFS_FLG_SPACE_FIXUP: first-mount "fixup" of free space within LEBs needed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)  * UBIFS_FLG_DOUBLE_HASH: store a 32bit cookie in directory entry nodes to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)  *			  support 64bit cookies for lookups by hash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)  * UBIFS_FLG_ENCRYPTION: this filesystem contains encrypted files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)  * UBIFS_FLG_AUTHENTICATION: this filesystem contains hashes for authentication
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 	UBIFS_FLG_BIGLPT = 0x02,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	UBIFS_FLG_SPACE_FIXUP = 0x04,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 	UBIFS_FLG_DOUBLE_HASH = 0x08,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	UBIFS_FLG_ENCRYPTION = 0x10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 	UBIFS_FLG_AUTHENTICATION = 0x20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) #define UBIFS_FLG_MASK (UBIFS_FLG_BIGLPT | UBIFS_FLG_SPACE_FIXUP | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 		UBIFS_FLG_DOUBLE_HASH | UBIFS_FLG_ENCRYPTION | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 		UBIFS_FLG_AUTHENTICATION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)  * struct ubifs_ch - common header node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)  * @magic: UBIFS node magic number (%UBIFS_NODE_MAGIC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)  * @crc: CRC-32 checksum of the node header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)  * @sqnum: sequence number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)  * @len: full node length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449)  * @node_type: node type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)  * @group_type: node group type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)  * @padding: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453)  * Every UBIFS node starts with this common part. If the node has a key, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)  * key always goes next.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) struct ubifs_ch {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 	__le32 magic;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 	__le32 crc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 	__le64 sqnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 	__le32 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 	__u8 node_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 	__u8 group_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 	__u8 padding[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)  * union ubifs_dev_desc - device node descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468)  * @new: new type device descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)  * @huge: huge type device descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)  * This data structure describes major/minor numbers of a device node. In an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)  * inode is a device node then its data contains an object of this type. UBIFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)  * uses standard Linux "new" and "huge" device node encodings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) union ubifs_dev_desc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 	__le32 new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 	__le64 huge;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481)  * struct ubifs_ino_node - inode node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)  * @key: node key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)  * @creat_sqnum: sequence number at time of creation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)  * @size: inode size in bytes (amount of uncompressed data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)  * @atime_sec: access time seconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487)  * @ctime_sec: creation time seconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)  * @mtime_sec: modification time seconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)  * @atime_nsec: access time nanoseconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)  * @ctime_nsec: creation time nanoseconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)  * @mtime_nsec: modification time nanoseconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492)  * @nlink: number of hard links
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)  * @uid: owner ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494)  * @gid: group ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495)  * @mode: access flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)  * @flags: per-inode flags (%UBIFS_COMPR_FL, %UBIFS_SYNC_FL, etc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497)  * @data_len: inode data length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498)  * @xattr_cnt: count of extended attributes this inode has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)  * @xattr_size: summarized size of all extended attributes in bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500)  * @padding1: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)  * @xattr_names: sum of lengths of all extended attribute names belonging to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502)  *               this inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503)  * @compr_type: compression type used for this inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504)  * @padding2: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)  * @data: data attached to the inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507)  * Note, even though inode compression type is defined by @compr_type, some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508)  * nodes of this inode may be compressed with different compressor - this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509)  * happens if compression type is changed while the inode already has data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510)  * nodes. But @compr_type will be use for further writes to the inode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512)  * Note, do not forget to amend 'zero_ino_node_unused()' function when changing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513)  * the padding fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) struct ubifs_ino_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 	__u8 key[UBIFS_MAX_KEY_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 	__le64 creat_sqnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 	__le64 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 	__le64 atime_sec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 	__le64 ctime_sec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 	__le64 mtime_sec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 	__le32 atime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 	__le32 ctime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 	__le32 mtime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 	__le32 nlink;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 	__le32 uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 	__le32 gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 	__le32 mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 	__le32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 	__le32 data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 	__le32 xattr_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 	__le32 xattr_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 	__u8 padding1[4]; /* Watch 'zero_ino_node_unused()' if changing! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 	__le32 xattr_names;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 	__le16 compr_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 	__u8 padding2[26]; /* Watch 'zero_ino_node_unused()' if changing! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 	__u8 data[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542)  * struct ubifs_dent_node - directory entry node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)  * @key: node key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)  * @inum: target inode number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546)  * @padding1: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547)  * @type: type of the target inode (%UBIFS_ITYPE_REG, %UBIFS_ITYPE_DIR, etc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548)  * @nlen: name length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)  * @cookie: A 32bits random number, used to construct a 64bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550)  *          identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551)  * @name: zero-terminated name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553)  * Note, do not forget to amend 'zero_dent_node_unused()' function when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554)  * changing the padding fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) struct ubifs_dent_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) 	__u8 key[UBIFS_MAX_KEY_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 	__le64 inum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) 	__u8 padding1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 	__u8 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) 	__le16 nlen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 	__le32 cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 	__u8 name[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568)  * struct ubifs_data_node - data node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)  * @key: node key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571)  * @size: uncompressed data size in bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572)  * @compr_type: compression type (%UBIFS_COMPR_NONE, %UBIFS_COMPR_LZO, etc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573)  * @compr_size: compressed data size in bytes, only valid when data is encrypted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574)  * @data: data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) struct ubifs_data_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 	__u8 key[UBIFS_MAX_KEY_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 	__le32 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 	__le16 compr_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 	__le16 compr_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 	__u8 data[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587)  * struct ubifs_trun_node - truncation node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589)  * @inum: truncated inode number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590)  * @padding: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591)  * @old_size: size before truncation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592)  * @new_size: size after truncation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594)  * This node exists only in the journal and never goes to the main area. Note,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595)  * do not forget to amend 'zero_trun_node_unused()' function when changing the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596)  * padding fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) struct ubifs_trun_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 	__le32 inum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 	__u8 padding[12]; /* Watch 'zero_trun_node_unused()' if changing! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 	__le64 old_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 	__le64 new_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607)  * struct ubifs_pad_node - padding node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609)  * @pad_len: how many bytes after this node are unused (because padded)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610)  * @padding: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) struct ubifs_pad_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) 	__le32 pad_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618)  * struct ubifs_sb_node - superblock node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620)  * @padding: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621)  * @key_hash: type of hash function used in keys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622)  * @key_fmt: format of the key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623)  * @flags: file-system flags (%UBIFS_FLG_BIGLPT, etc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624)  * @min_io_size: minimal input/output unit size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625)  * @leb_size: logical eraseblock size in bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626)  * @leb_cnt: count of LEBs used by file-system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627)  * @max_leb_cnt: maximum count of LEBs used by file-system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628)  * @max_bud_bytes: maximum amount of data stored in buds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629)  * @log_lebs: log size in logical eraseblocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630)  * @lpt_lebs: number of LEBs used for lprops table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631)  * @orph_lebs: number of LEBs used for recording orphans
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632)  * @jhead_cnt: count of journal heads
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633)  * @fanout: tree fanout (max. number of links per indexing node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634)  * @lsave_cnt: number of LEB numbers in LPT's save table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635)  * @fmt_version: UBIFS on-flash format version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636)  * @default_compr: default compression algorithm (%UBIFS_COMPR_LZO, etc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637)  * @padding1: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638)  * @rp_uid: reserve pool UID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639)  * @rp_gid: reserve pool GID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640)  * @rp_size: size of the reserved pool in bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641)  * @padding2: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642)  * @time_gran: time granularity in nanoseconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643)  * @uuid: UUID generated when the file system image was created
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644)  * @ro_compat_version: UBIFS R/O compatibility version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645)  * @hmac: HMAC to authenticate the superblock node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646)  * @hmac_wkm: HMAC of a well known message (the string "UBIFS") as a convenience
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647)  *            to the user to check if the correct key is passed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648)  * @hash_algo: The hash algo used for this filesystem (one of enum hash_algo)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649)  * @hash_mst: hash of the master node, only valid for signed images in which the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650)  *            master node does not contain a hmac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) struct ubifs_sb_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) 	__u8 padding[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) 	__u8 key_hash;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 	__u8 key_fmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) 	__le32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 	__le32 min_io_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) 	__le32 leb_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) 	__le32 leb_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) 	__le32 max_leb_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) 	__le64 max_bud_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 	__le32 log_lebs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) 	__le32 lpt_lebs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 	__le32 orph_lebs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) 	__le32 jhead_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 	__le32 fanout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) 	__le32 lsave_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 	__le32 fmt_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) 	__le16 default_compr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) 	__u8 padding1[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) 	__le32 rp_uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) 	__le32 rp_gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) 	__le64 rp_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) 	__le32 time_gran;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) 	__u8 uuid[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) 	__le32 ro_compat_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) 	__u8 hmac[UBIFS_MAX_HMAC_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) 	__u8 hmac_wkm[UBIFS_MAX_HMAC_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) 	__le16 hash_algo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) 	__u8 hash_mst[UBIFS_MAX_HASH_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) 	__u8 padding2[3774];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686)  * struct ubifs_mst_node - master node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688)  * @highest_inum: highest inode number in the committed index
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689)  * @cmt_no: commit number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690)  * @flags: various flags (%UBIFS_MST_DIRTY, etc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691)  * @log_lnum: start of the log
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692)  * @root_lnum: LEB number of the root indexing node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693)  * @root_offs: offset within @root_lnum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694)  * @root_len: root indexing node length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695)  * @gc_lnum: LEB reserved for garbage collection (%-1 value means the LEB was
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696)  * not reserved and should be reserved on mount)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697)  * @ihead_lnum: LEB number of index head
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698)  * @ihead_offs: offset of index head
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699)  * @index_size: size of index on flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700)  * @total_free: total free space in bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701)  * @total_dirty: total dirty space in bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702)  * @total_used: total used space in bytes (includes only data LEBs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703)  * @total_dead: total dead space in bytes (includes only data LEBs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704)  * @total_dark: total dark space in bytes (includes only data LEBs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705)  * @lpt_lnum: LEB number of LPT root nnode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706)  * @lpt_offs: offset of LPT root nnode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707)  * @nhead_lnum: LEB number of LPT head
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708)  * @nhead_offs: offset of LPT head
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709)  * @ltab_lnum: LEB number of LPT's own lprops table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710)  * @ltab_offs: offset of LPT's own lprops table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711)  * @lsave_lnum: LEB number of LPT's save table (big model only)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712)  * @lsave_offs: offset of LPT's save table (big model only)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713)  * @lscan_lnum: LEB number of last LPT scan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714)  * @empty_lebs: number of empty logical eraseblocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715)  * @idx_lebs: number of indexing logical eraseblocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716)  * @leb_cnt: count of LEBs used by file-system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717)  * @hash_root_idx: the hash of the root index node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718)  * @hash_lpt: the hash of the LPT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719)  * @hmac: HMAC to authenticate the master node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720)  * @padding: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) struct ubifs_mst_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) 	__le64 highest_inum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) 	__le64 cmt_no;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) 	__le32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) 	__le32 log_lnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) 	__le32 root_lnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) 	__le32 root_offs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) 	__le32 root_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) 	__le32 gc_lnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) 	__le32 ihead_lnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) 	__le32 ihead_offs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) 	__le64 index_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) 	__le64 total_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) 	__le64 total_dirty;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) 	__le64 total_used;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) 	__le64 total_dead;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) 	__le64 total_dark;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) 	__le32 lpt_lnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) 	__le32 lpt_offs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) 	__le32 nhead_lnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) 	__le32 nhead_offs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) 	__le32 ltab_lnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) 	__le32 ltab_offs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) 	__le32 lsave_lnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) 	__le32 lsave_offs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) 	__le32 lscan_lnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) 	__le32 empty_lebs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) 	__le32 idx_lebs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) 	__le32 leb_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) 	__u8 hash_root_idx[UBIFS_MAX_HASH_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) 	__u8 hash_lpt[UBIFS_MAX_HASH_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) 	__u8 hmac[UBIFS_MAX_HMAC_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) 	__u8 padding[152];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759)  * struct ubifs_ref_node - logical eraseblock reference node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761)  * @lnum: the referred logical eraseblock number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762)  * @offs: start offset in the referred LEB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763)  * @jhead: journal head number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764)  * @padding: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) struct ubifs_ref_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) 	__le32 lnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) 	__le32 offs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) 	__le32 jhead;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) 	__u8 padding[28];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775)  * struct ubifs_auth_node - node for authenticating other nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777)  * @hmac: The HMAC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) struct ubifs_auth_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) 	__u8 hmac[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785)  * struct ubifs_sig_node - node for signing other nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787)  * @type: type of the signature, currently only UBIFS_SIGNATURE_TYPE_PKCS7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788)  * supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789)  * @len: The length of the signature data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790)  * @padding: reserved for future, zeroes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791)  * @sig: The signature data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) struct ubifs_sig_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) 	__le32 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) 	__le32 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) 	__u8 padding[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) 	__u8 sig[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802)  * struct ubifs_branch - key/reference/length branch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803)  * @lnum: LEB number of the target node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804)  * @offs: offset within @lnum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805)  * @len: target node length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806)  * @key: key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808)  * In an authenticated UBIFS we have the hash of the referenced node after @key.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809)  * This can't be added to the struct type definition because @key is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810)  * dynamically sized element already.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) struct ubifs_branch {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) 	__le32 lnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) 	__le32 offs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) 	__le32 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) 	__u8 key[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820)  * struct ubifs_idx_node - indexing node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822)  * @child_cnt: number of child index nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823)  * @level: tree level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824)  * @branches: LEB number / offset / length / key branches
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) struct ubifs_idx_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) 	__le16 child_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) 	__le16 level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) 	__u8 branches[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834)  * struct ubifs_cs_node - commit start node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836)  * @cmt_no: commit number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) struct ubifs_cs_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) 	__le64 cmt_no;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844)  * struct ubifs_orph_node - orphan node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845)  * @ch: common header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846)  * @cmt_no: commit number (also top bit is set on the last node of the commit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847)  * @inos: inode numbers of orphans
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) struct ubifs_orph_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) 	struct ubifs_ch ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) 	__le64 cmt_no;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) 	__le64 inos[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855) #endif /* __UBIFS_MEDIA_H__ */