expose more stuff if MAKEFS is defined for the headers, and arrange for
the source file to be compilable from userland.
This commit is contained in:
parent
7e2d9be620
commit
929f8943ca
|
@ -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_ */
|
||||
|
|
|
@ -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_ */
|
||||
|
|
|
@ -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_ */
|
||||
|
|
|
@ -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 <sys/cdefs.h>
|
||||
__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 <sys/kernel.h>
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/vnode.h>
|
||||
#ifndef _KERNEL
|
||||
#include <stdio.h>
|
||||
#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)
|
||||
|
|
|
@ -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 <sys/cdefs.h>
|
||||
__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 <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/namei.h>
|
||||
#include <sys/mount.h> /* to define statvfs structure */
|
||||
#include <sys/vnode.h> /* to define vattr structure */
|
||||
#include <sys/errno.h>
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/kauth.h>
|
||||
#ifdef _KERNEL
|
||||
#include <sys/namei.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/vnode.h> /* to define vattr structure */
|
||||
#else
|
||||
#include <ffs/buf.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* msdosfs include files.
|
||||
|
|
|
@ -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 <sys/cdefs.h>
|
||||
__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 <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/namei.h>
|
||||
#include <sys/dirent.h>
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/buf.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/kauth.h>
|
||||
#else
|
||||
#include <ffs/buf.h>
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#include <fs/msdosfs/bpb.h>
|
||||
#include <fs/msdosfs/direntry.h>
|
||||
|
@ -65,6 +74,8 @@ __KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.27 2012/12/20 08:03:42 hannken
|
|||
#include <fs/msdosfs/msdosfsmount.h>
|
||||
#include <fs/msdosfs/fat.h>
|
||||
|
||||
|
||||
#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",
|
||||
|
|
|
@ -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_ */
|
||||
|
|
Loading…
Reference in New Issue