socket: move compat timeout handling into sock.c
This is a cleanup to prepare for the addition of 64-bit time_t in O_SNDTIMEO/O_RCVTIMEO. The existing compat handler seems unnecessarily complex and error-prone, moving it all into the main setsockopt()/getsockopt() implementation requires half as much code and is easier to extend. 32-bit user space can now use old_timeval32 on both 32-bit and 64-bit machines, while 64-bit code can use __old_kernel_timeval. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
a9bcfd1d17
commit
fe0c72f3db
@@ -1439,7 +1439,7 @@ static int vsock_stream_setsockopt(struct socket *sock,
|
||||
break;
|
||||
|
||||
case SO_VM_SOCKETS_CONNECT_TIMEOUT: {
|
||||
struct timeval tv;
|
||||
struct __kernel_old_timeval tv;
|
||||
COPY_IN(tv);
|
||||
if (tv.tv_sec >= 0 && tv.tv_usec < USEC_PER_SEC &&
|
||||
tv.tv_sec < (MAX_SCHEDULE_TIMEOUT / HZ - 1)) {
|
||||
@@ -1517,7 +1517,7 @@ static int vsock_stream_getsockopt(struct socket *sock,
|
||||
break;
|
||||
|
||||
case SO_VM_SOCKETS_CONNECT_TIMEOUT: {
|
||||
struct timeval tv;
|
||||
struct __kernel_old_timeval tv;
|
||||
tv.tv_sec = vsk->connect_timeout / HZ;
|
||||
tv.tv_usec =
|
||||
(vsk->connect_timeout -
|
||||
|
Reference in New Issue
Block a user