/* This function reads a node defined by @zbr from the flash media. Returns zero in case of success or a negative negative error code in case of failure.  */
int ubifs_tnc_read_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, void *node)
/* This function reads a node defined by @zbr from the flash media. Returns zero in case of success or a negative negative error code in case of failure.  */
int ubifs_tnc_read_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, void *node)
{
	union ubifs_key key1, *key = &zbr->key;
	int err, type = key_type(c, key);
	err = ubifs_read_node(c, node, type, zbr->len, zbr->lnum, zbr->offs);
	if (err) {
		dbg_tnc("key %s", DBGKEY(key));
		return err;
	}
	key_read(c, node + UBIFS_KEY_OFFSET, &key1);
	if (!keys_eq(c, key, &key1)) {
		ubifs_err("bad key in node at LEB %d:%d",
			  zbr->lnum, zbr->offs);
		dbg_tnc("looked for key %s found node's key %s",
			DBGKEY(key), DBGKEY1(&key1));
		dbg_dump_node(c, node);
		return -EINVAL;
	}
	return 0;
}