Re: [PATCH 2/5] nvme: register ns_id attributes as default sysfs groups
From: Bart Van Assche
Date: Tue Aug 14 2018 - 11:21:35 EST
On Tue, 2018-08-14 at 09:33 +-0200, Hannes Reinecke wrote:
+AD4- +-const struct attribute+AF8-group +ACo-nvme+AF8-ns+AF8-id+AF8-attr+AF8-groups+AFsAXQ- +AD0- +AHs-
+AD4- +- +ACY-nvme+AF8-ns+AF8-id+AF8-attr+AF8-group,
+AD4- +- NULL, /+ACo- Will be filled in by lightnvm if present +ACo-/
+AD4- +- NULL,
+AD4- +-+AH0AOw-
+AFs- ... +AF0-
+AD4- -void nvme+AF8-nvm+AF8-unregister+AF8-sysfs(struct nvme+AF8-ns +ACo-ns)
+AD4- -+AHs-
+AD4- - struct nvm+AF8-dev +ACo-ndev +AD0- ns-+AD4-ndev+ADs-
+AD4- - struct nvm+AF8-geo +ACo-geo +AD0- +ACY-ndev-+AD4-geo+ADs-
+AD4- +- return+ADs-
+AD4-
+AD4- switch (geo-+AD4-major+AF8-ver+AF8-id) +AHs-
+AD4- case 1:
+AD4- - sysfs+AF8-remove+AF8-group(+ACY-disk+AF8-to+AF8-dev(ns-+AD4-disk)-+AD4-kobj,
+AD4- - +ACY-nvm+AF8-dev+AF8-attr+AF8-group+AF8-12)+ADs-
+AD4- +- nvme+AF8-ns+AF8-id+AF8-attr+AF8-groups+AFs-1+AF0- +AD0- +ACY-nvm+AF8-dev+AF8-attr+AF8-group+AF8-12+ADs-
+AD4- break+ADs-
+AD4- case 2:
+AD4- - sysfs+AF8-remove+AF8-group(+ACY-disk+AF8-to+AF8-dev(ns-+AD4-disk)-+AD4-kobj,
+AD4- - +ACY-nvm+AF8-dev+AF8-attr+AF8-group+AF8-20)+ADs-
+AD4- +- nvme+AF8-ns+AF8-id+AF8-attr+AF8-groups+AFs-1+AF0- +AD0- +ACY-nvm+AF8-dev+AF8-attr+AF8-group+AF8-20+ADs-
This patch introduces a really ugly dependency between the NVMe core code and
the lightnvm code, namely that the lightnvm code has to know at which position
in the nvme+AF8-ns+AF8-id+AF8-attr+AF8-groups it can fill in its attribute group pointer. Have
you considered to make nvme+AF8-nvm+AF8-register+AF8-sysfs() return an attribute group
pointer such that the nvme+AF8-ns+AF8-id+AF8-attr+AF8-groups can be changed from a global into
a static array?
Thanks,
Bart.