summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2004-02-05 06:55:12 +0000
committerbde <bde@FreeBSD.org>2004-02-05 06:55:12 +0000
commit11c7633086124afc56ef9a7946732f6f0de26d17 (patch)
treec9c3e73b9777f4e599c6a0397cefbe7b57b73cc6 /sbin
parentcabea246201abda4a7da1d0299c2f5f505e885b2 (diff)
downloadFreeBSD-src-11c7633086124afc56ef9a7946732f6f0de26d17.zip
FreeBSD-src-11c7633086124afc56ef9a7946732f6f0de26d17.tar.gz
Document the dirty flag and other bits in the first 2 FAT entries
better. There is a related I/O error flag which we don't support in the kernel but must support here. (Support for bits that we don't understand here is mostly automatic by fail-safeness, but checkdirty() has fail-unsafeness.) There are some reserved and don't-care bits that weren't fully documented and aren't always masked properly. The comment about the bits in readfat() will be removed when the masking is fixed. Submitted by: rnordier
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fsck_msdosfs/fat.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sbin/fsck_msdosfs/fat.c b/sbin/fsck_msdosfs/fat.c
index d04661a..55f9bbb 100644
--- a/sbin/fsck_msdosfs/fat.c
+++ b/sbin/fsck_msdosfs/fat.c
@@ -52,6 +52,24 @@ static int clustdiffer(cl_t, cl_t *, cl_t *, int);
static int tryclear(struct bootblock *, struct fatEntry *, cl_t, cl_t *);
static int _readfat(int, struct bootblock *, int, u_char **);
+/*-
+ * The first 2 FAT entries contain pseudo-cluster numbers with the following
+ * layout:
+ *
+ * 31...... ........ ........ .......0
+ * rrrr1111 11111111 11111111 mmmmmmmm FAT32 entry 0
+ * rrrrsh11 11111111 11111111 11111xxx FAT32 entry 1
+ *
+ * 11111111 mmmmmmmm FAT16 entry 0
+ * sh111111 11111xxx FAT16 entry 1
+ *
+ * r = reserved
+ * m = BPB media ID byte
+ * s = clean flag (1 = dismounted; 0 = still mounted)
+ * h = hard error flag (1 = ok; 0 = I/O error)
+ * x = any value ok
+ */
+
int
checkdirty(int fs, struct bootblock *boot)
{
OpenPOWER on IntegriCloud