comparison pirollback/treewalk.c @ 43:9f4469766c74

pirollback: tree walk implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 06 Jul 2013 20:52:09 +0000
parents
children
comparison
equal deleted inserted replaced
42:15c2ac2c5c73 43:9f4469766c74
1 #include <sys/types.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include "types.h"
5 #include "struct.h"
6
7 extern struct inode_info inode[];
8 extern int last_inode;
9
10 static void
11 walk_level(curlev)
12 {
13 int child;
14
15 for (child = inode[curlev].descend; child;
16 child = inode[child].sibling) {
17 inode[child].parent = curlev;
18 walk_level(child);
19 }
20 }
21
22 walk_tree()
23 {
24 if (inode[1].type != 0xF2 || *(inode[1].dataptr) != '/' ||
25 inode[1].sibling) {
26 fprintf(stderr, "error: inode #1 is not the active root\n");
27 exit(1);
28 }
29 walk_level(1);
30 }