summaryrefslogtreecommitdiffstats
path: root/fs/isofs/dir.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
commitc7fc24dc4420057f103afe8fc64524ebc25c5d37 (patch)
tree3682407a599b8f9f03fc096298134cafba1c9b2f /fs/isofs/dir.c
parent1d793fade8b063fde3cf275bf1a5c2d381292cd9 (diff)
o Merge with Linux 2.1.116.
o New Newport console code. o New G364 console code.
Diffstat (limited to 'fs/isofs/dir.c')
-rw-r--r--fs/isofs/dir.c50
1 files changed, 39 insertions, 11 deletions
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index bddbe4ba6..524624572 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -1,7 +1,7 @@
/*
* linux/fs/isofs/dir.c
*
- * (C) 1992, 1993, 1994 Eric Youngdale Modified for ISO9660 filesystem.
+ * (C) 1992, 1993, 1994 Eric Youngdale Modified for ISO 9660 filesystem.
*
* (C) 1991 Linus Torvalds - minix filesystem
*
@@ -74,7 +74,7 @@ static int isofs_name_translate(char * old, int len, char * new)
if (c >= 'A' && c <= 'Z')
c |= 0x20; /* lower case */
- /* Drop trailing '.;1' (ISO9660:1988 7.5.1 requires period) */
+ /* Drop trailing '.;1' (ISO 9660:1988 7.5.1 requires period) */
if (c == '.' && i == len - 3 && old[i + 1] == ';' && old[i + 2] == '1')
break;
@@ -91,6 +91,32 @@ static int isofs_name_translate(char * old, int len, char * new)
return i;
}
+/* Acorn extensions written by Matthew Wilcox <willy@bofh.ai> 1998 */
+int get_acorn_filename(struct iso_directory_record * de,
+ char * retname, struct inode * inode)
+{
+ int std;
+ unsigned char * chr;
+ int retnamlen = isofs_name_translate(de->name,
+ de->name_len[0], retname);
+ if (retnamlen == 0) return 0;
+ std = sizeof(struct iso_directory_record) + de->name_len[0];
+ if (std & 1) std++;
+ if ((*((unsigned char *) de) - std) != 32) return retnamlen;
+ chr = ((unsigned char *) de) + std;
+ if (strncmp(chr, "ARCHIMEDES", 10)) return retnamlen;
+ if ((*retname == '_') && ((chr[19] & 1) == 1)) *retname = '!';
+ if (((de->flags[0] & 2) == 0) && (chr[13] == 0xff)
+ && ((chr[12] & 0xf0) == 0xf0))
+ {
+ retname[retnamlen] = ',';
+ sprintf(retname+retnamlen+1, "%3.3x",
+ ((chr[12] & 0xf) << 8) | chr[11]);
+ retnamlen += 4;
+ }
+ return retnamlen;
+}
+
/*
* This should _really_ be cleaned up some day..
*/
@@ -230,15 +256,17 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
p = tmpname;
} else
#endif
- {
- if (inode->i_sb->u.isofs_sb.s_mapping == 'n') {
- len = isofs_name_translate(de->name, de->name_len[0],
- tmpname);
- p = tmpname;
- } else {
- p = de->name;
- len = de->name_len[0];
- }
+ if (inode->i_sb->u.isofs_sb.s_mapping == 'a') {
+ len = get_acorn_filename(de, tmpname, inode);
+ p = tmpname;
+ } else
+ if (inode->i_sb->u.isofs_sb.s_mapping == 'n') {
+ len = isofs_name_translate(de->name,
+ de->name_len[0], tmpname);
+ p = tmpname;
+ } else {
+ p = de->name;
+ len = de->name_len[0];
}
}
if (len > 0) {