mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-22 16:44:32 +01:00
Add support for Joliet extensions to the iso9660 fs. The related PR
cannot yet be closed, though. I hope I got all credits right, and that the multiple submitted by lines do not break anyone's scripts... PR: kern/5038, kern/5567 Submitted by: Keith Jang <keith@email.gcn.net.tw> Submitted by: Joachim Kuebart <joki@kuebart.stuttgart.netsurf.de> Submitted by: Byung Yang <byung@wam.umd.edu> Submitted by: Motomichi Matsuzaki <mzaki@e-mail.ne.jp>
This commit is contained in:
parent
fa8e3bcb32
commit
44e568e2a1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=45773
@ -67,6 +67,8 @@ Do not strip version numbers on files.
|
||||
only the last one will be listed.)
|
||||
In either case, files may be opened without explicitly stating a
|
||||
version number.
|
||||
.It Fl j
|
||||
Do not use any Joliet extensions included in the filesystem.
|
||||
.It Fl o
|
||||
Options are specified with a
|
||||
.Fl o
|
||||
|
@ -49,7 +49,7 @@ static char copyright[] =
|
||||
static char sccsid[] = "@(#)mount_cd9660.c 8.7 (Berkeley) 5/1/95";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id: mount_cd9660.c,v 1.11 1997/03/29 03:32:35 imp Exp $";
|
||||
"$Id: mount_cd9660.c,v 1.12 1997/04/29 15:56:40 joerg Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/cdio.h>
|
||||
@ -73,6 +73,7 @@ struct mntopt mopts[] = {
|
||||
{ "extatt", 0, ISOFSMNT_EXTATT, 1 },
|
||||
{ "gens", 0, ISOFSMNT_GENS, 1 },
|
||||
{ "rrip", 1, ISOFSMNT_NORRIP, 1 },
|
||||
{ "joliet", 1, ISOFSMNT_NOJOLIET, 1 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@ -91,7 +92,7 @@ main(int argc, char **argv)
|
||||
mntflags = opts = verbose = 0;
|
||||
memset(&args, 0, sizeof args);
|
||||
args.ssector = -1;
|
||||
while ((ch = getopt(argc, argv, "ego:rs:v")) != -1)
|
||||
while ((ch = getopt(argc, argv, "egjo:rs:v")) != -1)
|
||||
switch (ch) {
|
||||
case 'e':
|
||||
opts |= ISOFSMNT_EXTATT;
|
||||
@ -99,6 +100,9 @@ main(int argc, char **argv)
|
||||
case 'g':
|
||||
opts |= ISOFSMNT_GENS;
|
||||
break;
|
||||
case 'j':
|
||||
opts |= ISOFSMNT_NOJOLIET;
|
||||
break;
|
||||
case 'o':
|
||||
getmntopts(optarg, mopts, &mntflags, &opts);
|
||||
break;
|
||||
|
@ -38,7 +38,7 @@
|
||||
* from: @(#)ufs_lookup.c 7.33 (Berkeley) 5/19/91
|
||||
*
|
||||
* @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94
|
||||
* $Id: cd9660_lookup.c,v 1.20 1997/11/07 08:52:50 phk Exp $
|
||||
* $Id: cd9660_lookup.c,v 1.21 1999/01/27 21:49:54 dillon Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -237,8 +237,7 @@ searchloop:
|
||||
if (namelen != 1
|
||||
|| ep->name[0] != 0)
|
||||
goto notfound;
|
||||
} else if (!(res = isofncmp(name,len,
|
||||
ep->name,namelen))) {
|
||||
} else if (!(res = isofncmp(name, len, ep->name, namelen, imp->joliet_level))) {
|
||||
if (isoflags & 2)
|
||||
ino = isodirino(ep, imp);
|
||||
else
|
||||
|
@ -50,3 +50,4 @@ struct iso_args {
|
||||
#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 Joliet Ext.*/
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_rrip.c 8.6 (Berkeley) 12/5/94
|
||||
* $Id: cd9660_rrip.c,v 1.12 1997/02/22 09:38:49 peter Exp $
|
||||
* $Id: cd9660_rrip.c,v 1.13 1997/08/02 14:31:19 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -298,18 +298,18 @@ cd9660_rrip_defname(isodir,ana)
|
||||
struct iso_directory_record *isodir;
|
||||
ISO_RRIP_ANALYZE *ana;
|
||||
{
|
||||
strcpy(ana->outbuf,"..");
|
||||
switch (*isodir->name) {
|
||||
isofntrans(isodir->name,isonum_711(isodir->name_len),
|
||||
ana->outbuf,ana->outlen,
|
||||
1,isonum_711(isodir->flags)&4, ana->imp->joliet_level);
|
||||
switch (*ana->outbuf) {
|
||||
default:
|
||||
isofntrans(isodir->name,isonum_711(isodir->name_len),
|
||||
ana->outbuf,ana->outlen,
|
||||
1,isonum_711(isodir->flags)&4);
|
||||
break;
|
||||
case 0:
|
||||
*ana->outlen = 1;
|
||||
break;
|
||||
case 1:
|
||||
*ana->outlen = 2;
|
||||
/* FALL THROUGH */
|
||||
case 0:
|
||||
/* outlen is 1 already */
|
||||
strcpy(ana->outbuf,"..");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -498,6 +498,7 @@ cd9660_rrip_loop(isodir,ana,table)
|
||||
register ISO_SUSP_HEADER *pend;
|
||||
struct buf *bp = NULL;
|
||||
char *pwhead;
|
||||
u_char c;
|
||||
int result;
|
||||
|
||||
/*
|
||||
@ -507,10 +508,10 @@ cd9660_rrip_loop(isodir,ana,table)
|
||||
pwhead = isodir->name + isonum_711(isodir->name_len);
|
||||
if (!(isonum_711(isodir->name_len)&1))
|
||||
pwhead++;
|
||||
isochar(isodir->name, pwhead, ana->imp->joliet_level, &c);
|
||||
|
||||
/* If it's not the '.' entry of the root dir obey SP field */
|
||||
if (*isodir->name != 0
|
||||
|| isonum_733(isodir->extent) != ana->imp->root_extent)
|
||||
if (c != 0 || isonum_733(isodir->extent) != ana->imp->root_extent)
|
||||
pwhead += ana->imp->rr_skip;
|
||||
else
|
||||
pwhead += ana->imp->rr_skip0;
|
||||
@ -633,6 +634,7 @@ cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp)
|
||||
{
|
||||
ISO_RRIP_ANALYZE analyze;
|
||||
RRIP_TABLE *tab;
|
||||
u_char c;
|
||||
|
||||
analyze.outbuf = outbuf;
|
||||
analyze.outlen = outlen;
|
||||
@ -642,9 +644,10 @@ cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp)
|
||||
analyze.fields = ISO_SUSP_ALTNAME|ISO_SUSP_RELDIR|ISO_SUSP_CLINK|ISO_SUSP_PLINK;
|
||||
*outlen = 0;
|
||||
|
||||
isochar(isodir->name, isodir->name + isonum_711(isodir->name_len),
|
||||
imp->joliet_level, &c);
|
||||
tab = rrip_table_getname;
|
||||
if (*isodir->name == 0
|
||||
|| *isodir->name == 1) {
|
||||
if (c == 0 || c == 1) {
|
||||
cd9660_rrip_defname(isodir,&analyze);
|
||||
|
||||
analyze.fields &= ~ISO_SUSP_ALTNAME;
|
||||
|
@ -5,7 +5,8 @@
|
||||
* This code is derived from software contributed to Berkeley
|
||||
* by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
|
||||
* Support code is derived from software contributed to Berkeley
|
||||
* by Atsushi Murai (amurai@spec.co.jp).
|
||||
* by Atsushi Murai (amurai@spec.co.jp). Joliet support was added by
|
||||
* Joachim Kuebart (joki@kuebart.stuttgart.netsurf.de).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -36,7 +37,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_util.c 8.3 (Berkeley) 12/5/94
|
||||
* $Id: cd9660_util.c,v 1.9 1997/02/22 09:38:50 peter Exp $
|
||||
* $Id: cd9660_util.c,v 1.10 1997/04/10 14:35:11 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -45,38 +46,66 @@
|
||||
|
||||
#include <isofs/cd9660/iso.h>
|
||||
|
||||
/*
|
||||
* Get one character out of an iso filename
|
||||
* Obey joliet_level
|
||||
* Return number of bytes consumed
|
||||
*/
|
||||
int
|
||||
isochar(isofn, isoend, joliet_level, c)
|
||||
u_char *isofn;
|
||||
u_char *isoend;
|
||||
int joliet_level;
|
||||
u_char *c;
|
||||
{
|
||||
*c = *isofn++;
|
||||
if (joliet_level == 0 || isofn == isoend)
|
||||
/* (00) and (01) are one byte in Joliet, too */
|
||||
return 1;
|
||||
|
||||
/* No Unicode support yet :-( */
|
||||
switch (*c) {
|
||||
default:
|
||||
*c = '?';
|
||||
break;
|
||||
case '\0':
|
||||
*c = *isofn;
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* translate and compare a filename
|
||||
* returns (fn - isofn)
|
||||
* Note: Version number plus ';' may be omitted.
|
||||
*/
|
||||
int
|
||||
isofncmp(fn, fnlen, isofn, isolen)
|
||||
isofncmp(fn, fnlen, isofn, isolen, joliet_level)
|
||||
u_char *fn;
|
||||
int fnlen;
|
||||
u_char *isofn;
|
||||
int isolen;
|
||||
int joliet_level;
|
||||
{
|
||||
int i, j;
|
||||
unsigned char c;
|
||||
u_char c, *fnend = fn + fnlen, *isoend = isofn + isolen;
|
||||
|
||||
while (--fnlen >= 0) {
|
||||
if (--isolen < 0)
|
||||
for (; fn != fnend; fn++) {
|
||||
if (isofn == isoend)
|
||||
return *fn;
|
||||
if ((c = *isofn++) == ';') {
|
||||
switch (*fn++) {
|
||||
default:
|
||||
return *--fn;
|
||||
case 0:
|
||||
return 0;
|
||||
case ';':
|
||||
break;
|
||||
}
|
||||
for (i = 0; --fnlen >= 0; i = i * 10 + *fn++ - '0') {
|
||||
isofn += isochar(isofn, isoend, joliet_level, &c);
|
||||
if (c == ';') {
|
||||
if (*fn++ != ';')
|
||||
return fn[-1];
|
||||
for (i = 0; fn != fnend; i = i * 10 + *fn++ - '0') {
|
||||
if (*fn < '0' || *fn > '9') {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
for (j = 0; --isolen >= 0; j = j * 10 + *isofn++ - '0');
|
||||
for (j = 0; isofn != isoend; j = j * 10 + c - '0')
|
||||
isofn += isochar(isofn, isoend,
|
||||
joliet_level, &c);
|
||||
return i - j;
|
||||
}
|
||||
if (c != *fn) {
|
||||
@ -90,15 +119,19 @@ isofncmp(fn, fnlen, isofn, isolen)
|
||||
} else
|
||||
return *fn - c;
|
||||
}
|
||||
fn++;
|
||||
}
|
||||
if (isolen > 0) {
|
||||
switch (*isofn) {
|
||||
if (isofn != isoend) {
|
||||
isofn += isochar(isofn, isoend, joliet_level, &c);
|
||||
switch (c) {
|
||||
default:
|
||||
return -1;
|
||||
return -c;
|
||||
case '.':
|
||||
if (isofn[1] != ';')
|
||||
return -1;
|
||||
if (isofn != isoend) {
|
||||
isochar(isofn, isoend, joliet_level, &c);
|
||||
if (c == ';')
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
case ';':
|
||||
return 0;
|
||||
}
|
||||
@ -107,35 +140,36 @@ isofncmp(fn, fnlen, isofn, isolen)
|
||||
}
|
||||
|
||||
/*
|
||||
* translate a filename
|
||||
* translate a filename of length > 0
|
||||
*/
|
||||
void
|
||||
isofntrans(infn, infnlen, outfn, outfnlen, original, assoc)
|
||||
isofntrans(infn, infnlen, outfn, outfnlen, original, assoc, joliet_level)
|
||||
u_char *infn;
|
||||
int infnlen;
|
||||
u_char *outfn;
|
||||
u_short *outfnlen;
|
||||
int original;
|
||||
int assoc;
|
||||
int joliet_level;
|
||||
{
|
||||
int fnidx = 0;
|
||||
u_char c, d = '\0', *infnend = infn + infnlen;
|
||||
|
||||
if (assoc) {
|
||||
*outfn++ = ASSOCCHAR;
|
||||
fnidx++;
|
||||
infnlen++;
|
||||
}
|
||||
for (; fnidx < infnlen; fnidx++) {
|
||||
char c = *infn++;
|
||||
for (; infn != infnend; fnidx++) {
|
||||
infn += isochar(infn, infnend, joliet_level, &c);
|
||||
|
||||
if (!original && c >= 'A' && c <= 'Z')
|
||||
*outfn++ = c + ('a' - 'A');
|
||||
else if (!original && c == '.' && *infn == ';')
|
||||
else if (!original && c == ';') {
|
||||
fnidx -= (d == '.');
|
||||
break;
|
||||
else if (!original && c == ';')
|
||||
break;
|
||||
else
|
||||
} else
|
||||
*outfn++ = c;
|
||||
d = c;
|
||||
}
|
||||
*outfnlen = fnidx;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
|
||||
* $Id: cd9660_vfsops.c,v 1.50 1999/01/30 12:26:22 phk Exp $
|
||||
* $Id: cd9660_vfsops.c,v 1.51 1999/01/31 11:54:29 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -53,6 +53,7 @@
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <isofs/cd9660/iso.h>
|
||||
#include <isofs/cd9660/iso_rrip.h>
|
||||
@ -281,15 +282,18 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
{
|
||||
register struct iso_mnt *isomp = (struct iso_mnt *)0;
|
||||
struct buf *bp = NULL;
|
||||
struct buf *pribp = NULL, *supbp = NULL;
|
||||
dev_t dev = devvp->v_rdev;
|
||||
int error = EINVAL;
|
||||
int needclose = 0;
|
||||
int high_sierra = 0;
|
||||
int iso_bsize;
|
||||
int iso_blknum;
|
||||
int joliet_level;
|
||||
struct iso_volume_descriptor *vdp = 0;
|
||||
struct iso_primary_descriptor *pri;
|
||||
struct iso_sierra_primary_descriptor *pri_sierra;
|
||||
struct iso_primary_descriptor *pri = NULL;
|
||||
struct iso_sierra_primary_descriptor *pri_sierra = NULL;
|
||||
struct iso_supplementary_descriptor *sup = NULL;
|
||||
struct iso_directory_record *rootp;
|
||||
int logical_block_size;
|
||||
|
||||
@ -319,6 +323,7 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
*/
|
||||
iso_bsize = ISO_DEFAULT_BLOCK_SIZE;
|
||||
|
||||
joliet_level = 0;
|
||||
for (iso_blknum = 16 + argp->ssector;
|
||||
iso_blknum < 100 + argp->ssector;
|
||||
iso_blknum++) {
|
||||
@ -335,25 +340,59 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
} 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)
|
||||
switch (isonum_711 (high_sierra? vdp->type_sierra: vdp->type)){
|
||||
case ISO_VD_PRIMARY:
|
||||
if (pribp == NULL) {
|
||||
pribp = bp;
|
||||
bp = NULL;
|
||||
pri = (struct iso_primary_descriptor *)vdp;
|
||||
pri_sierra =
|
||||
(struct iso_sierra_primary_descriptor *)vdp;
|
||||
}
|
||||
break;
|
||||
|
||||
case ISO_VD_SUPPLEMENTARY:
|
||||
if (supbp == NULL) {
|
||||
supbp = bp;
|
||||
bp = NULL;
|
||||
sup = (struct iso_supplementary_descriptor *)vdp;
|
||||
|
||||
if (!(argp->flags & ISOFSMNT_NOJOLIET)) {
|
||||
if (bcmp(sup->escape, "%/@", 3) == 0)
|
||||
joliet_level = 1;
|
||||
if (bcmp(sup->escape, "%/C", 3) == 0)
|
||||
joliet_level = 2;
|
||||
if (bcmp(sup->escape, "%/E", 3) == 0)
|
||||
joliet_level = 3;
|
||||
|
||||
if (isonum_711 (sup->flags) & 1)
|
||||
joliet_level = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ISO_VD_END:
|
||||
goto vd_end;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (bp) {
|
||||
brelse(bp);
|
||||
bp = NULL;
|
||||
}
|
||||
}
|
||||
vd_end:
|
||||
if (bp) {
|
||||
brelse(bp);
|
||||
bp = NULL;
|
||||
}
|
||||
|
||||
if (isonum_711 (high_sierra? vdp->type_sierra: vdp->type) != ISO_VD_PRIMARY) {
|
||||
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:
|
||||
@ -377,6 +416,7 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
isonum_733 (high_sierra?
|
||||
pri_sierra->volume_space_size:
|
||||
pri->volume_space_size);
|
||||
isomp->joliet_level = 0;
|
||||
/*
|
||||
* Since an ISO9660 multi-session CD can also access previous
|
||||
* sessions, we have to include them into the space consider-
|
||||
@ -391,13 +431,11 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
isomp->root_size = isonum_733 (rootp->size);
|
||||
|
||||
isomp->im_bmask = logical_block_size - 1;
|
||||
isomp->im_bshift = 0;
|
||||
while ((1 << isomp->im_bshift) < isomp->logical_block_size)
|
||||
isomp->im_bshift++;
|
||||
isomp->im_bshift = ffs(logical_block_size) - 1;
|
||||
|
||||
bp->b_flags |= B_AGE;
|
||||
brelse(bp);
|
||||
bp = NULL;
|
||||
pribp->b_flags |= B_AGE;
|
||||
brelse(pribp);
|
||||
pribp = NULL;
|
||||
|
||||
mp->mnt_data = (qaddr_t)isomp;
|
||||
mp->mnt_stat.f_fsid.val[0] = (long)dev;
|
||||
@ -434,12 +472,14 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
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)
|
||||
if (high_sierra) {
|
||||
/* this effectively ignores all the mount flags */
|
||||
log(LOG_INFO, "cd9660: High Sierra Format\n");
|
||||
isomp->iso_ftype = ISO_FTYPE_HIGH_SIERRA;
|
||||
else
|
||||
} else
|
||||
switch (isomp->im_flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS)) {
|
||||
default:
|
||||
isomp->iso_ftype = ISO_FTYPE_DEFAULT;
|
||||
@ -448,15 +488,38 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
isomp->iso_ftype = ISO_FTYPE_9660;
|
||||
break;
|
||||
case 0:
|
||||
log(LOG_INFO, "cd9660: RockRidge Extension\n");
|
||||
isomp->iso_ftype = ISO_FTYPE_RRIP;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Decide whether to use the Joliet descriptor */
|
||||
|
||||
if (isomp->iso_ftype != ISO_FTYPE_RRIP && joliet_level) {
|
||||
log(LOG_INFO, "cd9660: Joliet Extension\n");
|
||||
rootp = (struct iso_directory_record *)
|
||||
sup->root_directory_record;
|
||||
bcopy (rootp, isomp->root, sizeof isomp->root);
|
||||
isomp->root_extent = isonum_733 (rootp->extent);
|
||||
isomp->root_size = isonum_733 (rootp->size);
|
||||
isomp->joliet_level = joliet_level;
|
||||
supbp->b_flags |= B_AGE;
|
||||
}
|
||||
|
||||
if (supbp) {
|
||||
brelse(supbp);
|
||||
supbp = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
out:
|
||||
devvp->v_specmountpoint = NULL;
|
||||
if (bp)
|
||||
brelse(bp);
|
||||
if (pribp)
|
||||
brelse(pribp);
|
||||
if (supbp)
|
||||
brelse(supbp);
|
||||
if (needclose)
|
||||
(void)VOP_CLOSE(devvp, FREAD, NOCRED, p);
|
||||
if (isomp) {
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
|
||||
* $Id: cd9660_vnops.c,v 1.53 1998/07/04 20:45:30 julian Exp $
|
||||
* $Id: cd9660_vnops.c,v 1.54 1999/01/27 21:49:55 dillon Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -554,26 +554,23 @@ cd9660_readdir(ap)
|
||||
break;
|
||||
default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 || ISO_FTYPE_HIGH_SIERRA*/
|
||||
strcpy(idp->current.d_name,"..");
|
||||
switch (ep->name[0]) {
|
||||
case 0:
|
||||
if (idp->current.d_namlen == 1 && ep->name[0] == 0) {
|
||||
idp->current.d_namlen = 1;
|
||||
error = iso_uiodir(idp,&idp->current,idp->curroff);
|
||||
break;
|
||||
case 1:
|
||||
} else if (idp->current.d_namlen == 1 && ep->name[0] == 1) {
|
||||
idp->current.d_namlen = 2;
|
||||
error = iso_uiodir(idp,&idp->current,idp->curroff);
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
isofntrans(ep->name,idp->current.d_namlen,
|
||||
idp->current.d_name, &namelen,
|
||||
imp->iso_ftype == ISO_FTYPE_9660,
|
||||
isonum_711(ep->flags)&4);
|
||||
isonum_711(ep->flags)&4,
|
||||
imp->joliet_level);
|
||||
idp->current.d_namlen = (u_char)namelen;
|
||||
if (imp->iso_ftype == ISO_FTYPE_DEFAULT)
|
||||
error = iso_shipdir(idp);
|
||||
else
|
||||
error = iso_uiodir(idp,&idp->current,idp->curroff);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (error)
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)iso.h 8.6 (Berkeley) 5/10/95
|
||||
* $Id: iso.h,v 1.15 1997/05/04 16:17:49 joerg Exp $
|
||||
* $Id: iso.h,v 1.16 1997/05/07 13:23:04 joerg Exp $
|
||||
*/
|
||||
|
||||
#define ISODCL(from, to) (to - from + 1)
|
||||
@ -54,6 +54,7 @@ struct iso_volume_descriptor {
|
||||
|
||||
/* 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 @@ struct iso_primary_descriptor {
|
||||
};
|
||||
#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)]; /* 711? */
|
||||
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 @@ struct iso_extended_attributes {
|
||||
|
||||
/* 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
|
||||
@ -202,6 +244,8 @@ struct iso_mnt {
|
||||
|
||||
int rr_skip;
|
||||
int rr_skip0;
|
||||
|
||||
int joliet_level;
|
||||
};
|
||||
|
||||
#define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data))
|
||||
@ -221,8 +265,9 @@ extern vop_t **cd9660_vnodeop_p;
|
||||
extern vop_t **cd9660_specop_p;
|
||||
extern vop_t **cd9660_fifoop_p;
|
||||
|
||||
int isofncmp __P((u_char *, int, u_char *, int));
|
||||
void isofntrans __P((u_char *, int, u_char *, u_short *, int, int));
|
||||
int isochar __P((u_char *, u_char *, int, u_char *));
|
||||
int isofncmp __P((u_char *, int, u_char *, int, int));
|
||||
void isofntrans __P((u_char *, int, u_char *, u_short *, int, int, int));
|
||||
ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *));
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
@ -38,7 +38,7 @@
|
||||
* from: @(#)ufs_lookup.c 7.33 (Berkeley) 5/19/91
|
||||
*
|
||||
* @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94
|
||||
* $Id: cd9660_lookup.c,v 1.20 1997/11/07 08:52:50 phk Exp $
|
||||
* $Id: cd9660_lookup.c,v 1.21 1999/01/27 21:49:54 dillon Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -237,8 +237,7 @@ searchloop:
|
||||
if (namelen != 1
|
||||
|| ep->name[0] != 0)
|
||||
goto notfound;
|
||||
} else if (!(res = isofncmp(name,len,
|
||||
ep->name,namelen))) {
|
||||
} else if (!(res = isofncmp(name, len, ep->name, namelen, imp->joliet_level))) {
|
||||
if (isoflags & 2)
|
||||
ino = isodirino(ep, imp);
|
||||
else
|
||||
|
@ -50,3 +50,4 @@ struct iso_args {
|
||||
#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 Joliet Ext.*/
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_rrip.c 8.6 (Berkeley) 12/5/94
|
||||
* $Id: cd9660_rrip.c,v 1.12 1997/02/22 09:38:49 peter Exp $
|
||||
* $Id: cd9660_rrip.c,v 1.13 1997/08/02 14:31:19 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -298,18 +298,18 @@ cd9660_rrip_defname(isodir,ana)
|
||||
struct iso_directory_record *isodir;
|
||||
ISO_RRIP_ANALYZE *ana;
|
||||
{
|
||||
strcpy(ana->outbuf,"..");
|
||||
switch (*isodir->name) {
|
||||
isofntrans(isodir->name,isonum_711(isodir->name_len),
|
||||
ana->outbuf,ana->outlen,
|
||||
1,isonum_711(isodir->flags)&4, ana->imp->joliet_level);
|
||||
switch (*ana->outbuf) {
|
||||
default:
|
||||
isofntrans(isodir->name,isonum_711(isodir->name_len),
|
||||
ana->outbuf,ana->outlen,
|
||||
1,isonum_711(isodir->flags)&4);
|
||||
break;
|
||||
case 0:
|
||||
*ana->outlen = 1;
|
||||
break;
|
||||
case 1:
|
||||
*ana->outlen = 2;
|
||||
/* FALL THROUGH */
|
||||
case 0:
|
||||
/* outlen is 1 already */
|
||||
strcpy(ana->outbuf,"..");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -498,6 +498,7 @@ cd9660_rrip_loop(isodir,ana,table)
|
||||
register ISO_SUSP_HEADER *pend;
|
||||
struct buf *bp = NULL;
|
||||
char *pwhead;
|
||||
u_char c;
|
||||
int result;
|
||||
|
||||
/*
|
||||
@ -507,10 +508,10 @@ cd9660_rrip_loop(isodir,ana,table)
|
||||
pwhead = isodir->name + isonum_711(isodir->name_len);
|
||||
if (!(isonum_711(isodir->name_len)&1))
|
||||
pwhead++;
|
||||
isochar(isodir->name, pwhead, ana->imp->joliet_level, &c);
|
||||
|
||||
/* If it's not the '.' entry of the root dir obey SP field */
|
||||
if (*isodir->name != 0
|
||||
|| isonum_733(isodir->extent) != ana->imp->root_extent)
|
||||
if (c != 0 || isonum_733(isodir->extent) != ana->imp->root_extent)
|
||||
pwhead += ana->imp->rr_skip;
|
||||
else
|
||||
pwhead += ana->imp->rr_skip0;
|
||||
@ -633,6 +634,7 @@ cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp)
|
||||
{
|
||||
ISO_RRIP_ANALYZE analyze;
|
||||
RRIP_TABLE *tab;
|
||||
u_char c;
|
||||
|
||||
analyze.outbuf = outbuf;
|
||||
analyze.outlen = outlen;
|
||||
@ -642,9 +644,10 @@ cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp)
|
||||
analyze.fields = ISO_SUSP_ALTNAME|ISO_SUSP_RELDIR|ISO_SUSP_CLINK|ISO_SUSP_PLINK;
|
||||
*outlen = 0;
|
||||
|
||||
isochar(isodir->name, isodir->name + isonum_711(isodir->name_len),
|
||||
imp->joliet_level, &c);
|
||||
tab = rrip_table_getname;
|
||||
if (*isodir->name == 0
|
||||
|| *isodir->name == 1) {
|
||||
if (c == 0 || c == 1) {
|
||||
cd9660_rrip_defname(isodir,&analyze);
|
||||
|
||||
analyze.fields &= ~ISO_SUSP_ALTNAME;
|
||||
|
@ -5,7 +5,8 @@
|
||||
* This code is derived from software contributed to Berkeley
|
||||
* by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
|
||||
* Support code is derived from software contributed to Berkeley
|
||||
* by Atsushi Murai (amurai@spec.co.jp).
|
||||
* by Atsushi Murai (amurai@spec.co.jp). Joliet support was added by
|
||||
* Joachim Kuebart (joki@kuebart.stuttgart.netsurf.de).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -36,7 +37,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_util.c 8.3 (Berkeley) 12/5/94
|
||||
* $Id: cd9660_util.c,v 1.9 1997/02/22 09:38:50 peter Exp $
|
||||
* $Id: cd9660_util.c,v 1.10 1997/04/10 14:35:11 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -45,38 +46,66 @@
|
||||
|
||||
#include <isofs/cd9660/iso.h>
|
||||
|
||||
/*
|
||||
* Get one character out of an iso filename
|
||||
* Obey joliet_level
|
||||
* Return number of bytes consumed
|
||||
*/
|
||||
int
|
||||
isochar(isofn, isoend, joliet_level, c)
|
||||
u_char *isofn;
|
||||
u_char *isoend;
|
||||
int joliet_level;
|
||||
u_char *c;
|
||||
{
|
||||
*c = *isofn++;
|
||||
if (joliet_level == 0 || isofn == isoend)
|
||||
/* (00) and (01) are one byte in Joliet, too */
|
||||
return 1;
|
||||
|
||||
/* No Unicode support yet :-( */
|
||||
switch (*c) {
|
||||
default:
|
||||
*c = '?';
|
||||
break;
|
||||
case '\0':
|
||||
*c = *isofn;
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* translate and compare a filename
|
||||
* returns (fn - isofn)
|
||||
* Note: Version number plus ';' may be omitted.
|
||||
*/
|
||||
int
|
||||
isofncmp(fn, fnlen, isofn, isolen)
|
||||
isofncmp(fn, fnlen, isofn, isolen, joliet_level)
|
||||
u_char *fn;
|
||||
int fnlen;
|
||||
u_char *isofn;
|
||||
int isolen;
|
||||
int joliet_level;
|
||||
{
|
||||
int i, j;
|
||||
unsigned char c;
|
||||
u_char c, *fnend = fn + fnlen, *isoend = isofn + isolen;
|
||||
|
||||
while (--fnlen >= 0) {
|
||||
if (--isolen < 0)
|
||||
for (; fn != fnend; fn++) {
|
||||
if (isofn == isoend)
|
||||
return *fn;
|
||||
if ((c = *isofn++) == ';') {
|
||||
switch (*fn++) {
|
||||
default:
|
||||
return *--fn;
|
||||
case 0:
|
||||
return 0;
|
||||
case ';':
|
||||
break;
|
||||
}
|
||||
for (i = 0; --fnlen >= 0; i = i * 10 + *fn++ - '0') {
|
||||
isofn += isochar(isofn, isoend, joliet_level, &c);
|
||||
if (c == ';') {
|
||||
if (*fn++ != ';')
|
||||
return fn[-1];
|
||||
for (i = 0; fn != fnend; i = i * 10 + *fn++ - '0') {
|
||||
if (*fn < '0' || *fn > '9') {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
for (j = 0; --isolen >= 0; j = j * 10 + *isofn++ - '0');
|
||||
for (j = 0; isofn != isoend; j = j * 10 + c - '0')
|
||||
isofn += isochar(isofn, isoend,
|
||||
joliet_level, &c);
|
||||
return i - j;
|
||||
}
|
||||
if (c != *fn) {
|
||||
@ -90,15 +119,19 @@ isofncmp(fn, fnlen, isofn, isolen)
|
||||
} else
|
||||
return *fn - c;
|
||||
}
|
||||
fn++;
|
||||
}
|
||||
if (isolen > 0) {
|
||||
switch (*isofn) {
|
||||
if (isofn != isoend) {
|
||||
isofn += isochar(isofn, isoend, joliet_level, &c);
|
||||
switch (c) {
|
||||
default:
|
||||
return -1;
|
||||
return -c;
|
||||
case '.':
|
||||
if (isofn[1] != ';')
|
||||
return -1;
|
||||
if (isofn != isoend) {
|
||||
isochar(isofn, isoend, joliet_level, &c);
|
||||
if (c == ';')
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
case ';':
|
||||
return 0;
|
||||
}
|
||||
@ -107,35 +140,36 @@ isofncmp(fn, fnlen, isofn, isolen)
|
||||
}
|
||||
|
||||
/*
|
||||
* translate a filename
|
||||
* translate a filename of length > 0
|
||||
*/
|
||||
void
|
||||
isofntrans(infn, infnlen, outfn, outfnlen, original, assoc)
|
||||
isofntrans(infn, infnlen, outfn, outfnlen, original, assoc, joliet_level)
|
||||
u_char *infn;
|
||||
int infnlen;
|
||||
u_char *outfn;
|
||||
u_short *outfnlen;
|
||||
int original;
|
||||
int assoc;
|
||||
int joliet_level;
|
||||
{
|
||||
int fnidx = 0;
|
||||
u_char c, d = '\0', *infnend = infn + infnlen;
|
||||
|
||||
if (assoc) {
|
||||
*outfn++ = ASSOCCHAR;
|
||||
fnidx++;
|
||||
infnlen++;
|
||||
}
|
||||
for (; fnidx < infnlen; fnidx++) {
|
||||
char c = *infn++;
|
||||
for (; infn != infnend; fnidx++) {
|
||||
infn += isochar(infn, infnend, joliet_level, &c);
|
||||
|
||||
if (!original && c >= 'A' && c <= 'Z')
|
||||
*outfn++ = c + ('a' - 'A');
|
||||
else if (!original && c == '.' && *infn == ';')
|
||||
else if (!original && c == ';') {
|
||||
fnidx -= (d == '.');
|
||||
break;
|
||||
else if (!original && c == ';')
|
||||
break;
|
||||
else
|
||||
} else
|
||||
*outfn++ = c;
|
||||
d = c;
|
||||
}
|
||||
*outfnlen = fnidx;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
|
||||
* $Id: cd9660_vfsops.c,v 1.50 1999/01/30 12:26:22 phk Exp $
|
||||
* $Id: cd9660_vfsops.c,v 1.51 1999/01/31 11:54:29 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -53,6 +53,7 @@
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <isofs/cd9660/iso.h>
|
||||
#include <isofs/cd9660/iso_rrip.h>
|
||||
@ -281,15 +282,18 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
{
|
||||
register struct iso_mnt *isomp = (struct iso_mnt *)0;
|
||||
struct buf *bp = NULL;
|
||||
struct buf *pribp = NULL, *supbp = NULL;
|
||||
dev_t dev = devvp->v_rdev;
|
||||
int error = EINVAL;
|
||||
int needclose = 0;
|
||||
int high_sierra = 0;
|
||||
int iso_bsize;
|
||||
int iso_blknum;
|
||||
int joliet_level;
|
||||
struct iso_volume_descriptor *vdp = 0;
|
||||
struct iso_primary_descriptor *pri;
|
||||
struct iso_sierra_primary_descriptor *pri_sierra;
|
||||
struct iso_primary_descriptor *pri = NULL;
|
||||
struct iso_sierra_primary_descriptor *pri_sierra = NULL;
|
||||
struct iso_supplementary_descriptor *sup = NULL;
|
||||
struct iso_directory_record *rootp;
|
||||
int logical_block_size;
|
||||
|
||||
@ -319,6 +323,7 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
*/
|
||||
iso_bsize = ISO_DEFAULT_BLOCK_SIZE;
|
||||
|
||||
joliet_level = 0;
|
||||
for (iso_blknum = 16 + argp->ssector;
|
||||
iso_blknum < 100 + argp->ssector;
|
||||
iso_blknum++) {
|
||||
@ -335,25 +340,59 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
} 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)
|
||||
switch (isonum_711 (high_sierra? vdp->type_sierra: vdp->type)){
|
||||
case ISO_VD_PRIMARY:
|
||||
if (pribp == NULL) {
|
||||
pribp = bp;
|
||||
bp = NULL;
|
||||
pri = (struct iso_primary_descriptor *)vdp;
|
||||
pri_sierra =
|
||||
(struct iso_sierra_primary_descriptor *)vdp;
|
||||
}
|
||||
break;
|
||||
|
||||
case ISO_VD_SUPPLEMENTARY:
|
||||
if (supbp == NULL) {
|
||||
supbp = bp;
|
||||
bp = NULL;
|
||||
sup = (struct iso_supplementary_descriptor *)vdp;
|
||||
|
||||
if (!(argp->flags & ISOFSMNT_NOJOLIET)) {
|
||||
if (bcmp(sup->escape, "%/@", 3) == 0)
|
||||
joliet_level = 1;
|
||||
if (bcmp(sup->escape, "%/C", 3) == 0)
|
||||
joliet_level = 2;
|
||||
if (bcmp(sup->escape, "%/E", 3) == 0)
|
||||
joliet_level = 3;
|
||||
|
||||
if (isonum_711 (sup->flags) & 1)
|
||||
joliet_level = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ISO_VD_END:
|
||||
goto vd_end;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (bp) {
|
||||
brelse(bp);
|
||||
bp = NULL;
|
||||
}
|
||||
}
|
||||
vd_end:
|
||||
if (bp) {
|
||||
brelse(bp);
|
||||
bp = NULL;
|
||||
}
|
||||
|
||||
if (isonum_711 (high_sierra? vdp->type_sierra: vdp->type) != ISO_VD_PRIMARY) {
|
||||
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:
|
||||
@ -377,6 +416,7 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
isonum_733 (high_sierra?
|
||||
pri_sierra->volume_space_size:
|
||||
pri->volume_space_size);
|
||||
isomp->joliet_level = 0;
|
||||
/*
|
||||
* Since an ISO9660 multi-session CD can also access previous
|
||||
* sessions, we have to include them into the space consider-
|
||||
@ -391,13 +431,11 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
isomp->root_size = isonum_733 (rootp->size);
|
||||
|
||||
isomp->im_bmask = logical_block_size - 1;
|
||||
isomp->im_bshift = 0;
|
||||
while ((1 << isomp->im_bshift) < isomp->logical_block_size)
|
||||
isomp->im_bshift++;
|
||||
isomp->im_bshift = ffs(logical_block_size) - 1;
|
||||
|
||||
bp->b_flags |= B_AGE;
|
||||
brelse(bp);
|
||||
bp = NULL;
|
||||
pribp->b_flags |= B_AGE;
|
||||
brelse(pribp);
|
||||
pribp = NULL;
|
||||
|
||||
mp->mnt_data = (qaddr_t)isomp;
|
||||
mp->mnt_stat.f_fsid.val[0] = (long)dev;
|
||||
@ -434,12 +472,14 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
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)
|
||||
if (high_sierra) {
|
||||
/* this effectively ignores all the mount flags */
|
||||
log(LOG_INFO, "cd9660: High Sierra Format\n");
|
||||
isomp->iso_ftype = ISO_FTYPE_HIGH_SIERRA;
|
||||
else
|
||||
} else
|
||||
switch (isomp->im_flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS)) {
|
||||
default:
|
||||
isomp->iso_ftype = ISO_FTYPE_DEFAULT;
|
||||
@ -448,15 +488,38 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
isomp->iso_ftype = ISO_FTYPE_9660;
|
||||
break;
|
||||
case 0:
|
||||
log(LOG_INFO, "cd9660: RockRidge Extension\n");
|
||||
isomp->iso_ftype = ISO_FTYPE_RRIP;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Decide whether to use the Joliet descriptor */
|
||||
|
||||
if (isomp->iso_ftype != ISO_FTYPE_RRIP && joliet_level) {
|
||||
log(LOG_INFO, "cd9660: Joliet Extension\n");
|
||||
rootp = (struct iso_directory_record *)
|
||||
sup->root_directory_record;
|
||||
bcopy (rootp, isomp->root, sizeof isomp->root);
|
||||
isomp->root_extent = isonum_733 (rootp->extent);
|
||||
isomp->root_size = isonum_733 (rootp->size);
|
||||
isomp->joliet_level = joliet_level;
|
||||
supbp->b_flags |= B_AGE;
|
||||
}
|
||||
|
||||
if (supbp) {
|
||||
brelse(supbp);
|
||||
supbp = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
out:
|
||||
devvp->v_specmountpoint = NULL;
|
||||
if (bp)
|
||||
brelse(bp);
|
||||
if (pribp)
|
||||
brelse(pribp);
|
||||
if (supbp)
|
||||
brelse(supbp);
|
||||
if (needclose)
|
||||
(void)VOP_CLOSE(devvp, FREAD, NOCRED, p);
|
||||
if (isomp) {
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
|
||||
* $Id: cd9660_vnops.c,v 1.53 1998/07/04 20:45:30 julian Exp $
|
||||
* $Id: cd9660_vnops.c,v 1.54 1999/01/27 21:49:55 dillon Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -554,26 +554,23 @@ cd9660_readdir(ap)
|
||||
break;
|
||||
default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 || ISO_FTYPE_HIGH_SIERRA*/
|
||||
strcpy(idp->current.d_name,"..");
|
||||
switch (ep->name[0]) {
|
||||
case 0:
|
||||
if (idp->current.d_namlen == 1 && ep->name[0] == 0) {
|
||||
idp->current.d_namlen = 1;
|
||||
error = iso_uiodir(idp,&idp->current,idp->curroff);
|
||||
break;
|
||||
case 1:
|
||||
} else if (idp->current.d_namlen == 1 && ep->name[0] == 1) {
|
||||
idp->current.d_namlen = 2;
|
||||
error = iso_uiodir(idp,&idp->current,idp->curroff);
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
isofntrans(ep->name,idp->current.d_namlen,
|
||||
idp->current.d_name, &namelen,
|
||||
imp->iso_ftype == ISO_FTYPE_9660,
|
||||
isonum_711(ep->flags)&4);
|
||||
isonum_711(ep->flags)&4,
|
||||
imp->joliet_level);
|
||||
idp->current.d_namlen = (u_char)namelen;
|
||||
if (imp->iso_ftype == ISO_FTYPE_DEFAULT)
|
||||
error = iso_shipdir(idp);
|
||||
else
|
||||
error = iso_uiodir(idp,&idp->current,idp->curroff);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (error)
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)iso.h 8.6 (Berkeley) 5/10/95
|
||||
* $Id: iso.h,v 1.15 1997/05/04 16:17:49 joerg Exp $
|
||||
* $Id: iso.h,v 1.16 1997/05/07 13:23:04 joerg Exp $
|
||||
*/
|
||||
|
||||
#define ISODCL(from, to) (to - from + 1)
|
||||
@ -54,6 +54,7 @@ struct iso_volume_descriptor {
|
||||
|
||||
/* 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 @@ struct iso_primary_descriptor {
|
||||
};
|
||||
#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)]; /* 711? */
|
||||
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 @@ struct iso_extended_attributes {
|
||||
|
||||
/* 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
|
||||
@ -202,6 +244,8 @@ struct iso_mnt {
|
||||
|
||||
int rr_skip;
|
||||
int rr_skip0;
|
||||
|
||||
int joliet_level;
|
||||
};
|
||||
|
||||
#define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data))
|
||||
@ -221,8 +265,9 @@ extern vop_t **cd9660_vnodeop_p;
|
||||
extern vop_t **cd9660_specop_p;
|
||||
extern vop_t **cd9660_fifoop_p;
|
||||
|
||||
int isofncmp __P((u_char *, int, u_char *, int));
|
||||
void isofntrans __P((u_char *, int, u_char *, u_short *, int, int));
|
||||
int isochar __P((u_char *, u_char *, int, u_char *));
|
||||
int isofncmp __P((u_char *, int, u_char *, int, int));
|
||||
void isofntrans __P((u_char *, int, u_char *, u_short *, int, int, int));
|
||||
ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *));
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
Loading…
Reference in New Issue
Block a user