diff options
author | Vikas Chaudhary <vikas.chaudhary@qlogic.com> | 2012-02-13 18:30:46 +0530 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-02-19 09:33:32 -0600 |
commit | a11e25459558421ec5c4adc3fc46fe320ab74bd3 (patch) | |
tree | f1112f31c65b28337b9b25082a1c5a8246ceb1ad /drivers/scsi/scsi_transport_iscsi.c | |
parent | 46801ba698b3366cf8d293d9f3d4253b6fd5210b (diff) | |
download | linux-stable-a11e25459558421ec5c4adc3fc46fe320ab74bd3.tar.gz linux-stable-a11e25459558421ec5c4adc3fc46fe320ab74bd3.tar.bz2 linux-stable-a11e25459558421ec5c4adc3fc46fe320ab74bd3.zip |
[SCSI] scsi_transport_iscsi: added support for host event
Added support to post kernel host event to application using
netlink interface.
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_iscsi.c')
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 787044828a70..38f0bf8ea91a 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1476,6 +1476,37 @@ void iscsi_conn_login_event(struct iscsi_cls_conn *conn, } EXPORT_SYMBOL_GPL(iscsi_conn_login_event); +void iscsi_post_host_event(uint32_t host_no, struct iscsi_transport *transport, + enum iscsi_host_event_code code, uint32_t data_size, + uint8_t *data) +{ + struct nlmsghdr *nlh; + struct sk_buff *skb; + struct iscsi_uevent *ev; + int len = NLMSG_SPACE(sizeof(*ev) + data_size); + + skb = alloc_skb(len, GFP_KERNEL); + if (!skb) { + printk(KERN_ERR "gracefully ignored host event (%d):%d OOM\n", + host_no, code); + return; + } + + nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); + ev = NLMSG_DATA(nlh); + ev->transport_handle = iscsi_handle(transport); + ev->type = ISCSI_KEVENT_HOST_EVENT; + ev->r.host_event.host_no = host_no; + ev->r.host_event.code = code; + ev->r.host_event.data_size = data_size; + + if (data_size) + memcpy((char *)ev + sizeof(*ev), data, data_size); + + iscsi_multicast_skb(skb, ISCSI_NL_GRP_ISCSID, GFP_KERNEL); +} +EXPORT_SYMBOL_GPL(iscsi_post_host_event); + static int iscsi_if_send_reply(uint32_t group, int seq, int type, int done, int multi, void *payload, int size) |