Subversion Repositories HelenOS

Rev

Rev 1908 | Rev 1974 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1908 Rev 1972
Line 35... Line 35...
35
 *
35
 *
36
 */
36
 */
37
 
37
 
38
#include <genarch/ofw/ofw_tree.h>
38
#include <genarch/ofw/ofw_tree.h>
39
#include <arch/memstr.h>
39
#include <arch/memstr.h>
-
 
40
#include <mm/slab.h>
40
#include <func.h>
41
#include <func.h>
41
#include <print.h>
42
#include <print.h>
42
#include <panic.h>
43
#include <panic.h>
43
 
44
 
44
#define PATH_MAX_LEN    80
45
#define PATH_MAX_LEN    80
Line 234... Line 235...
234
 * @param node Root of the subtree.
235
 * @param node Root of the subtree.
235
 * @param path Current path, NULL for the very root of the entire tree.
236
 * @param path Current path, NULL for the very root of the entire tree.
236
 */
237
 */
237
static void ofw_tree_node_print(const ofw_tree_node_t *node, const char *path)
238
static void ofw_tree_node_print(const ofw_tree_node_t *node, const char *path)
238
{
239
{
-
 
240
    char *p;
-
 
241
 
239
    char p[PATH_MAX_LEN];
242
    p = (char *) malloc(PATH_MAX_LEN, 0);
240
   
243
 
241
    if (node->parent) {
244
    if (node->parent) {
242
        snprintf(p, PATH_MAX_LEN, "%s/%s", path, node->da_name);
245
        snprintf(p, PATH_MAX_LEN, "%s/%s", path, node->da_name);
243
        printf("%s\n", p);
246
        printf("%s\n", p);
244
    } else {
247
    } else {
245
        snprintf(p, PATH_MAX_LEN, "%s", node->da_name);
248
        snprintf(p, PATH_MAX_LEN, "%s", node->da_name);
246
        printf("/\n");
249
        printf("/\n");
247
    }
250
    }
248
 
251
 
249
    if (node->child)
252
    if (node->child)
250
        ofw_tree_node_print(node->child, p);
253
        ofw_tree_node_print(node->child, p);
251
   
254
 
252
    if (node->peer)
255
    if (node->peer)
253
        ofw_tree_node_print(node->peer, path);
256
        ofw_tree_node_print(node->peer, path);
-
 
257
 
-
 
258
    free(p);
254
}
259
}
255
 
260
 
256
/** Print the structure of the OpenFirmware device tree. */
261
/** Print the structure of the OpenFirmware device tree. */
257
void ofw_tree_print(void)
262
void ofw_tree_print(void)
258
{
263
{