Date: Fri, 14 Nov 1997 22:40:04 -0800 (PST) From: Keith Jang <keith@keith.private> To: freebsd-bugs Subject: Re: kern/5038 Message-ID: <199711150640.WAA03769@hub.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR kern/5038; it has been noted by GNATS.
From: Keith Jang <keith@keith.private>
To: freebsd-gnats-submit@freebsd.org
Cc: Subject: Re: kern/5038
Date: Sat, 15 Nov 1997 14:32:48 +0800 (CST)
The following are three files with a patch for reading joliet.
/sys/isofs/cd9660/cd9660_joliet.h:
begin 644 cd9660_joliet.h.gz
M'XL("`E9;#0``V-D.38V,%]J;VQI970N:`!U4FUKVS`8_.Y?<3`86_'RNI:$
M?NIB=Z1X-#0A7\8HBOPX%E,L(\EMPMA_WR,EA<(2,+*MTYWN3NI?);C"#R6M
M<:;R>#!:D4>^]SUX@_GR<7IS,\`L@VM)JDI)X95IF-1/DGXDGRB=(X=EU[::
M=M1X80]8&]WM"!DY:57KC85P$`V$]F0;%GHAWB1H+*S:G67TL*H)"^%KK,1&
M$S[BR1B/3%F2C!_P1-+8,HB8"LMUAHWAQ:U1C0\)!$I55639$@JS9?\:W[21
MO^%KMK)89RE>:R7KH*!-L^4=ND9)4Q(JI:D1.\YER:F2>F=BEU2IAE=L#IYX
M5Z="/9B\F>'`]UIL78K)],MP-`@3N9.BC6*8GWH;1[X+K!,:<U?*.D[Q:K#K
M^&-#&.Q'U^R07]6I.M6XSG*/M7+@1[P9FV5'#09L>;1GJ>4@W(3C68*F%])I
MT!CLOP[2,([C>(V*SRK"&*88I>!Y9O(-"&>F#\<B_*$EC@_G;2<]_B2`K(5%
M%0(#^,FW)YL5^`1,4O['Y/.OV^1ON%3/#X_%/%\]WQ=WWV^3BTH4NWBO-)FR
M$O?XGU*^G-TM<M;Z<#R1]]@\&\;BSF.CV.8YK,C7>3&,[5R$1[&VB_`X]IDD
*_P"42;O1:`,``-;Z
`
end
/sys/isofs/cd9660/cd9660_joliet.c:
begin 644 cd9660_joliet.c.gz
M'XL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\.=7+^^9Q]Q:X"B?I**NGSU?&M"$0,J[,
M?\\_P7^03'O`6T]N$`3:6RZU0T'6_?%P6R<A#VH01RS+,@"Q;QWD=J#O08U@
MX'YO'9V%#LW=*M'1X1&[RP8_]'V'!S34AA:)7CC=AT;(_5&&)_X!ZD!VR;8!
"``!O
`
end
patch for /sys:
diff -c -r sys/conf/files sys.keith/conf/files
*** sys/conf/files Thu Nov 13 03:25:21 1997
--- sys.keith/conf/files Fri Nov 14 22:03:23 1997
***************
*** 61,66 ****
--- 61,67 ----
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
diff -c -r sys/conf/files.newconf sys.keith/conf/files.newconf
*** sys/conf/files.newconf Thu Nov 13 03:25:21 1997
--- sys.keith/conf/files.newconf Fri Nov 14 22:03:23 1997
***************
*** 39,44 ****
--- 39,45 ----
file isofs/cd9660/cd9660_util.c cd9660
file isofs/cd9660/cd9660_vfsops.c cd9660
file isofs/cd9660/cd9660_vnops.c cd9660
+ file isofs/cd9660/cd9660_joliet.c cd9660
file kern/init_main.c
file kern/init_sysent.c
file kern/kern_acct.c
Only in sys.keith/isofs/cd9660: cd9660_joliet.c
Only in sys.keith/isofs/cd9660: cd9660_joliet.h
diff -c -r sys/isofs/cd9660/cd9660_lookup.c sys.keith/isofs/cd9660/cd9660_lookup.c
*** sys/isofs/cd9660/cd9660_lookup.c Thu Nov 13 03:26:37 1997
--- sys.keith/isofs/cd9660/cd9660_lookup.c Fri Nov 14 22:03:43 1997
***************
*** 50,56 ****
--- 50,58 ----
#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,272 ****
--- 269,287 ----
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 -c -r sys/isofs/cd9660/cd9660_mount.h sys.keith/isofs/cd9660/cd9660_mount.h
*** sys/isofs/cd9660/cd9660_mount.h Thu Nov 13 03:26:37 1997
--- sys.keith/isofs/cd9660/cd9660_mount.h Fri Nov 14 22:03:43 1997
***************
*** 47,52 ****
int flags; /* mounting flags, see below */
int ssector; /* starting sector, 0 for 1st session */
};
! #define ISOFSMNT_NORRIP 0x00000001 /* disable Rock Ridge Ext.*/
! #define ISOFSMNT_GENS 0x00000002 /* enable generation numbers */
! #define ISOFSMNT_EXTATT 0x00000004 /* enable extended attributes */
--- 47,53 ----
int flags; /* mounting flags, see below */
int ssector; /* starting sector, 0 for 1st session */
};
! #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 -c -r sys/isofs/cd9660/cd9660_vfsops.c sys.keith/isofs/cd9660/cd9660_vfsops.c
*** sys/isofs/cd9660/cd9660_vfsops.c Thu Nov 13 03:26:37 1997
--- sys.keith/isofs/cd9660/cd9660_vfsops.c Fri Nov 14 22:03:43 1997
***************
*** 55,61 ****
--- 55,63 ----
#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>
***************
*** 261,267 ****
struct iso_args *argp;
{
register struct iso_mnt *isomp = (struct iso_mnt *)0;
! struct buf *bp = NULL;
dev_t dev = devvp->v_rdev;
int error = EINVAL;
int needclose = 0;
--- 263,269 ----
struct iso_args *argp;
{
register struct iso_mnt *isomp = (struct iso_mnt *)0;
! struct buf *bp = NULL, *joliet_bp = NULL;
dev_t dev = devvp->v_rdev;
int error = EINVAL;
int needclose = 0;
***************
*** 271,279 ****
--- 273,283 ----
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;
***************
*** 316,321 ****
--- 320,344 ----
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) {
***************
*** 328,340 ****
brelse(bp);
}
! if (isonum_711 (high_sierra? vdp->type_sierra: vdp->type) != ISO_VD_PRIMARY) {
error = EINVAL;
goto out;
}
- pri = (struct iso_primary_descriptor *)vdp;
pri_sierra = (struct iso_sierra_primary_descriptor *)vdp;
logical_block_size =
isonum_723 (high_sierra?
--- 351,363 ----
brelse(bp);
}
! 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;
}
pri_sierra = (struct iso_sierra_primary_descriptor *)vdp;
+ pri = (struct iso_primary_descriptor *)vdp;
logical_block_size =
isonum_723 (high_sierra?
***************
*** 350,356 ****
rootp = (struct iso_directory_record *)
(high_sierra?
pri_sierra->root_directory_record:
! pri->root_directory_record);
isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK);
bzero((caddr_t)isomp, sizeof *isomp);
--- 373,381 ----
rootp = (struct iso_directory_record *)
(high_sierra?
pri_sierra->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);
***************
*** 380,385 ****
--- 405,412 ----
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;
***************
*** 416,439 ****
brelse(bp);
bp = NULL;
}
! isomp->im_flags = argp->flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS|ISOFSMNT_EXTATT);
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)) {
default:
isomp->iso_ftype = ISO_FTYPE_DEFAULT;
break;
! case ISOFSMNT_GENS|ISOFSMNT_NORRIP:
isomp->iso_ftype = ISO_FTYPE_9660;
break;
! case 0:
isomp->iso_ftype = ISO_FTYPE_RRIP;
break;
}
-
return 0;
out:
if (bp)
--- 443,469 ----
brelse(bp);
bp = NULL;
}
! 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|
! ISOFSMNT_NOJOLIET)) {
default:
isomp->iso_ftype = ISO_FTYPE_DEFAULT;
break;
! 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;
}
return 0;
out:
if (bp)
***************
*** 507,513 ****
struct iso_directory_record *dp =
(struct iso_directory_record *)imp->root;
ino_t ino = isodirino(dp, imp);
!
/*
* With RRIP we must use the `.' entry of the root directory.
* Simply tell vget, that it's a relocated directory.
--- 537,543 ----
struct iso_directory_record *dp =
(struct iso_directory_record *)imp->root;
ino_t ino = isodirino(dp, imp);
!
/*
* With RRIP we must use the `.' entry of the root directory.
* Simply tell vget, that it's a relocated directory.
diff -c -r sys/isofs/cd9660/cd9660_vnops.c sys.keith/isofs/cd9660/cd9660_vnops.c
*** sys/isofs/cd9660/cd9660_vnops.c Thu Nov 13 03:26:37 1997
--- sys.keith/isofs/cd9660/cd9660_vnops.c Fri Nov 14 22:03:43 1997
***************
*** 56,61 ****
--- 56,62 ----
#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 *));
***************
*** 540,545 ****
--- 541,552 ----
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 -c -r sys/isofs/cd9660/iso.h sys.keith/isofs/cd9660/iso.h
*** sys/isofs/cd9660/iso.h Thu Nov 13 03:26:37 1997
--- sys.keith/isofs/cd9660/iso.h Fri Nov 14 22:03:43 1997
***************
*** 54,59 ****
--- 54,60 ----
/* volume descriptor types */
#define ISO_VD_PRIMARY 1
+ #define ISO_VD_SUPPLEMENTARY 2
#define ISO_VD_END 255
#define ISO_STANDARD_ID "CD001"
***************
*** 98,103 ****
--- 99,145 ----
};
#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,181 ****
/* CD-ROM Format type */
enum ISO_FTYPE { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP,
! ISO_FTYPE_ECMA, ISO_FTYPE_HIGH_SIERRA };
#ifndef ISOFSMNT_ROOT
#define ISOFSMNT_ROOT 0
--- 217,223 ----
/* CD-ROM Format type */
enum ISO_FTYPE { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP,
! ISO_FTYPE_JOLIET, ISO_FTYPE_ECMA, ISO_FTYPE_HIGH_SIERRA };
#ifndef ISOFSMNT_ROOT
#define ISOFSMNT_ROOT 0
Only in sys.keith/isofs/cd9660: iso_joliet.h
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711150640.WAA03769>
