summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Rodrigues <rodrigc@FreeBSD.org>2007-07-08 15:30:28 +0000
committerCraig Rodrigues <rodrigc@FreeBSD.org>2007-07-08 15:30:28 +0000
commit1896da16251d669b9b1ee8310e887fb499e36f41 (patch)
tree85f19a12d7705c84b0989f79e10edc7f8bfc7327
parent63f318eddb50cb8fd90b38071854668191b4e541 (diff)
Notes
-rw-r--r--sys/conf/NOTES12
-rw-r--r--sys/conf/files2
-rw-r--r--sys/conf/options3
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c56
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c39
-rw-r--r--sys/modules/msdosfs/Makefile6
6 files changed, 59 insertions, 59 deletions
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 87842bbe10db..8f084825b554 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -957,18 +957,6 @@ options MSDOSFS_ICONV
options NTFS_ICONV
options UDF_ICONV
-# Experimental support for large MS-DOS filesystems.
-#
-# WARNING: This uses at least 32 bytes of kernel memory (which is not
-# reclaimed until the FS is unmounted) for each file on disk to map
-# between the 32-bit inode numbers used by VFS and the 64-bit pseudo-inode
-# numbers used internally by msdosfs. This is only safe to use in certain
-# controlled situations (e.g. read-only FS with less than 1 million files).
-# Since the mappings do not persist across unmounts (or reboots), these
-# filesystems are not suitable for exporting through NFS, or any other
-# application that requires fixed inode numbers.
-options MSDOSFS_LARGE
-
#####################################################################
# POSIX P1003.1B
diff --git a/sys/conf/files b/sys/conf/files
index f8a4634715ae..7abc9134e054 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1059,7 +1059,7 @@ fs/hpfs/hpfs_vnops.c optional hpfs
fs/msdosfs/msdosfs_conv.c optional msdosfs
fs/msdosfs/msdosfs_denode.c optional msdosfs
fs/msdosfs/msdosfs_fat.c optional msdosfs
-fs/msdosfs/msdosfs_fileno.c optional msdosfs_large
+fs/msdosfs/msdosfs_fileno.c optional msdosfs
fs/msdosfs/msdosfs_iconv.c optional msdosfs_iconv
fs/msdosfs/msdosfs_lookup.c optional msdosfs
fs/msdosfs/msdosfs_vfsops.c optional msdosfs
diff --git a/sys/conf/options b/sys/conf/options
index 300077a6a0a6..f56005eb510b 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -247,9 +247,6 @@ NETSMB opt_netsmb.h
# Obsolete
NETSMBCRYPTO opt_dontuse.h
-# Experimental support for large MS-DOS filesystems; SEE WARNING IN "NOTES"!
-MSDOSFS_LARGE opt_msdosfs.h
-
# Options used only in subr_param.c.
HZ opt_param.h
MAXFILES opt_param.h
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index e892af79880a..7b577e1263b1 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -74,15 +74,13 @@
#include <geom/geom.h>
#include <geom/geom_vfs.h>
-#include "opt_msdosfs.h"
-
/* List of mount options we support */
static const char *msdosfs_opts[] = {
"from",
"atime", "export", "force", "sync",
"uid", "gid", "mask", "dirmask",
"shortname", "shortnames", "longname", "longnames", "nowin95", "win95",
- "kiconv", "cs_win", "cs_dos", "cs_local",
+ "kiconv", "cs_win", "cs_dos", "cs_local", "large",
NULL
};
@@ -459,6 +457,21 @@ mountmsdosfs(devvp, mp, td)
pmp->pm_bo = bo;
/*
+ * Experimental support for large MS-DOS filesystems.
+ * WARNING: This uses at least 32 bytes of kernel memory (which is not
+ * reclaimed until the FS is unmounted) for each file on disk to map
+ * between the 32-bit inode numbers used by VFS and the 64-bit
+ * pseudo-inode numbers used internally by msdosfs. This is only
+ * safe to use in certain controlled situations (e.g. read-only FS
+ * with less than 1 million files).
+ * Since the mappings do not persist across unmounts (or reboots), these
+ * filesystems are not suitable for exporting through NFS, or any other
+ * application that requires fixed inode numbers.
+ */
+ vfs_flagopt(mp->mnt_optnew, "large", &pmp->pm_flags,
+ MSDOSFS_LARGEFS);
+
+ /*
* Compute several useful quantities from the bpb in the
* bootsector. Copy in the dos 5 variant of the bpb then fix up
* the fields that are different between dos 5 and dos 3.3.
@@ -500,19 +513,21 @@ mountmsdosfs(devvp, mp, td)
pmp->pm_HiddenSects = getushort(b33->bpbHiddenSecs);
pmp->pm_HugeSectors = pmp->pm_Sectors;
}
-#ifndef MSDOSFS_LARGE
- if (pmp->pm_HugeSectors > 0xffffffff /
- (pmp->pm_BytesPerSec / sizeof(struct direntry)) + 1) {
- /*
- * We cannot deal currently with this size of disk
- * due to fileid limitations (see msdosfs_getattr and
- * msdosfs_readdir)
- */
- error = EINVAL;
- printf("mountmsdosfs(): disk too big, sorry\n");
- goto error_exit;
+ if (!(pmp->pm_flags & MSDOSFS_LARGEFS)) {
+ if (pmp->pm_HugeSectors > 0xffffffff /
+ (pmp->pm_BytesPerSec / sizeof(struct direntry)) + 1) {
+ /*
+ * We cannot deal currently with this size of disk
+ * due to fileid limitations (see msdosfs_getattr and
+ * msdosfs_readdir)
+ */
+ error = EINVAL;
+ vfs_mount_error(mp,
+ "Disk too big, try '-o large' mount option");
+ printf("Disk too big, try '-o large' mount option\n");
+ goto error_exit;
+ }
}
-#endif /* !MSDOSFS_LARGE */
if (pmp->pm_RootDirEnts == 0) {
if (pmp->pm_Sectors
@@ -713,9 +728,8 @@ mountmsdosfs(devvp, mp, td)
mp->mnt_flag |= MNT_LOCAL;
MNT_IUNLOCK(mp);
-#ifdef MSDOSFS_LARGE
- msdosfs_fileno_init(mp);
-#endif
+ if (pmp->pm_flags & MSDOSFS_LARGEFS)
+ msdosfs_fileno_init(mp);
return 0;
@@ -798,9 +812,9 @@ msdosfs_unmount(mp, mntflags, td)
PICKUP_GIANT();
vrele(pmp->pm_devvp);
free(pmp->pm_inusemap, M_MSDOSFSFAT);
-#ifdef MSDOSFS_LARGE
- msdosfs_fileno_free(mp);
-#endif
+ if (pmp->pm_flags & MSDOSFS_LARGEFS) {
+ msdosfs_fileno_free(mp);
+ }
free(pmp, M_MSDOSFSMNT);
mp->mnt_data = (qaddr_t)0;
MNT_ILOCK(mp);
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 0ba6dbc52a3a..b5e27161db7d 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -78,8 +78,6 @@
#include <fs/msdosfs/denode.h>
#include <fs/msdosfs/fat.h>
-#include "opt_msdosfs.h"
-
#define DOS_FILESIZE_MAX 0xffffffff
/*
@@ -324,11 +322,12 @@ msdosfs_getattr(ap)
fileid = (uint64_t)roottobn(pmp, 0) * dirsperblk;
fileid += (uint64_t)dep->de_diroffset / sizeof(struct direntry);
}
-#ifdef MSDOSFS_LARGE
- vap->va_fileid = msdosfs_fileno_map(pmp->pm_mountp, fileid);
-#else
- vap->va_fileid = (long)fileid;
-#endif
+
+ if (pmp->pm_flags & MSDOSFS_LARGEFS)
+ vap->va_fileid = msdosfs_fileno_map(pmp->pm_mountp, fileid);
+ else
+ vap->va_fileid = (long)fileid;
+
if ((dep->de_Attributes & ATTR_READONLY) == 0)
mode = S_IRWXU|S_IRWXG|S_IRWXO;
else
@@ -1556,12 +1555,14 @@ msdosfs_readdir(ap)
* dirsperblk;
else
fileno = 1;
-#ifdef MSDOSFS_LARGE
- dirbuf.d_fileno = msdosfs_fileno_map(
- pmp->pm_mountp, fileno);
-#else
- dirbuf.d_fileno = (uint32_t)fileno;
-#endif
+ if (pmp->pm_flags & MSDOSFS_LARGEFS) {
+ dirbuf.d_fileno =
+ msdosfs_fileno_map(pmp->pm_mountp,
+ fileno);
+ } else {
+
+ dirbuf.d_fileno = (uint32_t)fileno;
+ }
dirbuf.d_type = DT_DIR;
switch (n) {
case 0:
@@ -1685,12 +1686,12 @@ msdosfs_readdir(ap)
fileno = (uint64_t)offset / sizeof(struct direntry);
dirbuf.d_type = DT_REG;
}
-#ifdef MSDOSFS_LARGE
- dirbuf.d_fileno = msdosfs_fileno_map(pmp->pm_mountp,
- fileno);
-#else
- dirbuf.d_fileno = (uint32_t)fileno;
-#endif
+ if (pmp->pm_flags & MSDOSFS_LARGEFS) {
+ dirbuf.d_fileno =
+ msdosfs_fileno_map(pmp->pm_mountp, fileno);
+ } else
+ dirbuf.d_fileno = (uint32_t)fileno;
+
if (chksum != winChksum(dentp->deName)) {
dirbuf.d_namlen = dos2unixfn(dentp->deName,
(u_char *)dirbuf.d_name,
diff --git a/sys/modules/msdosfs/Makefile b/sys/modules/msdosfs/Makefile
index cca7fa69d6f0..a0fe95f0b6ec 100644
--- a/sys/modules/msdosfs/Makefile
+++ b/sys/modules/msdosfs/Makefile
@@ -3,9 +3,9 @@
.PATH: ${.CURDIR}/../../fs/msdosfs
KMOD= msdosfs
-SRCS= opt_msdosfs.h vnode_if.h \
- msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_lookup.c \
- msdosfs_vfsops.c msdosfs_vnops.c
+SRCS= vnode_if.h \
+ msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_fileno.c \
+ msdosfs_lookup.c msdosfs_vfsops.c msdosfs_vnops.c
EXPORT_SYMS= msdosfs_iconv
.include <bsd.kmod.mk>