[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170427064636.GA7956@infradead.org>
Date: Wed, 26 Apr 2017 23:46:36 -0700
From: Christoph Hellwig <hch@...radead.org>
To: David Howells <dhowells@...hat.com>
Cc: viro@...iv.linux.org.uk, linux-man@...r.kernel.org,
linux-api@...r.kernel.org, linux-kernel@...r.kernel.org,
"Dmitry V. Levin" <ldv@...linux.org>, mtk.manpages@...il.com,
linux-fsdevel@...r.kernel.org, torvalds@...ux-foundation.org
Subject: Re: [PATCH] uapi: change the type of struct statx_timestamp.tv_nsec
to unsigned
I think this is the right thing to do, but we'd really need to get this
in before 4.11 is release and the syscall is out in the wild..
On Wed, Apr 26, 2017 at 02:50:00PM +0100, David Howells wrote:
> The more generic comment asserting that the value of struct
> statx_timestamp.tv_nsec might be negative is confusing to say the least.
>
> It contradicts both the struct stat.st_[acm]time_nsec tradition and
> struct timespec.tv_nsec requirements in utimensat syscall.
> If statx syscall ever returns a stx_[acm]time containing a negative
> tv_nsec that cannot be passed unmodified to utimensat syscall,
> it will cause an immense confusion.
>
> Fix this source of confusion by changing the type of struct
> statx_timestamp.tv_nsec from __s32 to __u32.
>
> Fixes: a528d35e8bfc ("statx: Add a system call to make enhanced file info available")
> Signed-off-by: Dmitry V. Levin <ldv@...linux.org>
> Signed-off-by: David Howells <dhowells@...hat.com>
> cc: linux-api@...r.kernel.org
> cc: mtk.manpages@...il.com
> ---
>
> include/uapi/linux/stat.h | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h
> index d538897b8e08..17b10304c393 100644
> --- a/include/uapi/linux/stat.h
> +++ b/include/uapi/linux/stat.h
> @@ -48,17 +48,13 @@
> * tv_sec holds the number of seconds before (negative) or after (positive)
> * 00:00:00 1st January 1970 UTC.
> *
> - * tv_nsec holds a number of nanoseconds before (0..-999,999,999 if tv_sec is
> - * negative) or after (0..999,999,999 if tv_sec is positive) the tv_sec time.
> - *
> - * Note that if both tv_sec and tv_nsec are non-zero, then the two values must
> - * either be both positive or both negative.
> + * tv_nsec holds a number of nanoseconds (0..999,999,999) after the tv_sec time.
> *
> * __reserved is held in case we need a yet finer resolution.
> */
> struct statx_timestamp {
> __s64 tv_sec;
> - __s32 tv_nsec;
> + __u32 tv_nsec;
> __s32 __reserved;
> };
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-api" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
---end quoted text---
Powered by blists - more mailing lists