linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* vfat on bigendian
@ 2001-10-11 14:36 Stefan Wanner
  2001-10-11 14:42 ` Olaf Hering
  2001-10-11 15:12 ` Derrik Pates
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Wanner @ 2001-10-11 14:36 UTC (permalink / raw)
  To: linuxppc-dev, dpates


hi

i tried the patch you posted today:
http://lists.linuxppc.org/linuxppc-dev/200110/msg00075.html

now, i can read files with long names created on windows. but it's no
more possible to create files on the linux system (also 8.3 names). they
apear on linux as ????.

any idea?

stefan


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: vfat on bigendian
  2001-10-11 14:36 vfat on bigendian Stefan Wanner
@ 2001-10-11 14:42 ` Olaf Hering
  2001-10-11 15:05   ` Stefan Wanner
  2001-10-11 15:39   ` Derrik Pates
  2001-10-11 15:12 ` Derrik Pates
  1 sibling, 2 replies; 5+ messages in thread
From: Olaf Hering @ 2001-10-11 14:42 UTC (permalink / raw)
  To: Stefan Wanner; +Cc: linuxppc-dev, dpates


On Thu, Oct 11, Stefan Wanner wrote:

>
> hi
>
> i tried the patch you posted today:
> http://lists.linuxppc.org/linuxppc-dev/200110/msg00075.html
>
> now, i can read files with long names created on windows. but it's no
> more possible to create files on the linux system (also 8.3 names). they
> apear on linux as ????.
>
> any idea?

Alan has the patch.
/mirror/SuSE/ftp.suse.com/pub/suse/ppc/kernel/BETA/patches/70__2.4.5-pre1_vfat_direntry_endianfix.diff.gz



Gruss Olaf

--
 $ man clone

BUGS
       Main feature not yet implemented...

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: vfat on bigendian
  2001-10-11 14:42 ` Olaf Hering
@ 2001-10-11 15:05   ` Stefan Wanner
  2001-10-11 15:39   ` Derrik Pates
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Wanner @ 2001-10-11 15:05 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev


thanks a lot!!!

now it works fine.

stefan


Olaf Hering wrote:

> On Thu, Oct 11, Stefan Wanner wrote:
>
>
>>hi
>>
>>i tried the patch you posted today:
>>http://lists.linuxppc.org/linuxppc-dev/200110/msg00075.html
>>
>>now, i can read files with long names created on windows. but it's no
>>more possible to create files on the linux system (also 8.3 names). they
>>apear on linux as ????.
>>
>>any idea?
>>
>
> Alan has the patch.
> /mirror/SuSE/ftp.suse.com/pub/suse/ppc/kernel/BETA/patches/70__2.4.5-pre1_vfat_direntry_endianfix.diff.gz
>
>
>
> Gruss Olaf
>
> --
>  $ man clone
>
> BUGS
>        Main feature not yet implemented...
>
>
>
>


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: vfat on bigendian
  2001-10-11 14:36 vfat on bigendian Stefan Wanner
  2001-10-11 14:42 ` Olaf Hering
@ 2001-10-11 15:12 ` Derrik Pates
  1 sibling, 0 replies; 5+ messages in thread
From: Derrik Pates @ 2001-10-11 15:12 UTC (permalink / raw)
  To: Stefan Wanner; +Cc: linuxppc-dev


On Thu, 11 Oct 2001, Stefan Wanner wrote:

> i tried the patch you posted today:
> http://lists.linuxppc.org/linuxppc-dev/200110/msg00075.html
>
> now, i can read files with long names created on windows. but it's no
> more possible to create files on the linux system (also 8.3 names). they
> apear on linux as ????.

*self-baps* Doh. I see where I need to add another translation, and I'm
doing so now.

/me == idiot...

Derrik Pates      |   Sysadmin, Douglas School   |    #linuxOS on EFnet
dpates@dsdk12.net |     District (dsdk12.net)    |    #linuxOS on OPN


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: vfat on bigendian
  2001-10-11 14:42 ` Olaf Hering
  2001-10-11 15:05   ` Stefan Wanner
@ 2001-10-11 15:39   ` Derrik Pates
  1 sibling, 0 replies; 5+ messages in thread
From: Derrik Pates @ 2001-10-11 15:39 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Stefan Wanner, linuxppc-dev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 738 bytes --]

On Thu, 11 Oct 2001, Olaf Hering wrote:

> Alan has the patch.
> /mirror/SuSE/ftp.suse.com/pub/suse/ppc/kernel/BETA/patches/70__2.4.5-pre1_vfat_direntry_endianfix.diff.gz

Yeah, except it looks like that patch will generate trashed short names. I
did fix my patch (I had to add stuff in fs/vfat/namei.c to translate the
long name in Unicode for into little-endian, and to allow "proper"
comparisons and conversions of its wide-char form so that the short name
will be generated correctly. The corrected patch is attached.

/me procceds to put a paper bag over his head and sit in the corner. :)

Derrik Pates      |   Sysadmin, Douglas School   |    #linuxOS on EFnet
dpates@dsdk12.net |     District (dsdk12.net)    |    #linuxOS on OPN

[-- Attachment #2: Type: TEXT/plain, Size: 2740 bytes --]

--- origs/linux-2.4-benh.dist/fs/fat/dir.c	Wed Oct 10 07:11:32 2001
+++ linux/fs/fat/dir.c	Wed Oct 10 21:07:04 2001
@@ -232,6 +232,10 @@
 				memcpy(&unicode[offset], ds->name0_4, 10);
 				memcpy(&unicode[offset+10], ds->name5_10, 12);
 				memcpy(&unicode[offset+22], ds->name11_12, 4);
+
+				for(i = offset; i < offset + 26; i += 2)
+					__le16_to_cpus((wchar_t *)&unicode[i]);
+
 				offset += 26;
 
 				if (ds->id & 0x40) {
@@ -430,6 +435,10 @@
 			memcpy(&unicode[offset], ds->name0_4, 10);
 			memcpy(&unicode[offset+10], ds->name5_10, 12);
 			memcpy(&unicode[offset+22], ds->name11_12, 4);
+
+			for(i = offset; i < offset + 26; i += 2)
+				__le16_to_cpus((wchar_t *)&unicode[i]);
+
 			offset += 26;
 
 			if (ds->id & 0x40) {
--- origs/linux-2.4-benh.dist/fs/vfat/namei.c	Wed Oct 10 07:11:32 2001
+++ linux/fs/vfat/namei.c	Thu Oct 11 09:29:29 2001
@@ -519,7 +519,8 @@
 	/*  `['     `]'    `;'     `,'     `+'      `=' */
 	0x005B, 0x005D, 0x003B, 0x002C, 0x002B, 0x003D, 0,
 };
-#define IS_REPLACECHAR(uni)	(vfat_unistrchr(replace_chars, (uni)) != NULL)
+#define IS_REPLACECHAR(uni)	(vfat_unistrchr(replace_chars, \
+					__cpu_to_le16(uni)) != NULL)
 
 static inline wchar_t *vfat_unistrchr(const wchar_t *s, const wchar_t c)
 {
@@ -587,7 +588,8 @@
 	0x002E, 0x0020, 0,
 };
 #define IS_SKIPCHAR(uni) \
-	((wchar_t)(uni) == skip_chars[0] || (wchar_t)(uni) == skip_chars[1])
+	(__cpu_to_le16((wchar_t)(uni)) == skip_chars[0] || \
+	 __cpu_to_le16((wchar_t)(uni)) == skip_chars[1])
 
 /* Given a valid longname, create a unique shortname.  Make sure the
  * shortname does not exist
@@ -627,7 +629,7 @@
 	/* Now, we need to create a shortname from the long name */
 	ext_start = end = &uname[ulen];
 	while (--ext_start >= uname) {
-		if (*ext_start == 0x002E) { /* is `.' */
+		if (*ext_start == __cpu_to_le16(0x002E)) { /* is `.' */
 			if (ext_start == end - 1) {
 				sz = ulen;
 				ext_start = NULL;
@@ -673,7 +675,8 @@
 			charbuf[0] = '_';
 			chl = 1;
 		} else {
-			chl = nls->uni2char(*ip, charbuf, sizeof(charbuf));
+			chl = nls->uni2char(__cpu_to_le16(*ip), charbuf,
+					sizeof(charbuf));
 			if (chl <= 0) {
 				is_shortname = 0;
 				charbuf[0]  = '_';
@@ -720,7 +723,8 @@
 				charbuf[0] = '_';
 				chl = 1;
 			} else {
-				chl = nls->uni2char(*ip, charbuf, sizeof(charbuf));
+				chl = nls->uni2char(__cpu_to_le16(*ip), charbuf,
+						sizeof(charbuf));
 				if (chl <= 0) {
 					is_shortname = 0;
 					charbuf[0] = '_';
@@ -883,6 +887,9 @@
 	}
 	if (*outlen > 260)
 		return -ENAMETOOLONG;
+
+	for(i = 0; i < *outlen; i++)
+		__cpu_to_le16s(&((wchar_t *)outname)[i]);
 
 	*longlen = *outlen;
 	if (*outlen % 13) {

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-10-11 15:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-11 14:36 vfat on bigendian Stefan Wanner
2001-10-11 14:42 ` Olaf Hering
2001-10-11 15:05   ` Stefan Wanner
2001-10-11 15:39   ` Derrik Pates
2001-10-11 15:12 ` Derrik Pates

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).