From 4b83c93f19424c4b7c02c8ce25f2a689fc6a7369 Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Wed, 5 Sep 2012 11:50:36 +0900 Subject: [PATCH] ofp-errors: Ignore text enclosed in square brackets Enhance to extract-ofp-errors to omit text enclosed in square brackets from error description. This allows some commentary other than the error description to be supplied in ofp-errors.h As suggested by Ben Pfaff Signed-off-by: Simon Horman [blp@nicira.com added the large comment on enum ofperr.] Signed-off-by: Ben Pfaff --- build-aux/extract-ofp-errors | 2 +- lib/ofp-errors.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/build-aux/extract-ofp-errors b/build-aux/extract-ofp-errors index e513b7f4a..bd4ab9ed5 100755 --- a/build-aux/extract-ofp-errors +++ b/build-aux/extract-ofp-errors @@ -207,7 +207,7 @@ def extract_ofp_errors(filenames): enum = m.group(1) - comments.append(comment) + comments.append(re.sub('\[[^]]*\]', '', comment)) names.append(enum) for dst in dsts.split(', '): diff --git a/lib/ofp-errors.h b/lib/ofp-errors.h index cdeddc9b2..e361223b3 100644 --- a/lib/ofp-errors.h +++ b/lib/ofp-errors.h @@ -45,6 +45,19 @@ struct ofpbuf; #define OFPERR_OFS (1 << 30) +/* OpenFlow error codes. + * + * The comments below are parsed by the extract-ofp-errors program at build + * time and used to determine the mapping between "enum ofperr" constants and + * error type/code values used in the OpenFlow protocol: + * + * - The first part of each comment specifies OpenFlow type/code for each + * protocol that supports the error. + * + * - Additional text is a human-readable description of the meaning of each + * error, used to explain the error to the user. Any text enclosed in + * square brackets is omitted; this can be used to explain rationale for + * choice of error codes in the case where this is desirable. */ enum ofperr { /* Expected duplications. */ -- 2.20.1