On Mon, Mar 31, 2014 at 3:13 PM, Andrew Morton
<[email protected]> wrote:
> On Sat, 29 Mar 2014 12:10:35 -0700 Conrad Meyer <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to