/* Switch to the next index */
zn = ubifs_tnc_find_child(znode->parent, iip + 1); if (!zn) { /* No more children to look at, we have walk up */
iip = znode->parent->child_cnt; continue;
}
/* Walk back down to the level we came from ('level') */ while (zn->level != level) {
znode = zn;
zn = ubifs_tnc_find_child(zn, 0); if (!zn) { /* *Thispathisnottoodeepsoitdoesnot *reach'level'.Trynextpath.
*/
iip = znode->iip; break;
}
}
ubifs_assert(c, znode); if (unlikely(!znode->parent)) return NULL;
/* Switch to the next index in the parent */
zn = ubifs_tnc_find_child(znode->parent, znode->iip + 1); if (!zn) /* This is in fact the last child, return parent */ return znode->parent;
/* Go to the first znode in this new subtree */ return ubifs_tnc_postorder_first(zn);
}
/** *ubifs_destroy_tnc_subtree-destroyallznodesconnectedtoasubtree. *@c:UBIFSfile-systemdescriptionobject *@znode:znodedefiningsubtreetodestroy * *ThisfunctiondestroyssubtreeoftheTNCtree.Returnsnumberofclean *znodesinthesubtree.
*/ long ubifs_destroy_tnc_subtree(conststruct ubifs_info *c, struct ubifs_znode *znode)
{ struct ubifs_znode *zn = ubifs_tnc_postorder_first(znode); long clean_freed = 0; int n;
ubifs_assert(c, zn); while (1) { for (n = 0; n < zn->child_cnt; n++) { if (!zn->zbranch[n].znode) continue;
if (zn->level > 0 &&
!ubifs_zn_dirty(zn->zbranch[n].znode))
clean_freed += 1;
cond_resched();
kfree(zn->zbranch[n].znode);
}
if (zn == znode) { if (!ubifs_zn_dirty(zn))
clean_freed += 1;
kfree(zn); return clean_freed;
}
zn = ubifs_tnc_postorder_next(c, zn);
}
}
/** *ubifs_destroy_tnc_tree-destroyallznodesconnectedtotheTNCtree. *@c:UBIFSfile-systemdescriptionobject * *ThisfunctiondestroysthewholeTNCtreeandupdatescleanglobalznode *count.
*/ void ubifs_destroy_tnc_tree(struct ubifs_info *c)
{ long n, freed;
switch (key_type(c, &zbr->key)) { case UBIFS_INO_KEY: case UBIFS_DATA_KEY: case UBIFS_DENT_KEY: case UBIFS_XENT_KEY: break; default:
ubifs_err(c, "bad key type at slot %d: %d",
i, key_type(c, &zbr->key));
err = 3; goto out_dump;
}
if (znode->level) continue;
type = key_type(c, &zbr->key); if (c->ranges[type].max_len == 0) { if (zbr->len != c->ranges[type].len) {
ubifs_err(c, "bad target node (type %d) length (%d)",
type, zbr->len);
ubifs_err(c, "have to be %d", c->ranges[type].len);
err = 4; goto out_dump;
}
} elseif (zbr->len < c->ranges[type].min_len ||
zbr->len > c->ranges[type].max_len) {
ubifs_err(c, "bad target node (type %d) length (%d)",
type, zbr->len);
ubifs_err(c, "have to be in range of %d-%d",
c->ranges[type].min_len,
c->ranges[type].max_len);
err = 5; goto out_dump;
}
}
/* *Ensurethatthenextkeyisgreaterorequivalenttothe *previousone.
*/ for (i = 0; i < znode->child_cnt - 1; i++) { constunion ubifs_key *key1, *key2;
cmp = keys_cmp(c, key1, key2); if (cmp > 0) {
ubifs_err(c, "bad key order (keys %d and %d)", i, i + 1);
err = 6; goto out_dump;
} elseif (cmp == 0 && !is_hash_key(c, key1)) { /* These can only be keys with colliding hash */
ubifs_err(c, "keys %d and %d are not hashed but equivalent",
i, i + 1);
err = 7; goto out_dump;
}
}
/* Make sure the key of the read node is correct */
key_read(c, node + UBIFS_KEY_OFFSET, &key1); if (!keys_eq(c, key, &key1)) {
ubifs_err(c, "bad key in node at LEB %d:%d",
zbr->lnum, zbr->offs);
dbg_tnck(key, "looked for key ");
dbg_tnck(&key1, "but found node's key ");
ubifs_dump_node(c, node, zbr->len); return -EINVAL;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.