MFC r281120:

Assert that an msdosfs mount is not read-only when FAT modifications
are requested.
This commit is contained in:
kib 2015-04-12 07:03:26 +00:00
parent 6135eb6231
commit cf6596d5ab

View File

@ -399,6 +399,8 @@ usemap_alloc(pmp, cn)
MSDOSFS_ASSERT_MP_LOCKED(pmp);
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
("usemap_alloc on ro msdosfs mount"));
KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
== 0, ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS,
(unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
@ -415,6 +417,8 @@ usemap_free(pmp, cn)
{
MSDOSFS_ASSERT_MP_LOCKED(pmp);
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
("usemap_free on ro msdosfs mount"));
pmp->pm_freeclustercount++;
pmp->pm_flags |= MSDOSFS_FSIMOD;
KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
@ -715,6 +719,8 @@ chainalloc(pmp, start, count, fillwith, retcluster, got)
u_long cl, n;
MSDOSFS_ASSERT_MP_LOCKED(pmp);
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
("chainalloc on ro msdosfs mount"));
for (cl = start, n = count; n-- > 0;)
usemap_alloc(pmp, cl++);