Linux 3.13.0删除了Netlink API函数genl_register_ops() / genl_unregister_ops()

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个下划线, 不是两个下划线.

链接:
https://github.com/torvalds/linux/commit/c53ed7423619b4e8108914a9f31b426dd58ad591#diff-ea377f51bb19ccf8eca5f86d57911514


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).

提交链接:
https://github.com/torvalds/linux/commit/489111e5c25b93be80340c3113d71903d7c82136#diff-ea377f51bb19ccf8eca5f86d57911514

# 内核开发者日志
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

提交链接:
https://github.com/torvalds/linux/commit/a07ea4d9941af5a0c6f0be2a71b51ac9c083c5e5#diff-978f38ced2a186be2e37a82afa10c815

# 内核开发者日志
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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值