Re: [PATCH] Added CONFIG_VFAT_FS_DUALNAMES option
From: Pavel Machek
Date: Wed Jul 01 2009 - 05:00:05 EST
> When VFAT_FS_DUALNAMES is disabled we avoid the creation of 8.3 short
> filenames for files on VFAT filesystems that require a long name. The
> patch uses a pattern of 11 bytes in the directory entry which contains
> invalid characters such that it cannot be considered to be a valid short
> filename.
>
> Signed-off-by: Andrew Tridgell <tridge@xxxxxxxxx>
> Acked-by: Dave Kleikamp <shaggy@xxxxxxxxxxxxxxxxxx>
> Acked-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
> ---
> fs/fat/Kconfig | 20 +++++++++++++++++
> fs/fat/dir.c | 15 ++++++-------
> fs/fat/namei_vfat.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 86 insertions(+), 8 deletions(-)
>
> diff --git a/fs/fat/Kconfig b/fs/fat/Kconfig
> index 182f9ff..907a5de 100644
> --- a/fs/fat/Kconfig
> +++ b/fs/fat/Kconfig
> @@ -74,6 +74,26 @@ config VFAT_FS
> To compile this as a module, choose M here: the module will be called
> vfat.
>
> +config VFAT_FS_DUALNAMES
> + bool "VFAT dual names support"
> + depends on VFAT_FS
Defaults should be back-compatible.
> +
> + Users considering enabling this option should consider the implications
> + of any patents that may exist on dual filenames in VFAT.
> +
> + If unsure, say N
Say Y.
Users considering disabling this should understand that filesystem
they write to will not be valid vfat filesystems, and may trigger bugs
in some devices.
> +#ifndef CONFIG_VFAT_FS_DUALNAMES
> +/*
> + * build a 11 byte 8.3 buffer which is not a short filename. We want 11
> + * bytes which:
> + * - will be seen as a constant string to all APIs on Linux and Windows
> + * - cannot be matched with wildcard patterns
> + * - cannot be used to access the file
> + * - has a low probability of collision within a directory
> + * - has an invalid 3 byte extension
> + * - contains at least one non-space and non-nul byte
> + */
What happens on collision? With 60000 entries in directory, there will
be 50% chance of collision. BAD.
Why not use something like position in directory instead of random
number?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/