loci: remove header classes
Now that e.g. of_oxm_t is a valid typedef for of_object_t, there's no need for
of_oxm_header_t.
diff --git a/c_gen/build_of_g.py b/c_gen/build_of_g.py
index ff2dfe8..ace386d 100755
--- a/c_gen/build_of_g.py
+++ b/c_gen/build_of_g.py
@@ -202,13 +202,7 @@
if type(m) == OFPadMember:
continue
else:
- # HACK the C backend does not yet support of_oxm_t
- if m.oftype == 'of_oxm_t':
- m_type = 'of_oxm_header_t'
- # HACK the C backend does not yet support of_bsn_vport_t
- elif m.oftype == 'of_bsn_vport_t':
- m_type = 'of_bsn_vport_header_t'
- elif m.oftype.find("list(") == 0:
+ if m.oftype.find("list(") == 0:
(list_name, base_type) = loxi_utils.list_name_extract(m.oftype)
m_type = list_name + "_t"
else:
@@ -248,19 +242,6 @@
Add information computed from the input, including offsets and
lengths of struct members and the set of list and action_id types.
"""
-
- # Generate header classes for inheritance parents
- for wire_version, ordered_classes in of_g.ordered_classes.items():
- classes = versions[of_g.of_version_wire2name[wire_version]]['classes']
- for cls in ordered_classes:
- if type_maps.class_is_inheritance_root(cls):
- new_cls = cls + '_header'
- of_g.ordered_classes[wire_version].append(new_cls)
- classes[new_cls] = classes[cls]
- of_g.base_length[(new_cls, wire_version)] = of_g.base_length[(cls, wire_version)]
- if (cls, wire_version) in of_g.is_fixed_length:
- of_g.is_fixed_length.add((cls, wire_version))
-
# Create lists
for version, protocol in loxi_globals.ir.items():
lists = set()
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index 4ccb412..a6868ce 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -1199,7 +1199,7 @@
LOCI_ASSERT(cur_len + abs_offset <= WBUF_CURRENT_BYTES(wbuf));
OF_TRY(of_match_deserialize(ver, %(m_name)s, obj, offset, cur_len));
""" % dict(m_name=m_name))
- elif m_type == "of_oxm_header_t":
+ elif m_type == "of_oxm_t":
out.write("""
/* Initialize child */
%(m_type)s_init(%(m_name)s, obj->version, 0, 1);
@@ -1207,7 +1207,7 @@
of_object_attach(obj, %(m_name)s, offset, cur_len);
of_object_wire_init(%(m_name)s, OF_OXM, 0);
""" % dict(m_type=m_type[:-2], m_name=m_name))
- elif m_type == "of_bsn_vport_header_t":
+ elif m_type == "of_bsn_vport_t":
out.write("""
/* Initialize child */
%(m_type)s_init(%(m_name)s, obj->version, 0, 1);
diff --git a/c_gen/c_show_gen.py b/c_gen/c_show_gen.py
index 7da3882..03a55d5 100644
--- a/c_gen/c_show_gen.py
+++ b/c_gen/c_show_gen.py
@@ -89,7 +89,6 @@
('uint64_t', 'generation_id'),
('uint16_t', 'value_mask'),
('uint32_t', 'value_mask'),
- ('uint32_t', 'oxm_header'),
('uint8_t', 'value_mask'),
('uint64_t', 'value_mask'),
('uint64_t', 'write_setfields'),
diff --git a/c_gen/c_test_gen.py b/c_gen/c_test_gen.py
index 5ddd4e9..cb7ff7d 100644
--- a/c_gen/c_test_gen.py
+++ b/c_gen/c_test_gen.py
@@ -99,8 +99,8 @@
of_octets_t="octets",
of_meter_features_t="features",
of_match_t="match",
- of_oxm_header_t="oxm",
- of_bsn_vport_header_t="bsn_vport",
+ of_oxm_t="oxm",
+ of_bsn_vport_t="bsn_vport",
of_table_desc_t="table_desc",
# BSN extensions
of_bsn_vport_q_in_q_t="vport",
@@ -128,8 +128,8 @@
# When embedding an object inside of another object we have to pick a single
# subclass to use, unlike lists where we use all subclasses.
embedded_subclasses = {
- 'of_oxm_header_t': 'of_oxm_eth_type',
- 'of_bsn_vport_header_t': 'of_bsn_vport_q_in_q',
+ 'of_oxm_t': 'of_oxm_eth_type',
+ 'of_bsn_vport_t': 'of_bsn_vport_q_in_q',
}
def ignore_member(cls, version, m_name, m_type):
diff --git a/c_gen/codegen.py b/c_gen/codegen.py
index b8e3b39..f052950 100644
--- a/c_gen/codegen.py
+++ b/c_gen/codegen.py
@@ -121,19 +121,6 @@
c_code_gen.gen_new_function_definitions(out, uclass.name)
c_code_gen.gen_accessor_definitions(out, uclass.name)
-# TODO remove header classes and use the corresponding class instead
-def generate_header_classes(install_dir):
- for cls in of_g.standard_class_order:
- if not cls.endswith("_header") or cls in ["of_header", "of_bsn_header", "of_nicira_header"]:
- continue
- with template_utils.open_output(install_dir, "loci/src/%s.c" % cls) as out:
- util.render_template(out, "class.c",
- push_wire_types_data=None,
- parse_wire_types_data=None)
- # Append legacy generated code
- c_code_gen.gen_new_function_definitions(out, cls)
- c_code_gen.gen_accessor_definitions(out, cls)
-
def generate_classes_header(install_dir):
# Collect legacy code
tmp = StringIO()
@@ -239,16 +226,6 @@
wire_type_get=wire_type_get,
wire_type_set=wire_type_set))
- # If this is the root of an inheritance hierachy, add metadata
- # for the corresponding header class
- if uclass.name in type_maps.inheritance_map:
- class_metadata.append(ClassMetadata(
- name=uclass.name + '_header',
- wire_length_get=wire_length_get,
- wire_length_set=wire_length_set,
- wire_type_get=wire_type_get,
- wire_type_set=wire_type_set))
-
for metadata in class_metadata:
class_metadata_dict[metadata.name] = metadata
diff --git a/c_gen/match.py b/c_gen/match.py
index d6b43fa..c6459d4 100644
--- a/c_gen/match.py
+++ b/c_gen/match.py
@@ -197,8 +197,7 @@
# Generate list of OXM names from the unified classes
oxm_names = [x[7:] for x in of_g.unified.keys() if
x.startswith('of_oxm_') and
- x.find('masked') < 0 and
- x.find('header') < 0]
+ x.find('masked') < 0]
# Check that all OXMs are in the match members
for key in oxm_names:
diff --git a/c_gen/type_maps.py b/c_gen/type_maps.py
index 3544d80..c79c7f8 100644
--- a/c_gen/type_maps.py
+++ b/c_gen/type_maps.py
@@ -36,8 +36,6 @@
"""
Returns True if cls is a virtual class
"""
- if cls.endswith("header"):
- return True
if loxi_utils.class_is_list(cls):
return True
return loxi_globals.unified.class_by_name(cls).virtual
diff --git a/lang_c.py b/lang_c.py
index c7b68f7..bec4a65 100644
--- a/lang_c.py
+++ b/lang_c.py
@@ -125,7 +125,6 @@
fn(outfile, os.path.basename(name))
c_gen.codegen.build_class_metadata()
c_gen.codegen.generate_classes(install_dir)
- c_gen.codegen.generate_header_classes(install_dir)
c_gen.codegen.generate_classes_header(install_dir)
c_gen.codegen.generate_lists(install_dir)
c_gen.codegen.generate_strings(install_dir)