lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 23 Sep 2015 16:26:50 -0700
From:	Stephen Hemminger <stephen@...workplumber.org>
To:	Matthias Tafelmeier <matthias.tafelmeier@....net>
Cc:	netdev@...r.kernel.org, hagen@...u.net, shemminger@...l.org,
	fw@...len.de, edumazet@...gle.com, daniel@...earbox.net
Subject: Re: [PATCH v7 02/10] ss: created formatters for json and hr

Having JSON output is going to be a real plus for programatic parsing.
My understanding of best practice with JSON is that it is best to output values
in best machine readable form, the format is not really meant for humans to
directly read.

Therefore I don't like the code that reformats numbers as hex.
If the values are better displayed in hex, then it is up to the program
parsing and presenting that to the user to do that. The JSON should
just put out numeric values as numeric.

> +/* hex conversion helper */
> +static void jsonw_hex_as_str_outp(json_writer_t *self, uint64_t num)
> +{
> +	char tmp[17];
> +
> +	sprintf(tmp, "%"PRIx64, num);
> +	jsonw_string(self, tmp);
> +}
> +
> +static void jsonw_hex_field_outp(json_writer_t *self, const char *prop, uint64_t num)
> +{
> +	jsonw_name(self, prop);
> +	jsonw_hex_as_str_outp(self, num);
> +}
> +

Other than that, my only other discomfort is that this patch set
makes the code grow so much larger and it becomes more complex for future
developers.

Maybe it is time to rewrite it in a better language ;-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ