Seperate usrsock device driver with usrsock core function layer
to make it more flexiable to adopt other kind of usrsock interface driver
Signed-off-by: liangchaozhong <liangchaozhong@xiaomi.com>
Do not use 'pvconn' argument to get the connection pointer since
pvconn is normally NULL for some events like NETDEV_DOWN.
Instead, the connection pointer can be reliably obtained from the
corresponding private pointer.
Signed-off-by: chao.an <anchao@xiaomi.com>
In file included from usrsock/usrsock_bind.c:32:
usrsock/usrsock_bind.c: In function ‘usrsock_bind’:
usrsock/usrsock_bind.c:183:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
183 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_bind.c:183:54: note: format string is defined here
183 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
CC: usrsock/usrsock_connect.c
CC: usrsock/usrsock_dev.c
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_handle_event’:
usrsock/usrsock_dev.c:488:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
488 | nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| size_t {aka long unsigned int}
usrsock/usrsock_dev.c:488:40: note: format string is defined here
488 | nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c:488:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
488 | nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
| |
| long unsigned int
usrsock/usrsock_dev.c:488:45: note: format string is defined here
488 | nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_handle_datareq_response’:
usrsock/usrsock_dev.c:657:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
657 | nwarn("%dth buffer not large enough (need: %d, have: %d).\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
660 | conn->resp.datain.iov[iovpos].iov_len);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| size_t {aka long unsigned int}
usrsock/usrsock_dev.c:657:61: note: format string is defined here
657 | nwarn("%dth buffer not large enough (need: %d, have: %d).\n",
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c:678:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
678 | nwarn("%dth buffer not large enough "
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
682 | conn->resp.datain.iov[iovpos].iov_len);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| size_t {aka long unsigned int}
usrsock/usrsock_dev.c:679:45: note: format string is defined here
679 | "(need: %" PRId32 ", have: %d).\n",
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_handle_req_response’:
usrsock/usrsock_dev.c:745:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
745 | nwarn("message too short, %d < %d.\n", len, hdrlen);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| size_t {aka long unsigned int}
usrsock/usrsock_dev.c:745:34: note: format string is defined here
745 | nwarn("message too short, %d < %d.\n", len, hdrlen);
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_write’:
usrsock/usrsock_dev.c:858:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
858 | nwarn("message too short, %d < %d.\n", len,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| size_t {aka long unsigned int}
usrsock/usrsock_dev.c:858:38: note: format string is defined here
858 | nwarn("message too short, %d < %d.\n", len,
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c:858:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
858 | nwarn("message too short, %d < %d.\n", len,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
859 | sizeof(struct usrsock_message_common_s));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long unsigned int
usrsock/usrsock_dev.c:858:43: note: format string is defined here
858 | nwarn("message too short, %d < %d.\n", len,
| ~^
| |
| int
| %ld
CC: usrsock/usrsock_getpeername.c
In file included from usrsock/usrsock_getpeername.c:32:
usrsock/usrsock_getpeername.c: In function ‘usrsock_getpeername’:
usrsock/usrsock_getpeername.c:190:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
190 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_getpeername.c:190:54: note: format string is defined here
190 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
CC: usrsock/usrsock_event.c
CC: usrsock/usrsock_getsockname.c
In file included from usrsock/usrsock_getsockname.c:32:
usrsock/usrsock_getsockname.c: In function ‘usrsock_getsockname’:
usrsock/usrsock_getsockname.c:190:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
190 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_getsockname.c:190:54: note: format string is defined here
190 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
CC: usrsock/usrsock_getsockopt.c
CC: usrsock/usrsock_poll.c
CC: usrsock/usrsock_recvmsg.c
In file included from usrsock/usrsock_recvmsg.c:32:
usrsock/usrsock_recvmsg.c: In function ‘usrsock_recvmsg’:
usrsock/usrsock_recvmsg.c:321:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
321 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_recvmsg.c:321:62: note: format string is defined here
321 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_recvmsg.c:32:
usrsock/usrsock_recvmsg.c:343:24: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
343 | nerr("net_timedwait errno: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_recvmsg.c:343:47: note: format string is defined here
343 | nerr("net_timedwait errno: %d\n", ret);
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_recvmsg.c:32:
usrsock/usrsock_recvmsg.c:384:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
384 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_recvmsg.c:384:58: note: format string is defined here
384 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
CC: usrsock/usrsock_sendmsg.c
In file included from usrsock/usrsock_sendmsg.c:32:
usrsock/usrsock_sendmsg.c: In function ‘usrsock_sendmsg’:
usrsock/usrsock_sendmsg.c:302:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
302 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_sendmsg.c:302:62: note: format string is defined here
302 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_sendmsg.c:32:
usrsock/usrsock_sendmsg.c:324:24: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
324 | nerr("net_timedwait errno: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_sendmsg.c:324:47: note: format string is defined here
324 | nerr("net_timedwait errno: %d\n", ret);
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_sendmsg.c:32:
usrsock/usrsock_sendmsg.c:364:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
364 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_sendmsg.c:364:58: note: format string is defined here
364 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
* Simplify EINTR/ECANCEL error handling
1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx
* Unify the void cast usage
1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro