Changeset a35b458 in mainline for boot/genarch/src/ofw_tree.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/genarch/src/ofw_tree.c
r3061bc1 ra35b458 65 65 if (addr) 66 66 addr[size] = '\0'; 67 67 68 68 return addr; 69 69 } … … 98 98 current_node->property = NULL; 99 99 current_node->device = NULL; 100 100 101 101 /* 102 102 * Get the disambigued name. … … 105 105 if (len == (size_t) -1) 106 106 return; 107 107 108 108 path[len] = '\0'; 109 109 110 110 /* Find last slash */ 111 111 size_t i; 112 112 for (i = len; (i > 0) && (path[i - 1] != '/'); i--); 113 113 114 114 /* Do not include the slash */ 115 115 len -= i; 116 116 117 117 /* Add space for trailing '\0' */ 118 118 char *da_name = ofw_tree_space_alloc(len + 1); 119 119 if (!da_name) 120 120 return; 121 121 122 122 memcpy(da_name, &path[i], len); 123 123 da_name[len] = '\0'; 124 124 current_node->da_name = (char *) balloc_rebase(da_name); 125 125 126 126 /* 127 127 * Recursively process the potential child node. … … 137 137 } 138 138 } 139 139 140 140 /* 141 141 * Count properties. … … 146 146 memcpy(name, name2, OFW_TREE_PROPERTY_MAX_NAMELEN); 147 147 } 148 148 149 149 if (!current_node->properties) 150 150 return; 151 151 152 152 /* 153 153 * Copy properties. … … 157 157 if (!property) 158 158 return; 159 159 160 160 name[0] = '\0'; 161 161 for (i = 0; ofw_next_property(current, name, name2) == 1; i++) { 162 162 if (i == current_node->properties) 163 163 break; 164 164 165 165 memcpy(name, name2, OFW_TREE_PROPERTY_MAX_NAMELEN); 166 166 memcpy(property[i].name, name, OFW_TREE_PROPERTY_MAX_NAMELEN); 167 167 property[i].name[OFW_TREE_PROPERTY_MAX_NAMELEN - 1] = '\0'; 168 168 169 169 size_t size = ofw_get_proplen(current, name); 170 170 property[i].size = size; 171 171 172 172 if (size) { 173 173 void *buf = ofw_tree_space_alloc(size); … … 182 182 property[i].value = NULL; 183 183 } 184 184 185 185 /* Just in case we ran out of memory. */ 186 186 current_node->properties = i; 187 187 current_node->property = (ofw_tree_property_t *) balloc_rebase(property); 188 188 189 189 /* 190 190 * Iteratively process the next peer node. … … 207 207 } 208 208 } 209 209 210 210 /* 211 211 * No more peers on this level. … … 225 225 if (root) 226 226 ofw_tree_node_process(root, NULL, ofw_root); 227 227 228 228 /* 229 229 * The firmware client interface does not automatically include the … … 241 241 } 242 242 } 243 243 244 244 return (ofw_tree_node_t *) balloc_rebase(root); 245 245 }
Note:
See TracChangeset
for help on using the changeset viewer.