1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-14 14:55:41 +00:00

Roll in my changes to make the cd9660 code understand the older

(original "High Sierra") CD format.  I've already implemented this for
1.1.5.1 (and posted to -hackers), but didn't get any response to it.
Perhaps i'm the only one who has such an old CD lying around...

Everything is done empirically, but i had three of them around (from
different vendors), so there's a high probability that i've got it
right. :)
This commit is contained in:
Joerg Wunsch 1995-01-16 17:03:29 +00:00
parent 87cf6d44c7
commit 988fa8efe3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=5651
18 changed files with 386 additions and 214 deletions

View File

@ -1,8 +1,10 @@
# $Id: TODO,v 1.4 1993/09/07 15:40:51 ws Exp $
# $Id: TODO,v 1.1.1.1 1994/05/24 10:04:12 rgrimes Exp $
1) should understand "older", original High Sierra ("CDROM001") type
Not yet. ( I don't have this technical information, yet. )
Done. (16-Jan-95, Joerg Wunsch joerg@freebsd.org)
2) should understand Rock Ridge

View File

@ -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.4 1994/09/15 19:45:58 bde Exp $
* $Id: cd9660_lookup.c,v 1.5 1994/09/26 00:32:54 gpalmer Exp $
*/
#include <sys/param.h>
@ -116,6 +116,7 @@ cd9660_lookup(ap)
ino_t ino = 0;
int reclen;
u_short namelen;
int isoflags;
char altname[NAME_MAX];
int res;
int assoc, len;
@ -276,6 +277,8 @@ cd9660_lookup(ap)
* Check for a name match.
*/
namelen = isonum_711(ep->name_len);
isoflags = isonum_711(imp->iso_ftype == ISO_FTYPE_HIGH_SIERRA?
&ep->date[6]: ep->flags);
if (reclen < ISO_DIRECTORY_RECORD_SIZE + namelen)
/* illegal entry, stop */
@ -283,7 +286,7 @@ cd9660_lookup(ap)
switch (imp->iso_ftype) {
default:
if ((!(isonum_711(ep->flags)&4)) == !assoc) {
if (!(isoflags & 4) == !assoc) {
if ((len == 1
&& *name == '.')
|| (flags & ISDOTDOT)) {
@ -302,7 +305,7 @@ cd9660_lookup(ap)
goto notfound;
} else if (!(res = isofncmp(name,len,
ep->name,namelen))) {
if (isonum_711(ep->flags)&2)
if (isoflags & 2)
isodirino(&ino,ep,imp);
else
ino = dbtob(bp->b_blkno)

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94
* $Id: cd9660_node.c,v 1.6 1994/09/26 00:32:56 gpalmer Exp $
* $Id: cd9660_node.c,v 1.7 1994/10/06 21:06:17 davidg Exp $
*/
#include <sys/param.h>
@ -266,13 +266,13 @@ iso_iget(xp, ino, relocated, ipp, isodir)
*/
vp->v_type = VNON;
switch (imp->iso_ftype) {
default: /* ISO_FTYPE_9660 */
default: /* ISO_FTYPE_9660 || ISO_FTYPE_HIGH_SIERRA */
if ((imp->im_flags&ISOFSMNT_EXTATT)
&& isonum_711(isodir->ext_attr_length))
iso_blkatoff(ip,-isonum_711(isodir->ext_attr_length),
&bp2);
cd9660_defattr(isodir,ip,bp2 );
cd9660_deftstamp(isodir,ip,bp2 );
cd9660_defattr(isodir,ip,bp2,imp->iso_ftype );
cd9660_deftstamp(isodir,ip,bp2,imp->iso_ftype );
break;
case ISO_FTYPE_RRIP:
result = cd9660_rrip_analyze(isodir,ip,imp);
@ -453,17 +453,20 @@ iso_iunlock(ip)
* File attributes
*/
void
cd9660_defattr(isodir,inop,bp)
cd9660_defattr(isodir,inop,bp,ftype)
struct iso_directory_record *isodir;
struct iso_node *inop;
struct buf *bp;
enum ISO_FTYPE ftype;
{
struct buf *bp2 = NULL;
struct iso_mnt *imp;
struct iso_extended_attributes *ap = NULL;
int off;
if (isonum_711(isodir->flags)&2) {
/* high sierra does not have timezone data, flag is one byte ahead */
if (isonum_711(ftype == ISO_FTYPE_HIGH_SIERRA?
&isodir->date[6]: isodir->flags)&2) {
inop->inode.iso_mode = S_IFDIR;
/*
* If we return 2, fts() will assume there are no subdirectories
@ -514,10 +517,11 @@ cd9660_defattr(isodir,inop,bp)
* Time stamps
*/
void
cd9660_deftstamp(isodir,inop,bp)
cd9660_deftstamp(isodir,inop,bp,ftype)
struct iso_directory_record *isodir;
struct iso_node *inop;
struct buf *bp;
enum ISO_FTYPE ftype;
{
struct buf *bp2 = NULL;
struct iso_mnt *imp;
@ -533,7 +537,8 @@ cd9660_deftstamp(isodir,inop,bp)
if (bp) {
ap = (struct iso_extended_attributes *)bp->b_un.b_addr;
if (isonum_711(ap->version) == 1) {
if (ftype != ISO_FTYPE_HIGH_SIERRA
&& isonum_711(ap->version) == 1) {
if (!cd9660_tstamp_conv17(ap->ftime,&inop->inode.iso_atime))
cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_atime);
if (!cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_ctime))
@ -544,7 +549,7 @@ cd9660_deftstamp(isodir,inop,bp)
ap = NULL;
}
if (!ap) {
cd9660_tstamp_conv7(isodir->date,&inop->inode.iso_ctime);
cd9660_tstamp_conv7(isodir->date,&inop->inode.iso_ctime,ftype);
inop->inode.iso_atime = inop->inode.iso_ctime;
inop->inode.iso_mtime = inop->inode.iso_ctime;
}
@ -553,9 +558,10 @@ cd9660_deftstamp(isodir,inop,bp)
}
int
cd9660_tstamp_conv7(pi,pu)
cd9660_tstamp_conv7(pi,pu,ftype)
char *pi;
struct timespec *pu;
enum ISO_FTYPE ftype;
{
int crtime, days;
int y, m, d, hour, minute, second, tz;
@ -566,7 +572,11 @@ struct timespec *pu;
hour = pi[3];
minute = pi[4];
second = pi[5];
tz = pi[6];
if(ftype != ISO_FTYPE_HIGH_SIERRA)
tz = pi[6];
else
/* original high sierra misses timezone data */
tz = 0;
if (y < 1970) {
pu->ts_sec = 0;
@ -616,28 +626,28 @@ cd9660_tstamp_conv17(pi,pu)
{
unsigned char buf[7];
/* year:"0001"-"9999" -> -1900 */
/* year:"0001"-"9999" -> -1900 */
buf[0] = cd9660_chars2ui(pi,4) - 1900;
/* month: " 1"-"12" -> 1 - 12 */
/* month: " 1"-"12" -> 1 - 12 */
buf[1] = cd9660_chars2ui(pi + 4,2);
/* day: " 1"-"31" -> 1 - 31 */
/* day: " 1"-"31" -> 1 - 31 */
buf[2] = cd9660_chars2ui(pi + 6,2);
/* hour: " 0"-"23" -> 0 - 23 */
/* hour: " 0"-"23" -> 0 - 23 */
buf[3] = cd9660_chars2ui(pi + 8,2);
/* minute:" 0"-"59" -> 0 - 59 */
/* minute:" 0"-"59" -> 0 - 59 */
buf[4] = cd9660_chars2ui(pi + 10,2);
/* second:" 0"-"59" -> 0 - 59 */
/* second:" 0"-"59" -> 0 - 59 */
buf[5] = cd9660_chars2ui(pi + 12,2);
/* difference of GMT */
buf[6] = pi[16];
return cd9660_tstamp_conv7(buf,pu);
return cd9660_tstamp_conv7(buf, pu, ISO_FTYPE_DEFAULT);
}
void

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_node.h 8.2 (Berkeley) 1/23/94
* $Id: cd9660_node.h,v 1.2 1994/08/02 07:41:22 davidg Exp $
* $Id: cd9660_node.h,v 1.3 1994/09/15 19:46:00 bde Exp $
*/
/*
@ -94,7 +94,7 @@ struct iso_node {
long i_size;
long iso_start; /* actual start of data of file (may be different */
/* from iso_extent, if file has extended attributes) */
ISO_RRIP_INODE inode;
ISO_RRIP_INODE inode;
};
#define i_forw i_chain[0]
@ -135,10 +135,10 @@ int cd9660_strategy __P((struct vop_strategy_args *));
int cd9660_print __P((struct vop_print_args *));
int cd9660_islocked __P((struct vop_islocked_args *));
void cd9660_defattr __P((struct iso_directory_record *,
struct iso_node *, struct buf *));
struct iso_node *, struct buf *, enum ISO_FTYPE));
void cd9660_deftstamp __P((struct iso_directory_record *,
struct iso_node *, struct buf *));
int cd9660_tstamp_conv7 __P((char *pi, struct timespec *pu));
struct iso_node *, struct buf *, enum ISO_FTYPE));
int cd9660_tstamp_conv7 __P((char *pi, struct timespec *pu, enum ISO_FTYPE));
int cd9660_tstamp_conv17 __P((unsigned char *pi, struct timespec *pu));
void isodirino __P((ino_t *inump, struct iso_directory_record *isodir,
struct iso_mnt *imp));

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_rrip.c 8.2 (Berkeley) 1/23/94
* $Id: cd9660_rrip.c,v 1.4 1994/09/15 19:46:01 bde Exp $
* $Id: cd9660_rrip.c,v 1.5 1994/09/26 00:32:57 gpalmer Exp $
*/
#include <sys/param.h>
@ -80,7 +80,7 @@ cd9660_rrip_defattr(isodir,ana)
{
/* But this is a required field! */
printf("RRIP without PX field?\n");
cd9660_defattr(isodir,ana->inop,NULL);
cd9660_defattr(isodir,ana->inop,NULL,ISO_FTYPE_RRIP);
}
/*
@ -88,7 +88,7 @@ cd9660_rrip_defattr(isodir,ana)
*/
static int
cd9660_rrip_slink(p,ana)
ISO_RRIP_SLINK *p;
ISO_RRIP_SLINK *p;
ISO_RRIP_ANALYZE *ana;
{
register ISO_RRIP_SLINK_COMPONENT *pcomp;
@ -286,7 +286,7 @@ cd9660_rrip_defname(isodir,ana)
*/
static int
cd9660_rrip_pclink(p,ana)
ISO_RRIP_CLINK *p;
ISO_RRIP_CLINK *p;
ISO_RRIP_ANALYZE *ana;
{
*ana->inump = isonum_733(p->dir_loc) << ana->imp->im_bshift;
@ -299,7 +299,7 @@ cd9660_rrip_pclink(p,ana)
*/
static int
cd9660_rrip_reldir(p,ana)
ISO_RRIP_RELDIR *p;
ISO_RRIP_RELDIR *p;
ISO_RRIP_ANALYZE *ana;
{
/* special hack to make caller aware of RE field */
@ -323,19 +323,22 @@ cd9660_rrip_tstamp(p,ana)
ptime += 7;
if (*p->flags&ISO_SUSP_TSTAMP_MODIFY) {
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_mtime);
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_mtime,
ISO_FTYPE_RRIP);
ptime += 7;
} else
bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec));
if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) {
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_atime);
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_atime,
ISO_FTYPE_RRIP);
ptime += 7;
} else
ana->inop->inode.iso_atime = ana->inop->inode.iso_mtime;
if (*p->flags&ISO_SUSP_TSTAMP_ATTR)
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_ctime);
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_ctime,
ISO_FTYPE_RRIP);
else
ana->inop->inode.iso_ctime = ana->inop->inode.iso_mtime;
@ -370,7 +373,7 @@ cd9660_rrip_deftstamp(isodir,ana)
struct iso_directory_record *isodir;
ISO_RRIP_ANALYZE *ana;
{
cd9660_deftstamp(isodir,ana->inop,NULL);
cd9660_deftstamp(isodir,ana->inop,NULL,ISO_FTYPE_RRIP);
}
/*
@ -476,7 +479,7 @@ cd9660_rrip_loop(isodir,ana,table)
/*
* Note: If name length is odd,
* it will be padding 1 byte after the name
* it will be padding 1 byte after the name
*/
pwhead = isodir->name + isonum_711(isodir->name_len);
if (!(isonum_711(isodir->name_len)&1))

View File

@ -36,33 +36,33 @@
* SUCH DAMAGE.
*
* @(#)cd9660_rrip.h 8.1 (Berkeley) 1/21/94
* $Id$
* $Id: cd9660_rrip.h,v 1.2 1994/08/02 07:41:30 davidg Exp $
*/
typedef struct {
char type [ISODCL ( 0, 1)];
unsigned char length [ISODCL ( 2, 2)]; /* 711 */
unsigned char version [ISODCL ( 3, 3)];
char type [ISODCL ( 0, 1)];
unsigned char length [ISODCL ( 2, 2)]; /* 711 */
unsigned char version [ISODCL ( 3, 3)];
} ISO_SUSP_HEADER;
typedef struct {
ISO_SUSP_HEADER h;
char mode_l [ISODCL ( 4, 7)]; /* 731 */
char mode_m [ISODCL ( 8, 11)]; /* 732 */
char links_l [ISODCL ( 12, 15)]; /* 731 */
char links_m [ISODCL ( 16, 19)]; /* 732 */
char uid_l [ISODCL ( 20, 23)]; /* 731 */
char uid_m [ISODCL ( 24, 27)]; /* 732 */
char gid_l [ISODCL ( 28, 31)]; /* 731 */
char gid_m [ISODCL ( 32, 35)]; /* 732 */
char mode_l [ISODCL ( 4, 7)]; /* 731 */
char mode_m [ISODCL ( 8, 11)]; /* 732 */
char links_l [ISODCL ( 12, 15)]; /* 731 */
char links_m [ISODCL ( 16, 19)]; /* 732 */
char uid_l [ISODCL ( 20, 23)]; /* 731 */
char uid_m [ISODCL ( 24, 27)]; /* 732 */
char gid_l [ISODCL ( 28, 31)]; /* 731 */
char gid_m [ISODCL ( 32, 35)]; /* 732 */
} ISO_RRIP_ATTR;
typedef struct {
ISO_SUSP_HEADER h;
char dev_t_high_l [ISODCL ( 4, 7)]; /* 731 */
char dev_t_high_m [ISODCL ( 8, 11)]; /* 732 */
char dev_t_low_l [ISODCL ( 12, 15)]; /* 731 */
char dev_t_low_m [ISODCL ( 16, 19)]; /* 732 */
char dev_t_high_l [ISODCL ( 4, 7)]; /* 731 */
char dev_t_high_m [ISODCL ( 8, 11)]; /* 732 */
char dev_t_low_l [ISODCL ( 12, 15)]; /* 731 */
char dev_t_low_m [ISODCL ( 16, 19)]; /* 732 */
} ISO_RRIP_DEVICE;
#define ISO_SUSP_CFLAG_CONTINUE 0x01
@ -73,31 +73,31 @@ typedef struct {
#define ISO_SUSP_CFLAG_HOST 0x20
typedef struct {
u_char cflag [ISODCL ( 1, 1)];
u_char clen [ISODCL ( 2, 2)];
u_char cflag [ISODCL ( 1, 1)];
u_char clen [ISODCL ( 2, 2)];
u_char name [0];
} ISO_RRIP_SLINK_COMPONENT;
#define ISO_RRIP_SLSIZ 2
typedef struct {
ISO_SUSP_HEADER h;
u_char flags [ISODCL ( 4, 4)];
u_char component [ISODCL ( 5, 5)];
u_char flags [ISODCL ( 4, 4)];
u_char component [ISODCL ( 5, 5)];
} ISO_RRIP_SLINK;
typedef struct {
ISO_SUSP_HEADER h;
char flags [ISODCL ( 4, 4)];
char flags [ISODCL ( 4, 4)];
} ISO_RRIP_ALTNAME;
typedef struct {
ISO_SUSP_HEADER h;
char dir_loc [ISODCL ( 4, 11)]; /* 733 */
char dir_loc [ISODCL ( 4, 11)]; /* 733 */
} ISO_RRIP_CLINK;
typedef struct {
ISO_SUSP_HEADER h;
char dir_loc [ISODCL ( 4, 11)]; /* 733 */
char dir_loc [ISODCL ( 4, 11)]; /* 733 */
} ISO_RRIP_PLINK;
typedef struct {
@ -116,18 +116,18 @@ typedef struct {
typedef struct {
ISO_SUSP_HEADER h;
unsigned char flags [ISODCL ( 4, 4)];
unsigned char time [ISODCL ( 5, 5)];
unsigned char flags [ISODCL ( 4, 4)];
unsigned char time [ISODCL ( 5, 5)];
} ISO_RRIP_TSTAMP;
typedef struct {
ISO_SUSP_HEADER h;
unsigned char flags [ISODCL ( 4, 4)];
unsigned char flags [ISODCL ( 4, 4)];
} ISO_RRIP_IDFLAG;
typedef struct {
ISO_SUSP_HEADER h;
char len_id [ISODCL ( 4, 4)];
char len_id [ISODCL ( 4, 4)];
char len_des [ISODCL ( 5, 5)];
char len_src [ISODCL ( 6, 6)];
char version [ISODCL ( 7, 7)];

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.3 (Berkeley) 1/31/94
* $Id: cd9660_vfsops.c,v 1.8 1994/09/26 00:32:58 gpalmer Exp $
* $Id: cd9660_vfsops.c,v 1.9 1994/11/14 07:01:58 bde Exp $
*/
#include <sys/param.h>
@ -224,11 +224,13 @@ iso_mountfs(devvp, mp, p, argp)
dev_t dev = devvp->v_rdev;
int error = EINVAL;
int needclose = 0;
int high_sierra = 0;
int ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
int iso_bsize;
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;
@ -265,28 +267,36 @@ iso_mountfs(devvp, mp, p, argp)
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 (vdp->type) == ISO_VD_END) {
error = EINVAL;
goto out;
}
if (isonum_711 (vdp->type) == ISO_VD_PRIMARY)
if (isonum_711 (high_sierra? vdp->type_sierra: vdp->type) == ISO_VD_PRIMARY)
break;
brelse(bp);
}
if (isonum_711 (vdp->type) != ISO_VD_PRIMARY) {
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 (pri->logical_block_size);
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
|| (logical_block_size & (logical_block_size - 1)) != 0) {
@ -294,12 +304,18 @@ iso_mountfs(devvp, mp, p, argp)
goto out;
}
rootp = (struct iso_directory_record *)pri->root_directory_record;
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);
isomp->logical_block_size = logical_block_size;
isomp->volume_space_size = isonum_733 (pri->volume_space_size);
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);
@ -335,9 +351,9 @@ iso_mountfs(devvp, mp, p, argp)
rootp = (struct iso_directory_record *)bp->b_un.b_addr;
if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) {
argp->flags |= ISOFSMNT_NORRIP;
argp->flags |= ISOFSMNT_NORRIP;
} else {
argp->flags &= ~ISOFSMNT_GENS;
argp->flags &= ~ISOFSMNT_GENS;
}
/*
@ -349,17 +365,22 @@ iso_mountfs(devvp, mp, p, argp)
bp = NULL;
}
isomp->im_flags = argp->flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS|ISOFSMNT_EXTATT);
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;
}
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:
@ -501,7 +522,7 @@ cd9660_statfs(mp, sbp, p)
sbp->f_blocks = isomp->volume_space_size;
sbp->f_bfree = 0; /* total free blocks */
sbp->f_bavail = 0; /* blocks free for non superuser */
sbp->f_files = 0; /* total files */
sbp->f_files = 0; /* total files */
sbp->f_ffree = 0; /* free file nodes */
if (sbp != &mp->mnt_stat) {
bcopy((caddr_t)mp->mnt_stat.f_mntonname,
@ -574,7 +595,7 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
struct iso_mnt *imp;
struct buf *bp;
struct iso_directory_record *dirp;
struct iso_node tip, *ip, *nip;
struct iso_node tip, *ip, *nip;
struct netcred *np;
imp = VFSTOISOFS (mp);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vnops.c 8.3 (Berkeley) 1/23/94
* $Id: cd9660_vnops.c,v 1.9 1994/09/26 00:32:59 gpalmer Exp $
* $Id: cd9660_vnops.c,v 1.10 1994/09/28 16:44:59 dfr Exp $
*/
#include <sys/param.h>
@ -290,7 +290,7 @@ cd9660_ioctl(ap)
struct vop_ioctl_args /* {
struct vnode *a_vp;
int a_command;
caddr_t a_data;
caddr_t a_data;
int a_fflag;
struct ucred *a_cred;
struct proc *a_p;
@ -476,6 +476,7 @@ cd9660_readdir(ap)
struct iso_directory_record *ep;
u_short elen;
int reclen;
int isoflags;
struct iso_mnt *imp;
struct iso_node *ip;
struct buf *bp = NULL;
@ -535,6 +536,8 @@ cd9660_readdir(ap)
(bp->b_un.b_addr + entryoffsetinblock);
reclen = isonum_711 (ep->length);
isoflags = isonum_711(imp->iso_ftype == ISO_FTYPE_HIGH_SIERRA?
&ep->date[6]: ep->flags);
if (reclen == 0) {
/* skip to next block, if any */
idp->curroff = roundup (idp->curroff,
@ -555,7 +558,7 @@ cd9660_readdir(ap)
}
idp->current.d_namlen = isonum_711 (ep->name_len);
if (isonum_711(ep->flags)&2)
if (isoflags & 2)
isodirino(&idp->current.d_fileno,ep,imp);
else
idp->current.d_fileno = dbtob(bp->b_blkno) +
@ -580,7 +583,7 @@ cd9660_readdir(ap)
if (idp->current.d_namlen)
error = iso_uiodir(idp,&idp->current,idp->curroff);
break;
default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 */
default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 || ISO_FTYPE_HIGH_SIERRA*/
strcpy(idp->current.d_name,"..");
switch (ep->name[0]) {
case 0:
@ -595,7 +598,7 @@ cd9660_readdir(ap)
isofntrans(ep->name,idp->current.d_namlen,
idp->current.d_name, &elen,
imp->iso_ftype == ISO_FTYPE_9660,
isonum_711(ep->flags)&4);
isoflags & 4);
idp->current.d_namlen = (u_char)elen;
if (imp->iso_ftype == ISO_FTYPE_DEFAULT)
error = iso_shipdir(idp);
@ -648,8 +651,8 @@ cd9660_readdir(ap)
* But otherwise the block read here is in the block buffer two times.
*/
typedef struct iso_directory_record ISODIR;
typedef struct iso_node ISONODE;
typedef struct iso_mnt ISOMNT;
typedef struct iso_node ISONODE;
typedef struct iso_mnt ISOMNT;
int
cd9660_readlink(ap)
struct vop_readlink_args /* {
@ -659,7 +662,7 @@ cd9660_readlink(ap)
} */ *ap;
{
ISONODE *ip;
ISODIR *dirp;
ISODIR *dirp;
ISOMNT *imp;
struct buf *bp;
u_short symlen;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)iso.h 8.2 (Berkeley) 1/23/94
* $Id: iso.h,v 1.2 1994/08/02 07:41:38 davidg Exp $
* $Id: iso.h,v 1.3 1994/09/09 11:11:01 dfr Exp $
*/
#define ISODCL(from, to) (to - from + 1)
@ -45,7 +45,11 @@ struct iso_volume_descriptor {
char type[ISODCL(1,1)]; /* 711 */
char id[ISODCL(2,6)];
char version[ISODCL(7,7)];
char data[ISODCL(8,2048)];
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 */
@ -53,13 +57,15 @@ struct iso_volume_descriptor {
#define ISO_VD_END 255
#define ISO_STANDARD_ID "CD001"
#define ISO_ECMA_ID "CDW01"
#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)];
char version [ISODCL ( 7, 7)]; /* 711 */
char unused1 [ISODCL ( 8, 8)];
char type [ISODCL ( 1, 1)]; /* 711 */
char id [ISODCL ( 2, 6)];
char version [ISODCL ( 7, 7)]; /* 711 */
char unused1 [ISODCL ( 8, 8)];
char system_id [ISODCL ( 9, 40)]; /* achars */
char volume_id [ISODCL ( 41, 72)]; /* dchars */
char unused2 [ISODCL ( 73, 80)];
@ -92,6 +98,43 @@ struct iso_primary_descriptor {
};
#define ISO_DEFAULT_BLOCK_SIZE 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 */
@ -129,7 +172,8 @@ struct iso_extended_attributes {
};
/* CD-ROM Format type */
enum ISO_FTYPE { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP, ISO_FTYPE_ECMA };
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
@ -153,7 +197,7 @@ struct iso_mnt {
char root[ISODCL (157, 190)];
int root_extent;
int root_size;
enum ISO_FTYPE iso_ftype;
enum ISO_FTYPE iso_ftype;
int rr_skip;
int rr_skip0;

View File

@ -1,8 +1,10 @@
# $Id: TODO,v 1.4 1993/09/07 15:40:51 ws Exp $
# $Id: TODO,v 1.1.1.1 1994/05/24 10:04:12 rgrimes Exp $
1) should understand "older", original High Sierra ("CDROM001") type
Not yet. ( I don't have this technical information, yet. )
Done. (16-Jan-95, Joerg Wunsch joerg@freebsd.org)
2) should understand Rock Ridge

View File

@ -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.4 1994/09/15 19:45:58 bde Exp $
* $Id: cd9660_lookup.c,v 1.5 1994/09/26 00:32:54 gpalmer Exp $
*/
#include <sys/param.h>
@ -116,6 +116,7 @@ cd9660_lookup(ap)
ino_t ino = 0;
int reclen;
u_short namelen;
int isoflags;
char altname[NAME_MAX];
int res;
int assoc, len;
@ -276,6 +277,8 @@ cd9660_lookup(ap)
* Check for a name match.
*/
namelen = isonum_711(ep->name_len);
isoflags = isonum_711(imp->iso_ftype == ISO_FTYPE_HIGH_SIERRA?
&ep->date[6]: ep->flags);
if (reclen < ISO_DIRECTORY_RECORD_SIZE + namelen)
/* illegal entry, stop */
@ -283,7 +286,7 @@ cd9660_lookup(ap)
switch (imp->iso_ftype) {
default:
if ((!(isonum_711(ep->flags)&4)) == !assoc) {
if (!(isoflags & 4) == !assoc) {
if ((len == 1
&& *name == '.')
|| (flags & ISDOTDOT)) {
@ -302,7 +305,7 @@ cd9660_lookup(ap)
goto notfound;
} else if (!(res = isofncmp(name,len,
ep->name,namelen))) {
if (isonum_711(ep->flags)&2)
if (isoflags & 2)
isodirino(&ino,ep,imp);
else
ino = dbtob(bp->b_blkno)

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94
* $Id: cd9660_node.c,v 1.6 1994/09/26 00:32:56 gpalmer Exp $
* $Id: cd9660_node.c,v 1.7 1994/10/06 21:06:17 davidg Exp $
*/
#include <sys/param.h>
@ -266,13 +266,13 @@ iso_iget(xp, ino, relocated, ipp, isodir)
*/
vp->v_type = VNON;
switch (imp->iso_ftype) {
default: /* ISO_FTYPE_9660 */
default: /* ISO_FTYPE_9660 || ISO_FTYPE_HIGH_SIERRA */
if ((imp->im_flags&ISOFSMNT_EXTATT)
&& isonum_711(isodir->ext_attr_length))
iso_blkatoff(ip,-isonum_711(isodir->ext_attr_length),
&bp2);
cd9660_defattr(isodir,ip,bp2 );
cd9660_deftstamp(isodir,ip,bp2 );
cd9660_defattr(isodir,ip,bp2,imp->iso_ftype );
cd9660_deftstamp(isodir,ip,bp2,imp->iso_ftype );
break;
case ISO_FTYPE_RRIP:
result = cd9660_rrip_analyze(isodir,ip,imp);
@ -453,17 +453,20 @@ iso_iunlock(ip)
* File attributes
*/
void
cd9660_defattr(isodir,inop,bp)
cd9660_defattr(isodir,inop,bp,ftype)
struct iso_directory_record *isodir;
struct iso_node *inop;
struct buf *bp;
enum ISO_FTYPE ftype;
{
struct buf *bp2 = NULL;
struct iso_mnt *imp;
struct iso_extended_attributes *ap = NULL;
int off;
if (isonum_711(isodir->flags)&2) {
/* high sierra does not have timezone data, flag is one byte ahead */
if (isonum_711(ftype == ISO_FTYPE_HIGH_SIERRA?
&isodir->date[6]: isodir->flags)&2) {
inop->inode.iso_mode = S_IFDIR;
/*
* If we return 2, fts() will assume there are no subdirectories
@ -514,10 +517,11 @@ cd9660_defattr(isodir,inop,bp)
* Time stamps
*/
void
cd9660_deftstamp(isodir,inop,bp)
cd9660_deftstamp(isodir,inop,bp,ftype)
struct iso_directory_record *isodir;
struct iso_node *inop;
struct buf *bp;
enum ISO_FTYPE ftype;
{
struct buf *bp2 = NULL;
struct iso_mnt *imp;
@ -533,7 +537,8 @@ cd9660_deftstamp(isodir,inop,bp)
if (bp) {
ap = (struct iso_extended_attributes *)bp->b_un.b_addr;
if (isonum_711(ap->version) == 1) {
if (ftype != ISO_FTYPE_HIGH_SIERRA
&& isonum_711(ap->version) == 1) {
if (!cd9660_tstamp_conv17(ap->ftime,&inop->inode.iso_atime))
cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_atime);
if (!cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_ctime))
@ -544,7 +549,7 @@ cd9660_deftstamp(isodir,inop,bp)
ap = NULL;
}
if (!ap) {
cd9660_tstamp_conv7(isodir->date,&inop->inode.iso_ctime);
cd9660_tstamp_conv7(isodir->date,&inop->inode.iso_ctime,ftype);
inop->inode.iso_atime = inop->inode.iso_ctime;
inop->inode.iso_mtime = inop->inode.iso_ctime;
}
@ -553,9 +558,10 @@ cd9660_deftstamp(isodir,inop,bp)
}
int
cd9660_tstamp_conv7(pi,pu)
cd9660_tstamp_conv7(pi,pu,ftype)
char *pi;
struct timespec *pu;
enum ISO_FTYPE ftype;
{
int crtime, days;
int y, m, d, hour, minute, second, tz;
@ -566,7 +572,11 @@ struct timespec *pu;
hour = pi[3];
minute = pi[4];
second = pi[5];
tz = pi[6];
if(ftype != ISO_FTYPE_HIGH_SIERRA)
tz = pi[6];
else
/* original high sierra misses timezone data */
tz = 0;
if (y < 1970) {
pu->ts_sec = 0;
@ -616,28 +626,28 @@ cd9660_tstamp_conv17(pi,pu)
{
unsigned char buf[7];
/* year:"0001"-"9999" -> -1900 */
/* year:"0001"-"9999" -> -1900 */
buf[0] = cd9660_chars2ui(pi,4) - 1900;
/* month: " 1"-"12" -> 1 - 12 */
/* month: " 1"-"12" -> 1 - 12 */
buf[1] = cd9660_chars2ui(pi + 4,2);
/* day: " 1"-"31" -> 1 - 31 */
/* day: " 1"-"31" -> 1 - 31 */
buf[2] = cd9660_chars2ui(pi + 6,2);
/* hour: " 0"-"23" -> 0 - 23 */
/* hour: " 0"-"23" -> 0 - 23 */
buf[3] = cd9660_chars2ui(pi + 8,2);
/* minute:" 0"-"59" -> 0 - 59 */
/* minute:" 0"-"59" -> 0 - 59 */
buf[4] = cd9660_chars2ui(pi + 10,2);
/* second:" 0"-"59" -> 0 - 59 */
/* second:" 0"-"59" -> 0 - 59 */
buf[5] = cd9660_chars2ui(pi + 12,2);
/* difference of GMT */
buf[6] = pi[16];
return cd9660_tstamp_conv7(buf,pu);
return cd9660_tstamp_conv7(buf, pu, ISO_FTYPE_DEFAULT);
}
void

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_node.h 8.2 (Berkeley) 1/23/94
* $Id: cd9660_node.h,v 1.2 1994/08/02 07:41:22 davidg Exp $
* $Id: cd9660_node.h,v 1.3 1994/09/15 19:46:00 bde Exp $
*/
/*
@ -94,7 +94,7 @@ struct iso_node {
long i_size;
long iso_start; /* actual start of data of file (may be different */
/* from iso_extent, if file has extended attributes) */
ISO_RRIP_INODE inode;
ISO_RRIP_INODE inode;
};
#define i_forw i_chain[0]
@ -135,10 +135,10 @@ int cd9660_strategy __P((struct vop_strategy_args *));
int cd9660_print __P((struct vop_print_args *));
int cd9660_islocked __P((struct vop_islocked_args *));
void cd9660_defattr __P((struct iso_directory_record *,
struct iso_node *, struct buf *));
struct iso_node *, struct buf *, enum ISO_FTYPE));
void cd9660_deftstamp __P((struct iso_directory_record *,
struct iso_node *, struct buf *));
int cd9660_tstamp_conv7 __P((char *pi, struct timespec *pu));
struct iso_node *, struct buf *, enum ISO_FTYPE));
int cd9660_tstamp_conv7 __P((char *pi, struct timespec *pu, enum ISO_FTYPE));
int cd9660_tstamp_conv17 __P((unsigned char *pi, struct timespec *pu));
void isodirino __P((ino_t *inump, struct iso_directory_record *isodir,
struct iso_mnt *imp));

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_rrip.c 8.2 (Berkeley) 1/23/94
* $Id: cd9660_rrip.c,v 1.4 1994/09/15 19:46:01 bde Exp $
* $Id: cd9660_rrip.c,v 1.5 1994/09/26 00:32:57 gpalmer Exp $
*/
#include <sys/param.h>
@ -80,7 +80,7 @@ cd9660_rrip_defattr(isodir,ana)
{
/* But this is a required field! */
printf("RRIP without PX field?\n");
cd9660_defattr(isodir,ana->inop,NULL);
cd9660_defattr(isodir,ana->inop,NULL,ISO_FTYPE_RRIP);
}
/*
@ -88,7 +88,7 @@ cd9660_rrip_defattr(isodir,ana)
*/
static int
cd9660_rrip_slink(p,ana)
ISO_RRIP_SLINK *p;
ISO_RRIP_SLINK *p;
ISO_RRIP_ANALYZE *ana;
{
register ISO_RRIP_SLINK_COMPONENT *pcomp;
@ -286,7 +286,7 @@ cd9660_rrip_defname(isodir,ana)
*/
static int
cd9660_rrip_pclink(p,ana)
ISO_RRIP_CLINK *p;
ISO_RRIP_CLINK *p;
ISO_RRIP_ANALYZE *ana;
{
*ana->inump = isonum_733(p->dir_loc) << ana->imp->im_bshift;
@ -299,7 +299,7 @@ cd9660_rrip_pclink(p,ana)
*/
static int
cd9660_rrip_reldir(p,ana)
ISO_RRIP_RELDIR *p;
ISO_RRIP_RELDIR *p;
ISO_RRIP_ANALYZE *ana;
{
/* special hack to make caller aware of RE field */
@ -323,19 +323,22 @@ cd9660_rrip_tstamp(p,ana)
ptime += 7;
if (*p->flags&ISO_SUSP_TSTAMP_MODIFY) {
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_mtime);
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_mtime,
ISO_FTYPE_RRIP);
ptime += 7;
} else
bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec));
if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) {
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_atime);
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_atime,
ISO_FTYPE_RRIP);
ptime += 7;
} else
ana->inop->inode.iso_atime = ana->inop->inode.iso_mtime;
if (*p->flags&ISO_SUSP_TSTAMP_ATTR)
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_ctime);
cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_ctime,
ISO_FTYPE_RRIP);
else
ana->inop->inode.iso_ctime = ana->inop->inode.iso_mtime;
@ -370,7 +373,7 @@ cd9660_rrip_deftstamp(isodir,ana)
struct iso_directory_record *isodir;
ISO_RRIP_ANALYZE *ana;
{
cd9660_deftstamp(isodir,ana->inop,NULL);
cd9660_deftstamp(isodir,ana->inop,NULL,ISO_FTYPE_RRIP);
}
/*
@ -476,7 +479,7 @@ cd9660_rrip_loop(isodir,ana,table)
/*
* Note: If name length is odd,
* it will be padding 1 byte after the name
* it will be padding 1 byte after the name
*/
pwhead = isodir->name + isonum_711(isodir->name_len);
if (!(isonum_711(isodir->name_len)&1))

View File

@ -36,33 +36,33 @@
* SUCH DAMAGE.
*
* @(#)cd9660_rrip.h 8.1 (Berkeley) 1/21/94
* $Id$
* $Id: cd9660_rrip.h,v 1.2 1994/08/02 07:41:30 davidg Exp $
*/
typedef struct {
char type [ISODCL ( 0, 1)];
unsigned char length [ISODCL ( 2, 2)]; /* 711 */
unsigned char version [ISODCL ( 3, 3)];
char type [ISODCL ( 0, 1)];
unsigned char length [ISODCL ( 2, 2)]; /* 711 */
unsigned char version [ISODCL ( 3, 3)];
} ISO_SUSP_HEADER;
typedef struct {
ISO_SUSP_HEADER h;
char mode_l [ISODCL ( 4, 7)]; /* 731 */
char mode_m [ISODCL ( 8, 11)]; /* 732 */
char links_l [ISODCL ( 12, 15)]; /* 731 */
char links_m [ISODCL ( 16, 19)]; /* 732 */
char uid_l [ISODCL ( 20, 23)]; /* 731 */
char uid_m [ISODCL ( 24, 27)]; /* 732 */
char gid_l [ISODCL ( 28, 31)]; /* 731 */
char gid_m [ISODCL ( 32, 35)]; /* 732 */
char mode_l [ISODCL ( 4, 7)]; /* 731 */
char mode_m [ISODCL ( 8, 11)]; /* 732 */
char links_l [ISODCL ( 12, 15)]; /* 731 */
char links_m [ISODCL ( 16, 19)]; /* 732 */
char uid_l [ISODCL ( 20, 23)]; /* 731 */
char uid_m [ISODCL ( 24, 27)]; /* 732 */
char gid_l [ISODCL ( 28, 31)]; /* 731 */
char gid_m [ISODCL ( 32, 35)]; /* 732 */
} ISO_RRIP_ATTR;
typedef struct {
ISO_SUSP_HEADER h;
char dev_t_high_l [ISODCL ( 4, 7)]; /* 731 */
char dev_t_high_m [ISODCL ( 8, 11)]; /* 732 */
char dev_t_low_l [ISODCL ( 12, 15)]; /* 731 */
char dev_t_low_m [ISODCL ( 16, 19)]; /* 732 */
char dev_t_high_l [ISODCL ( 4, 7)]; /* 731 */
char dev_t_high_m [ISODCL ( 8, 11)]; /* 732 */
char dev_t_low_l [ISODCL ( 12, 15)]; /* 731 */
char dev_t_low_m [ISODCL ( 16, 19)]; /* 732 */
} ISO_RRIP_DEVICE;
#define ISO_SUSP_CFLAG_CONTINUE 0x01
@ -73,31 +73,31 @@ typedef struct {
#define ISO_SUSP_CFLAG_HOST 0x20
typedef struct {
u_char cflag [ISODCL ( 1, 1)];
u_char clen [ISODCL ( 2, 2)];
u_char cflag [ISODCL ( 1, 1)];
u_char clen [ISODCL ( 2, 2)];
u_char name [0];
} ISO_RRIP_SLINK_COMPONENT;
#define ISO_RRIP_SLSIZ 2
typedef struct {
ISO_SUSP_HEADER h;
u_char flags [ISODCL ( 4, 4)];
u_char component [ISODCL ( 5, 5)];
u_char flags [ISODCL ( 4, 4)];
u_char component [ISODCL ( 5, 5)];
} ISO_RRIP_SLINK;
typedef struct {
ISO_SUSP_HEADER h;
char flags [ISODCL ( 4, 4)];
char flags [ISODCL ( 4, 4)];
} ISO_RRIP_ALTNAME;
typedef struct {
ISO_SUSP_HEADER h;
char dir_loc [ISODCL ( 4, 11)]; /* 733 */
char dir_loc [ISODCL ( 4, 11)]; /* 733 */
} ISO_RRIP_CLINK;
typedef struct {
ISO_SUSP_HEADER h;
char dir_loc [ISODCL ( 4, 11)]; /* 733 */
char dir_loc [ISODCL ( 4, 11)]; /* 733 */
} ISO_RRIP_PLINK;
typedef struct {
@ -116,18 +116,18 @@ typedef struct {
typedef struct {
ISO_SUSP_HEADER h;
unsigned char flags [ISODCL ( 4, 4)];
unsigned char time [ISODCL ( 5, 5)];
unsigned char flags [ISODCL ( 4, 4)];
unsigned char time [ISODCL ( 5, 5)];
} ISO_RRIP_TSTAMP;
typedef struct {
ISO_SUSP_HEADER h;
unsigned char flags [ISODCL ( 4, 4)];
unsigned char flags [ISODCL ( 4, 4)];
} ISO_RRIP_IDFLAG;
typedef struct {
ISO_SUSP_HEADER h;
char len_id [ISODCL ( 4, 4)];
char len_id [ISODCL ( 4, 4)];
char len_des [ISODCL ( 5, 5)];
char len_src [ISODCL ( 6, 6)];
char version [ISODCL ( 7, 7)];

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.3 (Berkeley) 1/31/94
* $Id: cd9660_vfsops.c,v 1.8 1994/09/26 00:32:58 gpalmer Exp $
* $Id: cd9660_vfsops.c,v 1.9 1994/11/14 07:01:58 bde Exp $
*/
#include <sys/param.h>
@ -224,11 +224,13 @@ iso_mountfs(devvp, mp, p, argp)
dev_t dev = devvp->v_rdev;
int error = EINVAL;
int needclose = 0;
int high_sierra = 0;
int ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
int iso_bsize;
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;
@ -265,28 +267,36 @@ iso_mountfs(devvp, mp, p, argp)
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 (vdp->type) == ISO_VD_END) {
error = EINVAL;
goto out;
}
if (isonum_711 (vdp->type) == ISO_VD_PRIMARY)
if (isonum_711 (high_sierra? vdp->type_sierra: vdp->type) == ISO_VD_PRIMARY)
break;
brelse(bp);
}
if (isonum_711 (vdp->type) != ISO_VD_PRIMARY) {
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 (pri->logical_block_size);
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
|| (logical_block_size & (logical_block_size - 1)) != 0) {
@ -294,12 +304,18 @@ iso_mountfs(devvp, mp, p, argp)
goto out;
}
rootp = (struct iso_directory_record *)pri->root_directory_record;
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);
isomp->logical_block_size = logical_block_size;
isomp->volume_space_size = isonum_733 (pri->volume_space_size);
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);
@ -335,9 +351,9 @@ iso_mountfs(devvp, mp, p, argp)
rootp = (struct iso_directory_record *)bp->b_un.b_addr;
if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) {
argp->flags |= ISOFSMNT_NORRIP;
argp->flags |= ISOFSMNT_NORRIP;
} else {
argp->flags &= ~ISOFSMNT_GENS;
argp->flags &= ~ISOFSMNT_GENS;
}
/*
@ -349,17 +365,22 @@ iso_mountfs(devvp, mp, p, argp)
bp = NULL;
}
isomp->im_flags = argp->flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS|ISOFSMNT_EXTATT);
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;
}
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:
@ -501,7 +522,7 @@ cd9660_statfs(mp, sbp, p)
sbp->f_blocks = isomp->volume_space_size;
sbp->f_bfree = 0; /* total free blocks */
sbp->f_bavail = 0; /* blocks free for non superuser */
sbp->f_files = 0; /* total files */
sbp->f_files = 0; /* total files */
sbp->f_ffree = 0; /* free file nodes */
if (sbp != &mp->mnt_stat) {
bcopy((caddr_t)mp->mnt_stat.f_mntonname,
@ -574,7 +595,7 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
struct iso_mnt *imp;
struct buf *bp;
struct iso_directory_record *dirp;
struct iso_node tip, *ip, *nip;
struct iso_node tip, *ip, *nip;
struct netcred *np;
imp = VFSTOISOFS (mp);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vnops.c 8.3 (Berkeley) 1/23/94
* $Id: cd9660_vnops.c,v 1.9 1994/09/26 00:32:59 gpalmer Exp $
* $Id: cd9660_vnops.c,v 1.10 1994/09/28 16:44:59 dfr Exp $
*/
#include <sys/param.h>
@ -290,7 +290,7 @@ cd9660_ioctl(ap)
struct vop_ioctl_args /* {
struct vnode *a_vp;
int a_command;
caddr_t a_data;
caddr_t a_data;
int a_fflag;
struct ucred *a_cred;
struct proc *a_p;
@ -476,6 +476,7 @@ cd9660_readdir(ap)
struct iso_directory_record *ep;
u_short elen;
int reclen;
int isoflags;
struct iso_mnt *imp;
struct iso_node *ip;
struct buf *bp = NULL;
@ -535,6 +536,8 @@ cd9660_readdir(ap)
(bp->b_un.b_addr + entryoffsetinblock);
reclen = isonum_711 (ep->length);
isoflags = isonum_711(imp->iso_ftype == ISO_FTYPE_HIGH_SIERRA?
&ep->date[6]: ep->flags);
if (reclen == 0) {
/* skip to next block, if any */
idp->curroff = roundup (idp->curroff,
@ -555,7 +558,7 @@ cd9660_readdir(ap)
}
idp->current.d_namlen = isonum_711 (ep->name_len);
if (isonum_711(ep->flags)&2)
if (isoflags & 2)
isodirino(&idp->current.d_fileno,ep,imp);
else
idp->current.d_fileno = dbtob(bp->b_blkno) +
@ -580,7 +583,7 @@ cd9660_readdir(ap)
if (idp->current.d_namlen)
error = iso_uiodir(idp,&idp->current,idp->curroff);
break;
default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 */
default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 || ISO_FTYPE_HIGH_SIERRA*/
strcpy(idp->current.d_name,"..");
switch (ep->name[0]) {
case 0:
@ -595,7 +598,7 @@ cd9660_readdir(ap)
isofntrans(ep->name,idp->current.d_namlen,
idp->current.d_name, &elen,
imp->iso_ftype == ISO_FTYPE_9660,
isonum_711(ep->flags)&4);
isoflags & 4);
idp->current.d_namlen = (u_char)elen;
if (imp->iso_ftype == ISO_FTYPE_DEFAULT)
error = iso_shipdir(idp);
@ -648,8 +651,8 @@ cd9660_readdir(ap)
* But otherwise the block read here is in the block buffer two times.
*/
typedef struct iso_directory_record ISODIR;
typedef struct iso_node ISONODE;
typedef struct iso_mnt ISOMNT;
typedef struct iso_node ISONODE;
typedef struct iso_mnt ISOMNT;
int
cd9660_readlink(ap)
struct vop_readlink_args /* {
@ -659,7 +662,7 @@ cd9660_readlink(ap)
} */ *ap;
{
ISONODE *ip;
ISODIR *dirp;
ISODIR *dirp;
ISOMNT *imp;
struct buf *bp;
u_short symlen;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)iso.h 8.2 (Berkeley) 1/23/94
* $Id: iso.h,v 1.2 1994/08/02 07:41:38 davidg Exp $
* $Id: iso.h,v 1.3 1994/09/09 11:11:01 dfr Exp $
*/
#define ISODCL(from, to) (to - from + 1)
@ -45,7 +45,11 @@ struct iso_volume_descriptor {
char type[ISODCL(1,1)]; /* 711 */
char id[ISODCL(2,6)];
char version[ISODCL(7,7)];
char data[ISODCL(8,2048)];
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 */
@ -53,13 +57,15 @@ struct iso_volume_descriptor {
#define ISO_VD_END 255
#define ISO_STANDARD_ID "CD001"
#define ISO_ECMA_ID "CDW01"
#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)];
char version [ISODCL ( 7, 7)]; /* 711 */
char unused1 [ISODCL ( 8, 8)];
char type [ISODCL ( 1, 1)]; /* 711 */
char id [ISODCL ( 2, 6)];
char version [ISODCL ( 7, 7)]; /* 711 */
char unused1 [ISODCL ( 8, 8)];
char system_id [ISODCL ( 9, 40)]; /* achars */
char volume_id [ISODCL ( 41, 72)]; /* dchars */
char unused2 [ISODCL ( 73, 80)];
@ -92,6 +98,43 @@ struct iso_primary_descriptor {
};
#define ISO_DEFAULT_BLOCK_SIZE 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 */
@ -129,7 +172,8 @@ struct iso_extended_attributes {
};
/* CD-ROM Format type */
enum ISO_FTYPE { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP, ISO_FTYPE_ECMA };
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
@ -153,7 +197,7 @@ struct iso_mnt {
char root[ISODCL (157, 190)];
int root_extent;
int root_size;
enum ISO_FTYPE iso_ftype;
enum ISO_FTYPE iso_ftype;
int rr_skip;
int rr_skip0;