diff --git a/sys/fs/msdosfs/denode.h b/sys/fs/msdosfs/denode.h index 8d2ac843f717..e3032b6a55e3 100644 --- a/sys/fs/msdosfs/denode.h +++ b/sys/fs/msdosfs/denode.h @@ -1,4 +1,4 @@ -/* $NetBSD: denode.h,v 1.20 2012/11/04 17:57:59 jakllsch Exp $ */ +/* $NetBSD: denode.h,v 1.21 2013/01/26 00:21:49 christos Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -231,7 +231,7 @@ struct denode { #define de_forw de_chain[0] #define de_back de_chain[1] -#ifdef _KERNEL +#if defined(_KERNEL) || defined(MAKEFS) #define VTODE(vp) ((struct denode *)(vp)->v_data) #define DETOV(de) ((de)->de_vnode) @@ -287,6 +287,8 @@ int msdosfs_pathconf (void *); /* * Internal service routine prototypes. */ +struct componentname; +struct direntry; int msdosfs_update(struct vnode *, const struct timespec *, const struct timespec *, int); int createde(struct denode *, struct denode *, @@ -312,5 +314,5 @@ int msdosfs_fh_enter(struct msdosfsmount *, uint32_t, uint32_t, uint32_t *); int msdosfs_fh_remove(struct msdosfsmount *, uint32_t, uint32_t); int msdosfs_fh_lookup(struct msdosfsmount *, uint32_t, uint32_t, uint32_t *); void msdosfs_fh_destroy(struct msdosfsmount *); -#endif /* _KERNEL */ +#endif /* _KERNEL || MAKEFS */ #endif /* _MSDOSFS_DENODE_H_ */ diff --git a/sys/fs/msdosfs/direntry.h b/sys/fs/msdosfs/direntry.h index 7c3c66c8ae32..9c1fdb76e073 100644 --- a/sys/fs/msdosfs/direntry.h +++ b/sys/fs/msdosfs/direntry.h @@ -1,4 +1,4 @@ -/* $NetBSD: direntry.h,v 1.5 2005/12/03 17:34:43 christos Exp $ */ +/* $NetBSD: direntry.h,v 1.6 2013/01/26 00:21:49 christos Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -120,7 +120,8 @@ struct winentry { #define DD_YEAR_MASK 0xFE00 /* year - 1980 */ #define DD_YEAR_SHIFT 9 -#ifdef _KERNEL +#if defined(_KERNEL) || defined(MAKEFS) +struct dirent; void unix2dostime(const struct timespec *tsp, int gmtoff, u_int16_t *ddp, u_int16_t *dtp, u_int8_t *dhp); void dos2unixtime(u_int dd, u_int dt, u_int dh, int gmtoff, @@ -135,5 +136,5 @@ int winChkName(const u_char *un, int unlen, struct winentry *wep, int win2unixfn(struct winentry *wep, struct dirent *dp, int chksum); u_int8_t winChksum(u_int8_t *name); int winSlotCnt(const u_char *un, int unlen); -#endif /* _KERNEL */ +#endif /* _KERNEL || MAKEFS */ #endif /* _MSDOSFS_DIRENTRY_H_ */ diff --git a/sys/fs/msdosfs/fat.h b/sys/fs/msdosfs/fat.h index 507400a5a58a..660ba5bba541 100644 --- a/sys/fs/msdosfs/fat.h +++ b/sys/fs/msdosfs/fat.h @@ -1,4 +1,4 @@ -/* $NetBSD: fat.h,v 1.7 2012/11/04 17:57:59 jakllsch Exp $ */ +/* $NetBSD: fat.h,v 1.8 2013/01/26 00:21:49 christos Exp $ */ /*- * Copyright (C) 1994, 1997 Wolfgang Solfrank. @@ -92,7 +92,7 @@ #define MSDOSFSEOF(cn, fatmask) \ (((cn) & CLUST_EOFS) == (CLUST_EOFS & (fatmask))) -#ifdef _KERNEL +#if defined(_KERNEL) || defined(MAKEFS) /* * These are the values for the function argument to the function * fatentry(). @@ -115,5 +115,5 @@ void fc_purge(struct denode *, u_int); void fc_lookup(struct denode *, u_long, u_long *, u_long *); int fillinusemap(struct msdosfsmount *); int freeclusterchain(struct msdosfsmount *, u_long); -#endif /* _KERNEL */ +#endif /* _KERNEL || MAKEFS */ #endif /* _MSDOSFS_FAT_H_ */ diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.c index d88f639e2036..6a9bb475aa9b 100644 --- a/sys/fs/msdosfs/msdosfs_conv.c +++ b/sys/fs/msdosfs/msdosfs_conv.c @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_conv.c,v 1.7 2009/03/15 17:15:57 cegger Exp $ */ +/* $NetBSD: msdosfs_conv.c,v 1.8 2013/01/26 00:21:49 christos Exp $ */ /*- * Copyright (C) 1995, 1997 Wolfgang Solfrank. @@ -47,8 +47,12 @@ * October 1992 */ +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + #include -__KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.7 2009/03/15 17:15:57 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.8 2013/01/26 00:21:49 christos Exp $"); /* * System include files. @@ -59,6 +63,9 @@ __KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.7 2009/03/15 17:15:57 cegger Exp #include #include #include +#ifndef _KERNEL +#include +#endif /* * MSDOSFS include files. @@ -209,8 +216,8 @@ dos2unixtime(u_int dd, u_int dt, u_int dh, int gmtoff, struct timespec *tsp) */ month = (dd & DD_MONTH_MASK) >> DD_MONTH_SHIFT; if (month == 0) { - printf("dos2unixtime(): month value out of range (%ld)\n", - month); + printf("%s: month value out of range (%ld)\n", + __func__, month); month = 1; } for (m = 0; m < month - 1; m++) @@ -700,7 +707,7 @@ int win2unixfn(struct winentry *wep, struct dirent *dp, int chksum) { u_int8_t *cp; - u_int8_t *np, *ep = dp->d_name + WIN_MAXLEN; + u_int8_t *np, *ep = (u_int8_t *)dp->d_name + WIN_MAXLEN; int i; if ((wep->weCnt&WIN_CNT) > howmany(WIN_MAXLEN, WIN_CHARS) diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c index c5f3e12756a9..b038f74af8eb 100644 --- a/sys/fs/msdosfs/msdosfs_fat.c +++ b/sys/fs/msdosfs/msdosfs_fat.c @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_fat.c,v 1.23 2012/12/20 11:44:39 hannken Exp $ */ +/* $NetBSD: msdosfs_fat.c,v 1.24 2013/01/26 00:21:49 christos Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -47,22 +47,30 @@ * October 1992 */ +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + #include -__KERNEL_RCSID(0, "$NetBSD: msdosfs_fat.c,v 1.23 2012/12/20 11:44:39 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_fat.c,v 1.24 2013/01/26 00:21:49 christos Exp $"); /* * kernel include files. */ #include #include -#include #include -#include #include /* to define statvfs structure */ -#include /* to define vattr structure */ #include #include #include +#ifdef _KERNEL +#include +#include +#include /* to define vattr structure */ +#else +#include +#endif /* * msdosfs include files. diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c index 6726c2c33fcf..2df17ff1b780 100644 --- a/sys/fs/msdosfs/msdosfs_lookup.c +++ b/sys/fs/msdosfs/msdosfs_lookup.c @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_lookup.c,v 1.27 2012/12/20 08:03:42 hannken Exp $ */ +/* $NetBSD: msdosfs_lookup.c,v 1.28 2013/01/26 00:21:49 christos Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -47,17 +47,26 @@ * October 1992 */ +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + #include -__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.27 2012/12/20 08:03:42 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.28 2013/01/26 00:21:49 christos Exp $"); #include #include +#include +#include #include +#include + +#ifdef _KERNEL #include #include -#include -#include -#include +#else +#include +#endif /* _KERNEL */ #include #include @@ -65,6 +74,8 @@ __KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.27 2012/12/20 08:03:42 hannken #include #include + +#ifdef _KERNEL /* * When we search a directory the blocks containing directory entries are * read and examined. The directory entries contain information that would @@ -559,6 +570,7 @@ foundroot: return 0; } +#endif /* _KERNEL */ /* * dep - directory entry to copy into the directory @@ -572,13 +584,17 @@ createde(struct denode *dep, struct denode *ddep, struct denode **depp, struct c { int error, rberror; u_long dirclust, clusoffset; - u_long fndoffset, havecnt=0, wcnt=1; + u_long fndoffset, havecnt = 0, wcnt = 1, i; struct direntry *ndep; struct msdosfsmount *pmp = ddep->de_pmp; struct buf *bp; daddr_t bn; - int blsize, i; + int blsize; +#ifdef _KERNEL int async = ddep->de_pmp->pm_mountp->mnt_flag & MNT_ASYNC; +#else +#define async 0 +#endif #ifdef MSDOSFS_DEBUG printf("createde(dep %p, ddep %p, depp %p, cnp %p)\n", @@ -716,7 +732,7 @@ createde(struct denode *dep, struct denode *ddep, struct denode **depp, struct c ndep = bptoep(pmp, bp, clusoffset); havecnt = ddep->de_fndcnt + 1; - for(i=wcnt; i <= havecnt; i++) { + for(i = wcnt; i <= havecnt; i++) { /* mark entry as deleted */ ndep->deName[0] = SLOT_DELETED; @@ -980,7 +996,11 @@ removede(struct denode *pdep, struct denode *dep) int blsize; struct msdosfsmount *pmp = pdep->de_pmp; u_long offset = pdep->de_fndoffset; +#ifdef _KERNEL int async = pdep->de_pmp->pm_mountp->mnt_flag & MNT_ASYNC; +#else +#define async 0 +#endif #ifdef MSDOSFS_DEBUG printf("removede(): filename %s, dep %p, offset %08lx\n", diff --git a/sys/fs/msdosfs/msdosfsmount.h b/sys/fs/msdosfs/msdosfsmount.h index 98213eb8732f..d7f99e493dda 100644 --- a/sys/fs/msdosfs/msdosfsmount.h +++ b/sys/fs/msdosfs/msdosfsmount.h @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfsmount.h,v 1.17 2012/11/04 17:57:59 jakllsch Exp $ */ +/* $NetBSD: msdosfsmount.h,v 1.18 2013/01/26 00:21:49 christos Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -96,7 +96,9 @@ struct msdosfs_args { MALLOC_DECLARE(M_MSDOSFSMNT); MALLOC_DECLARE(M_MSDOSFSTMP); #endif +#endif +#if defined(_KERNEL) || defined(MAKEFS) /* * Layout of the mount control block for a MSDOSFS file system. */ @@ -247,5 +249,5 @@ void msdosfs_init(void); void msdosfs_reinit(void); void msdosfs_done(void); -#endif /* _KERNEL */ +#endif /* _KERNEL || MAKEFS */ #endif /* _MSDOSFS_MSDOSFSMOUNT_H_ */