[PATCH 5/9] nvme: split off TLS sysfs attributes into a separate group
Hannes Reinecke
hare at suse.de
Tue Jul 23 10:29:59 PDT 2024
On 7/23/24 16:49, Christoph Hellwig wrote:
> On Mon, Jul 22, 2024 at 02:02:22PM +0200, Hannes Reinecke wrote:
>> +static umode_t nvme_tls_attrs_are_visible(struct kobject *kobj,
>> + struct attribute *a, int n)
>> +{
>> + struct device *dev = container_of(kobj, struct device, kobj);
>> + struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
>> +
>> + if (!ctrl->opts || strcmp(ctrl->opts->transport, "tcp"))
>> + return 0;
>> +
>> + if (a == &dev_attr_tls_key.attr &&
>> + !ctrl->opts->tls)
>
> As-is there is only a single attribute and you don't need the check for
> the specific attribute. And the point of making this a separate
> group is that we'll want to not have that check in the future as well,
> right?
>
Correct. It'll be filled out with the next two patches.
> I would have also kinda expected that this attribute group lives in
> tcp.c, is there a good reason to keep it in the core code?
>
I knew this argument would be coming.
Thing is: these options depend on CONFIG_NVME_TCP_TLS, so
they will always be encapsulated in some #ifdef, be it in sysfs.c
or in tcp.c.
And as we always will have to have an #ifdef in one of the files
I thought it easier to keep it in sysfs.c, and save us having to
have an exported attribute_group which might even be empty.
But if you insist ...
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare at suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Ivo Totev, Andrew McDonald,
Werner Knoblich
More information about the Linux-nvme
mailing list