Re: [PATCHv3 2/5] scsi: Export blacklist flags to sysfs

Bart Van Assche
2017-08-15T22:47:53Z

On Tue, 2017-08-15 at 10:03 +0200, Hannes Reinecke wrote:
> On 08/15/2017 05:18 AM, Martin K. Petersen wrote:
> >
> > Hannes,
> >
> > > + name = sdev_bflags_name(bflags);
> > > + if (name)
> > > + blen = snprintf(ptr, strlen(name) + 1,
> > > + "%s", name);
> > > + else
> > > + blen = snprintf(ptr, 67, "0x%X", bflags);
> >
> > It seems this else statement facilitates papering over the fact that
> > scsi_sysfs.c and scsi_devinfo.h can get out of sync.
> >
>
> But there is no good way of avoiding that, is there?

Hello Hannes,

How about running the following shell code from a makefile, storing the
result in a file and #including that file from drivers/scsi/scsi_sysfs.c?

sed -n 's/^#define BLIST_\([^[:blank:]]*\).*/\t{ BLIST_\1, "\1" },/p' include/scsi/scsi_devinfo.h

Bart.