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]
Date:	Tue, 09 Oct 2012 14:27:56 +0900
From:	Chul Lee <chur.lee@...sung.com>
To:	dave@...os.cz, '?????????' <jaegeuk.kim@...sung.com>
Cc:	viro@...iv.linux.org.uk, 'Theodore Ts'o' <tytso@....edu>,
	gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
	cm224.lee@...sung.com, jooyoung.hwang@...sung.com,
	linux-fsdevel@...r.kernel.org
Subject: RE: [PATCH 02/16] f2fs: add on-disk layout

Dear David Sterba,

David Sterba wrote:
> On Fri, Oct 05, 2012 at 08:56:44PM +0900, ????????? wrote:
> > +struct node_footer {
> > +	__le32 nid;		/* node id */
> > +	__le32 ino;		/* inode nunmber */
> > +	__le32 cold:1;		/* cold mark */
> > +	__le32 fsync:1;		/* fsync mark */
> > +	__le32 dentry:1;	/* dentry mark */
> > +	__le32 offset:29;	/* offset in inode's node space */
> 
> A bitfield for a on-disk structure? This will have endianity issues,
> (but I don't know if you intend to support big-endian). It's not enough
> to use cpu_to_le* as in
> 
> fill_node_footer(...) {
> 
> 	rn->footer.offset = cpu_to_le32(ofs);
> 
> }
> 
> because the bitfield inside the structure will be already defined
> reversed. The cpu_to_le macro will only convert value of 'ofs' but will
> place it to different bits than it would on a little-endian arch.
> 
> There are macros to define bitfields in an endian-neutral way (or do it
> by #ifdefs though it also involves duplicating the item names), or you
> can alternatively use two structs fr disk-only and memory-only access,
> the disk one stores __le32 with value combined of all and the in-memory
> gets set up properly and will look like your current version of the
> structure.
> 
> (More about not using bitfields
> http://yarchive.net/comp/linux/bitfields.html)

I appreciate your kind feedback, but we should've avoided using bitfields
for on-disk structure. As you suggested, we'll revise them. The latter
approach would be good.

> 
> 
> david

Chul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ