gpt4 book ai didi

linux-kernel - 我的属性太活泼了,我该怎么办?

转载 作者:行者123 更新时间:2023-12-03 10:43:32 24 4
gpt4 key购买 nike

在 linux 设备驱动程序中,在 probe 中创建 sysfs 属性太活泼了——特别是,it experiences a race condition with userspace .推荐的解决方法是将您的属性添加到各种默认属性组,以便在探测之前自动创建它们。对于设备驱动程序, struct device_driver 包含 const struct attribute_group **groups 以此目的。

然而, struct attribute_group 只有一个用于二进制属性的字段 in Linux 3.11 .对于较旧的内核(特别是 3.4),设备驱动程序应该如何在探测之前创建 sysfs 二进制属性?

最佳答案

报价(强调我的)Greg Kroah-Hartman来自他的 comment to a merge request (即 was merged by Linus 作为 3.11 开发周期的一部分):

Here are some driver core patches for 3.11-rc2. They aren't really bugfixes, but a bunch of new helper macros for drivers to properly create attribute groups, which drivers and subsystems need to fix up a ton of race issues with incorrectly creating sysfs files (binary and normal) after userspace has been told that the device is present.

Also here is the ability to create binary files as attribute groups, to solve that race condition, which was impossible to do before this, so that's my fault the drivers were broken.



所以看起来在旧内核上确实没有办法解决这个问题。

关于linux-kernel - 我的属性太活泼了,我该怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38620723/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com