mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-03 09:00:21 +00:00
Properly update FSInfo block after generation.
After populating the filesystem, write a FSInfo block with proper information. Reviewed by: emaste, cem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21363
This commit is contained in:
parent
8e67c427b5
commit
8651679a5c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=351415
@ -203,6 +203,8 @@ msdos_makefs(const char *image, const char *dir, fsnode *root, fsinfo_t *fsopts)
|
||||
errx(1, "Image file `%s' not created.", image);
|
||||
TIMER_RESULTS(start, "msdos_populate_dir");
|
||||
|
||||
if (msdosfs_fsiflush(pmp) != 0)
|
||||
errx(1, "Unable to update FSInfo block.");
|
||||
if (debug & DEBUG_FS_MAKEFS)
|
||||
putchar('\n');
|
||||
|
||||
|
@ -51,6 +51,7 @@ struct componentname {
|
||||
size_t cn_namelen;
|
||||
};
|
||||
|
||||
int msdosfs_fsiflush(struct msdosfsmount *);
|
||||
struct msdosfsmount *msdosfs_mount(struct vnode *);
|
||||
int msdosfs_root(struct msdosfsmount *, struct vnode *);
|
||||
|
||||
|
@ -359,3 +359,33 @@ msdosfs_root(struct msdosfsmount *pmp, struct vnode *vp) {
|
||||
vp->v_data = ndep;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have an FSInfo block, update it.
|
||||
*/
|
||||
int
|
||||
msdosfs_fsiflush(struct msdosfsmount *pmp)
|
||||
{
|
||||
struct fsinfo *fp;
|
||||
struct buf *bp;
|
||||
int error;
|
||||
|
||||
if (pmp->pm_fsinfo == 0 || (pmp->pm_flags & MSDOSFS_FSIMOD) == 0) {
|
||||
error = 0;
|
||||
goto out;
|
||||
}
|
||||
error = bread(pmp->pm_devvp, pmp->pm_fsinfo, pmp->pm_BytesPerSec,
|
||||
NOCRED, &bp);
|
||||
if (error != 0) {
|
||||
brelse(bp);
|
||||
goto out;
|
||||
}
|
||||
fp = (struct fsinfo *)bp->b_data;
|
||||
putulong(fp->fsinfree, pmp->pm_freeclustercount);
|
||||
putulong(fp->fsinxtfree, pmp->pm_nxtfree);
|
||||
pmp->pm_flags &= ~MSDOSFS_FSIMOD;
|
||||
error = bwrite(bp);
|
||||
|
||||
out:
|
||||
return (error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user