Skip to contentSkip to conversation

backports: SmPL patch equivalence support

PATCH In review Luis R. Rodriguez 4 participants 13 messages Jun 6, 2015 – Jun 9, 2015

lore
Share & tools
lore
#0 lore raw

cover backports: SmPL patch equivalence support

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

A long time ago I wrote SmPL <--> patch equivalence proof support for backports but put that work on hold as I found it could be useful as a generic tool. Quite a bit of time has passed and I haven't gotten to that again so just merge this for now. If we want to generalize it we can do so later.

This goes with an example patch being transformed.

Luis R. Rodriguez (4):
patches: remove bt_sock_stream_recvmsg() and bt_sock_recvmsg() from
ifdefs
patches: change 0054-struct-proto_ops-sig backport strategy gentree.py: add SmPL patch equivalence proof support
patches: provide 0054-struct-proto_ops-sig SmPL patch replacement

 gentree.py                                         |  71 ++++++-
 .../network/0054-struct-proto_ops-sig.cocci        | 177 +++++++++++++++++
 .../0054-struct-proto_ops-sig/bluetooth.patch      | 212 ---------------------
 .../0054-struct-proto_ops-sig/ieee802154.patch     |  79 --------
 .../network/0054-struct-proto_ops-sig/nfc.patch    |  59 ------
 5 files changed, 240 insertions(+), 358 deletions(-)
 create mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig.cocci
 delete mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig/bluetooth.patch
 delete mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig/ieee802154.patch
 delete mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig/nfc.patch
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#1 lore raw

PATCH 1/4 patches: remove bt_sock_stream_recvmsg() and bt_sock_recvmsg() from ifdefs

Both bt_sock_recvmsg() and bt_sock_stream_recvmsg() are used within bluetooth code but the backport actually required is only for the struct proto_ops and struct proto sendmsg and recvmsg callbacks. The bt_sock_recvmsg() and bt_sock_stream_recvmsg() are not callbacks, they are exported but are used all within the code we provide and carry.

This will help simplify the network/0054-struct-proto_ops-sig collateral evolution port to Coccinelle SmPL.

1   3.0.101             [  OK  ]
2   3.1.10              [  OK  ]
3   3.2.68              [  OK  ]
4   3.3.8               [  OK  ]
5   3.4.107             [  OK  ]
6   3.5.7               [  OK  ]
7   3.6.11              [  OK  ]
8   3.7.10              [  OK  ]
9   3.8.13              [  OK  ]
10  3.9.11              [  OK  ]
11  3.10.75             [  OK  ]
12  3.11.10             [  OK  ]
13  3.12.40             [  OK  ]
14  3.13.11             [  OK  ]
15  3.14.39             [  OK  ]
16  3.15.10             [  OK  ]
17  3.16.7              [  OK  ]
18  3.17.8              [  OK  ]
19  3.18.12             [  OK  ]
20  3.19.5              [  OK  ]
21  4.0.0               [  OK  ]
22  4.1-rc1             [  OK  ]
---
 .../0054-struct-proto_ops-sig/bluetooth.patch      | 92 ----------------------
 1 file changed, 92 deletions(-)
patches/collateral-evolutions/network/0054-struct-proto_ops-sig/bluetooth.patch +0 -92
index 614e551..1bd0ced 100644
@@ -1,53 +1,3 @@
---- a/include/net/bluetooth/bluetooth.h
-+++ b/include/net/bluetooth/bluetooth.h
-@@ -245,10 +245,17 @@ int  bt_sock_register(int proto, const s
- void bt_sock_unregister(int proto);
- void bt_sock_link(struct bt_sock_list *l, struct sock *s);
- void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- int  bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
- 		     int flags);
- int  bt_sock_stream_recvmsg(struct socket *sock, struct msghdr *msg,
- 			    size_t len, int flags);
-+#else
-+int  bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
-+				struct msghdr *msg, size_t len, int flags);
-+int  bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
-+			struct msghdr *msg, size_t len, int flags);
-+#endif
- uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait);
- int  bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
- int  bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
---- a/net/bluetooth/af_bluetooth.c
-+++ b/net/bluetooth/af_bluetooth.c
-@@ -210,8 +210,13 @@ struct sock *bt_accept_dequeue(struct so
- }
- EXPORT_SYMBOL(bt_accept_dequeue);
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
- 		    int flags)
-+#else
-+int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
-+				struct msghdr *msg, size_t len, int flags)
-+#endif
- {
- 	int noblock = flags & MSG_DONTWAIT;
- 	struct sock *sk = sock->sk;
-@@ -283,8 +288,13 @@ static long bt_sock_data_wait(struct soc
- 	return timeo;
- }
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- int bt_sock_stream_recvmsg(struct socket *sock, struct msghdr *msg,
- 			   size_t size, int flags)
-+#else
-+int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
-+			       struct msghdr *msg, size_t size, int flags)
-+#endif
- {
- 	struct sock *sk = sock->sk;
- 	int err = 0;
 --- a/net/bluetooth/hci_sock.c
 +++ b/net/bluetooth/hci_sock.c
 @@ -906,8 +906,13 @@ static void hci_sock_cmsg(struct sock *s
@@ -108,24 +58,6 @@
  {
  	struct sock *sk = sock->sk;
  	struct l2cap_pinfo *pi = l2cap_pi(sk);
-@@ -1004,9 +1014,17 @@ static int l2cap_sock_recvmsg(struct soc
- 	release_sock(sk);
- 
- 	if (sock->type == SOCK_STREAM)
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 		err = bt_sock_stream_recvmsg(sock, msg, len, flags);
-+#else
-+		err = bt_sock_stream_recvmsg(iocb, sock, msg, len, flags);
-+#endif
- 	else
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 		err = bt_sock_recvmsg(sock, msg, len, flags);
-+#else
-+		err = bt_sock_recvmsg(iocb, sock, msg, len, flags);
-+#endif
- 
- 	if (pi->chan->mode != L2CAP_MODE_ERTM)
- 		return err;
 --- a/net/bluetooth/rfcomm/sock.c
 +++ b/net/bluetooth/rfcomm/sock.c
 @@ -549,8 +549,13 @@ static int rfcomm_sock_getname(struct so
@@ -156,18 +88,6 @@
  {
  	struct sock *sk = sock->sk;
  	struct rfcomm_dlc *d = rfcomm_pi(sk)->dlc;
-@@ -627,7 +637,11 @@ static int rfcomm_sock_recvmsg(struct so
- 		return 0;
- 	}
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	len = bt_sock_stream_recvmsg(sock, msg, size, flags);
-+#else
-+	len = bt_sock_stream_recvmsg(iocb, sock, msg, size, flags);
-+#endif
- 
- 	lock_sock(sk);
- 	if (!(flags & MSG_PEEK) && len > 0)
 --- a/net/bluetooth/sco.c
 +++ b/net/bluetooth/sco.c
 @@ -688,8 +688,13 @@ static int sco_sock_getname(struct socke
@@ -198,15 +118,3 @@
  {
  	struct sock *sk = sock->sk;
  	struct sco_pinfo *pi = sco_pi(sk);
-@@ -777,7 +787,11 @@ static int sco_sock_recvmsg(struct socke
- 
- 	release_sock(sk);
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	return bt_sock_recvmsg(sock, msg, len, flags);
-+#else
-+	return bt_sock_recvmsg(iocb, sock, msg, len, flags);
-+#endif
- }
- 
- static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#2 lore raw

PATCH 2/4 patches: change 0054-struct-proto_ops-sig backport strategy

In reply to Luis R. Rodriguez

This modifies we backport the struct proto_ops and struct proto declarations from adding #idefs around the function prototype arguments to just declaring our own new backport callback for older kernels with the extra argument which calls the the upstream function. This is done because we cannot write an SmPL grammar patch to backport the collateral evolution as we do it now. The backport strategy we provide now is equivalent in terms of functionality but also a lot more clear, it also leaves the upstream code unmodified as much as possible, this should enable anyone reviewing the code to be able to more easily determine exactly what is going on.

1   3.0.101             [  OK  ]
2   3.1.10              [  OK  ]
3   3.2.68              [  OK  ]
4   3.3.8               [  OK  ]
5   3.4.107             [  OK  ]
6   3.5.7               [  OK  ]
7   3.6.11              [  OK  ]
8   3.7.10              [  OK  ]
9   3.8.13              [  OK  ]
10  3.9.11              [  OK  ]
11  3.10.75             [  OK  ]
12  3.11.10             [  OK  ]
13  3.12.40             [  OK  ]
14  3.13.11             [  OK  ]
15  3.14.39             [  OK  ]
16  3.15.10             [  OK  ]
17  3.16.7              [  OK  ]
18  3.17.8              [  OK  ]
19  3.18.12             [  OK  ]
20  3.19.5              [  OK  ]
21  4.0.0               [  OK  ]
22  4.1-rc1             [  OK  ]
real    53m48.791s
user    1437m15.048s
sys     217m20.652s
---
 .../0054-struct-proto_ops-sig/bluetooth.patch      | 235 +++++++++++++--------
 .../0054-struct-proto_ops-sig/ieee802154.patch     | 161 +++++++++-----
 .../network/0054-struct-proto_ops-sig/nfc.patch    | 138 ++++++++----
 3 files changed, 356 insertions(+), 178 deletions(-)
patches/collateral-evolutions/network/0054-struct-proto_ops-sig/bluetooth.patch +151 -84
index 1bd0ced..2cf5a9e 100644
@@ -1,120 +1,187 @@
 --- a/net/bluetooth/hci_sock.c
 +++ b/net/bluetooth/hci_sock.c
-@@ -906,8 +906,13 @@ static void hci_sock_cmsg(struct sock *s
- 	}
+@@ -953,6 +953,14 @@ static int hci_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
+ 
+ 	return err ? : copied;
  }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
++				     struct msghdr *msg, size_t len,
++				     int flags)
++{
++	return hci_sock_recvmsg(sock, msg, len, flags);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
  
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- static int hci_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
- 			    int flags)
-+#else
-+static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
-+			    struct msghdr *msg, size_t len, int flags)
-+#endif
- {
- 	int noblock = flags & MSG_DONTWAIT;
- 	struct sock *sk = sock->sk;
-@@ -1065,8 +1070,13 @@ done:
- 	return err;
+ static int hci_mgmt_cmd(struct hci_mgmt_chan *chan, struct sock *sk,
+ 			struct msghdr *msg, size_t msglen)
+@@ -1189,6 +1196,13 @@ drop:
+ 	kfree_skb(skb);
+ 	goto done;
  }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
++				     struct msghdr *msg, size_t len)
++{
++	return hci_sock_sendmsg(sock, msg, len);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
  
+ static int hci_sock_setsockopt(struct socket *sock, int level, int optname,
+ 			       char __user *optval, unsigned int len)
+@@ -1345,8 +1358,13 @@ static const struct proto_ops hci_sock_ops = {
+ 	.release	= hci_sock_release,
+ 	.bind		= hci_sock_bind,
+ 	.getname	= hci_sock_getname,
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- static int hci_sock_sendmsg(struct socket *sock, struct msghdr *msg,
- 			    size_t len)
+ 	.sendmsg	= hci_sock_sendmsg,
+ 	.recvmsg	= hci_sock_recvmsg,
 +#else
-+static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
-+			    struct msghdr *msg, size_t len)
-+#endif
- {
- 	struct sock *sk = sock->sk;
- 	struct hci_mgmt_chan *chan;
++	.sendmsg = backport_hci_sock_sendmsg,
++	.recvmsg = backport_hci_sock_recvmsg,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+ 	.ioctl		= hci_sock_ioctl,
+ 	.poll		= datagram_poll,
+ 	.listen		= sock_no_listen,
 --- a/net/bluetooth/l2cap_sock.c
 +++ b/net/bluetooth/l2cap_sock.c
-@@ -944,8 +944,13 @@ static int l2cap_sock_setsockopt(struct
+@@ -975,6 +975,13 @@ static int l2cap_sock_sendmsg(struct socket *sock, struct msghdr *msg,
+ 
  	return err;
  }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_l2cap_sock_sendmsg(struct kiocb *iocb,
++				       struct socket *sock,
++				       struct msghdr *msg, size_t len){
++	return l2cap_sock_sendmsg(sock, msg, len);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
  
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- static int l2cap_sock_sendmsg(struct socket *sock, struct msghdr *msg,
- 			      size_t len)
-+#else
-+static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
-+			      struct msghdr *msg, size_t len)
-+#endif
- {
- 	struct sock *sk = sock->sk;
- 	struct l2cap_chan *chan = l2cap_pi(sk)->chan;
-@@ -976,8 +981,13 @@ static int l2cap_sock_sendmsg(struct soc
+ static int l2cap_sock_recvmsg(struct socket *sock, struct msghdr *msg,
+ 			      size_t len, int flags)
+@@ -1036,6 +1043,14 @@ done:
+ 	release_sock(sk);
  	return err;
  }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_l2cap_sock_recvmsg(struct kiocb *iocb,
++				       struct socket *sock,
++				       struct msghdr *msg, size_t len,
++				       int flags){
++	return l2cap_sock_recvmsg(sock, msg, len, flags);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
  
+ /* Kill socket (only if zapped and orphan)
+  * Must be called on unlocked socket.
+@@ -1618,8 +1633,16 @@ static const struct proto_ops l2cap_sock_ops = {
+ 	.listen		= l2cap_sock_listen,
+ 	.accept		= l2cap_sock_accept,
+ 	.getname	= l2cap_sock_getname,
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- static int l2cap_sock_recvmsg(struct socket *sock, struct msghdr *msg,
- 			      size_t len, int flags)
+ 	.sendmsg	= l2cap_sock_sendmsg,
 +#else
-+static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
-+			      struct msghdr *msg, size_t len, int flags)
-+#endif
- {
- 	struct sock *sk = sock->sk;
- 	struct l2cap_pinfo *pi = l2cap_pi(sk);
++	.sendmsg = backport_l2cap_sock_sendmsg,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.recvmsg	= l2cap_sock_recvmsg,
++#else
++	.recvmsg = backport_l2cap_sock_recvmsg,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+ 	.poll		= bt_sock_poll,
+ 	.ioctl		= bt_sock_ioctl,
+ 	.mmap		= sock_no_mmap,
 --- a/net/bluetooth/rfcomm/sock.c
 +++ b/net/bluetooth/rfcomm/sock.c
-@@ -549,8 +549,13 @@ static int rfcomm_sock_getname(struct so
- 	return 0;
- }
+@@ -622,6 +622,13 @@ done:
  
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- static int rfcomm_sock_sendmsg(struct socket *sock, struct msghdr *msg,
- 			       size_t len)
-+#else
-+static int rfcomm_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
-+			       struct msghdr *msg, size_t len)
-+#endif
- {
- 	struct sock *sk = sock->sk;
- 	struct rfcomm_dlc *d = rfcomm_pi(sk)->dlc;
-@@ -615,8 +620,13 @@ done:
  	return sent;
  }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_rfcomm_sock_sendmsg(struct kiocb *iocb,
++					struct socket *sock,
++					struct msghdr *msg, size_t len){
++	return rfcomm_sock_sendmsg(sock, msg, len);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
  
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
  static int rfcomm_sock_recvmsg(struct socket *sock, struct msghdr *msg,
  			       size_t size, int flags)
-+#else
-+static int rfcomm_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
-+			       struct msghdr *msg, size_t size, int flags)
-+#endif
+@@ -647,6 +654,14 @@ static int rfcomm_sock_recvmsg(struct socket *sock, struct msghdr *msg,
+ 
+ 	return len;
+ }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_rfcomm_sock_recvmsg(struct kiocb *iocb,
++					struct socket *sock,
++					struct msghdr *msg, size_t len,
++					int flags){
++	return rfcomm_sock_recvmsg(sock, msg, len, flags);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
+ 
+ static int rfcomm_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, unsigned int optlen)
  {
- 	struct sock *sk = sock->sk;
- 	struct rfcomm_dlc *d = rfcomm_pi(sk)->dlc;
+@@ -1044,8 +1059,16 @@ static const struct proto_ops rfcomm_sock_ops = {
+ 	.listen		= rfcomm_sock_listen,
+ 	.accept		= rfcomm_sock_accept,
+ 	.getname	= rfcomm_sock_getname,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.sendmsg	= rfcomm_sock_sendmsg,
++#else
++	.sendmsg = backport_rfcomm_sock_sendmsg,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.recvmsg	= rfcomm_sock_recvmsg,
++#else
++	.recvmsg = backport_rfcomm_sock_recvmsg,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+ 	.shutdown	= rfcomm_sock_shutdown,
+ 	.setsockopt	= rfcomm_sock_setsockopt,
+ 	.getsockopt	= rfcomm_sock_getsockopt,
 --- a/net/bluetooth/sco.c
 +++ b/net/bluetooth/sco.c
-@@ -688,8 +688,13 @@ static int sco_sock_getname(struct socke
- 	return 0;
+@@ -713,6 +713,12 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg,
+ 	release_sock(sk);
+ 	return err;
  }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
++				     struct msghdr *msg, size_t len){
++	return sco_sock_sendmsg(sock, msg, len);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
  
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg,
- 			    size_t len)
-+#else
-+static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
-+			    struct msghdr *msg, size_t len)
-+#endif
+ static void sco_conn_defer_accept(struct hci_conn *conn, u16 setting)
  {
- 	struct sock *sk = sock->sk;
- 	int err;
-@@ -758,8 +763,13 @@ static void sco_conn_defer_accept(struct
- 	}
+@@ -779,6 +785,13 @@ static int sco_sock_recvmsg(struct socket *sock, struct msghdr *msg,
+ 
+ 	return bt_sock_recvmsg(sock, msg, len, flags);
  }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
++				     struct msghdr *msg, size_t len,
++				     int flags){
++	return sco_sock_recvmsg(sock, msg, len, flags);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
  
+ static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
+ {
+@@ -1178,8 +1191,16 @@ static const struct proto_ops sco_sock_ops = {
+ 	.listen		= sco_sock_listen,
+ 	.accept		= sco_sock_accept,
+ 	.getname	= sco_sock_getname,
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- static int sco_sock_recvmsg(struct socket *sock, struct msghdr *msg,
- 			    size_t len, int flags)
+ 	.sendmsg	= sco_sock_sendmsg,
 +#else
-+static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
-+			    struct msghdr *msg, size_t len, int flags)
-+#endif
- {
- 	struct sock *sk = sock->sk;
- 	struct sco_pinfo *pi = sco_pi(sk);
++	.sendmsg = backport_sco_sock_sendmsg,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.recvmsg	= sco_sock_recvmsg,
++#else
++	.recvmsg = backport_sco_sock_recvmsg,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+ 	.poll		= bt_sock_poll,
+ 	.ioctl		= bt_sock_ioctl,
+ 	.mmap		= sock_no_mmap,
patches/collateral-evolutions/network/0054-struct-proto_ops-sig/ieee802154.patch +108 -53

187 lines not on this page · raw message

patches/collateral-evolutions/network/0054-struct-proto_ops-sig/nfc.patch +97 -41

156 lines not on this page · raw message

Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#3 lore raw

PATCH 3/4 gentree.py: add SmPL patch equivalence proof support

In reply to Luis R. Rodriguez

If you have an SmPL patch that you think is ready to replace a series of unified diff patches you can pass as an argument to gentree.py '--prove-cocci' with the cocci file as the an extra argument and gentree.py will try to prove equivalence between the unified diff series and your Coccinelle SmPL patch.

You can use this as a guide when trying to replace an existing unified diff series carried within backports with a respective Coccinelle SmPL patch. You can use this to get a warm fuzzy or to provide backports maintainers with a warm fuzzy of comfort that your SmPL patch is sufficient.

In practice you might end up discovering as differences:

a) minor space cosmetic differences between what the Coccinelle engine does and what we as humans typically would do Coccinelle has already received substantial modificaitons to address some of these minor spacing changes, but some might still exist.

b) new code which previously was not modified, these are transformations which Coccinelle is providied to use, and hence further automating our backporting effort. If provide a backport of a collateral evolution in SmPL form it means we only have to write it once.

c) bugs within Coccinelle

a) and b) the most common differences observed, whereas we have yet to find c). If you find a) or c) please report the differences on the Coccinelle development mailing list.

The algorithm used for SmPL patch equivalence proof is as follows, using the command below:

mcgrof at cerro ~/backports (git::master)$ ./gentree.py --clean --prove-cocci \
	patches/collateral-evolutions/network/09-threaded-irq.cocci \
	/home/mcgrof/linux-next/ \
	/home/mcgrof/build/backports-20131206

When this is run gentree.py will first copy code we wish to backport from linux-next into two separate directories:

1) /home/mcgrof/build/backports-20131206
We then only apply the Coccinelle SmPL patch 09-threaded-irq.cocci

2) /home/mcgrof/build/backports-20131206.orig
We then only apply the unified diff patches found within the directory:
patches/collateral-evolutions/network/09-threaded-irq/

At this point we now have two treees with two different backporting strategies. Internally when --prove-cocci is used gentree.py creates within backports-20131206 a git to keep track of differences, this includes application of the 09-threaded-irq.cocci patch. We take advantage of the fact git is used then and replace all the files within backports-20131206.orig into backports-20131206 and just ask git for the differences.

In this particular case the diff stat shown reveals huge amount of differences, in this case upon inspecting the changes it reveals that using Coccinelle has enabled the generalized backport to propagate into a lot of other device drivers, and hence doing more automatic backport work for us. This is precicely why we want to generalize backports in Coccinelle SmPL form when possible.

A diff stat with no output would mean that there is a perfect equivalence.

The output of the command:

Copy original source files ...
Apply patches ...
Proving Coccinelle SmPL patch: 09-threaded-irq.cocci
Aggregating patch for Coccinelle SmPL 09-threaded-irq proof: drivers_net_wireless_b43_b43.patch Aggregating patch for Coccinelle SmPL 09-threaded-irq proof: drivers_net_wireless_iwlwifi_pcie_internal.patch Aggregating patch for Coccinelle SmPL 09-threaded-irq proof: drivers_net_wireless_ti_wlcore_main.patch Aggregating patch for Coccinelle SmPL 09-threaded-irq proof: drivers_net_wireless_b43_main.patch Aggregating patch for Coccinelle SmPL 09-threaded-irq proof: drivers_net_wireless_ti_wlcore_main_extra.patch Aggregating patch for Coccinelle SmPL 09-threaded-irq proof: drivers_net_wireless_iwlwifi_pcie_trans.patch Aggregating patch for Coccinelle SmPL 09-threaded-irq proof: drivers_net_wireless_ti_wlcore_wlcore.patch

Review the difference between what the tree looks like by applying your SmPL patch, then reverting that and only applying your the patches in the patch series.

Change directory to /home/mcgrof/build/backports-20131206 and run 'git diff' diff stat of the changes:

 drivers/media/platform/via-camera.c           | 28 +-----------
 drivers/media/radio/radio-wl1273.c            | 28 +-----------
 drivers/media/radio/si470x/radio-si470x-i2c.c | 24 +----------
 drivers/media/radio/si470x/radio-si470x.h     |  3 --
 drivers/net/ieee802154/mrf24j40.c             | 20 ---------
 drivers/net/wireless/ath/wil6210/interrupt.c  | 62 +++------------------------
 drivers/net/wireless/ath/wil6210/wil6210.h    |  3 --
 drivers/net/wireless/b43/main.c               | 21 ++++-----
 drivers/net/wireless/cw1200/cw1200_sdio.c     | 21 ---------
 drivers/net/wireless/cw1200/cw1200_spi.c      | 27 +-----------
 drivers/net/wireless/iwlwifi/pcie/internal.h  |  3 ++
 drivers/net/wireless/iwlwifi/pcie/trans.c     | 34 ++++++---------
 drivers/net/wireless/ti/wlcore/main.c         | 26 +++++------
 drivers/nfc/microread/i2c.c                   | 27 +-----------
 drivers/nfc/pn544/i2c.c                       | 27 +-----------
 drivers/regulator/da9063-regulator.c          | 26 -----------
 drivers/regulator/lp8755.c                    | 23 +---------
 17 files changed, 52 insertions(+), 351 deletions(-)
---
 gentree.py | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 63 insertions(+), 8 deletions(-)
gentree.py +63 -8
index 636ea60..9e9293b 100755
@@ -485,14 +485,30 @@ def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda
     a specific SmPL patch.
     """
     logwrite('Applying patches from %s to %s ...' % (patch_src, target_dir))
-    test_cocci = args.test_cocci or args.profile_cocci
+    test_cocci = args.test_cocci or args.profile_cocci or args.prove_cocci
+    # We don't skip all patches for SmPL proof, we need to use its old series
+    skip_patches = args.profile_cocci or args.test_cocci
     test_cocci_found = False
+    prove_cocci_tmp_dir = ''
+    if args.prove_cocci:
+        test_cocci = test_cocci.split('/')[-1]
+        prove_cocci_tmp_dir = target_dir + '.orig'
+        shutil.rmtree(prove_cocci_tmp_dir, ignore_errors=True)
+        copytree(target_dir, prove_cocci_tmp_dir)
     patches = []
     sempatches = []
     for root, dirs, files in os.walk(os.path.join(source_dir, patch_src)):
         for f in files:
-            if not test_cocci and f.endswith('.patch'):
-                patches.append(os.path.join(root, f))
+            if not skip_patches and f.endswith('.patch'):
+                if args.prove_cocci:
+                    # As an example if you use --prove-cocci patches/collateral-evolutions/network/09-threaded-irq.cocci
+                    # the patches under 09-threaded-irq will be used for the proof.
+                    proof_to_test_dir = test_cocci.split('/')[-1].split('.cocci')[0]
+                    if proof_to_test_dir in os.path.join(root, f):
+                        logwrite("Aggregating patch for Coccinelle SmPL %s proof: %s" % (proof_to_test_dir, f))
+                        patches.append(os.path.join(root, f))
+                else:
+                    patches.append(os.path.join(root, f))
             if f.endswith('.cocci'):
                 if test_cocci:
                     if f not in test_cocci:
@@ -502,6 +518,8 @@ def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda
                         logwrite("Testing Coccinelle SmPL patch: %s" % test_cocci)
                     elif args.profile_cocci:
                         logwrite("Profiling Coccinelle SmPL patch: %s" % test_cocci)
+                    elif args.prove_cocci:
+                        logwrite("Proving Coccinelle SmPL patch: %s" % test_cocci)
                 sempatches.append(os.path.join(root, f))
     patches.sort()
     prefix_len = len(os.path.join(source_dir, patch_src)) + 1
@@ -533,10 +551,13 @@ def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda
                 fullfn = os.path.join(target_dir, patched_file)
                 shutil.copyfile(fullfn, fullfn + '.orig_file')
 
+        patch_target_dir = target_dir
+        if args.prove_cocci:
+            patch_target_dir = prove_cocci_tmp_dir
         process = subprocess.Popen(['patch', '-p1'], stdout=subprocess.PIPE,
                                    stderr=subprocess.STDOUT, stdin=subprocess.PIPE,
                                    close_fds=True, universal_newlines=True,
-                                   cwd=target_dir)
+                                   cwd=patch_target_dir)
         output = process.communicate(input=open(pfile, 'r').read())[0]
         output = output.split('\n')
         if output[-1] == '':
@@ -578,7 +599,13 @@ def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda
             for f in files:
                 if f[-5:] == '.orig' or f[-4:] == '.rej':
                     os.unlink(os.path.join(root, f))
-        git_debug_snapshot(args, "apply %s patch %s" % (desc, print_name))
+        if patch_target_dir != target_dir:
+            for root, dirs, files in os.walk(patch_target_dir):
+                for f in files:
+                    if f[-5:] == '.orig' or f[-4:] == '.rej':
+                        os.unlink(os.path.join(root, f))
+        if not args.prove_cocci:
+            git_debug_snapshot(args, "apply %s patch %s" % (desc, print_name))
 
     sempatches.sort()
     prefix_len = len(os.path.join(source_dir, patch_src)) + 1
@@ -615,8 +642,27 @@ def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda
             for f in files:
                 if f.endswith('.cocci_backup'):
                     os.unlink(os.path.join(root, f))
+        if patch_target_dir != target_dir:
+            for root, dirs, files in os.walk(patch_target_dir):
+                for f in files:
+                    if f.endswith('.cocci_backup'):
+                        os.unlink(os.path.join(root, f))
         git_debug_snapshot(args, "apply %s SmPL patch %s" % (desc, print_name))
 
+    if args.prove_cocci:
+        copytree(prove_cocci_tmp_dir, target_dir, ignore=shutil.ignore_patterns('.git'))
+        shutil.rmtree(prove_cocci_tmp_dir, ignore_errors=True)
+        diff_stat = git.diff(tree=target_dir, extra_args=['--stat'])
+        if len(diff_stat) == 0:
+            logwrite('\nSmPL patch fully replaces patch series')
+        else:
+            logwrite('\nReview the difference between what the tree looks like ')
+            logwrite('by applying your SmPL patch, then reverting that and ')
+            logwrite('only applying your the patches in the patch series.')
+            logwrite('')
+            logwrite('Change directory to %s and run \'git diff\'' % target_dir)
+            logwrite('diff stat of the changes:\n')
+        logwrite(diff_stat)
     if test_cocci and test_cocci_found:
         logwrite('Done!')
         sys.exit(0)
@@ -675,6 +721,11 @@ def _main():
                         help='Only use the cocci file passed and pass --profile  to Coccinelle, ' +
                              'also creates a git repo on the target directory for easy inspection ' +
                              'of changes done by Coccinelle.')
+    parser.add_argument('--prove-cocci', metavar='<sp_file>', type=str, default=None,
+                        help='Only use the cocci file passed for Coccinelle and prove that it provides ' +
+                             'sufficient replacement for the patches under similar path name. Running ' +
+                             'git diff on the target directory suffices to show you what extra things' +
+                             'your SmPL patch did or what it didn\'t cover.')
     args = parser.parse_args()
 
     # When building a package we use CPTCFG as we can rely on the
@@ -721,6 +772,7 @@ def _main():
                    kup_test=args.kup_test,
                    test_cocci=args.test_cocci,
                    profile_cocci=args.profile_cocci,
+                   prove_cocci=args.prove_cocci,
                    logwrite=logwrite)
 
 def process(kerneldir, copy_list_file, git_revision=None,
@@ -730,6 +782,7 @@ def process(kerneldir, copy_list_file, git_revision=None,
             kup_test=False,
             test_cocci=None,
             profile_cocci=None,
+            prove_cocci=None,
             logwrite=lambda x:None,
             git_tracked_version=False):
     class Args(object):
@@ -738,7 +791,8 @@ def process(kerneldir, copy_list_file, git_revision=None,
                      gitdebug, verbose, extra_driver, kup,
                      kup_test,
                      test_cocci,
-                     profile_cocci):
+                     profile_cocci,
+                     prove_cocci):
             self.kerneldir = kerneldir
             self.copy_list = copy_list_file
             self.git_revision = git_revision
@@ -753,7 +807,8 @@ def process(kerneldir, copy_list_file, git_revision=None,
             self.kup_test = kup_test
             self.test_cocci = test_cocci
             self.profile_cocci = profile_cocci
-            if self.test_cocci or self.profile_cocci:
+            self.prove_cocci = prove_cocci
+            if self.test_cocci or self.profile_cocci or self.prove_cocci:
                 self.gitdebug = True
     def git_paranoia(tree=None, logwrite=lambda x:None):
         data = git.paranoia(tree)
@@ -767,7 +822,7 @@ def process(kerneldir, copy_list_file, git_revision=None,
     args = Args(kerneldir, copy_list_file,
                 git_revision, bpid, clean, refresh, base_name,
                 gitdebug, verbose, extra_driver, kup, kup_test,
-                test_cocci, profile_cocci)
+                test_cocci, profile_cocci, prove_cocci)
     rel_prep = None
 
     if bpid.integrate:
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#4 lore raw

Re: [PATCH 3/4] gentree.py: add SmPL patch equivalence proof support

Quoted 11 lines · Luis R. Rodriguez

If you have an SmPL patch that you think is ready to replace a series of unified diff patches you can pass as an argument to gentree.py '--prove-cocci' with the cocci file as the an extra argument and gentree.py will try to prove equivalence between the unified diff series and your Coccinelle SmPL patch.

You can use this as a guide when trying to replace an existing unified diff series carried within backports with a respective Coccinelle SmPL patch. You can use this to get a warm fuzzy or to provide backports maintainers with a warm fuzzy of comfort that your SmPL patch is sufficient.

I don't like this at all.

gentree.py is supposed to be a tool to generate a new backport tree. You're (ab)using it for (s)patch development purposes that it was never intended for.

It's already grown to be a spaghetti mess of different options, some of which cause partial tree creation (or no proper tree creation at all, iirc) and I think adding more to this will make it unmaintainable.

Additionally, there's no real reason why this needs to be part of gentree. In theory, you can just apply both patches to any kind of tree (doesn't have to be a backport) and see the difference.

In practice, I understand that it might make sense to apply them to a backport tree because that's where the original patch (non-spatch) came from, since presumably you want to use it for development. However, I still think this is far enough from the original purpose just like test_cocci and profile_cocci that it shouldn't be there.

I'd support changing gentree to support a "up to this patch" mode, in which it stops processing at a certain patch and other scripts can then do remaining work like cocci profiling (which IMHO really shouldn't be here at all) or this comparison testing.

I can also see how adding more to this script is convenient, since it's just a few lines of code in the right place in the script, but this has already made it complicated to follow all the different code paths and change them appropriately for any changes.

As a consequence, I cannot support this change and would much rather remove more of the cocci test options from here - really something like profiling and equivalence testing should be part of a script provided by upstream coccinelle anyway, instead of in the backports project.

johannes

#5 lore raw

Re: [PATCH 3/4] gentree.py: add SmPL patch equivalence proof support

Quoted 13 lines · Johannes Berg
Quoted 11 lines · Luis R. Rodriguez

If you have an SmPL patch that you think is ready to replace a series of unified diff patches you can pass as an argument to gentree.py '--prove-cocci' with the cocci file as the an extra argument and gentree.py will try to prove equivalence between the unified diff series and your Coccinelle SmPL patch.

You can use this as a guide when trying to replace an existing unified diff series carried within backports with a respective Coccinelle SmPL patch. You can use this to get a warm fuzzy or to provide backports maintainers with a warm fuzzy of comfort that your SmPL patch is sufficient.

Quoted 5 lines

I don't like this at all.

gentree.py is supposed to be a tool to generate a new backport tree. You're (ab)using it for (s)patch development purposes that it was never intended for.

This is true, its in the like of how we wrote pycocci to provide us with a multithreaded solution for spatch integration / development as well and how pycocci now is upstream on Coccinelle. That will / can be used until Coccinelle completes integration of wrapping up its multithreaded solution in a slightly different way.

Quoted 3 lines

It's already grown to be a spaghetti mess of different options, some of which cause partial tree creation (or no proper tree creation at all, iirc) and I think adding more to this will make it unmaintainable.

Yeah I can see that, it might already be pretty complex as-is.

Quoted 3 lines

Additionally, there's no real reason why this needs to be part of gentree. In theory, you can just apply both patches to any kind of tree (doesn't have to be a backport) and see the difference.

Indeed, my original goal was to generalize this but I just never got to it. I had a need for this again now, so I rebased it based on an old patch.

Quoted 5 lines

In practice, I understand that it might make sense to apply them to a backport tree because that's where the original patch (non-spatch) came from, since presumably you want to use it for development. However, I still think this is far enough from the original purpose just like test_cocci and profile_cocci that it shouldn't be there.

Sure, at least for this functionality the way it handles series is specialized to backports, ie, series-name-foo.cocci and assuming their's an equivalent unified patch equivalent series under series-name-foo/, but this can be generalized as part of a tool as well.

Quoted 4 lines

I'd support changing gentree to support a "up to this patch" mode, in which it stops processing at a certain patch and other scripts can then do remaining work like cocci profiling (which IMHO really shouldn't be here at all) or this comparison testing.

OK sure, agreed.

Quoted 4 lines

I can also see how adding more to this script is convenient, since it's just a few lines of code in the right place in the script, but this has already made it complicated to follow all the different code paths and change them appropriately for any changes.

Agreed.

Quoted 4 lines

As a consequence, I cannot support this change and would much rather remove more of the cocci test options from here - really something like profiling and equivalence testing should be part of a script provided by upstream coccinelle anyway, instead of in the backports project.

--test-cocci provides the similar functionality as you describe above to "stop after", in this case its just "apply only this series". Perhaps --test-cocci should be replaced with --only-this-series or something like that and/or --stop-on-series. Both would suffice for an external tool to them go and do the tests we need.

In so far as where else to put this functionality into, since pycocci is now part of Coccinelle, I could try to put that there.

I won't merge this then but I will note that I find this extremely useful for spatch development, I am not sure when I'll get time to integrate into pycocci which is why for convenience purpose did the respin. Folks who want this will just have to take this patch on their own and use it until we implement this into Coccinelle somehow directly (pycocci or others).

Luis

#6 lore raw

Re: [PATCH 3/4] gentree.py: add SmPL patch equivalence proof support

Quoted 3 lines · Luis R. Rodriguez

This is true, its in the like of how we wrote pycocci to provide us with a multithreaded solution for spatch integration / development as well and how pycocci now is upstream on Coccinelle.

Speaking of which - are you aware that pycocci fails (or rather doesn't fail!) miserably when cocci isn't installed/in the $PATH? At least I got a report to that extent, that it didn't really complete nor report an error in that case.

johannes

#7 lore raw

Re: [PATCH 3/4] gentree.py: add SmPL patch equivalence proof support

Quoted 9 lines · Johannes Berg
Quoted 3 lines · Luis R. Rodriguez

This is true, its in the like of how we wrote pycocci to provide us with a multithreaded solution for spatch integration / development as well and how pycocci now is upstream on Coccinelle.

Speaking of which - are you aware that pycocci fails (or rather doesn't fail!) miserably when cocci isn't installed/in the $PATH? At least I got a report to that extent,

Did you verify it?

Quoted 1 line

that it didn't really complete nor report an error in that case.

Definitely not. Error reporting from pycocci's use of Coccinelle use sucked though because it was adding extra spaces in between each character though, I just fixed that last week, will sync now. Patches / reports for issues are welcome but please note that pycocci is now part of Coccinelle so issues / patches should copy that list. For a while I'll just keep these in sync for convenience given that Coccinelle tends to batch a few commits before a release is made. I'll sync up now though.

mcgrof at ergon ~/linux-next (git::20150604-proto_ops-send-rcv-smpl)$ which pycocci
which: no pycocci in (/usr/local/bin/:/usr/local/sbin/:/sbin/:/usr/sbin/:/home/mcgrof/bin/:/usr/bin:/usr/local/bin/:/usr/local/sbin/:/sbin/:/usr/sbin/:/home/mcgrof/bin/:/usr/bin:/usr/local/bin/:/usr/local/sbin/:/sbin/:/usr/sbin/:/home/mcgrof/bin/:/usr/bin:/home/mcgrof/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games)

So not on my path.

mcgrof at ergon ~/linux-next (git::20150604-proto_ops-send-rcv-smpl)$ /home/mcgrof/devel/coccinelle/tools/pycocci 0002-no_dmabuf.cocci drivers/media/v4l2-core/videobuf2-dma-contig.c
spatch --sp-file 0002-no_dmabuf.cocci --in-place --recursive-includes --relax-include-path --use-coccigrep --timeout 120 --dir drivers/media/v4l2-core/videobuf2-dma-contig.c -max 4 -index 0 spatch --sp-file 0002-no_dmabuf.cocci --in-place --recursive-includes --relax-include-path --use-coccigrep --timeout 120 --dir drivers/media/v4l2-core/videobuf2-dma-contig.c -max 4 -index 1 spatch --sp-file 0002-no_dmabuf.cocci --in-place --recursive-includes --relax-include-path --use-coccigrep --timeout 120 --dir drivers/media/v4l2-core/videobuf2-dma-contig.c -max 4 -index 2 spatch --sp-file 0002-no_dmabuf.cocci --in-place --recursive-includes --relax-include-path --use-coccigrep --timeout 120 --dir drivers/media/v4l2-core/videobuf2-dma-contig.c -max 4 -index 3

and git diff yields exact same results as if when pycocci is in my path. Please have the user report the issue to this list and copy the cocci list. Also Johannes, I value your time and I feel you're investing quite a bit of time into this NACK discussion, I obviously trust your judgement completely on gentree.py maintenance so for your convenience feel free to be concise in your NACK's for patches there.

Luis

#8 lore raw

Re: [PATCH 3/4] gentree.py: add SmPL patch equivalence proof support

Quoted 5 lines · Luis R. Rodriguez
Quoted 3 lines

Speaking of which - are you aware that pycocci fails (or rather doesn't fail!) miserably when cocci isn't installed/in the $PATH? At least I got a report to that extent,

Did you verify it?

No, sorry. It was actually a pretty old discussion that came to my mind now.

Quoted 5 lines

mcgrof at ergon ~/linux-next (git::20150604-proto_ops-send-rcv-smpl)$ which pycocci
which: no pycocci in (/usr/local/bin/:/usr/local/sbin/:/sbin/:/usr/sbin/:/home/mcgrof/bin/:/usr/bin:/usr/local/bin/:/usr/local/sbin/:/sbin/:/usr/sbin/:/home/mcgrof/bin/:/usr/bin:/usr/local/bin/:/usr/local/sbin/:/sbin/:/usr/sbin/:/home/mcgrof/bin/:/usr/bin:/home/mcgrof/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games)

So not on my path.

Ah, no, I meant if *spatch* isn't on the $PATH, but you call pycocci ... the report said that in that case pycocci wasn't really failing "gracefully".

Anyway - I really should verify that myself first.

Quoted 4 lines

Also Johannes, I value your time and I feel you're investing quite a bit of time into this NACK discussion, I obviously trust your judgement completely on gentree.py maintenance so for your convenience feel free to be concise in your NACK's for patches there.

Nah, don't worry -- I need to write it down to actually have a coherent argument myself :)

johannes

#9 lore raw

PATCH 4/4 patches: provide 0054-struct-proto_ops-sig SmPL patch replacement

In reply to Luis R. Rodriguez

This replaces the 436 line of unified diff with 152 lines of grammar Coccinelle SmPL patch. SmPL patch equivalence proof tests reveals only cosmetic changes between using Coccinelle SmPL and unified diff as shown below. The difference shown are the results of two trees, one in which we applied the SmPL patch, and another in which the old unified patch series were used. This gives us an idea of what Coccinelle did differently.

1   3.0.101             [  OK  ]
2   3.1.10              [  OK  ]
3   3.2.68              [  OK  ]
4   3.3.8               [  OK  ]
5   3.4.107             [  OK  ]
6   3.5.7               [  OK  ]
7   3.6.11              [  OK  ]
8   3.7.10              [  OK  ]
9   3.8.13              [  OK  ]
10  3.9.11              [  OK  ]
11  3.10.75             [  OK  ]
12  3.11.10             [  OK  ]
13  3.12.40             [  OK  ]
14  3.13.11             [  OK  ]
15  3.14.39             [  OK  ]
16  3.15.10             [  OK  ]
17  3.16.7              [  OK  ]
18  3.17.8              [  OK  ]
19  3.18.12             [  OK  ]
20  3.19.5              [  OK  ]
21  4.0.0               [  OK  ]
22  4.1-rc1             [  OK  ]
mcgrof at ergon ~/backports (git::master)$ time \
	./gentree.py --clean --prove-cocci \
	patches/collateral-evolutions/network/0054-struct-proto_ops-sig.cocci \
	/home/mcgrof/linux-next/ /home/mcgrof/build/backports-20150525

Copy original source files ...
Applying patches from patches to
/home/mcgrof/build/backports-20150525 ...
Proving Coccinelle SmPL patch: 0054-struct-proto_ops-sig.cocci Aggregating patch for Coccinelle SmPL 0054-struct-proto_ops-sig proof: ieee802154.patch Aggregating patch for Coccinelle SmPL 0054-struct-proto_ops-sig proof: nfc.patch Aggregating patch for Coccinelle SmPL 0054-struct-proto_ops-sig proof: bluetooth.patch

Review the difference between what the tree looks like by applying your SmPL patch, then reverting that and only applying your the patches in the patch series.

Change directory to /home/mcgrof/build/backports-20150525 and run 'git diff' diff stat of the changes:

net/bluetooth/hci_sock.c | 11 +++++------

1 file changed, 5 insertions(+), 6 deletions(-)

Done!

real    0m21.965s
user    0m45.947s
sys     0m4.072s

Now when I change directory to /home/mcgrof/build/backports-20150525 and run 'git diff' I get:

	diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
	index 9326bc8..9ca0166 100644
	--- a/net/bluetooth/hci_sock.c
	+++ b/net/bluetooth/hci_sock.c
	@@ -956,7 +956,8 @@ static int hci_sock_recvmsg(struct socket *sock,
	struct msghdr *msg, size_t len,
	 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
	 static int backport_hci_sock_recvmsg(struct kiocb *iocb, struct socket
	*sock,
					     struct msghdr *msg, size_t len,
	-                                    int flags){
	+                                    int flags)
	+{
		return hci_sock_recvmsg(sock, msg, len, flags);
	 }
	 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
	@@ -1198,7 +1199,8 @@ drop:
	 }
	 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
	 static int backport_hci_sock_sendmsg(struct kiocb *iocb, struct socket
	*sock,
	-                                    struct msghdr *msg, size_t len){
	+                                    struct msghdr *msg, size_t len)
	+{
		return hci_sock_sendmsg(sock, msg, len);
	 }
	 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
	@@ -1360,12 +1362,9 @@ static const struct proto_ops hci_sock_ops = {
		.getname        = hci_sock_getname,
	 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
		.sendmsg        = hci_sock_sendmsg,
	-#else
	-       .sendmsg = backport_hci_sock_sendmsg,
	-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
	-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
		.recvmsg        = hci_sock_recvmsg,
	 #else
	+       .sendmsg = backport_hci_sock_sendmsg,
		.recvmsg = backport_hci_sock_recvmsg,
	 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
		.ioctl          = hci_sock_ioctl,
---
 .../network/0054-struct-proto_ops-sig.cocci        | 177 +++++++++++++++++++
 .../0054-struct-proto_ops-sig/bluetooth.patch      | 187 ---------------------
 .../0054-struct-proto_ops-sig/ieee802154.patch     | 134 ---------------
 .../network/0054-struct-proto_ops-sig/nfc.patch    | 115 -------------
 4 files changed, 177 insertions(+), 436 deletions(-)
 create mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig.cocci
 delete mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig/bluetooth.patch
 delete mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig/ieee802154.patch
 delete mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig/nfc.patch
patches/collateral-evolutions/network/0054-struct-proto_ops-sig.cocci new file +177 -0
new file mode 100644
index 0000000..0c0845a
@@ -0,0 +1,177 @@
+/*
+This provides the backport for the collateral evolution introduced
+via commit 1b784140474e4fc94281a49e96c67d29df0efbde, titled
+"net: Remove iocb argument from sendmsg and recvmsg".
+
+The net/tipc/ subsystem (Transparent Inter Process Communication (TIPC))
+relied historically on using an argument passed on the struct proto_ops
+and struct proto sendmsg and recvmsg callbacks to determine if it needed
+to perform a lock within its own code. Commit 1b784140474e4 removed replaced
+the locking functionality to require the argument and instead moved all
+the necessary heuristics into net/tipc. Other subsystems just passed NULL.
+After the net/tipc code was cleaned up from the locking (see commmit
+39a0295f901423e260a034ac7c3211ecaa9c2745 titled "tipc: Don't use iocb
+argument in socket layer") we no longer needed the extra argument on the
+struct proto_ops and struct proto callbacks.
+
+To backport non-tipc subsystems we then just need to modify the upstream
+code which declares these callbacks and add the extra argument again, but
+the same routine can be used from upstream code. The grammar we use below
+declares routines which can be pegged to struct proto_ops and struct proto
+callbacks that simply call the same upstream code, the extra argument is
+ignored. The argument can be ignored as it was only used within the
+net/tipc subsystem for locking purposes.
+*/
+
+@ proto_ops @
+identifier s, send_func, recv_func;
+@@
+
+ struct proto_ops s = {
+ 	.sendmsg = send_func,
+ 	.recvmsg = recv_func,
+};
+
+@ mod_send depends on proto_ops @
+identifier proto_ops.send_func;
+fresh identifier backport_send = "backport_" ## send_func;
+@@
+
+send_func(...)
+{
+	...
+}
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_send(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len)
++{
++	return send_func(sock, msg, len);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
+
+@ mod_recv depends on proto_ops @
+identifier proto_ops.recv_func;
+fresh identifier backport_recv = "backport_" ## recv_func;
+@@
+
+recv_func(...)
+{
+	...
+}
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_recv(struct kiocb *iocb, struct socket *sock,
++			  struct msghdr *msg, size_t len, int flags)
++{
++	return recv_func(sock, msg, len, flags);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
+
+@ mod_proto_ops_tx depends on proto_ops && mod_send @
+identifier s, proto_ops.send_func, mod_send.backport_send;
+@@
+
+ struct proto_ops s = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.sendmsg = send_func,
++#else
++	.sendmsg = backport_send,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+};
+
+@ mod_proto_ops_rx depends on proto_ops && mod_recv @
+identifier s, proto_ops.recv_func, mod_recv.backport_recv;
+@@
+
+ struct proto_ops s = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.recvmsg = recv_func,
++#else
++	.recvmsg = backport_recv,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+};
+
+@ mod_sock_send_callers depends on proto_ops@
+identifier proto_ops.send_func;
+identifier sock, msg, len, sk;
+@@
+
+send_func(struct socket *sock, struct msghdr *msg, size_t len)
+{
+	...
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+	return sk->sk_prot->sendmsg(sk, msg, len);
++#else
++	return sk->sk_prot->sendmsg(NULL, sk, msg, len);
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+}
+
+@ proto @
+identifier s, send_func, recv_func;
+@@
+
+ struct proto s = {
+ 	.sendmsg = send_func,
+ 	.recvmsg = recv_func,
+};
+
+@ proto_mod_send depends on proto @
+identifier proto.send_func;
+fresh identifier backport_send = "backport_" ## send_func;
+@@
+
+send_func(...)
+{
+	...
+}
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_send(struct kiocb *iocb, struct socket *sock,
++			  struct msghdr *msg, size_t len)
++{
++	return send_func(sock, msg, len);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
+
+@ proto_mod_recv depends on proto @
+identifier proto.recv_func;
+fresh identifier backport_recv = "backport_" ## recv_func;
+@@
+
+recv_func(...)
+{
+	...
+}
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_recv(struct kiocb *iocb, struct socket *sock,
++			  struct msghdr *msg, size_t len,
++			  int noblock, int flags, int *addr_len)
++{
++	return recv_func(sock, msg, len, noblock, flags, addr_len);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
+
+@ mod_proto_tx depends on proto && proto_mod_send @
+identifier s, proto.send_func, proto_mod_send.backport_send;
+@@
+
+ struct proto s = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.sendmsg = send_func,
++#else
++	.sendmsg = backport_send,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+};
+
+@ mod_proto_rx depends on proto && proto_mod_recv @
+identifier s, proto.recv_func, proto_mod_recv.backport_recv;
+@@
+
+ struct proto s = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.recvmsg = recv_func,
++#else
++	.recvmsg = backport_recv,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+};
patches/collateral-evolutions/network/0054-struct-proto_ops-sig/bluetooth.patch deleted +0 -187

187 lines not on this page · raw message

patches/collateral-evolutions/network/0054-struct-proto_ops-sig/ieee802154.patch deleted +0 -134

134 lines not on this page · raw message

patches/collateral-evolutions/network/0054-struct-proto_ops-sig/nfc.patch deleted +0 -115

115 lines not on this page · raw message

Signature · 1 line
2.3.2.209.gd67f9d5.dirty
Acked-by on v1 4/4
#10 lore raw

Re: [Cocci] [PATCH 4/4] patches: provide 0054-struct-proto_ops-sig SmPL patch replacement

for the semantic patch.

julia

Quoted 763 lines · Luis R. Rodriguez

This replaces the 436 line of unified diff with 152 lines of grammar Coccinelle SmPL patch. SmPL patch equivalence proof tests reveals only cosmetic changes between using Coccinelle SmPL and unified diff as shown below. The difference shown are the results of two trees, one in which we applied the SmPL patch, and another in which the old unified patch series were used. This gives us an idea of what Coccinelle did differently.

1   3.0.101             [  OK  ]
2   3.1.10              [  OK  ]
3   3.2.68              [  OK  ]
4   3.3.8               [  OK  ]
5   3.4.107             [  OK  ]
6   3.5.7               [  OK  ]
7   3.6.11              [  OK  ]
8   3.7.10              [  OK  ]
9   3.8.13              [  OK  ]
10  3.9.11              [  OK  ]
11  3.10.75             [  OK  ]
12  3.11.10             [  OK  ]
13  3.12.40             [  OK  ]
14  3.13.11             [  OK  ]
15  3.14.39             [  OK  ]
16  3.15.10             [  OK  ]
17  3.16.7              [  OK  ]
18  3.17.8              [  OK  ]
19  3.18.12             [  OK  ]
20  3.19.5              [  OK  ]
21  4.0.0               [  OK  ]
22  4.1-rc1             [  OK  ]
mcgrof at ergon ~/backports (git::master)$ time \
	./gentree.py --clean --prove-cocci \
	patches/collateral-evolutions/network/0054-struct-proto_ops-sig.cocci \
	/home/mcgrof/linux-next/ /home/mcgrof/build/backports-20150525

Copy original source files ...
Applying patches from patches to
/home/mcgrof/build/backports-20150525 ...
Proving Coccinelle SmPL patch: 0054-struct-proto_ops-sig.cocci Aggregating patch for Coccinelle SmPL 0054-struct-proto_ops-sig proof: ieee802154.patch Aggregating patch for Coccinelle SmPL 0054-struct-proto_ops-sig proof: nfc.patch Aggregating patch for Coccinelle SmPL 0054-struct-proto_ops-sig proof: bluetooth.patch

Review the difference between what the tree looks like by applying your SmPL patch, then reverting that and only applying your the patches in the patch series.

Change directory to /home/mcgrof/build/backports-20150525 and run 'git diff' diff stat of the changes:

net/bluetooth/hci_sock.c | 11 +++++------

1 file changed, 5 insertions(+), 6 deletions(-)

Done!

real    0m21.965s
user    0m45.947s
sys     0m4.072s

Now when I change directory to /home/mcgrof/build/backports-20150525 and run 'git diff' I get:

	diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
	index 9326bc8..9ca0166 100644
	--- a/net/bluetooth/hci_sock.c
	+++ b/net/bluetooth/hci_sock.c
	@@ -956,7 +956,8 @@ static int hci_sock_recvmsg(struct socket *sock,
	struct msghdr *msg, size_t len,
	 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
	 static int backport_hci_sock_recvmsg(struct kiocb *iocb, struct socket
	*sock,
					     struct msghdr *msg, size_t len,
	-                                    int flags){
	+                                    int flags)
	+{
		return hci_sock_recvmsg(sock, msg, len, flags);
	 }
	 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
	@@ -1198,7 +1199,8 @@ drop:
	 }
	 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
	 static int backport_hci_sock_sendmsg(struct kiocb *iocb, struct socket
	*sock,
	-                                    struct msghdr *msg, size_t len){
	+                                    struct msghdr *msg, size_t len)
	+{
		return hci_sock_sendmsg(sock, msg, len);
	 }
	 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
	@@ -1360,12 +1362,9 @@ static const struct proto_ops hci_sock_ops = {
		.getname        = hci_sock_getname,
	 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
		.sendmsg        = hci_sock_sendmsg,
	-#else
	-       .sendmsg = backport_hci_sock_sendmsg,
	-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
	-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
		.recvmsg        = hci_sock_recvmsg,
	 #else
	+       .sendmsg = backport_hci_sock_sendmsg,
		.recvmsg = backport_hci_sock_recvmsg,
	 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
		.ioctl          = hci_sock_ioctl,
---
 .../network/0054-struct-proto_ops-sig.cocci        | 177 +++++++++++++++++++
 .../0054-struct-proto_ops-sig/bluetooth.patch      | 187 ---------------------
 .../0054-struct-proto_ops-sig/ieee802154.patch     | 134 ---------------
 .../network/0054-struct-proto_ops-sig/nfc.patch    | 115 -------------
 4 files changed, 177 insertions(+), 436 deletions(-)
 create mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig.cocci
 delete mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig/bluetooth.patch
 delete mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig/ieee802154.patch
 delete mode 100644 patches/collateral-evolutions/network/0054-struct-proto_ops-sig/nfc.patch
patches/collateral-evolutions/network/0054-struct-proto_ops-sig.cocci new file +177 -0
new file mode 100644
index 0000000..0c0845a
@@ -0,0 +1,177 @@
+/*
+This provides the backport for the collateral evolution introduced
+via commit 1b784140474e4fc94281a49e96c67d29df0efbde, titled
+"net: Remove iocb argument from sendmsg and recvmsg".
+
+The net/tipc/ subsystem (Transparent Inter Process Communication (TIPC))
+relied historically on using an argument passed on the struct proto_ops
+and struct proto sendmsg and recvmsg callbacks to determine if it needed
+to perform a lock within its own code. Commit 1b784140474e4 removed replaced
+the locking functionality to require the argument and instead moved all
+the necessary heuristics into net/tipc. Other subsystems just passed NULL.
+After the net/tipc code was cleaned up from the locking (see commmit
+39a0295f901423e260a034ac7c3211ecaa9c2745 titled "tipc: Don't use iocb
+argument in socket layer") we no longer needed the extra argument on the
+struct proto_ops and struct proto callbacks.
+
+To backport non-tipc subsystems we then just need to modify the upstream
+code which declares these callbacks and add the extra argument again, but
+the same routine can be used from upstream code. The grammar we use below
+declares routines which can be pegged to struct proto_ops and struct proto
+callbacks that simply call the same upstream code, the extra argument is
+ignored. The argument can be ignored as it was only used within the
+net/tipc subsystem for locking purposes.
+*/
+
+@ proto_ops @
+identifier s, send_func, recv_func;
+@@
+
+ struct proto_ops s = {
+ 	.sendmsg = send_func,
+ 	.recvmsg = recv_func,
+};
+
+@ mod_send depends on proto_ops @
+identifier proto_ops.send_func;
+fresh identifier backport_send = "backport_" ## send_func;
+@@
+
+send_func(...)
+{
+	...
+}
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_send(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len)
++{
++	return send_func(sock, msg, len);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
+
+@ mod_recv depends on proto_ops @
+identifier proto_ops.recv_func;
+fresh identifier backport_recv = "backport_" ## recv_func;
+@@
+
+recv_func(...)
+{
+	...
+}
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_recv(struct kiocb *iocb, struct socket *sock,
++			  struct msghdr *msg, size_t len, int flags)
++{
++	return recv_func(sock, msg, len, flags);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
+
+@ mod_proto_ops_tx depends on proto_ops && mod_send @
+identifier s, proto_ops.send_func, mod_send.backport_send;
+@@
+
+ struct proto_ops s = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.sendmsg = send_func,
++#else
++	.sendmsg = backport_send,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+};
+
+@ mod_proto_ops_rx depends on proto_ops && mod_recv @
+identifier s, proto_ops.recv_func, mod_recv.backport_recv;
+@@
+
+ struct proto_ops s = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.recvmsg = recv_func,
++#else
++	.recvmsg = backport_recv,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+};
+
+@ mod_sock_send_callers depends on proto_ops@
+identifier proto_ops.send_func;
+identifier sock, msg, len, sk;
+@@
+
+send_func(struct socket *sock, struct msghdr *msg, size_t len)
+{
+	...
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+	return sk->sk_prot->sendmsg(sk, msg, len);
++#else
++	return sk->sk_prot->sendmsg(NULL, sk, msg, len);
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+}
+
+@ proto @
+identifier s, send_func, recv_func;
+@@
+
+ struct proto s = {
+ 	.sendmsg = send_func,
+ 	.recvmsg = recv_func,
+};
+
+@ proto_mod_send depends on proto @
+identifier proto.send_func;
+fresh identifier backport_send = "backport_" ## send_func;
+@@
+
+send_func(...)
+{
+	...
+}
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_send(struct kiocb *iocb, struct socket *sock,
++			  struct msghdr *msg, size_t len)
++{
++	return send_func(sock, msg, len);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
+
+@ proto_mod_recv depends on proto @
+identifier proto.recv_func;
+fresh identifier backport_recv = "backport_" ## recv_func;
+@@
+
+recv_func(...)
+{
+	...
+}
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++static int backport_recv(struct kiocb *iocb, struct socket *sock,
++			  struct msghdr *msg, size_t len,
++			  int noblock, int flags, int *addr_len)
++{
++	return recv_func(sock, msg, len, noblock, flags, addr_len);
++}
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
+
+@ mod_proto_tx depends on proto && proto_mod_send @
+identifier s, proto.send_func, proto_mod_send.backport_send;
+@@
+
+ struct proto s = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.sendmsg = send_func,
++#else
++	.sendmsg = backport_send,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+};
+
+@ mod_proto_rx depends on proto && proto_mod_recv @
+identifier s, proto.recv_func, proto_mod_recv.backport_recv;
+@@
+
+ struct proto s = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+ 	.recvmsg = recv_func,
++#else
++	.recvmsg = backport_recv,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
+};
patches/collateral-evolutions/network/0054-struct-proto_ops-sig/bluetooth.patch deleted +0 -187
deleted file mode 100644
index 2cf5a9e..0000000
@@ -1,187 +0,0 @@
---- a/net/bluetooth/hci_sock.c
-+++ b/net/bluetooth/hci_sock.c
-@@ -953,6 +953,14 @@ static int hci_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
- 
- 	return err ? : copied;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
-+				     struct msghdr *msg, size_t len,
-+				     int flags)
-+{
-+	return hci_sock_recvmsg(sock, msg, len, flags);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int hci_mgmt_cmd(struct hci_mgmt_chan *chan, struct sock *sk,
- 			struct msghdr *msg, size_t msglen)
-@@ -1189,6 +1196,13 @@ drop:
- 	kfree_skb(skb);
- 	goto done;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
-+				     struct msghdr *msg, size_t len)
-+{
-+	return hci_sock_sendmsg(sock, msg, len);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int hci_sock_setsockopt(struct socket *sock, int level, int optname,
- 			       char __user *optval, unsigned int len)
-@@ -1345,8 +1358,13 @@ static const struct proto_ops hci_sock_ops = {
- 	.release	= hci_sock_release,
- 	.bind		= hci_sock_bind,
- 	.getname	= hci_sock_getname,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.sendmsg	= hci_sock_sendmsg,
- 	.recvmsg	= hci_sock_recvmsg,
-+#else
-+	.sendmsg = backport_hci_sock_sendmsg,
-+	.recvmsg = backport_hci_sock_recvmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.ioctl		= hci_sock_ioctl,
- 	.poll		= datagram_poll,
- 	.listen		= sock_no_listen,
---- a/net/bluetooth/l2cap_sock.c
-+++ b/net/bluetooth/l2cap_sock.c
-@@ -975,6 +975,13 @@ static int l2cap_sock_sendmsg(struct socket *sock, struct msghdr *msg,
- 
- 	return err;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_l2cap_sock_sendmsg(struct kiocb *iocb,
-+				       struct socket *sock,
-+				       struct msghdr *msg, size_t len){
-+	return l2cap_sock_sendmsg(sock, msg, len);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int l2cap_sock_recvmsg(struct socket *sock, struct msghdr *msg,
- 			      size_t len, int flags)
-@@ -1036,6 +1043,14 @@ done:
- 	release_sock(sk);
- 	return err;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_l2cap_sock_recvmsg(struct kiocb *iocb,
-+				       struct socket *sock,
-+				       struct msghdr *msg, size_t len,
-+				       int flags){
-+	return l2cap_sock_recvmsg(sock, msg, len, flags);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- /* Kill socket (only if zapped and orphan)
-  * Must be called on unlocked socket.
-@@ -1618,8 +1633,16 @@ static const struct proto_ops l2cap_sock_ops = {
- 	.listen		= l2cap_sock_listen,
- 	.accept		= l2cap_sock_accept,
- 	.getname	= l2cap_sock_getname,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.sendmsg	= l2cap_sock_sendmsg,
-+#else
-+	.sendmsg = backport_l2cap_sock_sendmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.recvmsg	= l2cap_sock_recvmsg,
-+#else
-+	.recvmsg = backport_l2cap_sock_recvmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.poll		= bt_sock_poll,
- 	.ioctl		= bt_sock_ioctl,
- 	.mmap		= sock_no_mmap,
---- a/net/bluetooth/rfcomm/sock.c
-+++ b/net/bluetooth/rfcomm/sock.c
-@@ -622,6 +622,13 @@ done:
- 
- 	return sent;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_rfcomm_sock_sendmsg(struct kiocb *iocb,
-+					struct socket *sock,
-+					struct msghdr *msg, size_t len){
-+	return rfcomm_sock_sendmsg(sock, msg, len);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int rfcomm_sock_recvmsg(struct socket *sock, struct msghdr *msg,
- 			       size_t size, int flags)
-@@ -647,6 +654,14 @@ static int rfcomm_sock_recvmsg(struct socket *sock, struct msghdr *msg,
- 
- 	return len;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_rfcomm_sock_recvmsg(struct kiocb *iocb,
-+					struct socket *sock,
-+					struct msghdr *msg, size_t len,
-+					int flags){
-+	return rfcomm_sock_recvmsg(sock, msg, len, flags);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int rfcomm_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, unsigned int optlen)
- {
-@@ -1044,8 +1059,16 @@ static const struct proto_ops rfcomm_sock_ops = {
- 	.listen		= rfcomm_sock_listen,
- 	.accept		= rfcomm_sock_accept,
- 	.getname	= rfcomm_sock_getname,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.sendmsg	= rfcomm_sock_sendmsg,
-+#else
-+	.sendmsg = backport_rfcomm_sock_sendmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.recvmsg	= rfcomm_sock_recvmsg,
-+#else
-+	.recvmsg = backport_rfcomm_sock_recvmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.shutdown	= rfcomm_sock_shutdown,
- 	.setsockopt	= rfcomm_sock_setsockopt,
- 	.getsockopt	= rfcomm_sock_getsockopt,
---- a/net/bluetooth/sco.c
-+++ b/net/bluetooth/sco.c
-@@ -713,6 +713,12 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg,
- 	release_sock(sk);
- 	return err;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
-+				     struct msghdr *msg, size_t len){
-+	return sco_sock_sendmsg(sock, msg, len);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static void sco_conn_defer_accept(struct hci_conn *conn, u16 setting)
- {
-@@ -779,6 +785,13 @@ static int sco_sock_recvmsg(struct socket *sock, struct msghdr *msg,
- 
- 	return bt_sock_recvmsg(sock, msg, len, flags);
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
-+				     struct msghdr *msg, size_t len,
-+				     int flags){
-+	return sco_sock_recvmsg(sock, msg, len, flags);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
- {
-@@ -1178,8 +1191,16 @@ static const struct proto_ops sco_sock_ops = {
- 	.listen		= sco_sock_listen,
- 	.accept		= sco_sock_accept,
- 	.getname	= sco_sock_getname,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.sendmsg	= sco_sock_sendmsg,
-+#else
-+	.sendmsg = backport_sco_sock_sendmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.recvmsg	= sco_sock_recvmsg,
-+#else
-+	.recvmsg = backport_sco_sock_recvmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.poll		= bt_sock_poll,
- 	.ioctl		= bt_sock_ioctl,
- 	.mmap		= sock_no_mmap,
patches/collateral-evolutions/network/0054-struct-proto_ops-sig/ieee802154.patch deleted +0 -134
deleted file mode 100644
index 0497dbe..0000000
@@ -1,134 +0,0 @@
---- a/net/ieee802154/socket.c
-+++ b/net/ieee802154/socket.c
-@@ -101,8 +101,19 @@ static int ieee802154_sock_sendmsg(struct socket *sock, struct msghdr *msg,
- {
- 	struct sock *sk = sock->sk;
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	return sk->sk_prot->sendmsg(sk, msg, len);
-+#else
-+	return sk->sk_prot->sendmsg(NULL, sk, msg, len);
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_ieee802154_sock_sendmsg(struct kiocb *iocb,
-+					    struct socket *sock,
-+					    struct msghdr *msg, size_t len){
-+	return ieee802154_sock_sendmsg(sock, msg, len);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int ieee802154_sock_bind(struct socket *sock, struct sockaddr *uaddr,
- 				int addr_len)
-@@ -323,6 +334,12 @@ out_dev:
- out:
- 	return err;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_raw_sendmsg(struct kiocb *iocb, struct socket *sock,
-+				struct msghdr *msg, size_t len){
-+	return raw_sendmsg(sock, msg, len);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int raw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
- 		       int noblock, int flags, int *addr_len)
-@@ -356,6 +373,13 @@ out:
- 		return err;
- 	return copied;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_raw_recvmsg(struct kiocb *iocb, struct socket *sock,
-+				struct msghdr *msg, size_t len, int noblock,
-+				int flags, int *addr_len){
-+	return raw_recvmsg(sock, msg, len, noblock, flags, addr_len);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb)
- {
-@@ -409,8 +433,16 @@ static struct proto ieee802154_raw_prot = {
- 	.obj_size	= sizeof(struct sock),
- 	.close		= raw_close,
- 	.bind		= raw_bind,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.sendmsg	= raw_sendmsg,
-+#else
-+	.sendmsg = backport_raw_sendmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.recvmsg	= raw_recvmsg,
-+#else
-+	.recvmsg = backport_raw_recvmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.hash		= raw_hash,
- 	.unhash		= raw_unhash,
- 	.connect	= raw_connect,
-@@ -434,7 +466,11 @@ static const struct proto_ops ieee802154_raw_ops = {
- 	.shutdown	   = sock_no_shutdown,
- 	.setsockopt	   = sock_common_setsockopt,
- 	.getsockopt	   = sock_common_getsockopt,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.sendmsg	   = ieee802154_sock_sendmsg,
-+#else
-+	.sendmsg = backport_ieee802154_sock_sendmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.recvmsg	   = sock_common_recvmsg,
- 	.mmap		   = sock_no_mmap,
- 	.sendpage	   = sock_no_sendpage,
-@@ -710,6 +746,12 @@ out_dev:
- out:
- 	return err;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_dgram_sendmsg(struct kiocb *iocb, struct socket *sock,
-+				  struct msghdr *msg, size_t len){
-+	return dgram_sendmsg(sock, msg, len);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
- 			 int noblock, int flags, int *addr_len)
-@@ -751,6 +793,13 @@ out:
- 		return err;
- 	return copied;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_dgram_recvmsg(struct kiocb *iocb, struct socket *sock,
-+				  struct msghdr *msg, size_t len, int noblock,
-+				  int flags, int *addr_len){
-+	return dgram_recvmsg(sock, msg, len, noblock, flags, addr_len);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int dgram_rcv_skb(struct sock *sk, struct sk_buff *skb)
- {
-@@ -947,8 +996,16 @@ static struct proto ieee802154_dgram_prot = {
- 	.init		= dgram_init,
- 	.close		= dgram_close,
- 	.bind		= dgram_bind,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.sendmsg	= dgram_sendmsg,
-+#else
-+	.sendmsg = backport_dgram_sendmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.recvmsg	= dgram_recvmsg,
-+#else
-+	.recvmsg = backport_dgram_recvmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.hash		= dgram_hash,
- 	.unhash		= dgram_unhash,
- 	.connect	= dgram_connect,
-@@ -973,7 +1030,11 @@ static const struct proto_ops ieee802154_dgram_ops = {
- 	.shutdown	   = sock_no_shutdown,
- 	.setsockopt	   = sock_common_setsockopt,
- 	.getsockopt	   = sock_common_getsockopt,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.sendmsg	   = ieee802154_sock_sendmsg,
-+#else
-+	.sendmsg = backport_ieee802154_sock_sendmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.recvmsg	   = sock_common_recvmsg,
- 	.mmap		   = sock_no_mmap,
- 	.sendpage	   = sock_no_sendpage,
patches/collateral-evolutions/network/0054-struct-proto_ops-sig/nfc.patch deleted +0 -115
deleted file mode 100644
index e29c4d8..0000000
@@ -1,115 +0,0 @@
---- a/net/nfc/llcp_sock.c
-+++ b/net/nfc/llcp_sock.c
-@@ -792,6 +792,12 @@ static int llcp_sock_sendmsg(struct socket *sock, struct msghdr *msg,
- 
- 	return nfc_llcp_send_i_frame(llcp_sock, msg, len);
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_llcp_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
-+				      struct msghdr *msg, size_t len){
-+	return llcp_sock_sendmsg(sock, msg, len);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int llcp_sock_recvmsg(struct socket *sock, struct msghdr *msg,
- 			     size_t len, int flags)
-@@ -882,6 +888,13 @@ done:
- 
- 	return copied;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
-+				      struct msghdr *msg, size_t len,
-+				      int flags){
-+	return llcp_sock_recvmsg(sock, msg, len, flags);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static const struct proto_ops llcp_sock_ops = {
- 	.family         = PF_NFC,
-@@ -898,8 +911,16 @@ static const struct proto_ops llcp_sock_ops = {
- 	.shutdown       = sock_no_shutdown,
- 	.setsockopt     = nfc_llcp_setsockopt,
- 	.getsockopt     = nfc_llcp_getsockopt,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.sendmsg        = llcp_sock_sendmsg,
-+#else
-+	.sendmsg = backport_llcp_sock_sendmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.recvmsg        = llcp_sock_recvmsg,
-+#else
-+	.recvmsg = backport_llcp_sock_recvmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.mmap           = sock_no_mmap,
- };
- 
-@@ -919,7 +940,11 @@ static const struct proto_ops llcp_rawsock_ops = {
- 	.setsockopt     = sock_no_setsockopt,
- 	.getsockopt     = sock_no_getsockopt,
- 	.sendmsg        = sock_no_sendmsg,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.recvmsg        = llcp_sock_recvmsg,
-+#else
-+	.recvmsg = backport_llcp_sock_recvmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.mmap           = sock_no_mmap,
- };
- 
---- a/net/nfc/rawsock.c
-+++ b/net/nfc/rawsock.c
-@@ -246,6 +246,12 @@ static int rawsock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
- 
- 	return len;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_rawsock_sendmsg(struct kiocb *iocb, struct socket *sock,
-+				    struct msghdr *msg, size_t len){
-+	return rawsock_sendmsg(sock, msg, len);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static int rawsock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
- 			   int flags)
-@@ -274,6 +280,12 @@ static int rawsock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
- 
- 	return rc ? : copied;
- }
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-+static int backport_rawsock_recvmsg(struct kiocb *iocb, struct socket *sock,
-+				    struct msghdr *msg, size_t len, int flags){
-+	return rawsock_recvmsg(sock, msg, len, flags);
-+}
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
- 
- static const struct proto_ops rawsock_ops = {
- 	.family         = PF_NFC,
-@@ -290,8 +302,16 @@ static const struct proto_ops rawsock_ops = {
- 	.shutdown       = sock_no_shutdown,
- 	.setsockopt     = sock_no_setsockopt,
- 	.getsockopt     = sock_no_getsockopt,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.sendmsg        = rawsock_sendmsg,
-+#else
-+	.sendmsg = backport_rawsock_sendmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.recvmsg        = rawsock_recvmsg,
-+#else
-+	.recvmsg = backport_rawsock_recvmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.mmap           = sock_no_mmap,
- };
- 
-@@ -311,7 +331,11 @@ static const struct proto_ops rawsock_raw_ops = {
- 	.setsockopt     = sock_no_setsockopt,
- 	.getsockopt     = sock_no_getsockopt,
- 	.sendmsg        = sock_no_sendmsg,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
- 	.recvmsg        = rawsock_recvmsg,
-+#else
-+	.recvmsg = backport_rawsock_recvmsg,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */
- 	.mmap           = sock_no_mmap,
- };
- 
Signature · 6 lines
2.3.2.209.gd67f9d5.dirty

_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
#11 lore raw

Re: [Cocci] [PATCH 4/4] patches: provide 0054-struct-proto_ops-sig SmPL patch replacement

Quoted 1 line · Julia Lawall

Thanks for the review, I'll drop the SmPL proof support patches but merge the rest.

Luis

#12 lore raw
In reply to Luis R. Rodriguez
Quoted 6 lines · Luis R. Rodriguez

Luis R. Rodriguez (4):
patches: remove bt_sock_stream_recvmsg() and bt_sock_recvmsg() from
ifdefs
patches: change 0054-struct-proto_ops-sig backport strategy gentree.py: add SmPL patch equivalence proof support
patches: provide 0054-struct-proto_ops-sig SmPL patch replacement

FYI - dropped the gentree.py patch for SmPL proof support and pushed the rest.

Luis