lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8527.1279275842@redhat.com>
Date:	Fri, 16 Jul 2010 11:24:02 +0100
From:	David Howells <dhowells@...hat.com>
To:	Mark Harris <mhlk@....us>, Steve French <smfrench@...il.com>
Cc:	dhowells@...hat.com, viro@...iv.linux.org.uk,
	linux-fsdevel@...r.kernel.org, linux-nfs@...r.kernel.org,
	linux-cifs@...r.kernel.org, linux-kernel@...r.kernel.org,
	samba-technical@...ts.samba.org, linux-ext4@...r.kernel.org
Subject: Re: [PATCH 02/18] xstat: Add a pair of system calls to make extended file stats available [ver #6]

Mark Harris <mhlk@....us> wrote:

> > struct xstat_time {
> > 	unsigned long long	tv_sec, tv_nsec;
> > };
> 
> unsigned?  Existing filesystems support on-disk timestamps
> representing times prior to the epoch.

I suppose it doesn't hurt to make is signed.  It's large enough...

Looking at it again, having a 64-bit field for tv_nsec is overkill.  It can't
(or shouldn't) exceed 999,999,999 - well within the capability of a 32-bit
unsigned integer.

So how about using up the dead space for what Steve French wanted:

	| One hole that this reminded me about is how to return the superblock
	| time granularity (for NFSv4 this is attribute 51 "time_delta" which
	| is called on a superblock not on a file).  We run into time rounding
	| issues with Samba too.

By doing something like:

	struct xstat_time {
		signed long long	tv_sec;
		unsigned int		tv_nsec;
		unsigned short		tv_granularity;
		unsigned short		tv_gran_units;
	};

Where tv_granularity is the minimum granularity for tv_sec and tv_nsec given
as a quantity of tv_gran_units.  tv_gran_units could then be a constant, such
as:

	XSTAT_NANOSECONDS_GRANULARITY
	XSTAT_MICROSECONDS_GRANULARITY
	XSTAT_MILLISECONDS_GRANULARITY
	XSTAT_SECONDS_GRANULARITY
	XSTAT_MINUTES_GRANULARITY
	XSTAT_HOURS_GRANULARITY
	XSTAT_DAYS_GRANULARITY

So, for example, FAT times are a 2s granularity, so FAT would set
tv_granularity to 2 and tv_gran_units to XSTAT_SECONDS_GRANULARITY.

We could even support picosecond granularity if we made tv_nsec a 5-byte
field (tv_psec):

	struct xstat_time {
		signed long long	tv_sec;
		unsigned long long	tv_gran_units : 8;
		unsigned long long	tv_granularity : 16;
		unsigned long long	tv_psec	: 48;
	};

but that's probably excessive.  Does any filesystem we currently support need
that?

David
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ