NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/46743: suggested patch for second part
The following reply was made to PR bin/46743; it has been noted by GNATS.
From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/46743: suggested patch for second part
Date: Sat, 7 Dec 2013 23:31:23 +0100
--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
The patch below marks the "next free cluster" in the file system info
block as uninitialized, which make fsck_msdos happy and should be
generally ok.
An alternative is to mark cluster bpb.rdcl as 0 (i.e. free) in the
loop initializing the fats, but that code is ... "slightly" ugly:
} else if (lsn >= bpb.res && lsn < dir &&
!((lsn - bpb.res) %
(bpb.spf ? bpb.spf : bpb.bspf))) {
mk1(img[0], bpb.mid);
for (x = 1; x < o.fat_type * (o.fat_type == 32 ? 3U : 2U) /
8U; x++)
mk1(img[x], o.fat_type == 32 && x % 4 == 3 ? 0x0f : 0xff);
Maybe just leave that loop alone and clear a few bytes afterwards conditional
on
if (o.fat_type == 32 && bpb.infs != MAXU16)
However, the suggested patch is a lot simpler and I don't see any downsides.
Martin
--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch
Index: mkfs_msdos.c
===================================================================
RCS file: /cvsroot/src/sbin/newfs_msdos/mkfs_msdos.c,v
retrieving revision 1.8
diff -u -p -r1.8 mkfs_msdos.c
--- mkfs_msdos.c 19 Oct 2013 01:09:59 -0000 1.8
+++ mkfs_msdos.c 7 Dec 2013 22:04:08 -0000
@@ -709,7 +709,7 @@ mkfs_msdos(const char *fname, const char
mk4(img, 0x41615252);
mk4(img + MINBPS - 28, 0x61417272);
mk4(img + MINBPS - 24, 0xffffffff);
- mk4(img + MINBPS - 20, bpb.rdcl);
+ mk4(img + MINBPS - 20, 0xffffffff);
mk2(img + MINBPS - 2, DOSMAGIC);
} else if (lsn >= bpb.res && lsn < dir &&
!((lsn - bpb.res) %
--MGYHOYXEY6WxJCY8--
Home |
Main Index |
Thread Index |
Old Index