Re: [v4 05/11] nvme: Add durable name for dev_printk

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

 



On Fri, Jul 24, 2020 at 8:19 PM Tony Asleson <tasleson@xxxxxxxxxx> wrote:
>
> Corrections from Keith Busch review comments.

Good! And where is the commit message?



> +static ssize_t wwid_show(struct device *dev, struct device_attribute *attr,
> +                       char *buf);
> +
> +static int dev_to_nvme_durable_name(const struct device *dev, char *buf, size_t len)
> +{
> +       char serial[144];       /* Max 141 for wwid_show */
> +       ssize_t serial_len = wwid_show((struct device *)dev, NULL, serial);
> +
> +       if (serial_len > 0 && serial_len < len) {
> +               serial_len -= 1;  /* Remove the '\n' from the string */
> +               strncpy(buf, serial, serial_len);
> +               return serial_len;
> +       }
> +       return 0;
> +}

Sorry, but this is ugly. Can we rather get some common code from
wwid_show() and reuse it there and here w/o above dances with \n?

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux