Fixed printf format errors and style bugs in previous commit.

This commit is contained in:
Bruce Evans 2002-08-25 01:08:27 +00:00
parent 7412ba062f
commit 109a8e7c0c

View File

@ -51,6 +51,8 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/kernel.h>
@ -61,7 +63,6 @@
#include <sys/fcntl.h>
#include <sys/malloc.h>
#include <sys/stat.h> /* defines ALLPERMS */
#include <sys/mutex.h>
#include <fs/msdosfs/bpb.h>
#include <fs/msdosfs/bootsect.h>
@ -70,8 +71,6 @@
#include <fs/msdosfs/msdosfsmount.h>
#include <fs/msdosfs/fat.h>
#define MSDOSFS_DFLTBSIZE 4096
#if 1 /*def PC98*/
/*
* XXX - The boot signature formatted by NEC PC-98 DOS looks like a
@ -86,6 +85,8 @@
MALLOC_DEFINE(M_MSDOSFSMNT, "MSDOSFS mount", "MSDOSFS mount structure");
static MALLOC_DEFINE(M_MSDOSFSFAT, "MSDOSFS FAT", "MSDOSFS file allocation table");
int bdemsd = 0;
static int update_mp(struct mount *mp, struct msdosfs_args *argp);
static int mountmsdosfs(struct vnode *devvp, struct mount *mp,
struct thread *td, struct msdosfs_args *argp);
@ -142,6 +143,67 @@ update_mp(mp, argp)
return 0;
}
#if 0
int
msdosfs_mountroot()
{
register struct mount *mp;
struct thread *td = curthread; /* XXX */
size_t size;
int error;
struct msdosfs_args args;
if (root_device->dv_class != DV_DISK)
return (ENODEV);
/*
* Get vnodes for swapdev and rootdev.
*/
if (bdevvp(rootdev, &rootvp))
panic("msdosfs_mountroot: can't setup rootvp");
mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK | M_ZERO);
mp->mnt_op = &msdosfs_vfsops;
mp->mnt_flag = 0;
TAILQ_INIT(&mp->mnt_nvnodelist);
TAILQ_INIT(&mp->mnt_reservedvnlist);
args.flags = 0;
args.uid = 0;
args.gid = 0;
args.mask = 0777;
if ((error = mountmsdosfs(rootvp, mp, p, &args)) != 0) {
free(mp, M_MOUNT);
return (error);
}
if ((error = update_mp(mp, &args)) != 0) {
(void)msdosfs_unmount(mp, 0, td);
free(mp, M_MOUNT);
return (error);
}
if ((error = vfs_lock(mp)) != 0) {
(void)msdosfs_unmount(mp, 0, td);
free(mp, M_MOUNT);
return (error);
}
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
mp->mnt_vnodecovered = NULLVP;
(void) copystr("/", mp->mnt_stat.f_mntonname, MNAMELEN - 1,
&size);
bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
(void) copystr(ROOTNAME, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
&size);
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
(void)msdosfs_statfs(mp, &mp->mnt_stat, td);
vfs_unlock(mp);
return (0);
}
#endif
/*
* mp - path - addr in user space of mount point (ie /usr or whatever)
* data - addr in user space of mount params including the name of the block
@ -330,9 +392,9 @@ mountmsdosfs(devvp, mp, td, argp)
* Read the boot sector of the filesystem, and then check the
* boot signature. If not a dos boot sector then error out.
*
* NOTE: 2048 is a maximum sector size in current...
* NOTE: 8192 is a magic size that works for ffs.
*/
error = bread(devvp, 0, 2048, NOCRED, &bp);
error = bread(devvp, 0, 8192, NOCRED, &bp);
if (error)
goto error_exit;
bp->b_flags |= B_AGE;
@ -493,7 +555,7 @@ mountmsdosfs(devvp, mp, td, argp)
if (FAT12(pmp))
pmp->pm_fatblocksize = 3 * pmp->pm_BytesPerSec;
else
pmp->pm_fatblocksize = MSDOSFS_DFLTBSIZE;
pmp->pm_fatblocksize = PAGE_SIZE; /* XXX */
pmp->pm_fatblocksec = pmp->pm_fatblocksize / DEV_BSIZE;
pmp->pm_bnshift = ffs(DEV_BSIZE) - 1;
@ -546,7 +608,8 @@ mountmsdosfs(devvp, mp, td, argp)
* Check and validate (or perhaps invalidate?) the fsinfo structure?
*/
if (pmp->pm_fsinfo && pmp->pm_nxtfree > pmp->pm_maxcluster) {
printf("Next free cluster in FSInfo (%u) exceeds maxcluster (%u)\n",
printf(
"Next free cluster in FSInfo (%lu) exceeds maxcluster (%lu)\n",
pmp->pm_nxtfree, pmp->pm_maxcluster);
error = EINVAL;
goto error_exit;
@ -751,7 +814,7 @@ msdosfs_sync(mp, waitfor, cred, td)
if (vp->v_type == VNON ||
((dep->de_flag &
(DE_ACCESS | DE_CREATE | DE_UPDATE | DE_MODIFIED)) == 0 &&
(TAILQ_EMPTY(&vp->v_dirtyblkhd) || waitfor == MNT_LAZY))) {
TAILQ_EMPTY(&vp->v_dirtyblkhd))) {
mtx_unlock(&vp->v_interlock);
mtx_lock(&mntvnode_mtx);
continue;
@ -777,6 +840,12 @@ msdosfs_sync(mp, waitfor, cred, td)
*/
if (waitfor != MNT_LAZY) {
vn_lock(pmp->pm_devvp, LK_EXCLUSIVE | LK_RETRY, td);
if (!TAILQ_EMPTY(&pmp->pm_devvp->v_dirtyblkhd)) {
if (bdemsd)
Debugger("msdosfs: flush fs control info");
else
printf("msdosfs: flush fs control info\n");
}
error = VOP_FSYNC(pmp->pm_devvp, cred, waitfor, td);
if (error)
allerror = error;