linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: "Albert D. Cahalan" <acahalan@cs.uml.edu>
Cc: msmith@operamail.com (Malcolm Smith),
	linux-kernel@vger.kernel.org, chaffee@cs.berkeley.edu
Subject: Re: [RFC] FAT extension filters
Date: Thu, 16 May 2002 22:46:41 +0900	[thread overview]
Message-ID: <871yccgq7y.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <200205151749.g4FHnkt183716@saturn.cs.uml.edu>

"Albert D. Cahalan" <acahalan@cs.uml.edu> writes:

> Using plain old MS-DOS, or Linux right before the
> vfat code was merged, create a file with this name:
> 
> E5 44 05 44 E5 44 44 44   44 E5 05
> 
> On disk it gets stored as this:
> 
> 05 44 05 44 E5 44 44 44   44 E5 05
> ^^
> 
> Now remount or reboot so you don't cheat by
> accident. Do an "ls -l" and note that you
> see the original filename. The 0xE5 is at
> the beginning of the name, and the 0x05 in
> the middle has not been mangled.

Ah, yes. Indeed.

I'll submit the following patch to Linus. Thanks.

diff -urN linux-bk/fs/fat/dir.c linux-2.5.14/fs/fat/dir.c
--- linux-bk/fs/fat/dir.c	Mon May 13 02:28:29 2002
+++ linux-2.5.14/fs/fat/dir.c	Thu May 16 22:39:32 2002
@@ -271,13 +271,10 @@
 				long_slots = 0;
 		}
 
-		for (i = 0; i < 8; i++) {
-			/* see namei.c, msdos_format_name */
-			if (de->name[i] == 0x05)
-				work[i] = 0xE5;
-			else
-				work[i] = de->name[i];
-		}
+		/* see namei.c, msdos_format_name */
+		memcpy(work, de->name, sizeof(de->name));
+		if (de->name[0] == 0x05)
+			work[0] = 0xE5;
 		for (i = 0, j = 0, last_u = 0; i < 8;) {
 			if (!work[i]) break;
 			chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
@@ -478,13 +475,10 @@
 		dotoffset = 1;
 	}
 
-	for (i = 0; i < 8; i++) {
-		/* see namei.c, msdos_format_name */
-		if (de->name[i] == 0x05)
-			work[i] = 0xE5;
-		else
-			work[i] = de->name[i];
-	}
+	/* see namei.c, msdos_format_name */
+	memcpy(work, de->name, sizeof(de->name));
+	if (de->name[0] == 0x05)
+		work[0] = 0xE5;
 	for (i = 0, j = 0, last = 0, last_u = 0; i < 8;) {
 		if (!(c = work[i])) break;
 		chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  parent reply	other threads:[~2002-05-16 13:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-15  2:38 [RFC] FAT extension filters Malcolm Smith
2002-05-15  3:18 ` Albert D. Cahalan
2002-05-15 12:39   ` OGAWA Hirofumi
2002-05-15 17:49     ` Albert D. Cahalan
2002-05-15 18:05       ` Mark Mielke
2002-05-15 18:42         ` Albert D. Cahalan
2002-05-16 13:46       ` OGAWA Hirofumi [this message]
2002-05-15 12:49   ` Xavier Bestel

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=871yccgq7y.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=acahalan@cs.uml.edu \
    --cc=chaffee@cs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msmith@operamail.com \
    /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;
as well as URLs for NNTP newsgroup(s).