add debugging, fix warnings.

This commit is contained in:
christos 2013-01-26 00:31:49 +00:00
parent 929f8943ca
commit 980139beab
4 changed files with 16 additions and 11 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.33 2013/01/23 22:47:18 christos Exp $
# $NetBSD: Makefile,v 1.34 2013/01/26 00:31:49 christos Exp $
#
WARNS?= 5
@ -18,6 +18,7 @@ MKNODSRC= ${NETBSDSRCDIR}/sbin/mknod
MTREESRC= ${NETBSDSRCDIR}/usr.sbin/mtree
CPPFLAGS+= -I${.CURDIR} -I${MKNODSRC} -I${MTREESRC} -DMAKEFS
CPPFLAGS+= -DMSDOSFS_DEBUG
.PATH: ${MKNODSRC} ${MTREESRC}
.include "${.CURDIR}/cd9660/Makefile.inc"

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdos.h,v 1.1 2013/01/26 00:20:40 christos Exp $ */
/* $NetBSD: msdos.h,v 1.2 2013/01/26 00:31:49 christos Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@ -33,9 +33,10 @@
*/
struct vnode;
struct denode;
struct msdosfsmount *msdosfs_mount(struct vnode *, int);
int msdosfs_root(struct msdosfsmount *, struct vnode *);
struct denode * msdosfs_mkfile(const char *, struct denode *, fsnode *);
struct denode *msdosfs_mkfile(const char *, struct denode *, fsnode *);
struct denode *msdosfs_mkdire(const char *, struct denode *, fsnode *);

View File

@ -50,7 +50,7 @@
#endif
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.1 2013/01/26 00:20:40 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.2 2013/01/26 00:31:50 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -71,9 +71,10 @@ __KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.1 2013/01/26 00:20:40 christos
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "makefs.h"
#include "msdos.h"
#include "mkfs_msdos.h"
#define NOCRED NULL
#ifdef MSDOSFS_DEBUG
#define DPRINTF(a) printf a
@ -97,7 +98,7 @@ msdosfs_mount(struct vnode *devvp, int flags)
uint64_t psize = m->create_size;
unsigned secsize = 512;
if ((error = bread(devvp, 1, secsize, NOCRED, 0, &bp)) != 0)
if ((error = bread(devvp, 1, secsize, NULL, 0, &bp)) != 0)
goto error_exit;
bsp = (union bootsector *)bp->b_data;
@ -327,7 +328,7 @@ msdosfs_mount(struct vnode *devvp, int flags)
* padded at the end or in the middle?
*/
if ((error = bread(devvp, de_bn2kb(pmp, pmp->pm_fsinfo),
pmp->pm_BytesPerSec, NOCRED, 0, &bp)) != 0)
pmp->pm_BytesPerSec, NULL, 0, &bp)) != 0)
goto error_exit;
fp = (struct fsinfo *)bp->b_data;
if (!memcmp(fp->fsisig1, "RRaA", 4)

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_vnops.c,v 1.1 2013/01/26 00:20:40 christos Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.2 2013/01/26 00:31:50 christos Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.1 2013/01/26 00:20:40 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.2 2013/01/26 00:31:50 christos Exp $");
#include <sys/param.h>
#include <sys/mman.h>
@ -115,7 +115,8 @@ msdosfs_mkfile(const char *path, struct denode *pdep, fsnode *node)
cn.cn_namelen = strlen(node->name);
#ifdef MSDOSFS_DEBUG
printf("msdosfs_create(cn %s, vap 0%o\n", node->name, st->st_mode);
printf("msdosfs_create(name %s, mode 0%o size %zu\n", node->name,
st->st_mode, (size_t)st->st_size);
#endif
/*
@ -197,7 +198,8 @@ msdosfs_wfile(const char *path, struct denode *dep, fsnode *node)
if ((fd = open(path, O_RDONLY)) == -1)
err(1, "open %s", path);
if ((dat = mmap(0, nsize, PROT_READ, MAP_FILE, fd, 0)) == MAP_FAILED)
if ((dat = mmap(0, nsize, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0))
== MAP_FAILED)
err(1, "mmap %s", node->name);
close(fd);