From 79a02d029ccd6d998479d1cf58c812a7ea05ab73 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Fri, 18 May 2018 17:36:00 +0200 Subject: nlattr: add value processing support for xlat/flags nlattr decoders Needed for upcoming decoder of ethernet proto which is stored in the host order and has to be converted to the network order before printing as an xval constant. This change also adds ability to provide prefix/suffix in order to enclose the printed value in something that describes the performed conversion. * nlattr.h (struct decode_nla_xlat_opts): Add prefix, suffix, and process_fn fields. * nlattr.c (decode_nla_xval, decode_nla_flags): Handle process_fn, prefix, snd uffix parameters. --- nlattr.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nlattr.h') diff --git a/nlattr.h b/nlattr.h index fc7a67d92..478b8f118 100644 --- a/nlattr.h +++ b/nlattr.h @@ -38,6 +38,9 @@ struct decode_nla_xlat_opts { const char *dflt; enum xlat_type xt; enum xlat_style style; + const char *prefix; + const char *suffix; + uint64_t (*process_fn)(uint64_t val); }; typedef bool (*nla_decoder_t)(struct tcb *, kernel_ulong_t addr, -- cgit v1.2.1