From: tridge@samba.org
To: LKML <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Cc: torvalds@linux-foundation.org,
Ogawa Hirofumi <hirofumi@mail.parknet.co.jp>,
Steve French <sfrench@us.ibm.com>, Mingming Cao <cmm@us.ibm.com>,
Paul McKenney <paulmck@linux.vnet.ibm.com>,
Dave Kleikamp <shaggy@linux.vnet.ibm.com>,
john.lanza@linux.com
Subject: [PATCH 1/2] FAT: Add FAT_NO_83NAME flag
Date: Tue, 21 Jul 2009 12:49:40 +1000 [thread overview]
Message-ID: <19045.11460.815706.98797@samba.org> (raw)
This is the first of two patches which attempt to address the
technical concerns raised by the previous round of VFAT patent
workaround patches.
This patch adds a new flag field 'FAT_NO_83NAME' for FAT files. When
this flag is set on an 8.3 FAT entry, both the MSDOS and VFAT
filesystems will skip the entry. For MSDOS this makes the file
inaccessible. For VFAT it makes the file only accessible by the long
filename.
The justification for this patch is to provide a clean way to
distinguish files created on VFAT filesystems with long filenames but
without a 8.3 short name. It uses a unused bit in the FAT directory
entry to store the FAT_NO_83NAME flag.
This patch, combined with the following VFAT_FS_NO_DUALNAMES patch,
address the following technical issues found with the last series of
patches:
- Fixed problems with Win98, although some cosmetic issues remain
- Fixed problems with all tested MP3 players and similar devices
- Lowers the probability of a WinXP bluescreen by a factor of about 80x
- Fixed problems with mtools, although some cosmetic issues remain
that require a small mtools patch to fix
More details and testing tools are available at
http://kernel.org/pub/linux/kernel/people/tridge/VFAT/
Signed-off-by: Andrew Tridgell <tridge@samba.org>
---
fs/fat/dir.c | 14 ++++++++++++++
include/linux/msdos_fs.h | 1 +
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 38ff75a..902e84c 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -385,6 +385,13 @@ parse_record:
goto end_of_dir;
}
+ /*
+ * The FAT_NO_83NAME flag is used to mark files
+ * created with no 8.3 short name
+ */
+ if (de->lcase & FAT_NO_83NAME)
+ goto compare_longname;
+
memcpy(work, de->name, sizeof(de->name));
/* see namei.c, msdos_format_name */
if (work[0] == 0x05)
@@ -429,6 +436,7 @@ parse_record:
if (fat_name_match(sbi, name, name_len, bufname, len))
goto found;
+compare_longname:
if (nr_slots) {
void *longname = unicode + FAT_MAX_UNI_CHARS;
int size = PATH_MAX - FAT_MAX_UNI_SIZE;
@@ -530,6 +538,8 @@ parse_record:
if (de->attr != ATTR_EXT && IS_FREE(de->name))
goto record_end;
} else {
+ if (de->lcase & FAT_NO_83NAME)
+ goto record_end;
if ((de->attr & ATTR_VOLUME) || IS_FREE(de->name))
goto record_end;
}
@@ -935,6 +945,10 @@ int fat_scan(struct inode *dir, const unsigned char *name,
sinfo->bh = NULL;
while (fat_get_short_entry(dir, &sinfo->slot_off, &sinfo->bh,
&sinfo->de) >= 0) {
+ /* skip files marked as having no 8.3 short name */
+ if (sinfo->de->lcase & FAT_NO_83NAME)
+ continue;
+
if (!strncmp(sinfo->de->name, name, MSDOS_NAME)) {
sinfo->slot_off -= sizeof(*sinfo->de);
sinfo->nr_slots = 1;
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index ce38f1c..639e6a4 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -43,6 +43,7 @@
#define CASE_LOWER_BASE 8 /* base is lower case */
#define CASE_LOWER_EXT 16 /* extension is lower case */
+#define FAT_NO_83NAME 32 /* no 8.3 short filename for this file */
#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
--
1.6.0.4
next reply other threads:[~2009-07-21 3:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 2:49 tridge [this message]
2009-07-21 3:03 ` [PATCH 2/2] FAT: Add CONFIG_VFAT_FS_NO_DUALNAMES option tridge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19045.11460.815706.98797@samba.org \
--to=tridge@samba.org \
--cc=cmm@us.ibm.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=john.lanza@linux.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=sfrench@us.ibm.com \
--cc=shaggy@linux.vnet.ibm.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox