From nobody Fri Jun 17 19:28:51 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 424CA846AD2; Fri, 17 Jun 2022 19:28:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LPpxc1KGrz3GRj; Fri, 17 Jun 2022 19:28:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VujNaTP2uR8GxMhy8WQZFrswEn5iZ7FGfrcXzzefJsE=; b=G5T2gt8iQMMmUVVAHvw31iZWWAdImuIn9gHypp2oL+Y5N9r1M9PWdsxGvT7a9VoLKxd0VD oF3wveru+w2J2vET94W1QjypidLomdsK0baUqoWXrMxESXetAiq9G9+t0xH3VY1U6xKCxq F8Ch1UP/G4aSnTziHBHC4VYI3v7U88VdOjYbFGcD1TdU5Ykf/hJzp42rHr/cHnScVBZ+Y/ +ZwQlCz0pkpowpUjuQNIDCeTRlhqgFrzlWSteUd2XVjSsP5ZuW3cQV883GY/t3I4k11AAm ww/JaD3MipejxoJbNMpGWPbYCvXmlsn2QXUkcQentXC+OdVT7gFYFeCIFOwDkA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DFC12579D; Fri, 17 Jun 2022 19:28:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25HJSpfO096636; Fri, 17 Jun 2022 19:28:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJSpkO096635; Fri, 17 Jun 2022 19:28:51 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:28:51 GMT Message-Id: <202206171928.25HJSpkO096635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 34670aeab4f5 - stable/13 - linux(4): add struct timespec64 definition and conversion routine for future use. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 34670aeab4f5a4a1b2d0b7c3a759c0caf9e6e0b2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VujNaTP2uR8GxMhy8WQZFrswEn5iZ7FGfrcXzzefJsE=; b=y24U6U4JzWLfNEpldchd22FjkIUFz70lD4e2M04yoz3VwhpAEIH9MheqxhE2I1ZIJ/ldIE qGn5aToqnH9t/OJAMqMgCyScdnGrhvnLdJjlVpNH37nrOoxh/fvJuF/fYiYaspJsjaxezH 4uLQhQd38kjkEQ+t0Y1UBm6wjAGszWYmRn1Udnm+mbGRFWnV8M6Hrmp0CFiYb5GQaRgqg6 B7goHnT8i3CKHMYuZSmKFeOiELPqVlhKIIdZzXxzUYEZfmswQzGhUMiXdqTHQwA4Evdo9q oBKYVp8hzvZsCODW7zHY0uW1y4EgBM5VVKbOwqr0iuyLcNAXQEk6aRexRAvlLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494132; a=rsa-sha256; cv=none; b=PMxXiZOmwBvnyWUrPbCy4n6+ibAs0pyUJSD0/lu+WcLYcyNSPPsAxMciEzAzwrfB860r1P x3QqljQibh+FMOrO2IMJXh+PiF3/KWHpla1MV9UWTjPRcPR7G4Ke5cdqtF25YO5VbMiqsW +8UfnVjrCkM5YQx41dnmO6zR4jy1qE3qPRctig1//5p1U2le/UHvOwtOkjGcQKKdwG9xnv J9PWeSQNnp5WVfLsjxwR3JdaUBuAaXm174mX+eHrHbQKoKqE7JEsVroq1shCuUY1BKQtqy +uolz+tt41d5VLJE4p/0ZFEPot5FgJyNaSptX5e3SK45LMlrB+21ReMYogiZhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=34670aeab4f5a4a1b2d0b7c3a759c0caf9e6e0b2 commit 34670aeab4f5a4a1b2d0b7c3a759c0caf9e6e0b2 Author: Dmitry Chagin AuthorDate: 2021-06-07 01:47:12 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:27:55 +0000 linux(4): add struct timespec64 definition and conversion routine for future use. MFC after: 2 weeks (cherry picked from commit bfcce1a9f6e3c9defde10bb1f83d4ba9752c23f6) --- sys/amd64/linux32/linux.h | 7 +++++++ sys/compat/linux/linux_time.c | 24 ++++++++++++++++++++++++ sys/compat/linux/linux_timer.h | 6 ++++++ sys/i386/linux/linux.h | 7 +++++++ 4 files changed, 44 insertions(+) diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 6f26974a75a1..50a4efed1709 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -81,6 +81,7 @@ typedef l_int l_pid_t; typedef l_uint l_size_t; typedef l_long l_suseconds_t; typedef l_long l_time_t; +typedef l_longlong l_time64_t; typedef l_uint l_uid_t; typedef l_ushort l_uid16_t; typedef l_int l_timer_t; @@ -171,6 +172,12 @@ struct l_timespec { l_long tv_nsec; }; +/* __kernel_timespec */ +struct l_timespec64 { + l_time64_t tv_sec; + l_longlong tv_nsec; +}; + struct l_newstat { l_ushort st_dev; l_ushort __pad1; diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 1d7dcc869159..2f1430faf702 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -124,6 +124,30 @@ linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp) return (0); } +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +native_to_linux_timespec64(struct l_timespec64 *ltp64, struct timespec *ntp) +{ + + ltp64->tv_sec = ntp->tv_sec; + ltp64->tv_nsec = ntp->tv_nsec; + + return (0); +} + +int +linux_to_native_timespec64(struct timespec *ntp, struct l_timespec64 *ltp64) +{ + + if (ltp64->tv_sec < 0 || ltp64->tv_nsec < 0 || ltp64->tv_nsec > 999999999) + return (EINVAL); + ntp->tv_sec = ltp64->tv_sec; + ntp->tv_nsec = ltp64->tv_nsec; + + return (0); +} +#endif + int native_to_linux_itimerspec(struct l_itimerspec *ltp, struct itimerspec *ntp) { diff --git a/sys/compat/linux/linux_timer.h b/sys/compat/linux/linux_timer.h index 5344191742bb..6b5cf346049e 100644 --- a/sys/compat/linux/linux_timer.h +++ b/sys/compat/linux/linux_timer.h @@ -108,6 +108,12 @@ int native_to_linux_timespec(struct l_timespec *, struct timespec *); int linux_to_native_timespec(struct timespec *, struct l_timespec *); +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int native_to_linux_timespec64(struct l_timespec64 *, + struct timespec *); +int linux_to_native_timespec64(struct timespec *, + struct l_timespec64 *); +#endif int linux_to_native_clockid(clockid_t *, clockid_t); int native_to_linux_itimerspec(struct l_itimerspec *, struct itimerspec *); diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index 7a8de667e176..1bb76d8e41d0 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -71,6 +71,7 @@ typedef l_int l_pid_t; typedef l_uint l_size_t; typedef l_long l_suseconds_t; typedef l_long l_time_t; +typedef l_longlong l_time64_t; typedef l_uint l_uid_t; typedef l_ushort l_uid16_t; typedef l_int l_timer_t; @@ -142,6 +143,12 @@ struct l_timespec { l_long tv_nsec; }; +/* __kernel_timespec */ +struct l_timespec64 { + l_time64_t tv_sec; + l_longlong tv_nsec; +}; + struct l_newstat { l_ushort st_dev; l_ushort __pad1;