Module Name: src Committed By: christos Date: Sat Jan 26 16:50:46 UTC 2013
Modified Files: src/usr.sbin/makefs/ffs: buf.h src/usr.sbin/makefs/msdos: Makefile.inc msdosfs_denode.c msdosfs_vfsops.c msdosfs_vnops.c Log Message: make this cross-compile friendly. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/makefs/ffs/buf.h cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/makefs/msdos/Makefile.inc cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/makefs/msdos/msdosfs_denode.c cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/makefs/msdos/msdosfs_vfsops.c \ src/usr.sbin/makefs/msdos/msdosfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/makefs/ffs/buf.h diff -u src/usr.sbin/makefs/ffs/buf.h:1.3 src/usr.sbin/makefs/ffs/buf.h:1.4 --- src/usr.sbin/makefs/ffs/buf.h:1.3 Fri Jan 25 19:19:39 2013 +++ src/usr.sbin/makefs/ffs/buf.h Sat Jan 26 11:50:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.h,v 1.3 2013/01/26 00:19:39 christos Exp $ */ +/* $NetBSD: buf.h,v 1.4 2013/01/26 16:50:46 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -75,6 +75,7 @@ struct buf { TAILQ_ENTRY(buf) b_tailq; }; +struct kauth_cred; void bcleanup(void); int bread(struct vnode *, daddr_t, int, struct kauth_cred *, int, struct buf **); @@ -112,5 +113,7 @@ struct pool { #define mutex_destroy(m) #define desiredvnodes 10000 +#define NOCRED NULL +#define DEV_BSHIFT 9 #endif /* _FFS_BUF_H */ Index: src/usr.sbin/makefs/msdos/Makefile.inc diff -u src/usr.sbin/makefs/msdos/Makefile.inc:1.4 src/usr.sbin/makefs/msdos/Makefile.inc:1.5 --- src/usr.sbin/makefs/msdos/Makefile.inc:1.4 Fri Jan 25 19:20:40 2013 +++ src/usr.sbin/makefs/msdos/Makefile.inc Sat Jan 26 11:50:46 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.4 2013/01/26 00:20:40 christos Exp $ +# $NetBSD: Makefile.inc,v 1.5 2013/01/26 16:50:46 christos Exp $ # MSDOS= ${NETBSDSRCDIR}/sys/fs/msdosfs @@ -6,7 +6,10 @@ MSDOS_NEWFS= ${NETBSDSRCDIR}/sbin/newfs_ .PATH: ${.CURDIR}/msdos ${MSDOS} ${MSDOS_NEWFS} -CPPFLAGS+= -DMSDOS_EI -I${MSDOS} -I${MSDOS_NEWFS} -I${NETBSDSRCDIR}/sys +CPPFLAGS+= -DMSDOS_EI -I${MSDOS} -I${MSDOS_NEWFS} +.if !defined(HOSTPROGNAME) +CPPFLAGS+= -I${NETBSDSRCDIR}/sys +.endif SRCS+= mkfs_msdos.c msdosfs_fat.c msdosfs_conv.c msdosfs_vfsops.c SRCS+= msdosfs_lookup.c msdosfs_denode.c msdosfs_vnops.c Index: src/usr.sbin/makefs/msdos/msdosfs_denode.c diff -u src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.1 src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.2 --- src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.1 Fri Jan 25 19:20:40 2013 +++ src/usr.sbin/makefs/msdos/msdosfs_denode.c Sat Jan 26 11:50:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_denode.c,v 1.1 2013/01/26 00:20:40 christos Exp $ */ +/* $NetBSD: msdosfs_denode.c,v 1.2 2013/01/26 16:50:46 christos Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -52,28 +52,11 @@ #endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.1 2013/01/26 00:20:40 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.2 2013/01/26 16:50:46 christos Exp $"); #include <sys/param.h> -#include <sys/systm.h> -#include <sys/mount.h> -#include <sys/malloc.h> -#include <sys/pool.h> -#include <sys/proc.h> -#include <sys/kernel.h> /* defines "time" */ -#include <sys/dirent.h> -#include <sys/namei.h> -#include <sys/kauth.h> -#include <sys/rbtree.h> - -#ifdef _KERNEL -#include <sys/fstrans.h> -#include <uvm/uvm_extern.h> -#include <sys/buf.h> -#include <sys/vnode.h> -#else + #include <ffs/buf.h> -#endif #include <fs/msdosfs/bpb.h> #include <fs/msdosfs/msdosfsmount.h> @@ -208,7 +191,7 @@ deget(struct msdosfsmount *pmp, u_long d * Truncate the file described by dep to the length specified by length. */ int -detrunc(struct denode *dep, u_long length, int flags, kauth_cred_t cred) +detrunc(struct denode *dep, u_long length, int flags, struct kauth_cred *cred) { int error; int allerror = 0; @@ -331,7 +314,7 @@ detrunc(struct denode *dep, u_long lengt * Extend the file described by dep to length specified by length. */ int -deextend(struct denode *dep, u_long length, kauth_cred_t cred) +deextend(struct denode *dep, u_long length, struct kauth_cred *cred) { struct msdosfsmount *pmp = dep->de_pmp; u_long count, osize; @@ -341,16 +324,16 @@ deextend(struct denode *dep, u_long leng * The root of a DOS filesystem cannot be extended. */ if ((DETOV(dep) == (struct vnode *)-1) && !FAT32(pmp)) - return (EINVAL); + return EINVAL; /* * Directories cannot be extended. */ if (dep->de_Attributes & ATTR_DIRECTORY) - return (EISDIR); + return EISDIR; if (length <= dep->de_FileSize) - panic("deextend: file too large"); + return E2BIG; /* * Compute the number of clusters to allocate. Index: src/usr.sbin/makefs/msdos/msdosfs_vfsops.c diff -u src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.2 src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.3 --- src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.2 Fri Jan 25 19:31:50 2013 +++ src/usr.sbin/makefs/msdos/msdosfs_vfsops.c Sat Jan 26 11:50:46 2013 @@ -50,13 +50,9 @@ #endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.2 2013/01/26 00:31:50 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.3 2013/01/26 16:50:46 christos Exp $"); #include <sys/param.h> -#include <sys/systm.h> -#include <sys/dirent.h> -#include <sys/mount.h> -#include <sys/file.h> #include <ffs/buf.h> @@ -377,15 +373,6 @@ msdosfs_mount(struct vnode *devvp, int f } /* - * If they want FAT updates to be synchronous then let them suffer - * the performance degradation in exchange for the on disk copy of - * the FAT being correct just about all the time. I suppose this - * would be a good thing to turn on if the kernel is still flakey. - */ - if (flags & MNT_SYNCHRONOUS) - pmp->pm_flags |= MSDOSFSMNT_WAITONFAT; - - /* * Finish up. */ if (ronly) Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.2 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.3 --- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.2 Fri Jan 25 19:31:50 2013 +++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c Sat Jan 26 11:50:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_vnops.c,v 1.2 2013/01/26 00:31:50 christos Exp $ */ +/* $NetBSD: msdosfs_vnops.c,v 1.3 2013/01/26 16:50:46 christos Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -46,9 +46,12 @@ * * October 1992 */ +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.2 2013/01/26 00:31:50 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.3 2013/01/26 16:50:46 christos Exp $"); #include <sys/param.h> #include <sys/mman.h> @@ -91,10 +94,15 @@ static void msdosfs_times(struct msdosfsmount *pmp, struct denode *dep, const struct stat *st) { - unix2dostime(&st->st_atimespec, pmp->pm_gmtoff, &dep->de_ADate, - NULL, NULL); - unix2dostime(&st->st_mtimespec, pmp->pm_gmtoff, &dep->de_MDate, - &dep->de_MTime, NULL); +#ifdef __NetBSD__ + struct timespec at = st->st_atimespec; + struct timespec mt = st->st_mtimespec; +#else + struct timespec at = { st->st_atime, 0 }; + struct timespec mt = { st->st_mtime, 0 }; +#endif + unix2dostime(&at, pmp->pm_gmtoff, &dep->de_ADate, NULL, NULL); + unix2dostime(&mt, pmp->pm_gmtoff, &dep->de_MDate, &dep->de_MTime, NULL); } /* @@ -174,6 +182,7 @@ msdosfs_wfile(const char *path, struct d struct msdosfsmount *pmp = dep->de_pmp; struct buf *bp; char *dat; + u_long cn; #ifdef MSDOSFS_DEBUG printf("msdosfs_write(): diroff %lu, dirclust %lu, startcluster %lu\n", @@ -203,7 +212,7 @@ msdosfs_wfile(const char *path, struct d err(1, "mmap %s", node->name); close(fd); - for (u_long cn = 0;; cn++) { + for (cn = 0;; cn++) { int blsize, cpsize; daddr_t bn; if (pcbmap(dep, cn, &bn, 0, &blsize)) {