Re: [RFC 6/9] create_syslog_header: Add durable name

James Bottomley
2019-12-24T00:54:15Z

On Mon, 2019-12-23 at 16:55 -0600, Tony Asleson wrote:
> This gets us a persistent durable name for code that logs messages in
> the
> block layer that have the appropriate callbacks setup for durable
> name.
>
> Signed-off-by: Tony Asleson <tasleson@redhat.com>
> ---
> drivers/base/core.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 93cc1c45e9d3..57b5f5cd29fc 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -3318,6 +3318,15 @@ create_syslog_header(const struct device *dev,
> char *hdr, size_t hdrlen)
> "DEVICE=+%s:%s", subsys,
> dev_name(dev));
> }
>
> + if (dev->type && dev->type->durable_name) {
> + int dlen;
> +
> + dlen = dev_durable_name(dev, hdr + (pos + 1),
> + hdrlen - (pos + 1));
> + if (dlen)
> + pos += dlen + 1;
> + }
> +

dev_durable_name already returns zero if either dev->type or dev->type-
>durable_name are NULL, so the if() above is pointless.

James