net: sysfs: Implement is_visible for phys_(port_id, port_name, switch_id)
Subsystems (2)
PATCH v2 1/1 net: sysfs: Implement is_visible for phys_(port_id, port_name, switch_id)
phys_port_id_show, phys_port_name_show and phys_switch_id_show would return -EOPNOTSUPP if the netdev didn't implement the corresponding method.
There is no point in creating these files if they are unsupported.
Put these attributes in netdev_phys_group and implement the is_visible method. make phys_(port_id, port_name, switch_id) invisible if the netdev dosen't implement the corresponding method.
---
v2: Remove worthless comments
v1: https://lore.kernel.org/all/[email protected]/
--- include/linux/netdevice.h | 2 +- net/core/net-sysfs.c | 68 +++++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 28 deletions(-)
include/linux/netdevice.h +1 -1
@@ -2384,7 +2384,7 @@ struct net_device {struct dm_hw_stat_delta __rcu *dm_private;#endif struct device dev; -const struct attribute_group *sysfs_groups[4 ]; +const struct attribute_group *sysfs_groups[5 ];const struct attribute_group *sysfs_rx_queue_group;const struct rtnl_link_ops *rtnl_link_ops;
net/core/net-sysfs.c +41 -27
116 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 6 lines · Yajun Deng
phys_port_id_show,phys_port_name_showandphys_switch_id_showwould return-EOPNOTSUPPif the netdev didn't implement the corresponding method.There is no point in creating these files if they are unsupported.
Quoted 8 lines
Put these attributes in
netdev_phys_groupand implement theis_visiblemethod. makephys_(port_id, port_name, switch_id)invisible if the netdev dosen't implement the corresponding method.Signed-off-by Yajun Deng <[email protected]>---
v2: Remove worthless comments
v1: https://lore.kernel.org/all/[email protected]/
FWIIW, I had the same thought that Jakub related in his review of v1.
"I'm slightly worried some user space depends on the files existing,
but maybe ENOENT vs EOPNOTSUPP doesn't make a big difference.|
...
Paolo Abeni
maintainerQuoted 11 lines · Yajun Deng
phys_port_id_show,phys_port_name_showandphys_switch_id_showwould return-EOPNOTSUPPif the netdev didn't implement the corresponding method.There is no point in creating these files if they are unsupported.
Put these attributes in
netdev_phys_groupand implement theis_visiblemethod. makephys_(port_id, port_name, switch_id)invisible if the netdev dosen't implement the corresponding method.Signed-off-by Yajun Deng <[email protected]>
I fear that some orchestration infra depends on the files existence - i.e. scripts don't tolerate the files absence, deal only with I/O errors after open.
It feel a bit too dangerous to merge a change that could break user-space this late. Let's defer it to the beginning of the next cycle.
Paolo
Quoted 29 lines · Paolo Abeni
Quoted 15 lines · Yajun Deng
phys_port_id_show,phys_port_name_showandphys_switch_id_showwouldreturn
-EOPNOTSUPPif the netdev didn't implement the correspondingmethod.
There is no point in creating these files if they are unsupported.
Put these attributes in
netdev_phys_groupand implement theis_visibleQuoted 8 lines
method. make
phys_(port_id, port_name, switch_id)invisible if the netdevdosen't implement the corresponding method.
Signed-off-by Yajun Deng <[email protected]>I fear that some orchestration infra depends on the files existence -
Quoted 8 lines
i.e. scripts don't tolerate the files absence, deal only with I/O errors
after open.
It feel a bit too dangerous to merge a change that could break
user-space this late. Let's defer it to the beginning of the next cycle.
Ping.
Quoted 2 lines
Paolo
Paolo Abeni
maintainerQuoted 29 lines · Yajun Deng
Quoted 28 lines · Paolo Abeni
Quoted 14 lines · Yajun Deng
phys_port_id_show,phys_port_name_showandphys_switch_id_showwouldreturn
-EOPNOTSUPPif the netdev didn't implement the correspondingmethod.
There is no point in creating these files if they are unsupported.
Put these attributes in
netdev_phys_groupand implement theis_visibleQuoted 8 lines
method. make
phys_(port_id, port_name, switch_id)invisible if the netdevdosen't implement the corresponding method.
Signed-off-by Yajun Deng <[email protected]>I fear that some orchestration infra depends on the files existence -
i.e. scripts don't tolerate the files absence, deal only with I/O errors
Quoted 8 lines
Quoted 6 lines
after open.
It feel a bit too dangerous to merge a change that could break
user-space this late. Let's defer it to the beginning of the next cycle.
Ping.
I was likely not clear. The above means you should re-submit the patch now.
/P