Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Apr 1999 20:30:02 -0700 (PDT)
From:      Motomichi Matsuzaki <mzaki@e-mail.ne.jp>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/5038: FreeBSD can't read MS Joliet CDs.
Message-ID:  <199904080330.UAA07679@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/5038; it has been noted by GNATS.

From: Motomichi Matsuzaki <mzaki@e-mail.ne.jp>
To: freebsd-gnats-submit@freebsd.org, keith@email.gcn.net.tw
Cc: byung@wam.umd.edu, joki@kuebart.stuttgart.netsurf.de
Subject: Re: kern/5038: FreeBSD can't read MS Joliet CDs.
Date: Thu, 08 Apr 1999 12:25:33 +0900

 Hi.
 
 I have tried Byung's Joliet Patch(PR:kern/5038).
 
 This patch (and its ancestors) has the problem that 
 'ls -la' shows strange outputs for some CD-Rs.
 
 Note, there can be 2 or more PVDs, SVDs, and Boot records.
 The patch assumes that the SVD is the next sector to the PVD.
 This is wrong.
 On El Torito Bootable CD-ROMs, the first (#16) sector is PVD,
 and the second (#17) sector is *BOOT record*.
 Furthermore, there are some CD-Rs which have 2 PVDs and 2 SVDs.
 
 The following is the patch to Byung's considering multiple PVD/SVD/BOOTs.
 First, apply the Byung's patch at /usr/src (3.0-RELEASE or 3.1-STABLE),
 and then, apply this patch at /usr/src/sys/isofs/cd9660.
 
 --- cd9660_vfsops.c.prev	Thu Apr  8 09:30:53 1999
 +++ cd9660_vfsops.c	Thu Apr  8 11:04:33 1999
 @@ -283,7 +283,8 @@
  	struct iso_args *argp;
  {
  	register struct iso_mnt *isomp = (struct iso_mnt *)0;
 -	struct buf *bp = NULL, *joliet_bp = NULL;
 +	struct buf *bp = NULL;
 +	struct buf *pribp = NULL, *supbp = NULL;
  	dev_t dev = devvp->v_rdev;
  	int error = EINVAL;
  	int needclose = 0;
 @@ -292,9 +293,9 @@
  	int iso_bsize;
  	int iso_blknum;
  	struct iso_volume_descriptor *vdp = 0;
 -	struct iso_primary_descriptor *pri;
 +	struct iso_primary_descriptor *pri = NULL;
  	struct iso_supplementary_descriptor *sup = NULL;
 -	struct iso_sierra_primary_descriptor *pri_sierra;
 +	struct iso_sierra_primary_descriptor *pri_sierra = NULL;
  	struct iso_directory_record *rootp;
  	int logical_block_size;
  	int joliet_level = -1;
 @@ -334,6 +335,7 @@
  			goto out;
  		
  		vdp = (struct iso_volume_descriptor *)bp->b_data;
 +		high_sierra = 0;
  		if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) {
  			if (bcmp (vdp->id_sierra, ISO_SIERRA_ID,
  				  sizeof vdp->id) != 0) {
 @@ -341,45 +343,50 @@
  				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;
  		}
 +		switch (isonum_711 (high_sierra? vdp->type_sierra: vdp->type)){
 +		case ISO_VD_PRIMARY:
 +			if (pribp == NULL) {
 +				pribp = bp;
 +				pri = (struct iso_primary_descriptor *)vdp;
 +				pri_sierra =
 +				  (struct iso_sierra_primary_descriptor *)vdp;
 +			} else
 +				brelse(bp);
 +			break;
  
 -		if (isonum_711 (high_sierra? vdp->type_sierra: vdp->type) == ISO_VD_PRIMARY)
 +		case ISO_VD_SUPPLEMENTARY:
 +			if (supbp == NULL) {
 +				supbp = bp;
 +				sup = (struct iso_supplementary_descriptor *)vdp;
 +				joliet_level = cd9660_joliet_level(sup);
 +
 +				if (joliet_level < 0) {
 +					argp->flags |= ISOFSMNT_NOJOLIET;
 +				} else {
 +					argp->flags |= ISOFSMNT_NORRIP;
 +					argp->flags &= ~ISOFSMNT_GENS;
 +				}
 +			} else
 +				brelse(bp);
  			break;
 -		brelse(bp);
 +
 +		case ISO_VD_END:
 +			brelse(bp);
 +			bp = NULL;
 +			goto vd_end;
 +
 +		default:
 +			brelse(bp);
 +		}
  	}
 + vd_end:
  
 -	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)){
 +	if (pri == NULL) {
  		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:
 @@ -422,12 +429,14 @@
  	while ((1 << isomp->im_bshift) < isomp->logical_block_size)
  		isomp->im_bshift++;
  
 -	bp->b_flags |= B_AGE;
 -	brelse(bp);
 -	bp = NULL;
 -	brelse(joliet_bp);
 -	joliet_bp = NULL;
 -
 +	pribp->b_flags |= B_AGE;
 +	brelse(pribp);
 +	pribp = NULL;
 +	if (supbp) {
 +		if (joliet_level > 0) supbp->b_flags |= B_AGE;
 +		brelse(supbp);
 +		supbp = NULL;
 +	}
  
  	mp->mnt_data = (qaddr_t)isomp;
  	mp->mnt_stat.f_fsid.val[0] = (long)dev;
 @@ -494,6 +503,10 @@
  	devvp->v_specmountpoint = NULL;
  	if (bp)
  		brelse(bp);
 +	if (pribp)
 +		brelse(pribp);
 +	if (supbp)
 +		brelse(supbp);
  	if (needclose)
  		(void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p);
  	if (isomp) {
 
 
 -- 
 Motomichi Matsuzaki <mzaki@e-mail.ne.jp>
 Dept. of Biological Science, Fuculty of Sciences, Univ. of Tokyo, Japan
 
 
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904080330.UAA07679>