isofs patch for 8.3 UPPERCASE filenames

*Vic* P. Franck (vic@kcs.de)
Wed, 11 Feb 1998 12:38:06 +0100


This is a multi-part message in MIME format.

--------------75C3D56042F58AFE716E30E1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

REASON FOR PATCH:
Among some shell scripts from other unices, some applicattions on
M$-platforms rely on CD filenames all upper case 8.3 without
revision number, i.e. ";1" (as opposed to map=off). This patch is
essential for operating linux boxes as CD-Servers for those.

USAGE EXAMPLE:

mount /dev/scd0 /cdrom -o map=dos

All CD filenames on that CD will look like "FILENAME.EXT"
(upper case without extensions)

SIDE EFFECTS:
Anything else should behave like it did before.

I would like to see something like this included in 2.2.0
Please somebody test it and report bugs to vic@kcs.de

--Peter
p.s. who will update the mount manpage? -> drop me a private mail

--------------75C3D56042F58AFE716E30E1
Content-Type: text/plain; charset=us-ascii; name="isofs-upper8.3-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="isofs-upper8.3-patch"

diff -u /usr/src/linux-2.0.32/fs/isofs.org/dir.c /usr/src/linux-2.0.32/fs/isofs/dir.c
--- /usr/src/linux-2.0.32/fs/isofs.org/dir.c Tue Jul 23 09:26:40 1996
+++ /usr/src/linux-2.0.32/fs/isofs/dir.c Sun Feb 1 05:18:25 1998
@@ -7,6 +7,8 @@
*
* Steve Beynon : Missing last directory entries fixed
* (stephen@askone.demon.co.uk) : 21st June 1996
+ *
+ * 1998 Peter Franck (vic@ccc.de) - added "map=dos" mount option (8.3 uppercase)
*
* isofs directory handling functions
*/
@@ -76,7 +78,7 @@
return isofs_lookup_grandparent(inode, find_rock_ridge_relocation(de, inode));
}

-static int isofs_name_translate(char * old, int len, char * new)
+static int isofs_name_translate(char * old, int len, char * new, int dos_trn)
{
int i, c;

@@ -84,7 +86,7 @@
c = old[i];
if (!c)
break;
- if (c >= 'A' && c <= 'Z')
+ if (c >= 'A' && c <= 'Z' && !dos_trn)
c |= 0x20; /* lower case */

/* Drop trailing '.;1' (ISO9660:1988 7.5.1 requires period) */
@@ -263,8 +265,8 @@
continue;
}

- if (inode->i_sb->u.isofs_sb.s_mapping == 'n') {
- len = isofs_name_translate(name, len, tmpname);
+ if (inode->i_sb->u.isofs_sb.s_mapping != 'o') {
+ len = isofs_name_translate(name, len, tmpname, inode->i_sb->u.isofs_sb.s_mapping == 'd');
if (filldir(dirent, tmpname, len, filp->f_pos, inode_number) < 0)
break;
dcache_add(inode, tmpname, len, inode_number);
diff -u /usr/src/linux-2.0.32/fs/isofs.org/inode.c /usr/src/linux-2.0.32/fs/isofs/inode.c
--- /usr/src/linux-2.0.32/fs/isofs.org/inode.c Fri Aug 15 20:11:45 1997
+++ /usr/src/linux-2.0.32/fs/isofs/inode.c Sun Feb 1 05:02:22 1998
@@ -5,6 +5,7 @@
* 1992, 1993, 1994 Eric Youngdale Modified for ISO9660 filesystem.
* 1994 Eberhard Moenkeberg - multi session handling.
* 1995 Mark Dobie - allow mounting of some weird VideoCDs and PhotoCDs.
+ * 1998 Peter Franck (vic@ccc.de) - added "map=dos" mount option (8.3 uppercase)
*
*/

@@ -105,10 +106,11 @@
if ((value = strchr(this_char,'=')) != NULL)
*value++ = 0;
if (!strcmp(this_char,"map") && value) {
- if (value[0] && !value[1] && strchr("on",*value))
+ if (value[0] && !value[1] && strchr("ond",*value))
popt->map = *value;
else if (!strcmp(value,"off")) popt->map = 'o';
else if (!strcmp(value,"normal")) popt->map = 'n';
+ else if (!strcmp(value,"dos")) popt->map = 'd';
else return 0;
}
else if (!strcmp(this_char,"check") && value) {
diff -u /usr/src/linux-2.0.32/fs/isofs.org/namei.c /usr/src/linux-2.0.32/fs/isofs/namei.c
--- /usr/src/linux-2.0.32/fs/isofs.org/namei.c Tue Aug 12 23:06:35 1997
+++ /usr/src/linux-2.0.32/fs/isofs/namei.c Sun Feb 1 05:00:58 1998
@@ -4,6 +4,7 @@
* (C) 1992 Eric Youngdale Modified for ISO9660 filesystem.
*
* (C) 1991 Linus Torvalds - minix filesystem
+ * 1998 Peter Franck (vic@ccc.de) - added "map=dos" mount option (8.3 uppercase)
*/

#include <linux/sched.h>
@@ -63,7 +64,7 @@
{
unsigned long bufsize = ISOFS_BUFFER_SIZE(dir);
unsigned char bufbits = ISOFS_BUFFER_BITS(dir);
- unsigned int block, i, f_pos, offset, inode_number;
+ unsigned int block, i, f_pos, offset, inode_number, dos_case;
struct buffer_head * bh;
void * cpnt = NULL;
unsigned int old_offset;
@@ -157,10 +158,11 @@
if (rrflag) {
if (rrflag == -1) goto out; /* Relocated deep directory */
} else {
- if(dir->i_sb->u.isofs_sb.s_mapping == 'n') {
+ if(dir->i_sb->u.isofs_sb.s_mapping != 'o') {
+ dos_case = (dir->i_sb->u.isofs_sb.s_mapping == 'd');
for (i = 0; i < dlen; i++) {
c = dpnt[i];
- if (c >= 'A' && c <= 'Z') c |= 0x20; /* lower case */
+ if (c >= 'A' && c <= 'Z' && !dos_case) c |= 0x20; /* lower case */
if (c == ';' && i == dlen-2 && dpnt[i+1] == '1') {
dlen -= 2;
break;

--------------75C3D56042F58AFE716E30E1--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu