Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/msdosfs expose more stuff if MAKEFS is defined for th...
details: https://anonhg.NetBSD.org/src/rev/d4eda06057dd
branches: trunk
changeset: 784336:d4eda06057dd
user: christos <christos%NetBSD.org@localhost>
date: Sat Jan 26 00:21:49 2013 +0000
description:
expose more stuff if MAKEFS is defined for the headers, and arrange for
the source file to be compilable from userland.
diffstat:
sys/fs/msdosfs/denode.h | 8 +++++---
sys/fs/msdosfs/direntry.h | 7 ++++---
sys/fs/msdosfs/fat.h | 6 +++---
sys/fs/msdosfs/msdosfs_conv.c | 17 ++++++++++++-----
sys/fs/msdosfs/msdosfs_fat.c | 18 +++++++++++++-----
sys/fs/msdosfs/msdosfs_lookup.c | 36 ++++++++++++++++++++++++++++--------
sys/fs/msdosfs/msdosfsmount.h | 6 ++++--
7 files changed, 69 insertions(+), 29 deletions(-)
diffs (truncated from 306 to 300 lines):
diff -r 2a73df22ef68 -r d4eda06057dd sys/fs/msdosfs/denode.h
--- a/sys/fs/msdosfs/denode.h Sat Jan 26 00:20:40 2013 +0000
+++ b/sys/fs/msdosfs/denode.h Sat Jan 26 00:21:49 2013 +0000
@@ -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 @@
#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 @@
/*
* 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_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 -r 2a73df22ef68 -r d4eda06057dd sys/fs/msdosfs/direntry.h
--- a/sys/fs/msdosfs/direntry.h Sat Jan 26 00:20:40 2013 +0000
+++ b/sys/fs/msdosfs/direntry.h Sat Jan 26 00:21:49 2013 +0000
@@ -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 @@
#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 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 -r 2a73df22ef68 -r d4eda06057dd sys/fs/msdosfs/fat.h
--- a/sys/fs/msdosfs/fat.h Sat Jan 26 00:20:40 2013 +0000
+++ b/sys/fs/msdosfs/fat.h Sat Jan 26 00:21:49 2013 +0000
@@ -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_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 -r 2a73df22ef68 -r d4eda06057dd sys/fs/msdosfs/msdosfs_conv.c
--- a/sys/fs/msdosfs/msdosfs_conv.c Sat Jan 26 00:20:40 2013 +0000
+++ b/sys/fs/msdosfs/msdosfs_conv.c Sat Jan 26 00:21:49 2013 +0000
@@ -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 @@
#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 @@
*/
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 @@
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 -r 2a73df22ef68 -r d4eda06057dd sys/fs/msdosfs/msdosfs_fat.c
--- a/sys/fs/msdosfs/msdosfs_fat.c Sat Jan 26 00:20:40 2013 +0000
+++ b/sys/fs/msdosfs/msdosfs_fat.c Sat Jan 26 00:21:49 2013 +0000
@@ -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.
diff -r 2a73df22ef68 -r d4eda06057dd sys/fs/msdosfs/msdosfs_lookup.c
--- a/sys/fs/msdosfs/msdosfs_lookup.c Sat Jan 26 00:20:40 2013 +0000
+++ b/sys/fs/msdosfs/msdosfs_lookup.c Sat Jan 26 00:21:49 2013 +0000
@@ -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 @@
#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 @@
return 0;
}
+#endif /* _KERNEL */
/*
* dep - directory entry to copy into the directory
@@ -572,13 +584,17 @@
{
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 @@
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 @@
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 -r 2a73df22ef68 -r d4eda06057dd sys/fs/msdosfs/msdosfsmount.h
--- a/sys/fs/msdosfs/msdosfsmount.h Sat Jan 26 00:20:40 2013 +0000
+++ b/sys/fs/msdosfs/msdosfsmount.h Sat Jan 26 00:21:49 2013 +0000
@@ -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 @@
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 @@
Home |
Main Index |
Thread Index |
Old Index