summaryrefslogtreecommitdiffstats
path: root/sys/fs/msdosfs/msdosfsmount.h
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-07-03 13:22:38 +0000
committertjr <tjr@FreeBSD.org>2004-07-03 13:22:38 +0000
commitab16560f3305829961b71dbe71233abcd50f0aba (patch)
tree651a802dbc4eb055206f7c5ccba7348f998b53bd /sys/fs/msdosfs/msdosfsmount.h
parent158b00dfc0a2916d3a3e23aa2bd11bd84d6c0841 (diff)
downloadFreeBSD-src-ab16560f3305829961b71dbe71233abcd50f0aba.zip
FreeBSD-src-ab16560f3305829961b71dbe71233abcd50f0aba.tar.gz
By popular request, add a workaround that allows large (>128GB or so)
FAT32 filesystems to be mounted, subject to some fairly serious limitations. This works by extending the internal pseudo-inode-numbers generated from the file's starting cluster number to 64-bits, then creating a table mapping these into arbitrary 32-bit inode numbers, which can fit in struct dirent's d_fileno and struct vattr's va_fileid fields. The mappings do not persist across unmounts or reboots, so it's not possible to export these filesystems through NFS. The mapping table may grow to be rather large, and may grow large enough to exhaust kernel memory on filesystems with millions of files. Don't enable this option unless you understand the consequences.
Diffstat (limited to 'sys/fs/msdosfs/msdosfsmount.h')
-rw-r--r--sys/fs/msdosfs/msdosfsmount.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/sys/fs/msdosfs/msdosfsmount.h b/sys/fs/msdosfs/msdosfsmount.h
index 0ff712f..46f9cc5 100644
--- a/sys/fs/msdosfs/msdosfsmount.h
+++ b/sys/fs/msdosfs/msdosfsmount.h
@@ -53,10 +53,14 @@
#ifdef _KERNEL
+#include <sys/tree.h>
+
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_MSDOSFSMNT);
#endif
+struct msdosfs_fileno;
+
/*
* Layout of the mount control block for a msdos filesystem.
*/
@@ -99,7 +103,20 @@ struct msdosfsmount {
void *pm_w2u; /* Unicode->Local iconv handle */
void *pm_u2d; /* Unicode->DOS iconv handle */
void *pm_d2u; /* DOS->Local iconv handle */
+ u_int32_t pm_nfileno; /* next 32-bit fileno */
+ RB_HEAD(msdosfs_filenotree, msdosfs_fileno) pm_filenos; /* 64<->32-bit fileno mapping */
+};
+
+/*
+ * A 64-bit file number and the 32-bit file number to which it is mapped,
+ * in a red-black tree node.
+ */
+struct msdosfs_fileno {
+ RB_ENTRY(msdosfs_fileno) mf_tree;
+ uint32_t mf_fileno32;
+ uint64_t mf_fileno64;
};
+
/* Byte offset in FAT on filesystem pmp, cluster cn */
#define FATOFS(pmp, cn) ((cn) * (pmp)->pm_fatmult / (pmp)->pm_fatdiv)
@@ -202,6 +219,10 @@ int msdosfs_init(struct vfsconf *vfsp);
int msdosfs_uninit(struct vfsconf *vfsp);
int msdosfs_mountroot(void);
+void msdosfs_fileno_init(struct mount *);
+void msdosfs_fileno_free(struct mount *);
+uint32_t msdosfs_fileno_map(struct mount *, uint64_t);
+
#endif /* _KERNEL */
/*
@@ -219,7 +240,7 @@ struct msdosfs_args {
char *cs_win; /* Windows(Unicode) Charset */
char *cs_dos; /* DOS Charset */
char *cs_local; /* Local Charset */
- mode_t dirmask; /* dir mask to be applied for msdosfs perms */
+ mode_t dirmask; /* dir mask to be applied for msdosfs perms */
};
/*
@@ -236,6 +257,7 @@ struct msdosfs_args {
#define MSDOSFSMNT_RONLY 0x80000000 /* mounted read-only */
#define MSDOSFSMNT_WAITONFAT 0x40000000 /* mounted synchronous */
#define MSDOSFS_FATMIRROR 0x20000000 /* FAT is mirrored */
+#define MSDOSFS_LARGEFS 0x10000000 /* perform fileno mapping */
#define MSDOSFS_ARGSMAGIC 0xe4eff300
OpenPOWER on IntegriCloud