scsi: replace obsolete NLMSG_* with type safe nlmsg_*
Subsystems (4)
PATCH 5/6 scsi: replace obsolete NLMSG_* with type safe nlmsg_*
Signed-off-by Hong Zhiguo <[email protected]>
--- drivers/scsi/scsi_netlink.c | 4 +-- drivers/scsi/scsi_transport_fc.c | 21 +++++-------- drivers/scsi/scsi_transport_iscsi.c | 56 +++++++++++++++++------------------ 3 files changed, 38 insertions(+), 43 deletions(-)
drivers/scsi/scsi_netlink.c +2 -2
@@ -50,7 +50,7 @@ scsi_nl_rcv_msg(struct sk_buff *skb)u32 rlen;int err, tport; -while (skb->len >=NLMSG_SPACE (0 )) { +while (skb->len >=NLMSG_HDRLEN ) { err =0 ; nlh =nlmsg_hdr (skb);
@@ -70,7 +70,7 @@ scsi_nl_rcv_msg(struct sk_buff *skb) goto next_msg; } - hdr =NLMSG_DATA (nlh); + hdr =nlmsg_data (nlh);if ((hdr->version !=SCSI_NL_VERSION ) || (hdr->magic !=SCSI_NL_MAGIC )) { err = -EPROTOTYPE ;
drivers/scsi/scsi_transport_fc.c +8 -13
@@ -35,7 +35,6 @@#include <scsi/scsi_transport.h> #include <scsi/scsi_transport_fc.h> #include <scsi/scsi_cmnd.h> -#include <linux/netlink.h> #include <net/netlink.h> #include <scsi/scsi_netlink_fc.h> #include <scsi/scsi_bsg_fc.h>
@@ -534,7 +533,7 @@ fc_host_post_event(struct Scsi_Host *shost, u32 event_number,struct nlmsghdr *nlh;struct fc_nl_event *event;const char *name; -u32 len, skblen; +u32 len;int err;if (!scsi_nl_sock) {
@@ -543,21 +542,19 @@ fc_host_post_event(struct Scsi_Host *shost, u32 event_number, } len =FC_NL_MSGALIGN (sizeof (*event)); - skblen =NLMSG_SPACE (len); - skb =alloc_skb (skblen,GFP_KERNEL ); + skb =nlmsg_new (len,GFP_KERNEL );if (!skb) { err = -ENOBUFS ; goto send_fail; } - nlh =nlmsg_put (skb,0 ,0 ,SCSI_TRANSPORT_MSG , - skblen -sizeof (*nlh),0 ); + nlh =nlmsg_put (skb,0 ,0 ,SCSI_TRANSPORT_MSG , len,0 );if (!nlh) { err = -ENOBUFS ; goto send_fail_skb; } - event =NLMSG_DATA (nlh); + event =nlmsg_data (nlh);INIT_SCSI_NL_HDR (&event->snlh,SCSI_NL_TRANSPORT_FC ,FC_NL_ASYNC_EVENT , len);
@@ -604,7 +601,7 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,struct sk_buff *skb;struct nlmsghdr *nlh;struct fc_nl_event *event; -u32 len, skblen; +u32 len;int err;if (!scsi_nl_sock) {
@@ -613,21 +610,19 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, } len =FC_NL_MSGALIGN (sizeof (*event) + data_len); - skblen =NLMSG_SPACE (len); - skb =alloc_skb (skblen,GFP_KERNEL ); + skb =nlmsg_new (len,GFP_KERNEL );if (!skb) { err = -ENOBUFS ; goto send_vendor_fail; } - nlh =nlmsg_put (skb,0 ,0 ,SCSI_TRANSPORT_MSG , - skblen -sizeof (*nlh),0 ); + nlh =nlmsg_put (skb,0 ,0 ,SCSI_TRANSPORT_MSG , len,0 );if (!nlh) { err = -ENOBUFS ; goto send_vendor_fail_skb; } - event =NLMSG_DATA (nlh); + event =nlmsg_data (nlh);INIT_SCSI_NL_HDR (&event->snlh,SCSI_NL_TRANSPORT_FC ,FC_NL_ASYNC_EVENT , len);
drivers/scsi/scsi_transport_iscsi.c +28 -28
222 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Quoted 1 line · Hong Zhiguo
Signed-off-by Hong Zhiguo <[email protected]>
There are some formatting errors but the Netlink bits themselves look good.
Thanks, Thomas. But I didn't change any formatting. Just do the substitution in place.
Quoted 5 lines · Thomas Graf
Quoted 1 line · Hong Zhiguo
Signed-off-by Hong Zhiguo <[email protected]>There are some formatting errors but the Netlink bits themselves look good.
Signature · 2 lines
best regards Hong Zhiguo
David Miller
maintainerFrom: Thomas Graf <[email protected]>
Date: Thu, 28 Mar 2013 14:45:02 +0000
Quoted 6 lines · Hong Zhiguo
Quoted 1 line
Signed-off-by Hong Zhiguo <[email protected]>There are some formatting errors but the Netlink bits themselves look good.
I'll fix these up too when I commit.
Quoted 7 lines · Hong Zhiguo
Signed-off-by Hong Zhiguo <[email protected]>--- drivers/scsi/scsi_netlink.c | 4 +-- drivers/scsi/scsi_transport_fc.c | 21 +++++-------- drivers/scsi/scsi_transport_iscsi.c | 56 +++++++++++++++++------------------ 3 files changed, 38 insertions(+), 43 deletions(-)
iscsi parts are ok. I also ran some quick tests on them.
Reviewed-by Mike Christie <[email protected]>
David Miller
maintainerFrom: Hong Zhiguo <[email protected]>
Date: Thu, 28 Mar 2013 00:53:15 +0800
Quoted 1 line
Signed-off-by Hong Zhiguo <[email protected]>
Applied with formatting fixed up.