Date: Mon, 19 Apr 1999 00:23:23 +0900 From: "Ueda, Kazukiyo" <kueda@jupiter.qse.tohoku.ac.jp> To: jack@rabbit.eng.miami.edu Cc: FreeBSD Questions <freebsd-questions@FreeBSD.ORG> Subject: Re: long filenames Message-ID: <19990419002323U.kueda@jupiter.qse.tohoku.ac.jp> In-Reply-To: Your message of "Sun, 18 Apr 1999 00:31:51 -0400 (EDT)" <Pine.BSF.4.10.9904180030520.335-100000@rabbit.eng.miami.edu> References: <Pine.BSF.4.10.9904180030520.335-100000@rabbit.eng.miami.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi,
Which version of FreeBSD is running on your computer? If it's
3.1.0-RELEASE or -STABLE, you can use a patch file attached to this
mail. The file is which I made after I patched [PR 5038] manually to
the kernel sources. you just type in:
# cd /usr/src
# patch -p < a-patch-file
and then re-build the kernel. Before actually doing the patch, you
can see how patch command works by:
# patch -p --check < a-patch-file
I hope this would be easy job for you :)
--
Kazukiyo Ueda
From: Jack Freelander <jack@rabbit.eng.miami.edu>
Subject: Re: long filenames
Date: Sun, 18 Apr 1999 00:31:51 -0400 (EDT)
> > It's for 3.0-CURRENT, so I patched it to 3.1.0-RELEASE by hand, and
> > have been working good.
> >
> > Good luck.
>
> wow! I took a look a that web page... It sounds like this is gonna be a lot
> more complicated than I had hoped... any hints or suggestions?
>
> thanks!
>
> -jack
>
[-- Attachment #2 --]
diff -Nru sys/conf/files sys.joliet/conf/files
--- sys/conf/files Sat Apr 17 01:30:19 1999
+++ sys.joliet/conf/files Mon Mar 22 22:48:50 1999
@@ -90,6 +90,7 @@
dev/aic7xxx/aic7xxx.c optional ahc device-driver \
dependency "aic7xxx_{reg,seq}.h"
dev/aic7xxx/93cx6.c optional ahc device-driver
+dev/aic6x60/aic.c optional aic device-driver
dev/buslogic/bt.c optional bt device-driver
dev/ccd/ccd.c optional ccd device-driver
dev/isp/isp_freebsd.c optional isp device-driver
@@ -255,6 +256,7 @@
isofs/cd9660/cd9660_util.c optional cd9660
isofs/cd9660/cd9660_vfsops.c optional cd9660
isofs/cd9660/cd9660_vnops.c optional cd9660
+isofs/cd9660/cd9660_joliet.c optional cd9660
kern/imgact_aout.c standard
kern/imgact_elf.c standard
kern/imgact_gzip.c optional gzip
@@ -685,6 +687,8 @@
# be the inverse of the wanted one (MAKE_SET)
dev/usb/ugen.c optional ugen device-driver
dev/usb/uhid.c optional hid device-driver
+dev/usb/umodem.c optional umodem device-driver
+dev/usb/ucom.c optional ucom device-driver
dev/usb/ums.c optional ums device-driver
dev/usb/ulpt.c optional ulpt device-driver
dev/usb/ukbd.c optional ukbd device-driver
diff -Nru sys/isofs/cd9660/cd9660_joliet.c sys.joliet/isofs/cd9660/cd9660_joliet.c
--- sys/isofs/cd9660/cd9660_joliet.c Thu Jan 1 09:00:00 1970
+++ sys.joliet/isofs/cd9660/cd9660_joliet.c Mon Mar 22 22:49:43 1999
@@ -0,0 +1,56 @@
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/vnode.h>
+#include <sys/mount.h>
+#include <sys/kernel.h>
+
+#include <isofs/cd9660/iso.h>
+#include <isofs/cd9660/cd9660_node.h>
+#include <isofs/cd9660/cd9660_joliet.h>
+#include <isofs/cd9660/iso_joliet.h>
+
+int cd9660_joliet_getname(struct iso_directory_record *isodir,
+ char *outbuf, u_short *outlen)
+{
+ u_short
+ name_idx = 0,
+ max_name_len = (isonum_711)(isodir->name_len);
+
+ *outlen = 0;
+
+ strcpy(outbuf, "..");
+
+ if ((*isodir->name == 0) && (isonum_711((u_char *)isodir->name_len) == 1))
+ *outlen = 1;
+ else if ((*isodir->name == 1) && (isonum_711((u_char *)(isodir->name_len)) == 1))
+ *outlen = 2;
+ else
+ /* For now just ignore null characters */
+ for (name_idx = 0; name_idx < max_name_len; name_idx++) {
+ if ((isodir->name)[name_idx] == 0)
+ continue;
+ else if ((isodir->name)[name_idx] == ';')
+ break;
+ else {
+ outbuf[*outlen] = (isodir->name)[name_idx];
+ (*outlen)++;
+ }
+ }
+
+ return *outlen;
+}
+
+int cd9660_joliet_level(struct iso_supplementary_descriptor *svd)
+{
+ if (((svd->escape)[0] == ISO_JOLIET_ID1) &&
+ ((svd->escape)[1] == ISO_JOLIET_ID2)) {
+ switch ((svd->escape)[2]) {
+ case ISO_JOLIET_LEVEL1: return 1; break;
+ case ISO_JOLIET_LEVEL2: return 2; break;
+ case ISO_JOLIET_LEVEL3: return 3; break;
+ default: return -1; break;
+ }
+ } else
+ return -1;
+}
diff -Nru sys/isofs/cd9660/cd9660_joliet.h sys.joliet/isofs/cd9660/cd9660_joliet.h
--- sys/isofs/cd9660/cd9660_joliet.h Thu Jan 1 09:00:00 1970
+++ sys.joliet/isofs/cd9660/cd9660_joliet.h Mon Mar 22 22:50:11 1999
@@ -0,0 +1,31 @@
+/*
+ * Microsoft Joliet Ext. to ISO9660 CD specification
+ */
+
+/*
+ * Joliet uses Supplementary Volume Descriptor as an alternative to
+ * Primary Volume Descriptor. The Path Table & Root Directory Record
+ * of SVD both point to a different Logical Block than PVD, which
+ * long & unicode filenames reside.
+ */
+
+/*
+ * Joliet defines byte position 8 of SVD as Flags, 89-120 as Escape.
+ * It uses 3 bytes of Escape. The first two must be 0x25 & 0x2f to
+ * insure this is a Joliet CD. The third byte represents the level,
+ * 0x40, 0x43, 0x45 for level 1, 2, 3, respectively.
+ */
+typedef struct {
+ char flags [ISODCL ( 8, 8)];
+} ISO_JOLIET_FLAG;
+
+typedef struct {
+ char escape [ISODCL ( 89, 120)];
+} ISO_JOLIET_ESCAPE;
+
+#define ISO_JOLIET_ID1 0x25
+#define ISO_JOLIET_ID2 0x2f
+#define ISO_JOLIET_LEVEL1 0x40
+#define ISO_JOLIET_LEVEL2 0x43
+#define ISO_JOLIET_LEVEL3 0x45
+
diff -Nru sys/isofs/cd9660/cd9660_lookup.c sys.joliet/isofs/cd9660/cd9660_lookup.c
--- sys/isofs/cd9660/cd9660_lookup.c Fri Nov 7 17:52:50 1997
+++ sys.joliet/isofs/cd9660/cd9660_lookup.c Mon Mar 22 22:51:29 1999
@@ -50,7 +50,9 @@
#include <isofs/cd9660/iso.h>
#include <isofs/cd9660/cd9660_node.h>
+#include <isofs/cd9660/cd9660_joliet.h>
#include <isofs/cd9660/iso_rrip.h>
+#include <isofs/cd9660/iso_joliet.h>
/*
* Convert a component of a pathname into a pointer to a locked inode.
@@ -267,6 +269,19 @@
goto found;
ino = 0;
break;
+ case ISO_FTYPE_JOLIET:
+ if (isonum_711(ep->flags)&2)
+ ino = isodirino(ep, imp);
+ else
+ ino = dbtob(bp->b_blkno) + entryoffsetinblock;
+
+ dp->i_ino = ino;
+ cd9660_joliet_getname(ep,altname,&namelen);
+ if (namelen == cnp->cn_namelen
+ && !bcmp(name, altname, namelen))
+ goto found;
+ ino = 0;
+ break;
}
dp->i_offset += reclen;
entryoffsetinblock += reclen;
diff -Nru sys/isofs/cd9660/cd9660_mount.h sys.joliet/isofs/cd9660/cd9660_mount.h
--- sys/isofs/cd9660/cd9660_mount.h Wed Apr 30 00:52:53 1997
+++ sys.joliet/isofs/cd9660/cd9660_mount.h Mon Mar 22 22:51:48 1999
@@ -50,3 +50,4 @@
#define ISOFSMNT_NORRIP 0x00000001 /* disable Rock Ridge Ext.*/
#define ISOFSMNT_GENS 0x00000002 /* enable generation numbers */
#define ISOFSMNT_EXTATT 0x00000004 /* enable extended attributes */
+#define ISOFSMNT_NOJOLIET 0x00000008 /* disable Microsoft Joliet Ext.*/
diff -Nru sys/isofs/cd9660/cd9660_vfsops.c sys.joliet/isofs/cd9660/cd9660_vfsops.c
--- sys/isofs/cd9660/cd9660_vfsops.c Mon Jan 18 05:41:02 1999
+++ sys.joliet/isofs/cd9660/cd9660_vfsops.c Mon Mar 22 22:57:59 1999
@@ -55,7 +55,9 @@
#include <sys/stat.h>
#include <isofs/cd9660/iso.h>
+#include <isofs/cd9660/iso_joliet.h>
#include <isofs/cd9660/iso_rrip.h>
+#include <isofs/cd9660/cd9660_joliet.h>
#include <isofs/cd9660/cd9660_node.h>
#include <isofs/cd9660/cd9660_mount.h>
@@ -281,7 +283,7 @@
struct iso_args *argp;
{
register struct iso_mnt *isomp = (struct iso_mnt *)0;
- struct buf *bp = NULL;
+ struct buf *bp = NULL, *joliet_bp = NULL;
dev_t dev = devvp->v_rdev;
int error = EINVAL;
int needclose = 0;
@@ -291,9 +293,11 @@
int iso_blknum;
struct iso_volume_descriptor *vdp = 0;
struct iso_primary_descriptor *pri;
+ struct iso_supplementary_descriptor *sup = NULL;
struct iso_sierra_primary_descriptor *pri_sierra;
struct iso_directory_record *rootp;
int logical_block_size;
+ int joliet_level = -1;
if (!ronly)
return EROFS;
@@ -336,8 +340,26 @@
goto out;
} else
high_sierra = 1;
+ } else {
+ /*
+ * We know it's ISO9660 fs, now get Supplementary Volume
+ * Descriptor to check if it's Microsoft Joliet format.
+ */
+ if (error = bread(devvp, (1 + iso_blknum) * btodb(iso_bsize),
+ iso_bsize, NOCRED, &joliet_bp))
+ goto out;
+
+ sup = (struct iso_supplementary_descriptor *)joliet_bp->b_data;
+ joliet_level = cd9660_joliet_level(sup);
+
+ if (joliet_level < 0) {
+ argp->flags |= ISOFSMNT_NOJOLIET;
+ } else {
+ argp->flags |= ISOFSMNT_NORRIP;
+ argp->flags &= ~ISOFSMNT_GENS;
+ }
+ break;
}
-
if (isonum_711 (high_sierra? vdp->type_sierra: vdp->type) == ISO_VD_END) {
error = EINVAL;
goto out;
@@ -348,7 +370,7 @@
brelse(bp);
}
- if (isonum_711 (high_sierra? vdp->type_sierra: vdp->type) != ISO_VD_PRIMARY) {
+ if ((isonum_711 (high_sierra? vdp->type_sierra: vdp->type) != ISO_VD_PRIMARY) && (isonum_711 (high_sierra? vdp->type_sierra: vdp->type) != ISO_VD_SUPPLEMENTARY)){
error = EINVAL;
goto out;
}
@@ -370,7 +392,8 @@
rootp = (struct iso_directory_record *)
(high_sierra?
pri_sierra->root_directory_record:
- pri->root_directory_record);
+ ((joliet_level < 0) ? pri->root_directory_record:
+ sup->root_directory_record));
isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK);
bzero((caddr_t)isomp, sizeof *isomp);
@@ -400,6 +423,8 @@
bp->b_flags |= B_AGE;
brelse(bp);
bp = NULL;
+ brelse(joliet_bp);
+ joliet_bp = NULL;
mp->mnt_data = (qaddr_t)isomp;
mp->mnt_stat.f_fsid.val[0] = (long)dev;
@@ -436,19 +461,26 @@
brelse(bp);
bp = NULL;
}
- isomp->im_flags = argp->flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS|ISOFSMNT_EXTATT);
+ isomp->im_flags = argp->flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS|ISOFSMNT_EXTATT|ISOFSMNT_NOJOLIET);
if(high_sierra)
/* this effectively ignores all the mount flags */
isomp->iso_ftype = ISO_FTYPE_HIGH_SIERRA;
else
- switch (isomp->im_flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS)) {
+ switch (isomp->im_flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS|
+ ISOFSMNT_NOJOLIET)) {
default:
isomp->iso_ftype = ISO_FTYPE_DEFAULT;
break;
- case ISOFSMNT_GENS|ISOFSMNT_NORRIP:
+ case ISOFSMNT_GENS|ISOFSMNT_NORRIP|ISOFSMNT_NOJOLIET:
isomp->iso_ftype = ISO_FTYPE_9660;
break;
+ case ISOFSMNT_NOJOLIET:
+ isomp->iso_ftype = ISO_FTYPE_RRIP;
+ break;
+ case ISOFSMNT_NORRIP:
+ isomp->iso_ftype = ISO_FTYPE_JOLIET;
+ break;
case 0:
isomp->iso_ftype = ISO_FTYPE_RRIP;
break;
diff -Nru sys/isofs/cd9660/cd9660_vnops.c sys.joliet/isofs/cd9660/cd9660_vnops.c
--- sys/isofs/cd9660/cd9660_vnops.c Sun Jul 5 05:45:30 1998
+++ sys.joliet/isofs/cd9660/cd9660_vnops.c Mon Mar 22 22:59:09 1999
@@ -60,6 +60,7 @@
#include <isofs/cd9660/iso.h>
#include <isofs/cd9660/cd9660_node.h>
#include <isofs/cd9660/iso_rrip.h>
+#include <isofs/cd9660/iso_joliet.h>
static int cd9660_setattr __P((struct vop_setattr_args *));
static int cd9660_access __P((struct vop_access_args *));
@@ -547,6 +548,12 @@
if (idp->current.d_namlen)
error = iso_uiodir(idp,&idp->current,idp->curroff);
break;
+ case ISO_FTYPE_JOLIET:
+ cd9660_joliet_getname(ep,idp->current.d_name, &namelen);
+ idp->current.d_namlen = (u_char)namelen;
+ if (idp->current.d_namlen)
+ error = iso_uiodir(idp,&idp->current,idp->curroff);
+ break;
default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 || ISO_FTYPE_HIGH_SIERRA*/
strcpy(idp->current.d_name,"..");
switch (ep->name[0]) {
diff -Nru sys/isofs/cd9660/iso.h sys.joliet/isofs/cd9660/iso.h
--- sys/isofs/cd9660/iso.h Wed May 7 22:23:04 1997
+++ sys.joliet/isofs/cd9660/iso.h Mon Mar 22 23:00:25 1999
@@ -54,6 +54,7 @@
/* volume descriptor types */
#define ISO_VD_PRIMARY 1
+#define ISO_VD_SUPPLEMENTARY 2
#define ISO_VD_END 255
#define ISO_STANDARD_ID "CD001"
@@ -98,6 +99,47 @@
};
#define ISO_DEFAULT_BLOCK_SIZE 2048
+/*
+ * Used by Microsoft Joliet extension to ISO9660. Almost the same
+ * as PVD, but byte position 8 is a flag, and 89-120 is for escape.
+ */
+
+struct iso_supplementary_descriptor {
+ char type [ISODCL ( 1, 1)]; /* 711 */
+ char id [ISODCL ( 2, 6)];
+ char version [ISODCL ( 7, 7)]; /* 711 */
+ char flags [ISODCL ( 8, 8)];
+ char system_id [ISODCL ( 9, 40)]; /* achars */
+ char volume_id [ISODCL ( 41, 72)]; /* dchars */
+ char unused2 [ISODCL ( 73, 80)];
+ char volume_space_size [ISODCL ( 81, 88)]; /* 733 */
+ char escape [ISODCL ( 89, 120)];
+ char volume_set_size [ISODCL (121, 124)]; /* 723 */
+ char volume_sequence_number [ISODCL (125, 128)]; /* 723 */
+ char logical_block_size [ISODCL (129, 132)]; /* 723 */
+ char path_table_size [ISODCL (133, 140)]; /* 733 */
+ char type_l_path_table [ISODCL (141, 144)]; /* 731 */
+ char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
+ char type_m_path_table [ISODCL (149, 152)]; /* 732 */
+ char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
+ char root_directory_record [ISODCL (157, 190)]; /* 9.1 */
+ char volume_set_id [ISODCL (191, 318)]; /* dchars */
+ char publisher_id [ISODCL (319, 446)]; /* achars */
+ char preparer_id [ISODCL (447, 574)]; /* achars */
+ char application_id [ISODCL (575, 702)]; /* achars */
+ char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
+ char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
+ char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
+ char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
+ char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
+ char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
+ char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
+ char file_structure_version [ISODCL (882, 882)]; /* 711 */
+ char unused4 [ISODCL (883, 883)];
+ char application_data [ISODCL (884, 1395)];
+ char unused5 [ISODCL (1396, 2048)];
+};
+
struct iso_sierra_primary_descriptor {
char unknown1 [ISODCL ( 1, 8)]; /* 733 */
char type [ISODCL ( 9, 9)]; /* 711 */
@@ -175,7 +217,7 @@
/* CD-ROM Format type */
enum ISO_FTYPE { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP,
- ISO_FTYPE_ECMA, ISO_FTYPE_HIGH_SIERRA };
+ ISO_FTYPE_JOLIET, ISO_FTYPE_ECMA, ISO_FTYPE_HIGH_SIERRA };
#ifndef ISOFSMNT_ROOT
#define ISOFSMNT_ROOT 0
diff -Nru sys/isofs/cd9660/iso_joliet.h sys.joliet/isofs/cd9660/iso_joliet.h
--- sys/isofs/cd9660/iso_joliet.h Thu Jan 1 09:00:00 1970
+++ sys.joliet/isofs/cd9660/iso_joliet.h Mon Mar 22 23:00:49 1999
@@ -0,0 +1,17 @@
+/*
+ * Microsoft Joliet Ext. to ISO9660 CD specification
+ */
+
+#define ISO_JOLIET_ID1 0x25
+#define ISO_JOLIET_ID2 0x2f
+#define ISO_JOLIET_LEVEL1 0x40
+#define ISO_JOLIET_LEVEL2 0x43
+#define ISO_JOLIET_LEVEL3 0x45
+
+#define ISO_JOLIET_FNMASK 0xffff
+
+#define ISO_JOLIET_DEBUG
+
+int cd9660_joliet_getname(struct iso_directory_record *isodir,
+ char *outbuf, u_short *outlen);
+int cd9660_joliet_level(struct iso_supplementary_descriptor *svd);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990419002323U.kueda>
