diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-05-22 07:04:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-25 03:55:46 -0400 |
commit | 8c90e11e3543d7de612194a042a148caeaab5f1d (patch) | |
tree | ee2cc71e33af749692673add4aef255d9b5ab460 /drivers/isdn | |
parent | eac74af9b547e29c9634ed5eff4d514349e73310 (diff) |
mISDN: Use kernel_{send,recv}msg instead of open coding
Reducing the number of direct users of sock_{recv,send}msg.
Modified version to match the latest context.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Karsten Keil <keil@b1-systems.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/mISDN/l1oip.h | 2 | ||||
-rw-r--r-- | drivers/isdn/mISDN/l1oip_core.c | 24 |
2 files changed, 8 insertions, 18 deletions
diff --git a/drivers/isdn/mISDN/l1oip.h b/drivers/isdn/mISDN/l1oip.h index a23d575449f6..bc26c890d9a2 100644 --- a/drivers/isdn/mISDN/l1oip.h +++ b/drivers/isdn/mISDN/l1oip.h | |||
@@ -76,7 +76,7 @@ struct l1oip { | |||
76 | struct sockaddr_in sin_local; /* local socket name */ | 76 | struct sockaddr_in sin_local; /* local socket name */ |
77 | struct sockaddr_in sin_remote; /* remote socket name */ | 77 | struct sockaddr_in sin_remote; /* remote socket name */ |
78 | struct msghdr sendmsg; /* ip message to send */ | 78 | struct msghdr sendmsg; /* ip message to send */ |
79 | struct iovec sendiov; /* iov for message */ | 79 | struct kvec sendiov; /* iov for message */ |
80 | 80 | ||
81 | /* frame */ | 81 | /* frame */ |
82 | struct l1oip_chan chan[128]; /* channel instances */ | 82 | struct l1oip_chan chan[128]; /* channel instances */ |
diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c index d9cf83b17e3c..990e6a7e6674 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c | |||
@@ -279,7 +279,6 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, | |||
279 | int multi = 0; | 279 | int multi = 0; |
280 | u8 frame[len+32]; | 280 | u8 frame[len+32]; |
281 | struct socket *socket = NULL; | 281 | struct socket *socket = NULL; |
282 | mm_segment_t oldfs; | ||
283 | 282 | ||
284 | if (debug & DEBUG_L1OIP_MSG) | 283 | if (debug & DEBUG_L1OIP_MSG) |
285 | printk(KERN_DEBUG "%s: sending data to socket (len = %d)\n", | 284 | printk(KERN_DEBUG "%s: sending data to socket (len = %d)\n", |
@@ -352,10 +351,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, | |||
352 | "= %d)\n", __func__, len); | 351 | "= %d)\n", __func__, len); |
353 | hc->sendiov.iov_base = frame; | 352 | hc->sendiov.iov_base = frame; |
354 | hc->sendiov.iov_len = len; | 353 | hc->sendiov.iov_len = len; |
355 | oldfs = get_fs(); | 354 | len = kernel_sendmsg(socket, &hc->sendmsg, &hc->sendiov, 1, len); |
356 | set_fs(KERNEL_DS); | ||
357 | len = sock_sendmsg(socket, &hc->sendmsg, len); | ||
358 | set_fs(oldfs); | ||
359 | /* give socket back */ | 355 | /* give socket back */ |
360 | hc->socket = socket; /* no locking required */ | 356 | hc->socket = socket; /* no locking required */ |
361 | 357 | ||
@@ -660,8 +656,6 @@ l1oip_socket_thread(void *data) | |||
660 | struct l1oip *hc = (struct l1oip *)data; | 656 | struct l1oip *hc = (struct l1oip *)data; |
661 | int ret = 0; | 657 | int ret = 0; |
662 | struct msghdr msg; | 658 | struct msghdr msg; |
663 | struct iovec iov; | ||
664 | mm_segment_t oldfs; | ||
665 | struct sockaddr_in sin_rx; | 659 | struct sockaddr_in sin_rx; |
666 | unsigned char *recvbuf; | 660 | unsigned char *recvbuf; |
667 | size_t recvbuf_size = 1500; | 661 | size_t recvbuf_size = 1500; |
@@ -718,16 +712,12 @@ l1oip_socket_thread(void *data) | |||
718 | msg.msg_namelen = sizeof(sin_rx); | 712 | msg.msg_namelen = sizeof(sin_rx); |
719 | msg.msg_control = NULL; | 713 | msg.msg_control = NULL; |
720 | msg.msg_controllen = 0; | 714 | msg.msg_controllen = 0; |
721 | msg.msg_iov = &iov; | ||
722 | msg.msg_iovlen = 1; | ||
723 | 715 | ||
724 | /* build send message */ | 716 | /* build send message */ |
725 | hc->sendmsg.msg_name = &hc->sin_remote; | 717 | hc->sendmsg.msg_name = &hc->sin_remote; |
726 | hc->sendmsg.msg_namelen = sizeof(hc->sin_remote); | 718 | hc->sendmsg.msg_namelen = sizeof(hc->sin_remote); |
727 | hc->sendmsg.msg_control = NULL; | 719 | hc->sendmsg.msg_control = NULL; |
728 | hc->sendmsg.msg_controllen = 0; | 720 | hc->sendmsg.msg_controllen = 0; |
729 | hc->sendmsg.msg_iov = &hc->sendiov; | ||
730 | hc->sendmsg.msg_iovlen = 1; | ||
731 | 721 | ||
732 | /* give away socket */ | 722 | /* give away socket */ |
733 | spin_lock(&hc->socket_lock); | 723 | spin_lock(&hc->socket_lock); |
@@ -739,12 +729,12 @@ l1oip_socket_thread(void *data) | |||
739 | printk(KERN_DEBUG "%s: socket created and open\n", | 729 | printk(KERN_DEBUG "%s: socket created and open\n", |
740 | __func__); | 730 | __func__); |
741 | while (!signal_pending(current)) { | 731 | while (!signal_pending(current)) { |
742 | iov.iov_base = recvbuf; | 732 | struct kvec iov = { |
743 | iov.iov_len = recvbuf_size; | 733 | .iov_base = recvbuf, |
744 | oldfs = get_fs(); | 734 | .iov_len = sizeof(recvbuf), |
745 | set_fs(KERNEL_DS); | 735 | }; |
746 | recvlen = sock_recvmsg(socket, &msg, recvbuf_size, 0); | 736 | recvlen = kernel_recvmsg(socket, &msg, &iov, 1, |
747 | set_fs(oldfs); | 737 | sizeof(recvbuf), 0); |
748 | if (recvlen > 0) { | 738 | if (recvlen > 0) { |
749 | l1oip_socket_parse(hc, &sin_rx, recvbuf, recvlen); | 739 | l1oip_socket_parse(hc, &sin_rx, recvbuf, recvlen); |
750 | } else { | 740 | } else { |