Skip to contentSkip to conversation

compat: backport netlink pid to portid rename

PATCH New Luis R. Rodriguez 1 participant 1 message Sep 13, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat: backport netlink pid to portid rename

From: "Luis R. Rodriguez" <[email protected]>

The patch:

commit 15e473046cb6e5d18a4d0057e61d76315230382b

Author: Eric W. Biederman <[email protected]>
Date:   Fri Sep 7 20:12:54 2012 +0000

netlink: Rename pid to portid to avoid confusion

It is a frequent mistake to confuse the netlink port identifier with a process identifier. Try to reduce this confusion by renaming fields that hold port identifiers portid instead of pid.

I have carefully avoided changing the structures exported to userspace to avoid changing the userspace API.

I have successfully built an allyesconfig kernel with this change.

Changed the struct members:

struct netlink_notify->pid to
struct netlink_notify->portid

struct genl_info->snd_pid to
struct genl_info->snd_portid

This adds helpers to help reduce the overhead cost to backport this collateral evolution.

mcgrof@garbanzo ~/compat (git::master)$ time ckmake Trying kernel 3.5.0-030500-generic [OK] Trying kernel 3.4.4-030404-generic [OK] Trying kernel 3.3.7-030307-generic [OK] Trying kernel 3.2.2-030202-generic [OK] Trying kernel 3.1.10-030110-generic [OK] Trying kernel 3.0.18-030018-generic [OK] Trying kernel 2.6.39-02063904-generic [OK] Trying kernel 2.6.38-02063808-generic [OK] Trying kernel 2.6.37-02063706-generic [OK] Trying kernel 2.6.36-02063604-generic [OK] Trying kernel 2.6.35-02063512-generic [OK] Trying kernel 2.6.34-02063410-generic [OK] Trying kernel 2.6.33-02063305-generic [OK] Trying kernel 2.6.32-02063255-generic [OK] Trying kernel 2.6.31-02063113-generic [OK] Trying kernel 2.6.30-02063010-generic [OK] Trying kernel 2.6.29-02062906-generic [OK] Trying kernel 2.6.28-02062810-generic [OK] Trying kernel 2.6.27-020627-generic [OK] Trying kernel 2.6.26-020626-generic [OK] Trying kernel 2.6.25-020625-generic [OK] Trying kernel 2.6.24-020624-generic [OK]

real    1m0.017s
user    3m12.748s
sys     0m30.274s
Cc Eric W. Biederman <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc David S. Miller <[email protected]>
---
 include/linux/compat-3.7.h |    8 ++++++++
 1 file changed, 8 insertions(+)
include/linux/compat-3.7.h +8 -0
index 6cee787..e4e126c 100644
@@ -10,6 +10,10 @@
 #include <linux/pci.h>
 #include <linux/pci_regs.h>
 
+#define netlink_notify_portid(__notify) (__notify->pid)
+#define genl_info_snd_portid(__genl_info) (__genl_info->snd_pid)
+#define NETLINK_CB_PORTID(__skb) NETLINK_CB(cb->skb).pid
+
 bool mod_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork,
 		      unsigned long delay);
 
@@ -55,6 +59,10 @@ static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos,
 
 #define PCI_EXP_LNKSTA2			50      /* Link Status 2 */
 
+#else /* (LINUX_VERSION_CODE > KERNEL_VERSION(3,7,0)) */
+#define netlink_notify_portid(__notify) (__notify->portid)
+#define genl_info_snd_portid(__genl_info) (__genl_info->snd_portid)
+#define NETLINK_CB_PORTID(__skb) NETLINK_CB(cb->skb).portid
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) */
 
 #endif /* LINUX_3_7_COMPAT_H */
Signature · 1 line
1.7.10.4