lib: fdtable: Add callback for close() calls

Do not route close() calls via ioctl() as that is error prone
and quite pointless. Instead create a callback for close() in
fdtable and use it directly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2020-08-11 11:43:51 +03:00 committed by Andrew Boie
commit 2ed6b6a8ed
12 changed files with 108 additions and 64 deletions

View file

@ -1453,13 +1453,14 @@ static ssize_t offload_sendto(void *obj, const void *buf, size_t len,
return ret;
}
static int offload_close(void *obj)
{
return offload_close((struct modem_socket *)obj);
}
static int offload_ioctl(void *obj, unsigned int request, va_list args)
{
switch (request) {
/* Handle close specifically. */
case ZFD_IOCTL_CLOSE:
return offload_close((struct modem_socket *)obj);
case ZFD_IOCTL_POLL_PREPARE:
return -EXDEV;
@ -1532,6 +1533,7 @@ static const struct socket_op_vtable offload_socket_fd_op_vtable = {
.fd_vtable = {
.read = offload_read,
.write = offload_write,
.close = offload_close,
.ioctl = offload_ioctl,
},
.bind = offload_bind,