Date: Thu, 11 Feb 2016 13:56:16 -0500 From: Pedro Giffuni <pfg@FreeBSD.org> To: Bruce Evans <brde@optusnet.com.au> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r295523 - head/sys/fs/ext2fs Message-ID: <56BCD950.6090803@FreeBSD.org> In-Reply-To: <20160212030505.C1943@besplex.bde.org> References: <201602111527.u1BFRFMe011283@repo.freebsd.org> <20160212030505.C1943@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 02/11/16 11:54, Bruce Evans wrote: > On Thu, 11 Feb 2016, Pedro F. Giffuni wrote: > >> Log: >> Ext4: Use boolean type instead of '0' and '1' >> >> There are precedents of uses of bool in the kernel and >> it is incorrect style to use integers as replacement for >> a boolean type. > > This is all backwards. > > It is correct style to use integers to represent booleans. > We had this same discussion for ddb. You didn't agree there either though. > There are precedents for breaking this style by using the > bool type, but not many in fs code: > This line of code (from ext2_bmap.c): if (path.ep_is_sparse) is correct only of ep_is_sparse is boolean. If it is an int it has to be rewritten as: if (path.ep_is_sparse != 0) I chose to keep it boolean. > In all of /sys/fs/*, there were just 12 lines of declarations > that use 'bool'. All of these were in autofs. Now there are > 13 such lines (1 more in ext2fs). 1 use is especially useless > and especially unlikely to be all uses of booleans. > The age of the code matters. Ext2 has a lot of code copy/pasted from UFS and it is useful to keep it similar. The ext4 code is new, I don't expect to maintain the exact style unless it's documented as part of style(9). Pedro.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56BCD950.6090803>