2 * Copyright (c) 2013 David Chisnall
5 * This software was developed by SRI International and the University of
6 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
7 * ("CTSRD"), as part of the DARPA CRASH research programme.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 property_value::get_as_uint32()
54 if (byte_data.size() != 4)
59 v &= byte_data[0] << 24;
60 v &= byte_data[1] << 16;
61 v &= byte_data[2] << 8;
62 v &= byte_data[3] << 0;
67 property_value::push_to_buffer(byte_buffer &buffer)
69 if (!byte_data.empty())
71 buffer.insert(buffer.end(), byte_data.begin(), byte_data.end());
75 string_data.push_to_buffer(buffer, true);
82 property_value::write_dts(FILE *file)
88 assert(0 && "Invalid type");
92 write_as_string(file);
98 if (byte_data.size() % 4 == 0)
100 write_as_cells(file);
103 write_as_bytes(file);
109 property_value::resolve_type()
115 if (byte_data.empty())
120 if (byte_data.back() == 0)
122 bool is_all_printable = true;
125 for (byte_buffer::iterator i=byte_data.begin(), e=byte_data.end()-1; i<e ; i++)
128 is_all_printable &= (*i == '\0') || isprint(*i);
133 if (!is_all_printable)
138 if (is_all_printable && (bytes > nuls))
152 property_value::write_as_string(FILE *file)
155 if (byte_data.empty())
157 string_data.print(file);
161 for (byte_buffer::iterator i=byte_data.begin(), e=byte_data.end()-1; i!=e ; ++i)
163 // FIXME Escape tabs, newlines, and so on.
166 fputs("\", \"", file);
176 property_value::write_as_cells(FILE *file)
179 assert((byte_data.size() % 4) == 0);
180 for (byte_buffer::iterator i=byte_data.begin(), e=byte_data.end(); i!=e ; ++i)
190 fprintf(file, "0x%" PRIx32, v);
200 property_value::write_as_bytes(FILE *file)
203 for (byte_buffer::iterator i=byte_data.begin(), e=byte_data.end(); i!=e ; i++)
205 fprintf(file, "%hhx", *i);
215 property::parse_string(input_buffer &input)
218 assert(input[0] == '"');
220 const char *start = (const char*)input;
222 while (char c = input[0])
224 if (c == '"' && input[-1] != '\\')
232 v.string_data = string(start, length);
237 property::parse_cells(input_buffer &input)
239 assert(input[0] == '<');
243 while (!input.consume('>'))
246 // If this is a phandle then we need to get the name of the
248 if (input.consume('&'))
251 // FIXME: We should support full paths here, but we
253 string referenced = string::parse_node_name(input);
254 if (referenced.empty())
256 input.parse_error("Expected node name");
261 // If we already have some bytes, make the phandle a
262 // separate component.
263 if (!v.byte_data.empty())
266 v = property_value();
268 v.string_data = referenced;
269 v.type = property_value::PHANDLE;
271 v = property_value();
275 //FIXME: We should support labels in the middle
276 //of these, but we don't.
278 if (!input.consume_integer(val))
280 input.parse_error("Expected numbers in array of cells");
284 push_big_endian(v.byte_data, (uint32_t)val);
288 // Don't store an empty string value here.
289 if (v.byte_data.size() > 0)
296 property::parse_bytes(input_buffer &input)
298 assert(input[0] == '[');
302 while (!input.consume(']'))
305 //FIXME: We should support
306 //labels in the middle of
307 //these, but we don't.
309 if (!input.consume_hex_byte(val))
311 input.parse_error("Expected hex bytes in array of bytes");
315 v.byte_data.push_back(val);
323 property::parse_reference(input_buffer &input)
325 assert(input[0] == '&');
329 v.string_data = string::parse_node_name(input);
330 if (v.string_data.empty())
332 input.parse_error("Expected node name");
336 v.type = property_value::CROSS_REFERENCE;
340 property::property(input_buffer &structs, input_buffer &strings)
342 uint32_t name_offset;
344 valid = structs.consume_binary(length) &&
345 structs.consume_binary(name_offset);
348 fprintf(stderr, "Failed to read property\n");
352 input_buffer name_buffer = strings.buffer_from_offset(name_offset);
353 if (name_buffer.empty())
355 fprintf(stderr, "Property name offset %" PRIu32
356 " is past the end of the strings table\n",
361 key = string(name_buffer);
365 for (uint32_t i=0 ; i<length ; i++)
367 if (!(valid = structs.consume_binary(byte)))
369 fprintf(stderr, "Failed to read property value\n");
372 v.byte_data.push_back(byte);
377 property::property(input_buffer &input, string k, string l) : key(k), label(l),
385 input.parse_error("Invalid property value.");
398 parse_reference(input);
406 } while (input.consume(','));
407 if (!input.consume(';'))
409 input.parse_error("Expected ; at end of property");
415 property::parse_dtb(input_buffer &structs, input_buffer &strings)
417 property *p = new property(structs, strings);
427 property::parse(input_buffer &input, string key, string label)
429 property *p = new property(input, key, label);
439 property::write(dtb::output_writer &writer, dtb::string_table &strings)
441 writer.write_token(dtb::FDT_PROP);
442 byte_buffer value_buffer;
443 for (value_iterator i=begin(), e=end() ; i!=e ; ++i)
445 i->push_to_buffer(value_buffer);
447 writer.write_data((uint32_t)value_buffer.size());
448 writer.write_comment(key);
449 writer.write_data(strings.add_string(key));
450 writer.write_data(value_buffer);
454 property::write_dts(FILE *file, int indent)
456 for (int i=0 ; i<indent ; i++)
460 if (label != string())
472 for (value_iterator i=begin(), e=end() ; i!=e ; ++i)
486 node::parse_name(input_buffer &input, bool &is_property, const char *error)
495 return string::parse_property_name(input);
497 string n = string::parse_node_or_property_name(input, is_property);
502 input.parse_error(error);
509 node::node(input_buffer &structs, input_buffer &strings) : valid(true)
511 const char *name_start = (const char*)structs;
513 while (structs[0] != '\0' && structs[0] != '@')
518 name = string(name_start, name_length);
519 if (structs[0] == '@')
522 name_start = (const char*)structs;
524 while (structs[0] != '\0')
529 unit_address = string(name_start, name_length);
533 while (structs.consume_binary(token))
538 fprintf(stderr, "Unexpected token 0x%" PRIx32
539 " while parsing node.\n", token);
542 // Child node, parse it.
543 case dtb::FDT_BEGIN_NODE:
545 node *child = node::parse_dtb(structs, strings);
551 children.push_back(child);
554 // End of this node, no errors.
555 case dtb::FDT_END_NODE:
557 // Property, parse it.
560 property *prop = property::parse_dtb(structs, strings);
566 properties.push_back(prop);
570 // End of structs table. Should appear after
571 // the end of the last node.
573 fprintf(stderr, "Unexpected FDT_END token while parsing node.\n");
576 // NOPs are padding. Ignore them.
581 fprintf(stderr, "Failed to read token from structs table while parsing node.\n");
586 node::node(input_buffer &input, string n, string l, string a) :
587 label(l), name(n), unit_address(a), valid(true)
589 if (!input.consume('{'))
591 input.parse_error("Expected { to start new device tree node.\n");
594 while (valid && !input.consume('}'))
596 // flag set if we find any characters that are only in
597 // the property name character set, not the node
598 bool is_property = false;
599 string child_name, child_label, child_address;
600 child_name = parse_name(input, is_property,
601 "Expected property or node name");
602 if (input.consume(':'))
604 // Node labels can contain any characters? The
605 // spec doesn't say, so we guess so...
607 child_label = child_name;
608 child_name = parse_name(input, is_property, "Expected property or node name");
610 if (input.consume('@'))
612 child_address = parse_name(input, is_property, "Expected unit address");
619 // If we're parsing a property, then we must actually do that.
620 if (input.consume('='))
622 property *p= property::parse(input, child_name,
630 properties.push_back(p);
633 else if (!is_property && input[0] == ('{'))
635 node *child = node::parse(input, child_name,
636 child_label, child_address);
639 children.push_back(child);
646 else if (input.consume(';'))
648 properties.push_back(new property(child_name, child_label));
652 input.parse_error("Error parsing property.");
661 node::cmp_properties(property *p1, property *p2)
663 return p1->get_key() < p2->get_key();
667 node::cmp_children(node *c1, node *c2)
669 if (c1->name == c2->name)
671 return c1->unit_address < c2->unit_address;
673 return c1->name < c2->name;
679 std::sort(property_begin(), property_end(), cmp_properties);
680 std::sort(child_begin(), child_end(), cmp_children);
681 for (child_iterator i=child_begin(), e=child_end() ; i!=e ; ++i)
688 node::parse(input_buffer &input, string name, string label, string address)
690 node *n = new node(input, name, label, address);
700 node::parse_dtb(input_buffer &structs, input_buffer &strings)
702 node *n = new node(structs, strings);
713 while (!children.empty())
715 delete children.back();
718 while (!properties.empty())
720 delete properties.back();
721 properties.pop_back();
726 node::get_property(string key)
728 for (property_iterator i=property_begin(), e=property_end() ; i!=e ; ++i)
730 if ((*i)->get_key() == key)
739 node::merge_node(node *other)
741 if (!other->label.empty())
743 label = other->label;
745 // Note: this is an O(n*m) operation. It might be sensible to
746 // optimise this if we find that there are nodes with very
747 // large numbers of properties, but for typical usage the
748 // entire vector will fit (easily) into cache, so iterating
749 // over it repeatedly isn't that expensive.
750 while (!other->properties.empty())
752 property *p = other->properties.front();
753 for (property_iterator i=property_begin(), e=property_end() ; i!=e ; ++i)
755 if ((*i)->get_key() == p->get_key())
763 other->properties.erase(other->properties.begin());
765 while (!other->children.empty())
767 node *c = other->children.front();
769 for (child_iterator i=child_begin(), e=child_end() ; i!=e ; ++i)
771 if ((*i)->name == c->name && (*i)->unit_address == c->unit_address)
781 children.push_back(c);
783 other->children.erase(other->children.begin());
788 node::write(dtb::output_writer &writer, dtb::string_table &strings)
790 writer.write_token(dtb::FDT_BEGIN_NODE);
791 byte_buffer name_buffer;
792 name.push_to_buffer(name_buffer);
793 if (unit_address != string())
795 name_buffer.push_back('@');
796 unit_address.push_to_buffer(name_buffer);
798 writer.write_comment(name);
799 writer.write_data(name_buffer);
800 writer.write_data((uint8_t)0);
801 for (property_iterator i=property_begin(), e=property_end() ; i!=e ; ++i)
803 (*i)->write(writer, strings);
805 for (child_iterator i=child_begin(), e=child_end() ; i!=e ; ++i)
807 (*i)->write(writer, strings);
809 writer.write_token(dtb::FDT_END_NODE);
813 node::write_dts(FILE *file, int indent)
815 for (int i=0 ; i<indent ; i++)
819 if (label != string())
824 if (name != string())
828 if (unit_address != string())
831 unit_address.print(file);
833 fputs(" {\n\n", file);
834 for (property_iterator i=property_begin(), e=property_end() ; i!=e ; ++i)
836 (*i)->write_dts(file, indent+1);
838 for (child_iterator i=child_begin(), e=child_end() ; i!=e ; ++i)
840 (*i)->write_dts(file, indent+1);
842 for (int i=0 ; i<indent ; i++)
850 device_tree::collect_names_recursive(node* n, node_path &path)
852 string name = n->label;
853 path.push_back(std::make_pair(n->name, n->unit_address));
854 if (name != string())
856 if (node_names.find(name) == node_names.end())
858 node_names.insert(std::make_pair(name, n));
859 node_paths.insert(std::make_pair(name, path));
863 node_names[name] = (node*)-1;
864 std::map<string, node_path>::iterator i = node_paths.find(name);
865 if (i != node_paths.end())
867 node_paths.erase(name);
869 fprintf(stderr, "Label not unique: ");
871 fprintf(stderr, ". References to this label will not be resolved.");
874 for (node::child_iterator i=n->child_begin(), e=n->child_end() ; i!=e ; ++i)
876 collect_names_recursive(*i, path);
879 // Now we collect the phandles and properties that reference
881 for (node::property_iterator i=n->property_begin(), e=n->property_end() ; i!=e ; ++i)
883 for (property::value_iterator p=(*i)->begin(),pe=(*i)->end() ; p!=pe ; ++p)
887 phandles.push_back(&*p);
889 if (p->is_cross_reference())
891 cross_references.push_back(&*p);
894 if ((*i)->get_key() == string("phandle") ||
895 (*i)->get_key() == string("linux,phandle"))
897 if ((*i)->begin()->byte_data.size() != 4)
899 fprintf(stderr, "Invalid phandle value for node ");
901 fprintf(stderr, ". Should be a 4-byte value.\n");
906 uint32_t phandle = (*i)->begin()->get_as_uint32();
907 used_phandles.insert(std::make_pair(phandle, n));
914 device_tree::collect_names()
917 collect_names_recursive(root, p);
921 device_tree::resolve_cross_references()
923 for (std::vector<property_value*>::iterator i=cross_references.begin(), e=cross_references.end() ; i!=e ; ++i)
925 property_value* pv = *i;
926 node_path path = node_paths[pv->string_data];
927 // Skip the first name in the path. It's always "", and implicitly /
928 for (node_path::iterator p=path.begin()+1, pe=path.end() ; p!=pe ; ++p)
930 pv->byte_data.push_back('/');
931 p->first.push_to_buffer(pv->byte_data);
932 if (!(p->second.empty()))
934 pv->byte_data.push_back('@');
935 p->second.push_to_buffer(pv->byte_data);
938 pv->byte_data.push_back(0);
940 uint32_t phandle = 1;
941 for (std::vector<property_value*>::iterator i=phandles.begin(), e=phandles.end() ; i!=e ; ++i)
943 string target_name = (*i)->string_data;
944 node *target = node_names[target_name];
947 fprintf(stderr, "Failed to find node with label:");
949 fprintf(stderr, "\n");
953 // If there is an existing phandle, use it
954 property *p = target->get_property("phandle");
957 p = target->get_property("linux,phandle");
961 // Otherwise insert a new phandle node
963 while (used_phandles.find(phandle) != used_phandles.end())
965 // Note that we only don't need to
966 // store this phandle in the set,
967 // because we are monotonically
968 // increasing the value of phandle and
969 // so will only ever revisit this value
970 // if we have used 2^32 phandles, at
971 // which point our blob won't fit in
972 // any 32-bit system and we've done
973 // something badly wrong elsewhere
977 push_big_endian(v.byte_data, phandle++);
978 if (phandle_node_name == BOTH || phandle_node_name == LINUX)
980 p = new property(string("linux,phandle"));
982 target->add_property(p);
984 if (phandle_node_name == BOTH || phandle_node_name == EPAPR)
986 p = new property(string("phandle"));
988 target->add_property(p);
991 p->begin()->push_to_buffer((*i)->byte_data);
992 assert((*i)->byte_data.size() == 4);
997 device_tree::parse_roots(input_buffer &input, std::vector<node*> &roots)
1000 while (valid && input.consume('/'))
1003 node *n = node::parse(input, string("", 1));
1016 device_tree::buffer_for_file(const char *path)
1018 if (string(path) == string("-"))
1020 input_buffer *b = new stream_input_buffer();
1021 buffers.push_back(b);
1024 int source = open(path, O_RDONLY);
1027 fprintf(stderr, "Unable to open file %s\n", path);
1030 input_buffer *b = new mmap_input_buffer(source);
1031 // Keep the buffer that owns the memory around for the lifetime
1032 // of this FDT. Ones simply referring to it may have shorter
1034 buffers.push_back(b);
1039 template<class writer> void
1040 device_tree::write(int fd)
1042 dtb::string_table st;
1045 writer reservation_writer;
1046 writer struct_writer;
1047 writer strings_writer;
1049 // Build the reservation table
1050 reservation_writer.write_comment(string("Memory reservations"));
1051 reservation_writer.write_label(string("dt_reserve_map"));
1052 for (std::vector<reservation>::iterator i=reservations.begin(),
1053 e=reservations.end() ; i!=e ; ++i)
1055 reservation_writer.write_comment(string("Reservation start"));
1056 reservation_writer.write_data(i->first);
1057 reservation_writer.write_comment(string("Reservation length"));
1058 reservation_writer.write_data(i->first);
1060 // Write n spare reserve map entries, plus the trailing 0.
1061 for (uint32_t i=0 ; i<=spare_reserve_map_entries ; i++)
1063 reservation_writer.write_data((uint64_t)0);
1064 reservation_writer.write_data((uint64_t)0);
1068 struct_writer.write_comment(string("Device tree"));
1069 struct_writer.write_label(string("dt_struct_start"));
1070 root->write(struct_writer, st);
1071 struct_writer.write_token(dtb::FDT_END);
1072 struct_writer.write_label(string("dt_struct_end"));
1074 st.write(strings_writer);
1075 // Find the strings size before we stick padding on the end.
1076 // Note: We should possibly use a new writer for the padding.
1077 head.size_dt_strings = strings_writer.size();
1079 // Stick the padding in the strings writer, but after the
1080 // marker indicating that it's the end.
1081 // Note: We probably should add a padding call to the writer so
1082 // that the asm back end can write padding directives instead
1083 // of a load of 0 bytes.
1084 for (uint32_t i=0 ; i<blob_padding ; i++)
1086 strings_writer.write_data((uint8_t)0);
1088 head.totalsize = sizeof(head) + strings_writer.size() +
1089 struct_writer.size() + reservation_writer.size();
1090 while (head.totalsize < minimum_blob_size)
1093 strings_writer.write_data((uint8_t)0);
1095 head.off_dt_struct = sizeof(head) + reservation_writer.size();;
1096 head.off_dt_strings = head.off_dt_struct + struct_writer.size();
1097 head.off_mem_rsvmap = sizeof(head);
1098 head.boot_cpuid_phys = boot_cpu;
1099 head.size_dt_struct = struct_writer.size();
1100 head.write(head_writer);
1102 head_writer.write_to_file(fd);
1103 reservation_writer.write_to_file(fd);
1104 struct_writer.write_to_file(fd);
1105 strings_writer.write_label(string("dt_blob_end"));
1106 strings_writer.write_to_file(fd);
1110 device_tree::referenced_node(property_value &v)
1114 return node_names[v.string_data];
1118 return used_phandles[v.get_as_uint32()];
1124 device_tree::write_binary(int fd)
1126 write<dtb::binary_writer>(fd);
1130 device_tree::write_asm(int fd)
1132 write<dtb::asm_writer>(fd);
1136 device_tree::write_dts(int fd)
1138 FILE *file = fdopen(fd, "w");
1139 fputs("/dtc-v1/;\n\n", file);
1141 if (!reservations.empty())
1143 const char msg[] = "/memreserve/";
1144 fwrite(msg, sizeof(msg), 1, file);
1145 for (std::vector<reservation>::iterator i=reservations.begin(),
1146 e=reservations.end() ; i!=e ; ++i)
1148 fprintf(stderr, " %" PRIx64 " %" PRIx64, i->first, i->second);
1150 fputs(";\n\n", file);
1154 root->write_dts(file, 0);
1159 device_tree::parse_dtb(const char *fn, FILE *depfile)
1161 input_buffer *in = buffer_for_file(fn);
1167 input_buffer &input = *in;
1169 valid = h.read_dtb(input);
1170 boot_cpu = h.boot_cpuid_phys;
1171 if (h.last_comp_version > 17)
1173 fprintf(stderr, "Don't know how to read this version of the device tree blob");
1180 input_buffer reservation_map =
1181 input.buffer_from_offset(h.off_mem_rsvmap, 0);
1182 uint64_t start, length;
1185 if (!(reservation_map.consume_binary(start) &&
1186 reservation_map.consume_binary(length)))
1188 fprintf(stderr, "Failed to read memory reservation table\n");
1192 } while (!((start == 0) && (length == 0)));
1193 input_buffer struct_table =
1194 input.buffer_from_offset(h.off_dt_struct, h.size_dt_struct);
1195 input_buffer strings_table =
1196 input.buffer_from_offset(h.off_dt_strings, h.size_dt_strings);
1198 if (!(struct_table.consume_binary(token) &&
1199 (token == dtb::FDT_BEGIN_NODE)))
1201 fprintf(stderr, "Expected FDT_BEGIN_NODE token.\n");
1205 root = node::parse_dtb(struct_table, strings_table);
1206 if (!(struct_table.consume_binary(token) && (token == dtb::FDT_END)))
1208 fprintf(stderr, "Expected FDT_END token after parsing root node.\n");
1212 valid = (root != 0);
1216 device_tree::parse_dts(const char *fn, FILE *depfile)
1218 input_buffer *in = buffer_for_file(fn);
1224 std::vector<node*> roots;
1225 input_buffer &input = *in;
1227 bool read_header = false;
1229 if (input.consume("/dts-v1/;"))
1234 while(input.consume("/include/"))
1237 if (!input.consume('"'))
1239 input.parse_error("Expected quoted filename");
1244 while (input[length] != '"') length++;
1246 const char *file = (const char*)input;
1247 const char *dir = dirname(fn);
1248 int dir_length = strlen(dir);
1249 char *include_file = (char*)malloc(strlen(dir) + length + 2);
1250 memcpy(include_file, dir, dir_length);
1251 include_file[dir_length] = '/';
1252 memcpy(include_file+dir_length+1, file, length);
1253 include_file[dir_length+length+1] = 0;
1254 input_buffer *include_buffer = buffer_for_file(include_file);
1256 if (include_buffer == 0)
1258 for (std::vector<const char*>::iterator i=include_paths.begin(), e=include_paths.end() ; e!=i ; ++i)
1262 dir_length = strlen(dir);
1263 include_file = (char*)malloc(strlen(dir) +
1265 memcpy(include_file, dir, dir_length);
1266 include_file[dir_length] = '/';
1267 memcpy(include_file+dir_length+1, file, length);
1268 include_file[dir_length+length+1] = 0;
1269 include_buffer = buffer_for_file(include_file);
1270 if (include_buffer != 0)
1279 fputs(include_file, depfile);
1281 if (include_buffer == 0)
1286 input_buffer &include = *include_buffer;
1287 input.consume(include_file+dir_length+1);
1289 free((void*)include_file);
1293 include.next_token();
1294 read_header = include.consume("/dts-v1/;");
1296 parse_roots(include, roots);
1301 input.parse_error("Expected /dts-v1/; version string");
1303 // Read any memory reservations
1304 while(input.consume("/memreserve/"))
1306 long long start, len;
1308 // Read the start and length.
1309 if (!(input.consume_integer(start) &&
1310 (input.next_token(),
1311 input.consume_integer(len))))
1313 input.parse_error("Expected /dts-v1/; version string");
1317 reservations.push_back(reservation(start, len));
1319 parse_roots(input, roots);
1320 switch (roots.size())
1324 input.parse_error("Failed to find root node /.");
1332 for (std::vector<node*>::iterator i=roots.begin()+1,
1333 e=roots.end() ; i!=e ; ++i)
1335 root->merge_node(*i);
1342 resolve_cross_references();
1345 device_tree::~device_tree()
1351 while (!buffers.empty())
1353 delete buffers.back();