Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/makefs make this cross-compile friendly.



details:   https://anonhg.NetBSD.org/src/rev/6a63144e63ca
branches:  trunk
changeset: 784352:6a63144e63ca
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 26 16:50:46 2013 +0000

description:
make this cross-compile friendly.

diffstat:

 usr.sbin/makefs/ffs/buf.h              |   5 ++++-
 usr.sbin/makefs/msdos/Makefile.inc     |   7 +++++--
 usr.sbin/makefs/msdos/msdosfs_denode.c |  31 +++++++------------------------
 usr.sbin/makefs/msdos/msdosfs_vfsops.c |  15 +--------------
 usr.sbin/makefs/msdos/msdosfs_vnops.c  |  23 ++++++++++++++++-------
 5 files changed, 33 insertions(+), 48 deletions(-)

diffs (217 lines):

diff -r f9647d3cbfb7 -r 6a63144e63ca usr.sbin/makefs/ffs/buf.h
--- a/usr.sbin/makefs/ffs/buf.h Sat Jan 26 16:05:34 2013 +0000
+++ b/usr.sbin/makefs/ffs/buf.h Sat Jan 26 16:50:46 2013 +0000
@@ -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 @@
        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 @@
 #define mutex_destroy(m)
 
 #define desiredvnodes 10000
+#define NOCRED NULL
+#define DEV_BSHIFT 9
 
 #endif /* _FFS_BUF_H */
diff -r f9647d3cbfb7 -r 6a63144e63ca usr.sbin/makefs/msdos/Makefile.inc
--- a/usr.sbin/makefs/msdos/Makefile.inc        Sat Jan 26 16:05:34 2013 +0000
+++ b/usr.sbin/makefs/msdos/Makefile.inc        Sat Jan 26 16:50:46 2013 +0000
@@ -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 @@
 
 .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
diff -r f9647d3cbfb7 -r 6a63144e63ca usr.sbin/makefs/msdos/msdosfs_denode.c
--- a/usr.sbin/makefs/msdos/msdosfs_denode.c    Sat Jan 26 16:05:34 2013 +0000
+++ b/usr.sbin/makefs/msdos/msdosfs_denode.c    Sat Jan 26 16:50:46 2013 +0000
@@ -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 @@
  * 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 @@
  * 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 @@
         * 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.
diff -r f9647d3cbfb7 -r 6a63144e63ca usr.sbin/makefs/msdos/msdosfs_vfsops.c
--- a/usr.sbin/makefs/msdos/msdosfs_vfsops.c    Sat Jan 26 16:05:34 2013 +0000
+++ b/usr.sbin/makefs/msdos/msdosfs_vfsops.c    Sat Jan 26 16:50:46 2013 +0000
@@ -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 @@
        }
 
        /*
-        * 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)
diff -r f9647d3cbfb7 -r 6a63144e63ca usr.sbin/makefs/msdos/msdosfs_vnops.c
--- a/usr.sbin/makefs/msdos/msdosfs_vnops.c     Sat Jan 26 16:05:34 2013 +0000
+++ b/usr.sbin/makefs/msdos/msdosfs_vnops.c     Sat Jan 26 16:50:46 2013 +0000
@@ -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 @@
 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 @@
        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 @@
                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)) {



Home | Main Index | Thread Index | Old Index