index: mmap: read child node
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Fri, 2 Dec 2011 19:41:46 +0000 (17:41 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Sat, 3 Dec 2011 06:07:15 +0000 (04:07 -0200)
libkmod/libkmod-index.c

index 8f35ecf..c21eec7 100644 (file)
@@ -706,3 +706,14 @@ static struct index_mm_node *index_mm_readroot(struct index_mm *idx)
 {
        return index_mm_read_node(idx, idx->root_offset);
 }
+
+static struct index_mm_node *index_mm_readchild(const struct index_mm_node *parent,
+                                                                       int ch)
+{
+       if (parent->first <= ch && ch <= parent->last) {
+               return index_mm_read_node(parent->idx,
+                                       parent->children[ch - parent->first]);
+       }
+
+       return NULL;
+}