Re: [PATCH net-next v2 6/8] net: netconsole: cache userdata formatted string in netconsole_target

From: Simon Horman
Date: Fri Feb 02 2024 - 06:53:41 EST


On Fri, Jan 26, 2024 at 03:13:41PM -0800, Matthew Wood wrote:
> Store a formatted string for userdata that will be appended to netconsole
> messages. The string has a capacity of 4KB, as calculated by the userdatum
> entry length of 256 bytes and a max of 16 userdata entries.
>
> Update the stored netconsole_target->userdata_complete string with the new
> formatted userdata values when a userdatum is created, edited, or
> removed. Each userdata entry contains a trailing newline, which will be
> formatted as such in netconsole messages::
>
> 6.7.0-rc8-virtme,12,500,1646292204,-;test
> release=foo
> something=bar
> 6.7.0-rc8-virtme,12,500,1646292204,-;another test
> release=foo
> something=bar
>
> Enforcement of MAX_USERDATA_ITEMS is done in userdatum_make_item;
> update_userdata will not check for this case but will skip any userdata
> children over the limit of MAX_USERDATA_ITEMs.
>
> If a userdata entry/dir is created but no value is provided, that entry
> will be skipped. This is in part because update_userdata() can't be
> called in userdatum_make_item() since the item will not have been added
> to the userdata config_group children yet. To preserve the experience of
> adding an empty userdata that doesn't show up in the netconsole
> messages, purposefully skip emtpy userdata items even when

nit: empty

> update_userdata() can be called.
>
> Co-developed-by: Breno Leitao <leitao@xxxxxxxxxx>
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
> Signed-off-by: Matthew Wood <thepacketgeek@xxxxxxxxx>

..