整理Generic Netlink 編程過程當中遇到的坑

Linux 4.10 API接口變動

1. 刪除了API函數__genl_register_family_with_ops(family, ops, n_ops).

2. 刪除了API宏函數genl_register_family_with_ops(family, ops).

git提交連接:
https://github.com/torvalds/l...linux

# 內核開發者日誌
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

git提交日誌連接:
https://github.com/torvalds/l...git

# 內核開發者日誌3
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>

Linux 3.13.0 API接口變動

  1. 刪除了API函數genl_register_ops() / genl_unregister_ops()

git提交日誌連接:
https://github.com/torvalds/l...github

# 內核開發者日誌
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>
相關文章
相關標籤/搜索