From owner-freebsd-hackers Sat Dec 24 13:58:48 1994 Return-Path: hackers-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id NAA02911 for hackers-outgoing; Sat, 24 Dec 1994 13:58:48 -0800 Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.cdrom.com (8.6.9/8.6.6) with SMTP id VAA02885 for ; Sat, 24 Dec 1994 21:58:37 GMT Received: from sax.sax.de by irz301.inf.tu-dresden.de with SMTP (5.67b+/DEC-Ultrix/4.3) id AA20973; Sat, 24 Dec 1994 22:59:15 +0100 Received: by sax.sax.de (8.6.9/8.6.9) with UUCP id XAA04782 for hackers%freebsd.org@sax.de; Sat, 24 Dec 1994 23:05:13 +0100 Received: by bonnie.tcd-dresden.de (8.6.8/8.6.6) id WAA19346; Sat, 24 Dec 1994 22:30:03 +0100 From: j@uriah.sax.de (J Wunsch) Message-Id: <199412242130.WAA19346@bonnie.tcd-dresden.de> Subject: High Sierra CD's To: hackers@freebsd.org (FreeBSD hackers) Date: Sat, 24 Dec 1994 22:30:03 +0100 (MET) X-Phone: +49-351-8141 137 Reply-To: joerg_wunsch@uriah.sax.de X-Mailer: ELM [version 2.4 PL23] Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Length: 14762 Sender: hackers-owner@freebsd.org Precedence: bulk Since it became the major point for a potential FreeBSD ``customer'' (he wants to set up a production CD-ROM server), i've quickly hacked the support for the old ``High Sierra'' CD-ROM format. From the commentary in the 2.0 sources i took that it's still not on the way there due to a lack of informations. I've got three CD's (from different sources), so my guessing should be okay. I've hacked this for 1.1.5.1, but the basic scenario should be identical to 2.0. I'm posting it here since i guess there might be other folks outside being bothered by the ``Invalid argument'' for some CD's. It works now for all the CDs i could lay my hands on. It's relative to the /sys/isofs directory of 1.1.5.1. I don't plan to maintain this (except for serious bugs), it's just posted here as an inspiration for the cd9660 maintainers. I could beta-test a 2.0 implementation though. *** iso.h.orig Sun Dec 19 01:51:02 1993 --- iso.h Sat Dec 24 08:34:13 1994 *************** *** 11,17 **** char type[ISODCL(1,1)]; /* 711 */ char id[ISODCL(2,6)]; char version[ISODCL(7,7)]; ! char data[ISODCL(8,2048)]; }; /* volume descriptor types */ --- 11,21 ---- char type[ISODCL(1,1)]; /* 711 */ char id[ISODCL(2,6)]; char version[ISODCL(7,7)]; ! char unused[ISODCL(8,8)]; ! char type_sierra[ISODCL(9,9)]; /* 711 */ ! char id_sierra[ISODCL(10,14)]; ! char version_sierra[ISODCL(15,15)]; ! char data[ISODCL(16,2048)]; }; /* volume descriptor types */ *************** *** 21,26 **** --- 25,32 ---- #define ISO_STANDARD_ID "CD001" #define ISO_ECMA_ID "CDW01" + #define ISO_SIERRA_ID "CDROM" + struct iso_primary_descriptor { char type [ISODCL ( 1, 1)]; /* 711 */ char id [ISODCL ( 2, 6)]; *************** *** 57,62 **** --- 63,105 ---- char unused5 [ISODCL (1396, 2048)]; }; + struct iso_sierra_primary_descriptor { + char unknown1 [ISODCL ( 1, 8)]; /* 733 */ + char type [ISODCL ( 9, 9)]; /* 711 */ + char id [ISODCL ( 10, 14)]; + char version [ISODCL ( 15, 15)]; /* 711 */ + char unused1 [ISODCL ( 16, 16)]; + char system_id [ISODCL ( 17, 48)]; /* achars */ + char volume_id [ISODCL ( 49, 80)]; /* dchars */ + char unused2 [ISODCL ( 81, 88)]; + char volume_space_size [ISODCL ( 89, 96)]; /* 733 */ + char unused3 [ISODCL ( 97, 128)]; + char volume_set_size [ISODCL (129, 132)]; /* 723 */ + char volume_sequence_number [ISODCL (133, 136)]; /* 723 */ + char logical_block_size [ISODCL (137, 140)]; /* 723 */ + char path_table_size [ISODCL (141, 148)]; /* 733 */ + char type_l_path_table [ISODCL (149, 152)]; /* 731 */ + char opt_type_l_path_table [ISODCL (153, 156)]; /* 731 */ + char unknown2 [ISODCL (157, 160)]; /* 731 */ + char unknown3 [ISODCL (161, 164)]; /* 731 */ + char type_m_path_table [ISODCL (165, 168)]; /* 732 */ + char opt_type_m_path_table [ISODCL (169, 172)]; /* 732 */ + char unknown4 [ISODCL (173, 176)]; /* 732 */ + char unknown5 [ISODCL (177, 180)]; /* 732 */ + char root_directory_record [ISODCL (181, 214)]; /* 9.1 */ + char volume_set_id [ISODCL (215, 342)]; /* dchars */ + char publisher_id [ISODCL (343, 470)]; /* achars */ + char preparer_id [ISODCL (471, 598)]; /* achars */ + char application_id [ISODCL (599, 726)]; /* achars */ + char copyright_id [ISODCL (727, 790)]; /* achars */ + char creation_date [ISODCL (791, 806)]; /* ? */ + char modification_date [ISODCL (807, 822)]; /* ? */ + char expiration_date [ISODCL (823, 838)]; /* ? */ + char effective_date [ISODCL (839, 854)]; /* ? */ + char file_structure_version [ISODCL (855, 855)]; /* 711 */ + char unused4 [ISODCL (856, 2048)]; + }; + struct iso_directory_record { char length [ISODCL (1, 1)]; /* 711 */ char ext_attr_length [ISODCL (2, 2)]; /* 711 */ *************** *** 72,78 **** }; /* CD-ROM Fromat type */ ! enum ISO_FTYPE { ISO_FTYPE_9660, ISO_FTYPE_RRIP, ISO_FTYPE_ECMA }; struct iso_mnt { int logical_block_size; --- 115,122 ---- }; /* CD-ROM Fromat type */ ! enum ISO_FTYPE { ISO_FTYPE_9660, ISO_FTYPE_RRIP, ISO_FTYPE_ECMA, ! ISO_FTYPE_HIGH_SIERRA, ISO_FTYPE_UNKNOWN = -1}; struct iso_mnt { int logical_block_size; *** isofs_lookup.c.orig Thu Nov 25 02:32:22 1993 --- isofs_lookup.c Sat Dec 24 09:03:22 1994 *************** *** 278,283 **** --- 278,284 ---- } else { switch ( imp->iso_ftype ) { case ISO_FTYPE_9660: + case ISO_FTYPE_HIGH_SIERRA: if( ( namelen >= ndp->ni_namelen ) && ( isofncmp( ndp->ni_ptr, ndp->ni_namelen, ep->name, namelen ) ) ) { ndp->ni_ufs.ufs_ino = isonum_733 (ep->extent); *** isofs_node.c.orig Thu Nov 25 02:32:23 1993 --- isofs_node.c Sat Dec 24 09:07:00 1994 *************** *** 150,167 **** insque(ip, ih); ISO_ILOCK(ip); ip->iso_reclen = isonum_711 (isodir->length); ip->iso_extlen = isonum_711 (isodir->ext_attr_length); ip->iso_extent = isonum_733 (isodir->extent); ip->i_size = isonum_733 (isodir->size); ! ip->iso_flags = isonum_711 (isodir->flags); ip->iso_unit_size = isonum_711 (isodir->file_unit_size); ip->iso_interleave_gap = isonum_711 (isodir->interleave); ip->iso_volume_seq = isonum_723 (isodir->volume_sequence_number); ip->iso_namelen = isonum_711 (isodir->name_len); - imp = VFSTOISOFS (mntp); - vp = ITOV(ip); /* * Setup time stamp, attribute , if CL or PL, set loc but not yet.. */ --- 150,171 ---- insque(ip, ih); ISO_ILOCK(ip); + imp = VFSTOISOFS (mntp); + vp = ITOV(ip); + ip->iso_reclen = isonum_711 (isodir->length); ip->iso_extlen = isonum_711 (isodir->ext_attr_length); ip->iso_extent = isonum_733 (isodir->extent); ip->i_size = isonum_733 (isodir->size); ! /* high sierra does not have timezone data, flag is one byte ahead */ ! ip->iso_flags = isonum_711 (imp->iso_ftype == ISO_FTYPE_HIGH_SIERRA? ! &isodir->date[6]: ! isodir->flags); ip->iso_unit_size = isonum_711 (isodir->file_unit_size); ip->iso_interleave_gap = isonum_711 (isodir->interleave); ip->iso_volume_seq = isonum_723 (isodir->volume_sequence_number); ip->iso_namelen = isonum_711 (isodir->name_len); /* * Setup time stamp, attribute , if CL or PL, set loc but not yet.. */ *************** *** 169,174 **** --- 173,183 ---- case ISO_FTYPE_9660: isofs_rrip_defattr ( isodir, &(ip->inode) ); isofs_rrip_deftstamp( isodir, &(ip->inode) ); + goto FlameOff; + break; + case ISO_FTYPE_HIGH_SIERRA: + isofs_rrip_defattr ( isodir, &(ip->inode) ); + isofs_high_sierra_deftstamp( isodir, &(ip->inode) ); goto FlameOff; break; case ISO_FTYPE_RRIP: *** isofs_rrip.c.orig Mon Jun 13 22:19:35 1994 --- isofs_rrip.c Sat Dec 24 09:07:10 1994 *************** *** 174,182 **** /* * Time stamp */ ! static void isofs_rrip_tstamp_conv7(pi, pu) char *pi; struct timeval *pu; { int i; int crtime,days; --- 174,183 ---- /* * Time stamp */ ! static void isofs_rrip_tstamp_conv7(pi, pu, has_tz) char *pi; struct timeval *pu; + int has_tz; { int i; int crtime,days; *************** *** 211,217 **** tz |= (-1 << 8); /* timezone offset is unreliable on some disks */ ! if (-48 <= tz && tz <= 52) crtime -= tz * 15 * 60; } pu->tv_sec = crtime; --- 212,218 ---- tz |= (-1 << 8); /* timezone offset is unreliable on some disks */ ! if (has_tz && (-48 <= tz && tz <= 52)) crtime -= tz * 15 * 60; } pu->tv_sec = crtime; *************** *** 263,269 **** /* difference of GMT */ buf[6] = pi[16]; ! isofs_rrip_tstamp_conv7(buf, pu); } static int isofs_rrip_tstamp( p, ana ) --- 264,270 ---- /* difference of GMT */ buf[6] = pi[16]; ! isofs_rrip_tstamp_conv7(buf, pu, 1); } static int isofs_rrip_tstamp( p, ana ) *************** *** 276,290 **** /* Check a format of time stamp (7bytes/17bytes) */ if ( !(*p->flags & ISO_SUSP_TSTAMP_FORM17 ) ) { ! isofs_rrip_tstamp_conv7(ptime, &ana->inode.iso_ctime ); if ( *p->flags & ISO_SUSP_TSTAMP_MODIFY ) ! isofs_rrip_tstamp_conv7(ptime+7, &ana->inode.iso_mtime ); else ana->inode.iso_mtime = ana->inode.iso_ctime; if ( *p->flags & ISO_SUSP_TSTAMP_ACCESS ) ! isofs_rrip_tstamp_conv7(ptime+14, &ana->inode.iso_atime ); else ana->inode.iso_atime = ana->inode.iso_ctime; } else { --- 277,291 ---- /* Check a format of time stamp (7bytes/17bytes) */ if ( !(*p->flags & ISO_SUSP_TSTAMP_FORM17 ) ) { ! isofs_rrip_tstamp_conv7(ptime, &ana->inode.iso_ctime, 1 ); if ( *p->flags & ISO_SUSP_TSTAMP_MODIFY ) ! isofs_rrip_tstamp_conv7(ptime+7, &ana->inode.iso_mtime, 1 ); else ana->inode.iso_mtime = ana->inode.iso_ctime; if ( *p->flags & ISO_SUSP_TSTAMP_ACCESS ) ! isofs_rrip_tstamp_conv7(ptime+14, &ana->inode.iso_atime, 1 ); else ana->inode.iso_atime = ana->inode.iso_ctime; } else { *************** *** 307,313 **** struct iso_directory_record *isodir; ISO_RRIP_ANALYZE *ana; { ! isofs_rrip_tstamp_conv7(isodir->date, &ana->inode.iso_ctime ); ana->inode.iso_atime = ana->inode.iso_ctime; ana->inode.iso_mtime = ana->inode.iso_ctime; return 0; --- 308,325 ---- struct iso_directory_record *isodir; ISO_RRIP_ANALYZE *ana; { ! isofs_rrip_tstamp_conv7(isodir->date, &ana->inode.iso_ctime, 1); ! ana->inode.iso_atime = ana->inode.iso_ctime; ! ana->inode.iso_mtime = ana->inode.iso_ctime; ! return 0; ! } ! ! ! int isofs_high_sierra_deftstamp( isodir, ana ) ! struct iso_directory_record *isodir; ! ISO_RRIP_ANALYZE *ana; ! { ! isofs_rrip_tstamp_conv7(isodir->date, &ana->inode.iso_ctime, 0); ana->inode.iso_atime = ana->inode.iso_ctime; ana->inode.iso_mtime = ana->inode.iso_ctime; return 0; *** isofs_vfsops.c.orig Thu Jun 2 08:48:34 1994 --- isofs_vfsops.c Sat Dec 24 11:01:59 1994 *************** *** 176,187 **** imp = VFSTOISOFS(mp); /* Check the Rock Ridge Extention support */ ! if ( args.exflags & MNT_NORRIP ) { ! imp->iso_ftype = ISO_FTYPE_9660; ! mp->mnt_flag |= MNT_NORRIP; ! } else { ! imp->iso_ftype = ISO_FTYPE_RRIP; ! mp->mnt_flag &= ~MNT_NORRIP; } (void) copyinstr(path, imp->im_fsmnt, sizeof(imp->im_fsmnt)-1, &size); --- 176,189 ---- imp = VFSTOISOFS(mp); /* Check the Rock Ridge Extention support */ ! if ( imp->iso_ftype == ISO_FTYPE_UNKNOWN ) { ! if (args.exflags & MNT_NORRIP ) { ! imp->iso_ftype = ISO_FTYPE_9660; ! mp->mnt_flag |= MNT_NORRIP; ! } else { ! imp->iso_ftype = ISO_FTYPE_RRIP; ! mp->mnt_flag &= ~MNT_NORRIP; ! } } (void) copyinstr(path, imp->im_fsmnt, sizeof(imp->im_fsmnt)-1, &size); *************** *** 211,216 **** --- 213,219 ---- int havepart = 0, blks; int error = EINVAL, i, size; int needclose = 0; + int high_sierra = 0; int ronly = (mp->mnt_flag & MNT_RDONLY) != 0; extern struct vnode *rootvp; int j; *************** *** 218,223 **** --- 221,227 ---- int iso_blknum; struct iso_volume_descriptor *vdp; struct iso_primary_descriptor *pri; + struct iso_sierra_primary_descriptor *pri_sierra; struct iso_directory_record *rootp; int logical_block_size; *************** *** 252,279 **** vdp = (struct iso_volume_descriptor *)bp->b_un.b_addr; if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) { ! error = EINVAL; ! goto out; } ! if (isonum_711 (vdp->type) == ISO_VD_END) { error = EINVAL; goto out; } ! if (isonum_711 (vdp->type) == ISO_VD_PRIMARY) break; brelse(bp); } ! if (isonum_711 (vdp->type) != ISO_VD_PRIMARY) { error = EINVAL; goto out; } pri = (struct iso_primary_descriptor *)vdp; ! ! logical_block_size = isonum_723 (pri->logical_block_size); if (logical_block_size < DEV_BSIZE || logical_block_size >= MAXBSIZE --- 256,293 ---- vdp = (struct iso_volume_descriptor *)bp->b_un.b_addr; if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) { ! if (bcmp (vdp->id_sierra, ISO_SIERRA_ID, ! sizeof vdp->id) != 0) { ! error = EINVAL; ! goto out; ! } else ! high_sierra = 1; } ! if (isonum_711 (high_sierra? vdp->type_sierra: vdp->type) ! == ISO_VD_END) { error = EINVAL; goto out; } ! if (isonum_711 (high_sierra? vdp->type_sierra: vdp->type) ! == ISO_VD_PRIMARY) break; 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? pri_sierra->logical_block_size: ! pri->logical_block_size); if (logical_block_size < DEV_BSIZE || logical_block_size >= MAXBSIZE *************** *** 282,292 **** goto out; } ! rootp = (struct iso_directory_record *)pri->root_directory_record; isomp = (struct iso_mnt *)malloc(sizeof *isomp,M_ISOFSMNT,M_WAITOK); isomp->logical_block_size = logical_block_size; ! isomp->volume_space_size = isonum_733 (pri->volume_space_size); bcopy (rootp, isomp->root, sizeof isomp->root); isomp->root_extent = isonum_733 (rootp->extent); isomp->root_size = isonum_733 (rootp->size); --- 296,313 ---- goto out; } ! rootp = (struct iso_directory_record *) ! (high_sierra? ! pri_sierra->root_directory_record: ! pri->root_directory_record); isomp = (struct iso_mnt *)malloc(sizeof *isomp,M_ISOFSMNT,M_WAITOK); isomp->logical_block_size = logical_block_size; ! isomp->iso_ftype = ! high_sierra? ISO_FTYPE_HIGH_SIERRA: ISO_FTYPE_UNKNOWN; ! isomp->volume_space_size = ! isonum_733 (high_sierra? pri_sierra->volume_space_size: ! pri->volume_space_size); bcopy (rootp, isomp->root, sizeof isomp->root); isomp->root_extent = isonum_733 (rootp->extent); isomp->root_size = isonum_733 (rootp->size); *** isofs_vnops.c.orig Sun Jun 12 06:05:29 1994 --- isofs_vnops.c Sat Dec 24 09:03:22 1994 *************** *** 333,338 **** --- 333,339 ---- isofs_rrip_getname( ep, dirent.d_name, &dirent.d_namlen ); break; case ISO_FTYPE_9660: + case ISO_FTYPE_HIGH_SIERRA: { int namelen = dirent.d_namlen; isofntrans(ep->name, dirent.d_namlen, -- cheers, J"org work: --- no longer --- private: joerg_wunsch@uriah.sax.de Never trust an operating system you don't have sources for. ;-)