/* * Power debug tool (powerdebug) * * Copyright (C) 2016, Linaro Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ /* * Structure describing a node of the clock tree * * tail : points to the last element in the list * next : points to the next element in the list * child : points to the child node * parent : points to the parent node * depth : the recursive level of the node * path : absolute pathname of the directory * name : basename of the directory */ struct tree { struct tree *tail; struct tree *next; struct tree *prev; struct tree *child; struct tree *parent; char *path; char *name; void *private; int nrchild; unsigned char depth; }; typedef int (*tree_cb_t)(struct tree *t, void *data); typedef int (*tree_filter_t)(const char *name); extern struct tree *tree_load(const char *path, tree_filter_t filter, bool follow); extern struct tree *tree_find(struct tree *tree, const char *name); extern int tree_for_each(struct tree *tree, tree_cb_t cb, void *data); extern int tree_for_each_reverse(struct tree *tree, tree_cb_t cb, void *data); extern int tree_for_each_parent(struct tree *tree, tree_cb_t cb, void *data); extern int tree_finds(struct tree *tree, const char *name, struct tree ***ptr);