2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

ofp-errors: Remove OFPERR_* values for error categories.

The main use of OFPERR_* is to define specific errors, but OFPERR_* also
existed for each possible category of error, to enable partial decoding of
unknown specific errors within a known category.  However, in practice,
it was very easy to misuse the error categories as if they were particular
errors.  This commit removes the error category values, to make that error
impossible.

(If partial decoding of unknown specific errors turns out to have been a
valuable feature, then we can reintroduce it some other way.)

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Jarno Rajahalme
2012-11-30 14:32:12 -08:00
committed by Ben Pfaff
parent edd70aa771
commit df30f9b1cd
3 changed files with 3 additions and 94 deletions

View File

@@ -294,7 +294,6 @@ struct ofperr_domain {
const char *name;
uint8_t version;
enum ofperr (*decode)(uint16_t type, uint16_t code);
enum ofperr (*decode_type)(uint16_t type);
struct pair errors[OFPERR_N_ERRORS];
};
@@ -332,24 +331,6 @@ static enum ofperr
print """\
}
return 0;
}
static enum ofperr
%s_decode_type(uint16_t type)
{
switch (type) {""" % name
for enum in names:
if enum not in map:
continue
type_, code = map[enum]
if code is not None:
continue
print " case %d:" % type_
print " return OFPERR_%s;" % enum
print """\
}
return 0;
}"""
@@ -358,8 +339,7 @@ static const struct ofperr_domain %s = {
"%s",
%d,
%s_decode,
%s_decode_type,
{""" % (name, description, version, name, name)
{""" % (name, description, version, name)
for enum in names:
if enum in map:
type_, code = map[enum]