Subversion Repositories HelenOS

Rev

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

Rev 1896 Rev 1899
Line 95... Line 95...
95
 * @param node Node whose child is being looked up.
95
 * @param node Node whose child is being looked up.
96
 * @param name Name of the child being looked up.
96
 * @param name Name of the child being looked up.
97
 *
97
 *
98
 * @return NULL if there is no such child or pointer to the matching child node.
98
 * @return NULL if there is no such child or pointer to the matching child node.
99
 */
99
 */
100
static ofw_tree_node_t *ofw_tree_find_child(ofw_tree_node_t *node, const char *name)
100
ofw_tree_node_t *ofw_tree_find_child(ofw_tree_node_t *node, const char *name)
101
{
101
{
102
    ofw_tree_node_t *cur;
102
    ofw_tree_node_t *cur;
103
   
103
   
104
    /*
104
    /*
105
     * Try to find the disambigued name.
105
     * Try to find the disambigued name.
Line 122... Line 122...
122
    }
122
    }
123
       
123
       
124
    return NULL;
124
    return NULL;
125
}
125
}
126
 
126
 
-
 
127
/** Lookup first child of given device type.
-
 
128
 *
-
 
129
 * @param node Node whose child is being looked up.
-
 
130
 * @param name Device type of the child being looked up.
-
 
131
 *
-
 
132
 * @return NULL if there is no such child or pointer to the matching child node.
-
 
133
 */
-
 
134
ofw_tree_node_t *ofw_tree_find_child_by_device_type(ofw_tree_node_t *node, const char *name)
-
 
135
{
-
 
136
    ofw_tree_node_t *cur;
-
 
137
    ofw_tree_property_t *prop;
-
 
138
   
-
 
139
    for (cur = node->child; cur; cur = cur->peer) {
-
 
140
        prop = ofw_tree_getprop(cur, "device_type");
-
 
141
        if (!prop || !prop->value)
-
 
142
            continue;
-
 
143
        if (strcmp(prop->value, name) == 0)
-
 
144
            return cur;
-
 
145
    }
-
 
146
           
-
 
147
    return NULL;
-
 
148
}
-
 
149
 
-
 
150
/** Lookup first peer of given device type.
-
 
151
 *
-
 
152
 * @param node Node whose peer is being looked up.
-
 
153
 * @param name Device type of the child being looked up.
-
 
154
 *
-
 
155
 * @return NULL if there is no such child or pointer to the matching child node.
-
 
156
 */
-
 
157
ofw_tree_node_t *ofw_tree_find_peer_by_device_type(ofw_tree_node_t *node, const char *name)
-
 
158
{
-
 
159
    ofw_tree_node_t *cur;
-
 
160
    ofw_tree_property_t *prop;
-
 
161
   
-
 
162
    for (cur = node->peer; cur; cur = cur->peer) {
-
 
163
        prop = ofw_tree_getprop(cur, "device_type");
-
 
164
        if (!prop || !prop->value)
-
 
165
            continue;
-
 
166
        if (strcmp(prop->value, name) == 0)
-
 
167
            return cur;
-
 
168
    }
-
 
169
           
-
 
170
    return NULL;
-
 
171
}
-
 
172
 
-
 
173
 
127
/** Lookup OpenFirmware node by its path.
174
/** Lookup OpenFirmware node by its path.
128
 *
175
 *
129
 * @param path Path to the node.
176
 * @param path Path to the node.
130
 *
177
 *
131
 * @return NULL if there is no such node or pointer to the leaf node.
178
 * @return NULL if there is no such node or pointer to the leaf node.