2013年11月: 修改的内核头文件 include/net/genetlink.h
github记录: https://github.com/torvalds/linux/commits/v3.13/include/net/genetlink.h
邮件记录: https://www.spinics.net/lists/netfilter-devel/msg28932.html
Linux 3.13 API接口变更
1. 删除了API函数genl_register_ops()
/ genl_unregister_ops()
.
但是此时这两个函数作为内部函数名依然存在于内核源码genetlink.c中. 后来几经演化变成了genl_validate_ops()
# 内核开发者日志
genetlink: remove genl_register_ops/genl_unregister_ops
genl_register_ops() is still needed for internal registration,
but is no longer available to users of the API.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
链接:
https://github.com/torvalds/linux/commit/3686ec5e84977eddc796903177e7e0a122585c11
2. struct genl_family
结构体中, 新增结构体成员ops
数组, 取代旧版本的ops_list
/ops_head
链表.
内部函数名演化: 1中旧的内部函数genl_register_ops()
此处演化变成genl_validate_add_ops()
链接:
https://github.com/torvalds/linux/commit/d91824c08fbcb265ec930d863fa905e8daa836a4
3. 删除了API函数__genl_register_family_with_ops(family, ops, n_ops)
. 保留不带下划线的API函数genl_register_family_with_ops(family, ops, n_ops)
.
另外内部函数名继续演化: 2中的内部函数genl_validate_add_ops()
, 最终演变成genl_validate_ops()
链接:
https://github.com/torvalds/linux/commit/568508aa0724cc39bcf7d3d8001bd27a45609800
4. 修改了API函数genl_register_family_with_ops()
的参数个数
重新定义的临时宏为genl_register_family_with_ops(family, ops)
.参数个数由3个变为2个.
原来的函数名字改为_genl_register_family_with_ops(family, ops, n_ops)
. 参数个数为3个. 注意此处前缀添加了1个下划线, 不是两个下划线.
Linux 4.10 API接口变更
文件名 include/net/genetlink.h
https://github.com/torvalds/linux/commits/v4.10/include/net/genetlink.h
2016年10月
1. 删除了参数个数为2个的API宏genl_register_family_with_ops(family, ops)
.
2. 删除了前缀为单下划线并带3个参数的API函数_genl_register_family_with_ops(family, ops, n_ops)
.
# 内核开发者日志
genetlink: statically initialize families
Instead of providing macros/inline functions to initialize
the families, make all users initialize them statically and
get rid of the macros.
This reduces the kernel code size by about 1.6k on x86-64
(with allyesconfig).
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3. 删除了常量定义GENL_ID_GENERATE
# 内核开发者日志
genetlink: no longer support using static family IDs
Static family IDs have never really been used, the only
use case was the workaround I introduced for those users
that assumed their family ID was also their multicast
group ID.
Additionally, because static family IDs would never be
reserved by the generic netlink code, using a relatively
low ID would only work for built-in families that can be
registered immediately after generic netlink is started,
which is basically only the control family (apart from
the workaround code, which I also had to add code for so
it would reserve those IDs)
Thus, anything other than GENL_ID_GENERATE is flawed and
luckily not used except in the cases I mentioned. Move
those workarounds into a few lines of code, and then get
rid of GENL_ID_GENERATE entirely, making it more robust.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>