Re: [RFC 8/9] ata_dev_printk: Add durable name to output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2019-12-23 at 16:55 -0600, Tony Asleson wrote:
> If we have a durable name we will add to output, else
> we will default to existing message output format.
> 
> Signed-off-by: Tony Asleson <tasleson@xxxxxxxxxx>
> ---
>  drivers/ata/libata-core.c | 26 +++++++++++++++++++++++---
>  1 file changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 28c492be0a57..b57a74cfb529 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -7249,6 +7249,9 @@ EXPORT_SYMBOL(ata_link_printk);
>  void ata_dev_printk(const struct ata_device *dev, const char *level,
>  		    const char *fmt, ...)
>  {
> +	char dict[128];
> +	int dict_len = 0;
> +
>  	struct va_format vaf;
>  	va_list args;
>  
> @@ -7257,9 +7260,26 @@ void ata_dev_printk(const struct ata_device
> *dev, const char *level,
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
>  
> -	printk("%sata%u.%02u: %pV",
> -	       level, dev->link->ap->print_id, dev->link->pmp + dev-
> >devno,
> -	       &vaf);
> +	if (dev->sdev) {
> +		dict_len = dev_durable_name(
> +			&dev->sdev->sdev_gendev,
> +			dict,
> +			sizeof(dict));
> +	}
> +
> +	if (dict_len > 0) {
> +		printk_emit(0, level[1] - '0', dict, dict_len,
> +				"sata%u.%02u: %pV",
> +				dev->link->ap->print_id,
> +				dev->link->pmp + dev->devno,
> +				&vaf);
> +	} else {
> +		printk("%sata%u.%02u: %pV",
> +			level,
> +			dev->link->ap->print_id,
> +			dev->link->pmp + dev->devno,
> +			&vaf);
> +	}

As I said, I think ata_dev_printk should expand to dev_printk, which
would render all the above unnecessary, but just in case there's a
problem, printk_emit() with a dict_len == 0 is directly equivalent to
printk() so the whole if (dict_len > 0) is unnecessary.

James




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux