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] [day] [month] [year] [list]
Message-ID: <20070227224523.GU10715@schatzie.adilger.int>
Date:	Tue, 27 Feb 2007 15:45:24 -0700
From:	Andreas Dilger <adilger@...sterfs.com>
To:	Kalpak Shah <kalpak@...sterfs.com>
Cc:	linux-ext4 <linux-ext4@...r.kernel.org>,
	Dave Kleikamp <shaggy@...ux.vnet.ibm.com>,
	Johann Lombardi <johann.lombardi@...l.net>,
	TheodoreTso <tytso@....edu>, sct <sct@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH take3 1/1] nanosecond timestamps

On Feb 27, 2007  15:14 +0530, Kalpak Shah wrote:
> +#define EXT4_EPOCH_BITS 2
> +
> +static inline __le32 ext4_encode_extra_time(struct timespec *time)
> +{
> +       return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
> +			   time->tv_sec >> 32 : 0) |
> +			   ((time->tv_nsec << 2) & EXT4_NSEC_MASK));

This should be "(time->tv_nsec << EXT4_EPOCH_BITS)".  We don't strictly
need the EXT4_NSEC_MASK because cpu_to_le32() will truncate the field to
32 bits anyways.

> +static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) {
> +       if (sizeof(time->tv_sec) > 4)
> +	       time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK)
> +			       << 32;
> +       time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> 2;

This should be ">> EXT4_EPOCH_BITS".  Similarly, le32_to_cpu() will truncate
extra to 32 bits and we shift away the "epoch" part of the field, so we don't
need the EXT4_NSEC_MASK at all.

> +#define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode)		  	       \
> +do {									       \
> +	if (EXT4_FITS_IN_INODE(raw_inode, xtime))                              \
> +		(inode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime);       \

We might consider doing this in the caller for the crtime field.  That is
only read/written in a single place, and it is the only one that needs the
extra check to determine if the seconds field is in the body of the inode.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

-
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