decoration decoration
Stories

GROKLAW
When you want to know more...
decoration
For layout only
Home
Archives
Site Map
Search
About Groklaw
Awards
Legal Research
Timelines
ApplevSamsung
ApplevSamsung p.2
ArchiveExplorer
Autozone
Bilski
Cases
Cast: Lawyers
Comes v. MS
Contracts/Documents
Courts
DRM
Gordon v MS
GPL
Grokdoc
HTML How To
IPI v RH
IV v. Google
Legal Docs
Lodsys
MS Litigations
MSvB&N
News Picks
Novell v. MS
Novell-MS Deal
ODF/OOXML
OOXML Appeals
OraclevGoogle
Patents
ProjectMonterey
Psystar
Quote Database
Red Hat v SCO
Salus Book
SCEA v Hotz
SCO Appeals
SCO Bankruptcy
SCO Financials
SCO Overview
SCO v IBM
SCO v Novell
SCO:Soup2Nuts
SCOsource
Sean Daly
Software Patents
Switch to Linux
Transcripts
Unix Books
Your contributions keep Groklaw going.
To donate to Groklaw 2.0:

Groklaw Gear

Click here to send an email to the editor of this weblog.


To read comments to this article, go here
Tridge -- Subject: [PATCH] Add CONFIG_VFAT_NO_CREATE_WITH_LONGNAMES option
Friday, May 01 2009 @ 07:38 PM EDT

The community is at work, I see. Not only is there a prior art search going on regarding three Microsoft patents asserted against TomTom (details here), but now Andrew Tridgell has posted some code on LKML. You'll never guess what it does? I'll let tridge tell you:
When this option is enabled the VFAT filesystem will refuse to create new files with long names. Accessing existing files with long names will continue to work.
In a perfect world, there would be no bullies, no software patents, and no one would need to write code like this. But here in the real world, with our very practical feet firmly planted on terra firma, aren't you glad you have some very clever friends?

Back in July of 2003, in the very first interview I ever gave, I was asked if I thought Microsoft was behind the SCO attacks on Linux, and while I said back then that I didn't know, I felt the issue was bigger than the players, that it was a culture clash between proprietary software and FOSS, and I expressed confidence that no matter who was involved, FOSS had a wonderful edge:

So, what do you do about a bully? If he's bigger than you are, you certainly try to outsmart him. There's no lack of brains on our side, happily.
Did I nail it, or did I nail it?

For the historical record, and because I just like looking at it, here's the post:

***************************

Subject: [PATCH] Add CONFIG_VFAT_NO_CREATE_WITH_LONGNAMES option
From: Dave Kleikamp
Date: Fri, 01 May 2009 12:41:29 -0500
From: Andrew Tridgell
Subject: [PATCH] Add CONFIG_VFAT_NO_CREATE_WITH_LONGNAMES option

When this option is enabled the VFAT filesystem will refuse to create new files with long names. Accessing existing files with long names will continue to work.

File names to be created must conform to the 8.3 format. Mixed case is not allowed in either the prefix or the suffix.

Signed-off-by: Andrew Tridgell
Signed-off-by: Dave Kleikamp
Acked-by: Steve French
Cc: Ogawa Hirofumi
Cc: Mingming Cao

---
 fs/fat/Kconfig      |   18 ++++++++++++++++++
 fs/fat/namei_vfat.c |   26 +++++++++++++++++++++-----
 2 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/fs/fat/Kconfig b/fs/fat/Kconfig
index 182f9ff..1439681 100644
--- a/fs/fat/Kconfig
+++ b/fs/fat/Kconfig

@@ -98,3 +98,21 @@ config FAT_DEFAULT_IOCHARSET
 
 	  Enable any character sets you need in File Systems/Native Language
 	  Support.
+
+config VFAT_NO_CREATE_WITH_LONGNAMES
+	bool "Disable creating files with long names"
+	depends on VFAT_FS
+	default n
+	help
+	  Set this to disable support for creating files or directories with
+	  names longer than 8.3 (the original DOS maximum file name length)
+	  e.g. naming a file FILE1234.TXT would be allowed but creating or
+	  renaming a file to FILE12345.TXT or FILE1234.TEXT would not
+	  be permitted.
+
+	  Case on files is only preserved if all of the prefix is the same
+	  case and all of the extension is the same case. So the names
+	  "FILE.txt", "file.TXT" would be case preserved, but if you create a
+	  file called "File.TxT" then it will be stored on disk as "FILE.TXT".
+
+	  Reading files with long file names is still permitted.
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index a0e00e3..cf0400e 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -316,6 +316,7 @@ static int vfat_create_shortname(struct inode *dir, struct nls_table *nls,
 	int sz = 0, extlen, baselen, i, numtail_baselen, numtail2_baselen;
 	int is_shortname;
 	struct shortname_info base_info, ext_info;
+	unsigned shortname_flags = opts->shortname;
 
 	is_shortname = 1;
 	INIT_SHORTNAME_INFO(&base_info);
@@ -424,13 +425,20 @@ static int vfat_create_shortname(struct inode *dir, struct nls_table *nls,
 	memcpy(name_res, base, baselen);
 	memcpy(name_res + 8, ext, extlen);
 	*lcase = 0;
+
+#ifdef CONFIG_VFAT_NO_CREATE_WITH_LONGNAMES
+	if (is_shortname == 0)
+		return -ENAMETOOLONG;
+	shortname_flags = VFAT_SFN_CREATE_WINNT;
+#endif
+
 	if (is_shortname && base_info.valid && ext_info.valid) {
 		if (vfat_find_form(dir, name_res) == 0)
 			return -EEXIST;
 
-		if (opts->shortname & VFAT_SFN_CREATE_WIN95) {
+		if (shortname_flags & VFAT_SFN_CREATE_WIN95) {
 			return (base_info.upper && ext_info.upper);
-		} else if (opts->shortname & VFAT_SFN_CREATE_WINNT) {
+		} else if (shortname_flags & VFAT_SFN_CREATE_WINNT) {
 			if ((base_info.upper || base_info.lower) &&

 			    (ext_info.upper || ext_info.lower)) {
 				if (!base_info.upper && base_info.lower)
@@ -593,15 +601,19 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name,
 {
 	struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
 	struct fat_mount_options *opts = &sbi->options;
-	struct msdos_dir_slot *ps;
 	struct msdos_dir_entry *de;
-	unsigned char cksum, lcase;
+	unsigned char lcase;
 	unsigned char msdos_name[MSDOS_NAME];
 	wchar_t *uname;
 	__le16 time, date;
 	u8 time_cs;
-	int err, ulen, usize, i;
+	int err, ulen, usize;
+#ifndef CONFIG_VFAT_NO_CREATE_WITH_LONGNAMES
+	unsigned char cksum;
+	int i;
 	loff_t offset;
+	struct msdos_dir_slot *ps;
+#endif
 
 	*nr_slots = 0;
 
@@ -628,6 +640,9 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name,
 		goto shortname;
 	}
 
+#ifdef CONFIG_VFAT_NO_CREATE_WITH_LONGNAMES
+	de = (struct msdos_dir_entry *)slots;
+#else
 	/* build the entry of long file name */
 	cksum = fat_checksum(msdos_name);
 
@@ -645,6 +660,7 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name,
 	}
 	slots[0].id |= 0x40;
 	de = (struct msdos_dir_entry *)ps;
+#endif
 
 shortname:
 	/* build the entry of 8.3 alias name */
-- 
David Kleikamp
IBM Linux Technology Center




  View Printable Version


Groklaw © Copyright 2003-2013 Pamela Jones.
All trademarks and copyrights on this page are owned by their respective owners.
Comments are owned by the individual posters.

PJ's articles are licensed under a Creative Commons License. ( Details )