mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Conrad Meyer <cse.cem@gmail.com>
Cc: Conrad Meyer <cemeyer@uw.edu>,
	OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Mark <markk@clara.co.uk>
Subject: Re: [PATCH v2] fs: FAT: Add support for DOS 1.x formatted volumes
Date: Mon, 31 Mar 2014 15:32:32 -0700	[thread overview]
Message-ID: <20140331153232.1ea27e25cb4690e64da63782@linux-foundation.org> (raw)
In-Reply-To: <CAG6CVpV6sxOc2ZH_xWRGc28N6W+M9iK6QbX-4bx326FON8B9GA@mail.gmail.com>

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.


  reply	other threads:[~2014-03-31 22:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-29 19:10 Conrad Meyer
2014-03-31 14:07 ` OGAWA Hirofumi
2014-03-31 14:21   ` Conrad Meyer
2014-03-31 22:13 ` Andrew Morton
2014-03-31 22:21   ` Conrad Meyer
2014-03-31 22:32     ` Andrew Morton [this message]
2014-03-31 23:14       ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140331153232.1ea27e25cb4690e64da63782@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cemeyer@uw.edu \
    --cc=cse.cem@gmail.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markk@clara.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®