Date: Tue, 18 Apr 2000 08:34:44 -0500 From: John Estess <jestess@wcnet.net> To: freebsd-fs@freebsd.org Subject: Re: FFS and ints Message-ID: <38FC6474.7E16D9EF@wcnet.net>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------4AAF98DA7ADECDBBB93BEEF3 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Adrian Chadd wrote: > Now, this makes sense EXCEPT that cg_rotor/frotor/irotor are defined > as int32_ts which mean any weirdnesses that corrupt these values to > negative values will not be picked up in fsck. > > So, my question is this: should the cg definition change to change > things that should be unsigned to unsigned, or should fsck change > and we leave the kernel alone? > > Adrian Back to memory lane... About two months ago I was going through warnings generated by fsck during the compile and discovered three unsigned to signed warnings. /usr/src/sbin/fsck/dir.c: In function `dirscan': /usr/src/sbin/fsck/dir.c:127: warning: comparison between signed and unsigned /usr/src/sbin/fsck/dir.c: In function `expanddir': /usr/src/sbin/fsck/dir.c:620: warning: comparison between signed and unsigned /usr/src/sbin/fsck/dir.c:634: warning: comparison between signed and unsigned One of these is easily gotten rid of in fsck. The others can be tracked to (the input to )/ffs/fs.h to some uncapitalized macros (below - those bastards :-)). If you can cast input to be unsigned for everything, you might get rid of the unsigned/signed compares. A macro, or god forbid, a function - if it wasn't too slow, could take the place of this in fsck.h, if they aren't used elsewhere (I'll grep world later). Since I'm working nights (6pm to 6am - 5 days a week) and I'm moving by the end of the month, I have no time for this. Also, I'm still cutting my teeth on fs stuff, so everything I've written could be wrong... #define dblksize(fs, dip, lbn) \ (((lbn) >= NDADDR || (dip)->di_size >= smalllblktosize(fs, (lbn) + 1)) \ ? (fs)->fs_bsize \ : (fragroundup(fs, blkoff(fs, (dip)->di_size)))) #define smalllblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \ ((blk) << (fs)->fs_bshift) --------------4AAF98DA7ADECDBBB93BEEF3 Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Mozilla-Status2: 00000000 Message-ID: <38FC6408.CD7DFB2E@wcnet.net> Date: Tue, 18 Apr 2000 08:32:56 -0500 From: John Estess <jestess@wcnet.net> X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.0.36 i386) X-Accept-Language: en MIME-Version: 1.0 To: Adrian Chadd <adrian@freebsd.org> Subject: Re: FFS and ints References: <20000418193741.E71428@ewok.creative.net.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Adrian Chadd wrote: > Now, this makes sense EXCEPT that cg_rotor/frotor/irotor are defined > as int32_ts which mean any weirdnesses that corrupt these values to > negative values will not be picked up in fsck. > > So, my question is this: should the cg definition change to change > things that should be unsigned to unsigned, or should fsck change > and we leave the kernel alone? > > Adrian Back to memory lane... About two months ago I was going through warnings generated by fsck during the compile and discovered three unsigned to signed warnings. /usr/src/sbin/fsck/dir.c: In function `dirscan': /usr/src/sbin/fsck/dir.c:127: warning: comparison between signed and unsigned /usr/src/sbin/fsck/dir.c: In function `expanddir': /usr/src/sbin/fsck/dir.c:620: warning: comparison between signed and unsigned /usr/src/sbin/fsck/dir.c:634: warning: comparison between signed and unsigned One of these is easily gotten rid of in fsck. The others can be tracked to (the input to )/ffs/fs.h to some uncapitalized macros (below - those bastards :-)). If you can cast input to be unsigned for everything, you might get rid of the unsigned/signed compares. A macro, or god forbid, a function - if it wasn't too slow, could take the place of this in fsck.h, if they aren't used elsewhere (I'll grep world later). Since I'm working nights (6pm to 6am - 5 days a week) and I'm moving by the end of the month, I have no time for this. Also, I'm still cutting my teeth on fs stuff, so everything I've written could be wrong... #define dblksize(fs, dip, lbn) \ (((lbn) >= NDADDR || (dip)->di_size >= smalllblktosize(fs, (lbn) + 1)) \ ? (fs)->fs_bsize \ : (fragroundup(fs, blkoff(fs, (dip)->di_size)))) #define smalllblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \ ((blk) << (fs)->fs_bshift) --------------4AAF98DA7ADECDBBB93BEEF3-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38FC6474.7E16D9EF>