[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG6CVpV6sxOc2ZH_xWRGc28N6W+M9iK6QbX-4bx326FON8B9GA@mail.gmail.com>
Date: Mon, 31 Mar 2014 15:21:17 -0700
From: Conrad Meyer <cse.cem@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Conrad Meyer <cemeyer@...edu>,
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Mark <markk@...ra.co.uk>
Subject: Re: [PATCH v2] fs: FAT: Add support for DOS 1.x formatted volumes
On Mon, Mar 31, 2014 at 3:13 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Sat, 29 Mar 2014 12:10:35 -0700 Conrad Meyer <cemeyer@...edu> wrote:
>
>> + .nr_sectors = 360 * KB_IN_SECTORS,
>> + .sec_per_clus = 2,
>> + .dir_entries = 112,
>> + .media = 0xFD,
>> + .fat_length = 2,
>> +},
>> +{ 0 } };
>
> We don't really need this EOF element.
Ah, right, I forgot about ARRAY_SIZE. This is an old version of this
patch, see v3 here: https://lkml.org/lkml/2014/3/31/275
But the same criticism is valid there, too.
>> + 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. Not sure what would be better -- memcmp() part of the
struct to a zeroed array?
>
>> + return;
>> +
>> + bd_sects = part_nr_sects_read(sb->s_bdev->bd_part);
>> + for (di = floppy_defaults; di->nr_sectors; di++) {
>
> Can do something like
>
> for (di = floppy_defaults;
> di < floppy_defaults + ARRAY_SIZE(floppy_defaults); di++) {
Yep, I should revise and send a v4 patch. Thanks.
>
>> + if (di->nr_sectors == bd_sects)
>> + break;
>> + }
>> + if (di->nr_sectors == 0) {
>> + fat_msg(sb, KERN_WARNING,
>> + "DOS volume lacks BPB and isn't a recognized floppy size (%ld sectors)",
>> + (long)bd_sects);
>
> sector_t can be u64 on 32-bit so one should really use %Lu and cast to
> u64.
Thanks, will fix.
Conrad
--
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