]> xenbits.xensource.com Git - freebsd.git/commitdiff
makefs: share msdosfsmount.h between kernel msdosfs and makefs
authoremaste <emaste@FreeBSD.org>
Sun, 1 Sep 2019 16:55:33 +0000 (16:55 +0000)
committeremaste <emaste@FreeBSD.org>
Sun, 1 Sep 2019 16:55:33 +0000 (16:55 +0000)
Sponsored by: The FreeBSD Foundation

sys/fs/msdosfs/msdosfsmount.h
usr.sbin/makefs/msdos.c
usr.sbin/makefs/msdos/msdosfs_conv.c
usr.sbin/makefs/msdos/msdosfs_denode.c
usr.sbin/makefs/msdos/msdosfs_fat.c
usr.sbin/makefs/msdos/msdosfs_lookup.c
usr.sbin/makefs/msdos/msdosfs_vfsops.c
usr.sbin/makefs/msdos/msdosfs_vnops.c
usr.sbin/makefs/msdos/msdosfsmount.h [deleted file]

index 77985e56d65be51fe9a90982d8d70e63d3411af5..975372da8ef7b520ded1d55c37a8597af00eb177 100644 (file)
@@ -53,7 +53,7 @@
 #ifndef _MSDOSFS_MSDOSFSMOUNT_H_
 #define        _MSDOSFS_MSDOSFSMOUNT_H_
 
-#ifdef _KERNEL
+#if defined (_KERNEL) || defined(MAKEFS)
 
 #include <sys/types.h>
 #include <sys/lock.h>
@@ -224,6 +224,7 @@ struct msdosfs_fileno {
 
 #endif /* _KERNEL */
 
+#ifndef MAKEFS
 /*
  *  Arguments to mount MSDOS filesystems.
  */
@@ -241,6 +242,7 @@ struct msdosfs_args {
        char    *cs_local;      /* Local Charset */
        mode_t  dirmask;        /* dir  mask to be applied for msdosfs perms */
 };
+#endif /* MAKEFS */
 
 /*
  * Msdosfs mount options:
index 9f2528a6987e65def7f4fe6cda7fb945cb5bc76a..de8ec1b9b1d42144dd2c2001eba5ca34afd1b3a7 100644 (file)
@@ -63,9 +63,7 @@ __FBSDID("$FreeBSD$");
 #include <fs/msdosfs/bpb.h>
 #include "msdos/direntry.h"
 #include <fs/msdosfs/denode.h>
-
-
-#include "msdos/msdosfsmount.h"
+#include <fs/msdosfs/msdosfsmount.h>
 
 static int msdos_populate_dir(const char *, struct denode *, fsnode *,
     fsnode *, fsinfo_t *);
index 1adbb9272b0cfaca39b71fccbb9fc12c9a9dbe22..b53656d3b439ca507f69fea2b136e4a81b0d86d4 100644 (file)
@@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
 
 #include <fs/msdosfs/bpb.h>
 #include "msdos/direntry.h"
-#include "msdos/msdosfsmount.h"
+#include <fs/msdosfs/msdosfsmount.h>
 
 #include "makefs.h"
 #include "msdos.h"
index fc5c097670e58b1cfeb339bbf876f6825a5d1bf2..1bc31e44b5d877b73c5ca5dde1e0efbf71e766bb 100644 (file)
@@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$");
 #include <fs/msdosfs/direntry.h>
 #include <fs/msdosfs/denode.h>
 #include <fs/msdosfs/fat.h>
-#include "msdos/msdosfsmount.h"
+#include <fs/msdosfs/msdosfsmount.h>
 
 #include "makefs.h"
 #include "msdos.h"
index 3992f7f9d51415281bbcc33e450dec7f41fcbb4b..63c4ef14cf142872825a68cc0dfc491f7688c8cc 100644 (file)
@@ -64,7 +64,7 @@
 #include "msdos/direntry.h"
 #include <fs/msdosfs/denode.h>
 #include <fs/msdosfs/fat.h>
-#include "msdos/msdosfsmount.h"
+#include <fs/msdosfs/msdosfsmount.h>
 
 #include "makefs.h"
 #include "msdos.h"
index b82b23ec8aa133bae93a259b0911da676b597910..ee586818afce7222bf6c7f2107edfc057092168e 100644 (file)
@@ -61,7 +61,7 @@
 #include "msdos/direntry.h"
 #include <fs/msdosfs/denode.h>
 #include <fs/msdosfs/fat.h>
-#include "msdos/msdosfsmount.h"
+#include <fs/msdosfs/msdosfsmount.h>
 
 #include "makefs.h"
 #include "msdos.h"
index b3b008a12f08e879c93bf86942444cff8e91cb41..15f965f5d8e9eb8204249f9f5f857439ff2fb832 100644 (file)
@@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$");
 #include "msdos/direntry.h"
 #include <fs/msdosfs/denode.h>
 #include <fs/msdosfs/fat.h>
-#include "msdos/msdosfsmount.h"
+#include <fs/msdosfs/msdosfsmount.h>
 
 #include <mkfs_msdos.h>
 
index c75168a0e70716f1dfccba3ecf2b7731f6a37547..f25900c8cb30849f4067e54a62ed418a8b779ca5 100644 (file)
@@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$");
 #include "msdos/direntry.h"
 #include <fs/msdosfs/denode.h>
 #include <fs/msdosfs/fat.h>
-#include "msdos/msdosfsmount.h"
+#include <fs/msdosfs/msdosfsmount.h>
 
 #include "makefs.h"
 #include "msdos.h"
diff --git a/usr.sbin/makefs/msdos/msdosfsmount.h b/usr.sbin/makefs/msdos/msdosfsmount.h
deleted file mode 100644 (file)
index aa279e3..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-/* $FreeBSD$ */
-/*     $NetBSD: msdosfsmount.h,v 1.17 1997/11/17 15:37:07 ws Exp $     */
-
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
- * Copyright (C) 1994, 1995, 1997 TooLs GmbH.
- * All rights reserved.
- * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*-
- * Written by Paul Popelka (paulp@uts.amdahl.com)
- *
- * You can do anything you want with this software, just don't say you wrote
- * it, and don't remove this notice.
- *
- * This software is provided "as is".
- *
- * The author supplies this software to be publicly redistributed on the
- * understanding that the author is not responsible for the correct
- * functioning of this software in any circumstances and is not liable for
- * any damages caused by this software.
- *
- * October 1992
- */
-
-#ifndef _MSDOSFS_MSDOSFSMOUNT_H_
-#define        _MSDOSFS_MSDOSFSMOUNT_H_
-
-#include <sys/types.h>
-
-struct vnode;
-struct cdev;
-struct bpb50;
-
-/*
- * Layout of the mount control block for a MSDOSFS filesystem.
- */
-struct msdosfsmount {
-       struct vnode *pm_devvp; /* vnode for character device mounted */
-       struct cdev *pm_dev;    /* character device mounted */
-       struct bpb50 pm_bpb;    /* BIOS parameter blk for this fs */
-       u_long pm_FATsecs;      /* actual number of FAT sectors */
-       u_long pm_fatblk;       /* block # of first FAT */
-       u_long pm_rootdirblk;   /* block # (cluster # for FAT32) of root directory number */
-       u_long pm_rootdirsize;  /* size in blocks (not clusters) */
-       u_long pm_firstcluster; /* block number of first cluster */
-       u_long pm_maxcluster;   /* maximum cluster number */
-       u_long pm_freeclustercount;     /* number of free clusters */
-       u_long pm_cnshift;      /* shift file offset right this amount to get a cluster number */
-       u_long pm_crbomask;     /* and a file offset with this mask to get cluster rel offset */
-       u_long pm_bnshift;      /* shift file offset right this amount to get a block number */
-       u_long pm_bpcluster;    /* bytes per cluster */
-       u_long pm_fmod;         /* ~0 if fs is modified, this can rollover to 0 */
-       u_long pm_fatblocksize; /* size of FAT blocks in bytes */
-       u_long pm_fatblocksec;  /* size of FAT blocks in sectors */
-       u_long pm_fatsize;      /* size of FAT in bytes */
-       uint32_t pm_fatmask;    /* mask to use for FAT numbers */
-       u_long pm_fsinfo;       /* fsinfo block number */
-       u_long pm_nxtfree;      /* next place to search for a free cluster */
-       u_int pm_fatmult;       /* these 2 values are used in FAT */
-       u_int pm_fatdiv;        /*      offset computation */
-       u_int pm_curfat;        /* current FAT for FAT32 (0 otherwise) */
-       u_int *pm_inusemap;     /* ptr to bitmap of in-use clusters */
-       uint64_t pm_flags;      /* see below */
-};
-
-/* Byte offset in FAT on filesystem pmp, cluster cn */
-#define        FATOFS(pmp, cn) ((cn) * (pmp)->pm_fatmult / (pmp)->pm_fatdiv)
-
-/* Number of bits in one pm_inusemap item: */
-#define        N_INUSEBITS     (8 * sizeof(u_int))
-
-/*
- * Shorthand for fields in the bpb contained in the msdosfsmount structure.
- */
-#define        pm_BytesPerSec  pm_bpb.bpbBytesPerSec
-#define        pm_ResSectors   pm_bpb.bpbResSectors
-#define        pm_FATs         pm_bpb.bpbFATs
-#define        pm_RootDirEnts  pm_bpb.bpbRootDirEnts
-#define        pm_Sectors      pm_bpb.bpbSectors
-#define        pm_Media        pm_bpb.bpbMedia
-#define        pm_SecPerTrack  pm_bpb.bpbSecPerTrack
-#define        pm_Heads        pm_bpb.bpbHeads
-#define        pm_HiddenSects  pm_bpb.bpbHiddenSecs
-#define        pm_HugeSectors  pm_bpb.bpbHugeSectors
-
-/*
- * Convert pointer to buffer -> pointer to direntry
- */
-#define        bptoep(pmp, bp, dirofs) \
-       ((struct direntry *)(((bp)->b_data)     \
-        + ((dirofs) & (pmp)->pm_crbomask)))
-
-/*
- * Convert block number to cluster number
- */
-#define        de_bn2cn(pmp, bn) \
-       ((bn) >> ((pmp)->pm_cnshift - (pmp)->pm_bnshift))
-
-/*
- * Convert cluster number to block number
- */
-#define        de_cn2bn(pmp, cn) \
-       ((cn) << ((pmp)->pm_cnshift - (pmp)->pm_bnshift))
-
-/*
- * Convert file offset to cluster number
- */
-#define de_cluster(pmp, off) \
-       ((off) >> (pmp)->pm_cnshift)
-
-/*
- * Clusters required to hold size bytes
- */
-#define        de_clcount(pmp, size) \
-       (((size) + (pmp)->pm_bpcluster - 1) >> (pmp)->pm_cnshift)
-
-/*
- * Convert file offset to block number
- */
-#define de_blk(pmp, off) \
-       (de_cn2bn(pmp, de_cluster((pmp), (off))))
-
-/*
- * Convert cluster number to file offset
- */
-#define        de_cn2off(pmp, cn) \
-       ((cn) << (pmp)->pm_cnshift)
-
-/*
- * Convert block number to file offset
- */
-#define        de_bn2off(pmp, bn) \
-       ((bn) << (pmp)->pm_bnshift)
-/*
- * Map a cluster number into a filesystem relative block number.
- */
-#define        cntobn(pmp, cn) \
-       (de_cn2bn((pmp), (cn)-CLUST_FIRST) + (pmp)->pm_firstcluster)
-
-/*
- * Calculate block number for directory entry in root dir, offset dirofs
- */
-#define        roottobn(pmp, dirofs) \
-       (de_blk((pmp), (dirofs)) + (pmp)->pm_rootdirblk)
-
-/*
- * Calculate block number for directory entry at cluster dirclu, offset
- * dirofs
- */
-#define        detobn(pmp, dirclu, dirofs) \
-       ((dirclu) == MSDOSFSROOT \
-        ? roottobn((pmp), (dirofs)) \
-        : cntobn((pmp), (dirclu)))
-
-/*
- * Msdosfs mount options:
- */
-#define        MSDOSFSMNT_SHORTNAME    1       /* Force old DOS short names only */
-#define        MSDOSFSMNT_LONGNAME     2       /* Force Win'95 long names */
-#define        MSDOSFSMNT_NOWIN95      4       /* Completely ignore Win95 entries */
-#define        MSDOSFSMNT_KICONV       0x10    /* Use libiconv to convert chars */
-/* All flags above: */
-#define        MSDOSFSMNT_MNTOPT \
-       (MSDOSFSMNT_SHORTNAME|MSDOSFSMNT_LONGNAME|MSDOSFSMNT_NOWIN95 \
-        |MSDOSFSMNT_KICONV)
-#define        MSDOSFSMNT_RONLY        0x80000000      /* mounted read-only    */
-#define        MSDOSFSMNT_WAITONFAT    0x40000000      /* mounted synchronous  */
-#define        MSDOSFS_FATMIRROR       0x20000000      /* FAT is mirrored */
-#define        MSDOSFS_FSIMOD          0x01000000
-
-#endif /* !_MSDOSFS_MSDOSFSMOUNT_H_ */