Lines Matching defs:node
40 * UBIFS stores nodes at 64 bit-aligned addresses. If the node length is not
41 * aligned, UBIFS starts the next node from the aligned address, and the padded
43 * bytes in those small gaps. Common headers of nodes store real node lengths,
47 * uses padding nodes or padding bytes, if the padding node does not fit.
74 * ubifs_check_node - check node.
76 * @buf: node to check
82 * This function checks node magic number and CRC checksum. This function also
83 * validates node length to prevent UBIFS from becoming crazy when an attacker
85 * node length in the common header could cause UBIFS to read memory outside of
119 ubifs_err("bad node type %d", type);
152 ubifs_err("bad node length %d", node_len);
155 ubifs_err("bad node at LEB %d:%d", lnum, offs);
169 * when we have to write less data we add padding node to the write-buffer and
172 * padding node which takes %UBIFS_PAD_NODE_SZ bytes, we write padding bytes
200 /* Too little space, padding node won't fit */
229 * ubifs_prepare_node - prepare node to be written to flash.
231 * @node: the node to pad
232 * @len: node length
235 * This function prepares node at @node to be written to the media - it
236 * calculates node CRC, fills the common header, and adds proper padding up to
239 void ubifs_prepare_node(struct ubifs_info *c, void *node, int len, int pad)
242 struct ubifs_ch *ch = node;
252 crc = crc32(UBIFS_CRC32_INIT, node + 8, len - 8);
258 ubifs_pad(c, node + len, pad);
263 * ubifs_prep_grp_node - prepare node of a group to be written to flash.
265 * @node: the node to pad
266 * @len: node length
267 * @last: indicates the last node of the group
269 * This function prepares node at @node to be written to the media - it
270 * calculates node CRC and fills the common header.
272 void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last)
275 struct ubifs_ch *ch = node;
288 crc = crc32(UBIFS_CRC32_INIT, node + 8, len - 8);
497 * @buf: node to write
498 * @len: node length
501 * the last piece of the node won't reach the flash media immediately if it
502 * does not take whole minimal I/O unit. Instead, the node will sit in RAM
506 * case of failure. If the node cannot be written because there is no more
535 * The node is not very large and fits entirely within
566 * The node is large enough and does not fit entirely within current
586 * We align node length to 8-byte boundary because we anyway flash wbuf
642 * ubifs_write_node - write node to the media.
644 * @buf: the node to write
645 * @len: node length
648 * @dtype: node life-time hint (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN)
650 * This function automatically fills node magic number, assigns sequence
651 * number, and calculates node CRC checksum. The length of the @buf buffer has
653 * appends padding node and padding bytes if needed. Returns zero in case of
683 * ubifs_read_node_wbuf - read node from the media or write-buffer.
686 * @type: node type
687 * @len: node length
691 * This function reads a node of known type and length, checks it and stores
692 * in @buf. If the node partially or fully sits in the write-buffer, this
731 ubifs_err("failed to read node %d from LEB %d:%d, "
739 ubifs_err("bad node type (%d but expected %d)",
746 ubifs_err("expected node type %d", type);
752 ubifs_err("bad node length %d, expected %d", rlen, len);
759 ubifs_err("bad node at LEB %d:%d", lnum, offs);
766 * ubifs_read_node - read node.
769 * @type: node type
770 * @len: node length (not aligned)
774 * This function reads a node of known type and and length, checks it and
792 ubifs_err("cannot read node %d from LEB %d:%d, error %d",
798 ubifs_err("bad node type (%d but expected %d)",
805 ubifs_err("expected node type %d", type);
811 ubifs_err("bad node length %d, expected %d", l, len);
818 ubifs_err("bad node at LEB %d:%d", lnum, offs);
929 * a _copy_ of corresponding on-flash node which sits