lkml.org 
[lkml]   [2014]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] fs: FAT: Add support for DOS 1.x formatted volumes
On Mon, 31 Mar 2014 15:21:17 -0700 Conrad Meyer <cse.cem@gmail.com> wrote:

> >> + if (get_unaligned_le16(&b->sector_size) != 0 || b->sec_per_clus != 0 ||
> >> + b->reserved != 0 || b->fats != 0 ||
> >> + get_unaligned_le16(&b->dir_entries) != 0 ||
> >> + get_unaligned_le16(&b->sectors) != 0 || b->media != 0 ||
> >> + b->fat_length != 0 || b->secs_track != 0 || b->heads != 0 ||
> >> + b->secs_track != 0 || b->heads != 0)
> >
> > Impressive!
>
> I aim to please.

No great improvements immediately occur to me ;)

One could do

/* nice comment */
if (get_unaligned_le16(&b->sector_size) != 0)
return;
/* another nice comment */
if (b->sec_per_clus != 0)
return;
...

but one would quickly run out of nice comments.

You could do s/ != 0//g.

> Not sure what would be better -- memcmp() part of the
> struct to a zeroed array?

memcmp would be hacky. And possibly buggy if there are holes in the
struct, which is arch-dependent, shudder.



\
 
 \ /
  Last update: 2014-04-01 01:01    [W:0.046 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site