diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1995-05-30 08:16:23 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1995-05-30 08:16:23 +0000 |
commit | c86f0c7a71e7ade3e38b325c186a9cf374e0411e (patch) | |
tree | 176f04f674860c7cfae9ac5d2ff4d4e1d73cb2b7 /sys/fs/cd9660 | |
parent | 423ba8f9bc23d93bfc244aca9b12563b1c9de90d (diff) | |
download | FreeBSD-src-c86f0c7a71e7ade3e38b325c186a9cf374e0411e.zip FreeBSD-src-c86f0c7a71e7ade3e38b325c186a9cf374e0411e.tar.gz |
Remove trailing whitespace.
Diffstat (limited to 'sys/fs/cd9660')
-rw-r--r-- | sys/fs/cd9660/cd9660_lookup.c | 38 | ||||
-rw-r--r-- | sys/fs/cd9660/cd9660_node.c | 70 | ||||
-rw-r--r-- | sys/fs/cd9660/cd9660_rrip.c | 122 | ||||
-rw-r--r-- | sys/fs/cd9660/cd9660_util.c | 8 | ||||
-rw-r--r-- | sys/fs/cd9660/cd9660_vfsops.c | 88 | ||||
-rw-r--r-- | sys/fs/cd9660/cd9660_vnops.c | 84 | ||||
-rw-r--r-- | sys/fs/cd9660/iso.h | 18 |
7 files changed, 214 insertions, 214 deletions
diff --git a/sys/fs/cd9660/cd9660_lookup.c b/sys/fs/cd9660/cd9660_lookup.c index 9ae15f6..e035ce0 100644 --- a/sys/fs/cd9660/cd9660_lookup.c +++ b/sys/fs/cd9660/cd9660_lookup.c @@ -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.5 1994/09/26 00:32:54 gpalmer Exp $ + * $Id: cd9660_lookup.c,v 1.6 1995/01/16 17:03:23 joerg Exp $ */ #include <sys/param.h> @@ -126,7 +126,7 @@ cd9660_lookup(ap) struct ucred *cred = cnp->cn_cred; int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; - + bp = NULL; *vpp = NULL; vdp = ap->a_dvp; @@ -134,7 +134,7 @@ cd9660_lookup(ap) imp = dp->i_mnt; lockparent = flags & LOCKPARENT; wantparent = flags & (LOCKPARENT|WANTPARENT); - + /* * Check accessiblity of directory. */ @@ -142,7 +142,7 @@ cd9660_lookup(ap) return (ENOTDIR); if ((error = VOP_ACCESS(vdp, VEXEC, cred, cnp->cn_proc))) return (error); - + /* * We now have a segment name to search for, and a directory to search. * @@ -197,7 +197,7 @@ cd9660_lookup(ap) vdp = ITOV(dp); *vpp = NULL; } - + len = cnp->cn_namelen; name = cnp->cn_nameptr; /* @@ -208,7 +208,7 @@ cd9660_lookup(ap) len--; name++; } - + /* * If there is cached information on a previous search of * this directory, pick up where we last left off. @@ -236,7 +236,7 @@ cd9660_lookup(ap) iso_nchstats.ncs_2passes++; } endsearch = roundup(dp->i_size, imp->logical_block_size); - + searchloop: while (dp->i_offset < endsearch) { /* @@ -256,7 +256,7 @@ searchloop: */ ep = (struct iso_directory_record *) (bp->b_un.b_addr + entryoffsetinblock); - + reclen = isonum_711 (ep->length); if (reclen == 0) { /* skip to next block, if any */ @@ -264,26 +264,26 @@ searchloop: roundup(dp->i_offset, imp->logical_block_size); continue; } - + if (reclen < ISO_DIRECTORY_RECORD_SIZE) /* illegal entry, stop */ break; - + if (entryoffsetinblock + reclen > imp->logical_block_size) /* entries are not allowed to cross boundaries */ break; - + /* * 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 */ break; - + switch (imp->iso_ftype) { default: if (!(isoflags & 4) == !assoc) { @@ -375,13 +375,13 @@ notfound: if (nameiop == CREATE || nameiop == RENAME) return (EJUSTRETURN); return (ENOENT); - + found: if (numdirpasses == 2) iso_nchstats.ncs_pass2++; if (bp != NULL) brelse(bp); - + /* * Found component in pathname. * If the final component of path name, save information @@ -389,7 +389,7 @@ found: */ if ((flags & ISLASTCN) && nameiop == LOOKUP) dp->i_diroff = dp->i_offset; - + /* * Step through the translation in the name. We do not `iput' the * directory because we may need it again if a symbolic link @@ -435,7 +435,7 @@ found: ISO_IUNLOCK(pdp); *vpp = ITOV(tdp); } - + /* * Insert name into cache if appropriate. */ @@ -461,13 +461,13 @@ iso_blkatoff(ip, offset, bpp) int bsize = iso_blksize(imp,ip,lbn); struct buf *bp; int error; - + if ((error = bread(ITOV(ip),lbn,bsize,NOCRED,&bp))) { brelse(bp); *bpp = 0; return (error); } *bpp = bp; - + return (0); } diff --git a/sys/fs/cd9660/cd9660_node.c b/sys/fs/cd9660/cd9660_node.c index a6292f3..7b321a7 100644 --- a/sys/fs/cd9660/cd9660_node.c +++ b/sys/fs/cd9660/cd9660_node.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94 - * $Id: cd9660_node.c,v 1.9 1995/02/21 18:41:30 bde Exp $ + * $Id: cd9660_node.c,v 1.10 1995/03/16 18:12:15 bde Exp $ */ #include <sys/param.h> @@ -117,7 +117,7 @@ iso_dmap(dev,ino,create) { struct iso_dnode *dp; union iso_dhead *dh; - + dh = &iso_dhead[DNOHASH(dev, ino)]; for (dp = dh->dh_chain[0]; dp != (struct iso_dnode *)dh; @@ -132,7 +132,7 @@ iso_dmap(dev,ino,create) dp->i_dev = dev; dp->i_number = ino; insque(dp,dh); - + return dp; } @@ -142,7 +142,7 @@ iso_dunmap(dev) { struct iso_dnode *dp, *dq; union iso_dhead *dh; - + for (dh = iso_dhead; dh < iso_dhead + DNOHSZ; dh++) { for (dp = dh->dh_chain[0]; dp != (struct iso_dnode *)dh; @@ -184,7 +184,7 @@ iso_iget(xp, ino, relocated, ipp, isodir) union iso_ihead *ih; int error, result; struct iso_mnt *imp; - + ih = &iso_ihead[INOHASH(dev, ino)]; loop: for (ip = ih->ih_chain[0]; @@ -218,7 +218,7 @@ loop: ip->i_devvp = 0; ip->i_diroff = 0; ip->i_lockf = 0; - + /* * Put it onto its hash chain and lock it so that other requests for * this inode will block if they arrive while we are sleeping waiting @@ -234,7 +234,7 @@ loop: ip->i_mnt = imp; ip->i_devvp = imp->im_devvp; VREF(ip->i_devvp); - + if (relocated) { /* * On relocated directories we must @@ -252,13 +252,13 @@ loop: } isodir = (struct iso_directory_record *)bp->b_un.b_addr; } - + ip->iso_extent = isonum_733(isodir->extent); ip->i_size = isonum_733(isodir->size); ip->iso_start = isonum_711(isodir->ext_attr_length) + ip->iso_extent; - + vp = ITOV(ip); - + /* * Setup time stamp, attribute */ @@ -280,12 +280,12 @@ loop: brelse(bp2); if (bp) brelse(bp); - + /* * Initialize the associated vnode */ vp->v_type = IFTOVT(ip->inode.iso_mode); - + if ( vp->v_type == VFIFO ) { vp->v_op = cd9660_fifoop_p; } else if ( vp->v_type == VCHR || vp->v_type == VBLK ) { @@ -321,10 +321,10 @@ loop: ip = iq; } } - + if (ip->iso_extent == imp->root_extent) vp->v_flag |= VROOT; - + *ipp = ip; return 0; } @@ -336,7 +336,7 @@ int iso_iput(ip) register struct iso_node *ip; { - + if ((ip->i_flag & ILOCKED) == 0) panic("iso_iput"); ISO_IUNLOCK(ip); @@ -357,10 +357,10 @@ cd9660_inactive(ap) struct vnode *vp = ap->a_vp; register struct iso_node *ip = VTOI(vp); int error = 0; - + if (prtactive && vp->v_usecount != 0) vprint("cd9660_inactive: pushing active", vp); - + ip->i_flag = 0; /* * If we are done with the inode, reclaim it @@ -382,7 +382,7 @@ cd9660_reclaim(ap) { register struct vnode *vp = ap->a_vp; register struct iso_node *ip = VTOI(vp); - + if (prtactive && vp->v_usecount != 0) vprint("cd9660_reclaim: pushing active", vp); /* @@ -411,7 +411,7 @@ int iso_ilock(ip) register struct iso_node *ip; { - + while (ip->i_flag & ILOCKED) { ip->i_flag |= IWANT; if (ip->i_spare0 == curproc->p_pid) @@ -458,7 +458,7 @@ cd9660_defattr(isodir,inop,bp,ftype) struct iso_mnt *imp; struct iso_extended_attributes *ap = NULL; int off; - + /* 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) { @@ -480,7 +480,7 @@ cd9660_defattr(isodir,inop,bp,ftype) } if (bp) { ap = (struct iso_extended_attributes *)bp->b_un.b_addr; - + if (isonum_711(ap->version) == 1) { if (!(ap->perm[0]&0x40)) inop->inode.iso_mode |= VEXEC >> 6; @@ -522,7 +522,7 @@ cd9660_deftstamp(isodir,inop,bp,ftype) struct iso_mnt *imp; struct iso_extended_attributes *ap = NULL; int off; - + if (!bp && ((imp = inop->i_mnt)->im_flags&ISOFSMNT_EXTATT) && (off = isonum_711(isodir->ext_attr_length))) { @@ -531,7 +531,7 @@ cd9660_deftstamp(isodir,inop,bp,ftype) } if (bp) { ap = (struct iso_extended_attributes *)bp->b_un.b_addr; - + if (ftype != ISO_FTYPE_HIGH_SIERRA && isonum_711(ap->version) == 1) { if (!cd9660_tstamp_conv17(ap->ftime,&inop->inode.iso_atime)) @@ -560,7 +560,7 @@ enum ISO_FTYPE ftype; { int crtime, days; int y, m, d, hour, minute, second, tz; - + y = pi[0] + 1900; m = pi[1]; d = pi[2]; @@ -572,7 +572,7 @@ enum ISO_FTYPE ftype; else /* original high sierra misses timezone data */ tz = 0; - + if (y < 1970) { pu->ts_sec = 0; pu->ts_nsec = 0; @@ -590,7 +590,7 @@ enum ISO_FTYPE ftype; days = 367*(y-1960)-7*(y+(m+9)/12)/4-3*((y+(m+9)/12-1)/100+1)/4+275*m/9+d-239; #endif crtime = ((((days * 24) + hour) * 60 + minute) * 60) + second; - + /* timezone offset is unreliable on some disks */ if (-48 <= tz && tz <= 52) crtime -= tz * 15 * 60; @@ -606,7 +606,7 @@ cd9660_chars2ui(begin,len) int len; { unsigned rc; - + for (rc = 0; --len >= 0;) { rc *= 10; rc += *begin++ - '0'; @@ -620,28 +620,28 @@ cd9660_tstamp_conv17(pi,pu) struct timespec *pu; { unsigned char buf[7]; - + /* year:"0001"-"9999" -> -1900 */ buf[0] = cd9660_chars2ui(pi,4) - 1900; - + /* month: " 1"-"12" -> 1 - 12 */ buf[1] = cd9660_chars2ui(pi + 4,2); - + /* day: " 1"-"31" -> 1 - 31 */ buf[2] = cd9660_chars2ui(pi + 6,2); - + /* hour: " 0"-"23" -> 0 - 23 */ buf[3] = cd9660_chars2ui(pi + 8,2); - + /* minute:" 0"-"59" -> 0 - 59 */ buf[4] = cd9660_chars2ui(pi + 10,2); - + /* 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, ISO_FTYPE_DEFAULT); } diff --git a/sys/fs/cd9660/cd9660_rrip.c b/sys/fs/cd9660/cd9660_rrip.c index 87767ea..dca8983 100644 --- a/sys/fs/cd9660/cd9660_rrip.c +++ b/sys/fs/cd9660/cd9660_rrip.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_rrip.c 8.2 (Berkeley) 1/23/94 - * $Id: cd9660_rrip.c,v 1.5 1994/09/26 00:32:57 gpalmer Exp $ + * $Id: cd9660_rrip.c,v 1.6 1995/01/16 17:03:26 joerg Exp $ */ #include <sys/param.h> @@ -95,13 +95,13 @@ cd9660_rrip_slink(p,ana) register ISO_RRIP_SLINK_COMPONENT *pcompe; int len, wlen, cont; char *outbuf, *inbuf; - + pcomp = (ISO_RRIP_SLINK_COMPONENT *)p->component; pcompe = (ISO_RRIP_SLINK_COMPONENT *)((char *)p + isonum_711(p->h.length)); len = *ana->outlen; outbuf = ana->outbuf; cont = ana->cont; - + /* * Gathering a Symbolic name from each component with path */ @@ -109,7 +109,7 @@ cd9660_rrip_slink(p,ana) pcomp < pcompe; pcomp = (ISO_RRIP_SLINK_COMPONENT *)((char *)pcomp + ISO_RRIP_SLSIZ + isonum_711(pcomp->clen))) { - + if (!cont) { if (len < ana->maxlen) { len++; @@ -117,29 +117,29 @@ cd9660_rrip_slink(p,ana) } } cont = 0; - + inbuf = ".."; wlen = 0; - + switch (*pcomp->cflag) { - + case ISO_SUSP_CFLAG_CURRENT: /* Inserting Current */ wlen = 1; break; - + case ISO_SUSP_CFLAG_PARENT: /* Inserting Parent */ wlen = 2; break; - + case ISO_SUSP_CFLAG_ROOT: /* Inserting slash for ROOT */ /* start over from beginning(?) */ outbuf -= len; len = 0; break; - + case ISO_SUSP_CFLAG_VOLROOT: /* Inserting a mount point i.e. "/cdrom" */ /* same as above */ @@ -148,13 +148,13 @@ cd9660_rrip_slink(p,ana) inbuf = ana->imp->im_mountp->mnt_stat.f_mntonname; wlen = strlen(inbuf); break; - + case ISO_SUSP_CFLAG_HOST: /* Inserting hostname i.e. "kurt.tools.de" */ inbuf = hostname; wlen = hostnamelen; break; - + case ISO_SUSP_CFLAG_CONTINUE: cont = 1; /* fall thru */ @@ -168,7 +168,7 @@ cd9660_rrip_slink(p,ana) wlen = ana->maxlen + 1; break; } - + if (len + wlen > ana->maxlen) { /* indicate error to caller */ ana->cont = 1; @@ -177,16 +177,16 @@ cd9660_rrip_slink(p,ana) *ana->outlen = 0; return 0; } - + bcopy(inbuf,outbuf,wlen); outbuf += wlen; len += wlen; - + } ana->outbuf = outbuf; *ana->outlen = len; ana->cont = cont; - + if (!isonum_711(p->flags)) { ana->fields &= ~ISO_SUSP_SLINK; return ISO_SUSP_SLINK; @@ -205,28 +205,28 @@ cd9660_rrip_altname(p,ana) char *inbuf; int wlen; int cont; - + inbuf = ".."; wlen = 0; cont = 0; - + switch (*p->flags) { case ISO_SUSP_CFLAG_CURRENT: /* Inserting Current */ wlen = 1; break; - + case ISO_SUSP_CFLAG_PARENT: /* Inserting Parent */ wlen = 2; break; - + case ISO_SUSP_CFLAG_HOST: /* Inserting hostname i.e. "kurt.tools.de" */ inbuf = hostname; wlen = hostnamelen; break; - + case ISO_SUSP_CFLAG_CONTINUE: cont = 1; /* fall thru */ @@ -235,13 +235,13 @@ cd9660_rrip_altname(p,ana) wlen = isonum_711(p->h.length) - 5; inbuf = (char *)p + 5; break; - + default: printf("RRIP with incorrect NM flags?\n"); wlen = ana->maxlen + 1; break; } - + if ((*ana->outlen += wlen) > ana->maxlen) { /* treat as no name field */ ana->fields &= ~ISO_SUSP_ALTNAME; @@ -249,10 +249,10 @@ cd9660_rrip_altname(p,ana) *ana->outlen = 0; return 0; } - + bcopy(inbuf,ana->outbuf,wlen); ana->outbuf += wlen; - + if (!cont) { ana->fields &= ~ISO_SUSP_ALTNAME; return ISO_SUSP_ALTNAME; @@ -314,55 +314,55 @@ cd9660_rrip_tstamp(p,ana) ISO_RRIP_ANALYZE *ana; { unsigned char *ptime; - + ptime = p->time; - + /* Check a format of time stamp (7bytes/17bytes) */ if (!(*p->flags&ISO_SUSP_TSTAMP_FORM17)) { if (*p->flags&ISO_SUSP_TSTAMP_CREAT) ptime += 7; - + if (*p->flags&ISO_SUSP_TSTAMP_MODIFY) { 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, 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, ISO_FTYPE_RRIP); else ana->inop->inode.iso_ctime = ana->inop->inode.iso_mtime; - + } else { if (*p->flags&ISO_SUSP_TSTAMP_CREAT) ptime += 17; - + if (*p->flags&ISO_SUSP_TSTAMP_MODIFY) { cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_mtime); ptime += 17; } else bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec)); - + if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) { cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_atime); ptime += 17; } else ana->inop->inode.iso_atime = ana->inop->inode.iso_mtime; - + if (*p->flags&ISO_SUSP_TSTAMP_ATTR) cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_ctime); else ana->inop->inode.iso_ctime = ana->inop->inode.iso_mtime; - + } ana->fields &= ~ISO_SUSP_TSTAMP; return ISO_SUSP_TSTAMP; @@ -385,10 +385,10 @@ cd9660_rrip_device(p,ana) ISO_RRIP_ANALYZE *ana; { unsigned high, low; - + high = isonum_733(p->dev_t_high_l); low = isonum_733(p->dev_t_low_l); - + if ( high == 0 ) { ana->inop->inode.iso_rdev = makedev( major(low), minor(low) ); } else { @@ -410,7 +410,7 @@ cd9660_rrip_idflag(p,ana) /* special handling of RE field */ if (ana->fields&ISO_SUSP_RELDIR) return cd9660_rrip_reldir(p,ana); - + return ISO_SUSP_IDFLAG; } @@ -476,7 +476,7 @@ cd9660_rrip_loop(isodir,ana,table) struct buf *bp = NULL; char *pwhead; int result; - + /* * Note: If name length is odd, * it will be padding 1 byte after the name @@ -484,23 +484,23 @@ cd9660_rrip_loop(isodir,ana,table) pwhead = isodir->name + isonum_711(isodir->name_len); if (!(isonum_711(isodir->name_len)&1)) pwhead++; - + /* 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) pwhead += ana->imp->rr_skip; else pwhead += ana->imp->rr_skip0; - + phead = (ISO_SUSP_HEADER *)pwhead; pend = (ISO_SUSP_HEADER *)((char *)isodir + isonum_711(isodir->length)); - + result = 0; while (1) { ana->iso_ce_len = 0; /* * Note: "pend" should be more than one SUSP header - */ + */ while (pend >= phead + 1) { if (isonum_711(phead->version) == 1) { for (ptable = table; ptable->func; ptable++) { @@ -519,7 +519,7 @@ cd9660_rrip_loop(isodir,ana,table) */ phead = (ISO_SUSP_HEADER *)((char *)phead + isonum_711(phead->length)); } - + if ( ana->fields && ana->iso_ce_len ) { if (ana->iso_ce_blk >= ana->imp->volume_space_size || ana->iso_ce_off + ana->iso_ce_len > ana->imp->logical_block_size @@ -542,7 +542,7 @@ cd9660_rrip_loop(isodir,ana,table) for (ptable = table; ptable->func2; ptable++) if (!(ptable->result&result)) ptable->func2(isodir,ana); - + return result; } @@ -563,17 +563,17 @@ cd9660_rrip_analyze(isodir,inop,imp) struct iso_mnt *imp; { ISO_RRIP_ANALYZE analyze; - + analyze.inop = inop; analyze.imp = imp; analyze.fields = ISO_SUSP_ATTR|ISO_SUSP_TSTAMP|ISO_SUSP_DEVICE; - + return cd9660_rrip_loop(isodir,&analyze,rrip_table_analyze); } -/* - * Get Alternate Name from 'AL' record - * If either no AL record or 0 length, +/* + * Get Alternate Name from 'AL' record + * If either no AL record or 0 length, * it will be return the translated ISO9660 name, */ static RRIP_TABLE rrip_table_getname[] = { @@ -597,7 +597,7 @@ cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp) { ISO_RRIP_ANALYZE analyze; RRIP_TABLE *tab; - + analyze.outbuf = outbuf; analyze.outlen = outlen; analyze.maxlen = NAME_MAX; @@ -605,21 +605,21 @@ cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp) analyze.imp = imp; analyze.fields = ISO_SUSP_ALTNAME|ISO_SUSP_RELDIR|ISO_SUSP_CLINK|ISO_SUSP_PLINK; *outlen = 0; - + tab = rrip_table_getname; if (*isodir->name == 0 || *isodir->name == 1) { cd9660_rrip_defname(isodir,&analyze); - + analyze.fields &= ~ISO_SUSP_ALTNAME; tab++; } - + return cd9660_rrip_loop(isodir,&analyze,tab); } -/* - * Get Symbolic Name from 'SL' record +/* + * Get Symbolic Name from 'SL' record * * Note: isodir should contains SL record! */ @@ -639,7 +639,7 @@ cd9660_rrip_getsymname(isodir,outbuf,outlen,imp) struct iso_mnt *imp; { ISO_RRIP_ANALYZE analyze; - + analyze.outbuf = outbuf; analyze.outlen = outlen; *outlen = 0; @@ -647,7 +647,7 @@ cd9660_rrip_getsymname(isodir,outbuf,outlen,imp) analyze.cont = 1; /* don't start with a slash */ analyze.imp = imp; analyze.fields = ISO_SUSP_SLINK; - + return (cd9660_rrip_loop(isodir,&analyze,rrip_table_getsymname)&ISO_SUSP_SLINK); } @@ -669,7 +669,7 @@ cd9660_rrip_offset(isodir,imp) { ISO_RRIP_OFFSET *p; ISO_RRIP_ANALYZE analyze; - + imp->rr_skip0 = 0; p = (ISO_RRIP_OFFSET *)(isodir->name + 1); if (bcmp(p,"SP\7\1\276\357",6)) { @@ -679,11 +679,11 @@ cd9660_rrip_offset(isodir,imp) if (bcmp(p,"SP\7\1\276\357",6)) return -1; } - + analyze.imp = imp; analyze.fields = ISO_SUSP_EXTREF; if (!(cd9660_rrip_loop(isodir,&analyze,rrip_table_extref)&ISO_SUSP_EXTREF)) return -1; - + return isonum_711(p->skip); } diff --git a/sys/fs/cd9660/cd9660_util.c b/sys/fs/cd9660/cd9660_util.c index 52a80d7..3d58e4e 100644 --- a/sys/fs/cd9660/cd9660_util.c +++ b/sys/fs/cd9660/cd9660_util.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_util.c 8.1 (Berkeley) 1/21/94 - * $Id$ + * $Id: cd9660_util.c,v 1.3 1994/08/02 07:41:31 davidg Exp $ */ #include <sys/param.h> @@ -159,7 +159,7 @@ isofncmp(unsigned char *fn,int fnlen,unsigned char *isofn,int isolen) { int i, j; unsigned char c; - + while (--fnlen >= 0) { if (--isolen < 0) return *fn; @@ -216,14 +216,14 @@ isofntrans(unsigned char *infn,int infnlen, int original,int assoc) { int fnidx = 0; - + if (assoc) { *outfn++ = ASSOCCHAR; fnidx++; } for (; fnidx < infnlen; fnidx++) { char c = *infn++; - + if (!original && c >= 'A' && c <= 'Z') *outfn++ = c + ('a' - 'A'); else if (!original && c == '.' && *infn == ';') diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 8fc30a8..afa08f4 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_vfsops.c 8.3 (Berkeley) 1/31/94 - * $Id: cd9660_vfsops.c,v 1.11 1995/03/16 20:23:24 wollman Exp $ + * $Id: cd9660_vfsops.c,v 1.12 1995/05/19 03:25:35 davidg Exp $ */ #include <sys/param.h> @@ -92,7 +92,7 @@ cd9660_mountroot() u_int size; int error; struct iso_args args; - + /* * Get vnode for rootdev. */ @@ -152,13 +152,13 @@ cd9660_mount(mp, path, data, ndp, p) u_int size; int error; struct iso_mnt *imp = 0; - + if ((error = copyin(data, (caddr_t)&args, sizeof (struct iso_args)))) return (error); - + if ((mp->mnt_flag & MNT_RDONLY) == 0) return (EROFS); - + /* * If updating, check whether changing from read-only to * read/write; if there is no device name, that's all we do. @@ -233,10 +233,10 @@ iso_mountfs(devvp, mp, p, argp) struct iso_sierra_primary_descriptor *pri_sierra; struct iso_directory_record *rootp; int logical_block_size; - + if (!ronly) return EROFS; - + /* * Disallow multiple mounts of the same device. * Disallow mounting of a device that is currently in use @@ -253,18 +253,18 @@ iso_mountfs(devvp, mp, p, argp) if ((error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p))) return error; needclose = 1; - + /* This is the "logical sector size". The standard says this * should be 2048 or the physical sector size on the device, * whichever is greater. For now, we'll just use a constant. */ iso_bsize = ISO_DEFAULT_BLOCK_SIZE; - + for (iso_blknum = 16; iso_blknum < 100; iso_blknum++) { if ((error = bread (devvp, btodb(iso_blknum * iso_bsize), iso_bsize, NOCRED, &bp))) goto out; - + 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, @@ -274,41 +274,41 @@ 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) 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 || (logical_block_size & (logical_block_size - 1)) != 0) { error = EINVAL; goto out; } - + 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; @@ -319,16 +319,16 @@ iso_mountfs(devvp, mp, p, argp) bcopy (rootp, isomp->root, sizeof isomp->root); isomp->root_extent = isonum_733 (rootp->extent); 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++; - + bp->b_flags |= B_AGE; brelse(bp); bp = NULL; - + mp->mnt_data = (qaddr_t)isomp; mp->mnt_stat.f_fsid.val[0] = (long)dev; mp->mnt_stat.f_fsid.val[1] = MOUNT_CD9660; @@ -337,9 +337,9 @@ iso_mountfs(devvp, mp, p, argp) isomp->im_mountp = mp; isomp->im_dev = dev; isomp->im_devvp = devvp; - + devvp->v_specflags |= SI_MOUNTEDON; - + /* Check the Rock Ridge Extention support */ if (!(argp->flags & ISOFSMNT_NORRIP)) { if ((error = bread (isomp->im_devvp, @@ -347,15 +347,15 @@ iso_mountfs(devvp, mp, p, argp) * isomp->logical_block_size / DEV_BSIZE, isomp->logical_block_size,NOCRED,&bp))) goto out; - + rootp = (struct iso_directory_record *)bp->b_un.b_addr; - + if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) { argp->flags |= ISOFSMNT_NORRIP; } else { argp->flags &= ~ISOFSMNT_GENS; } - + /* * The contents are valid, * but they will get reread as part of another vnode, so... @@ -381,7 +381,7 @@ iso_mountfs(devvp, mp, p, argp) isomp->iso_ftype = ISO_FTYPE_RRIP; break; } - + return 0; out: if (bp) @@ -420,7 +420,7 @@ cd9660_unmount(mp, mntflags, p) { register struct iso_mnt *isomp; int error, flags = 0; - + if (mntflags & MNT_FORCE) { if (!iso_doforce) return (EINVAL); @@ -440,7 +440,7 @@ cd9660_unmount(mp, mntflags, p) if (isomp->iso_ftype == ISO_FTYPE_RRIP) iso_dunmap(isomp->im_dev); #endif - + isomp->im_devvp->v_specflags &= ~SI_MOUNTEDON; error = VOP_CLOSE(isomp->im_devvp, FREAD, NOCRED, p); vrele(isomp->im_devvp); @@ -464,7 +464,7 @@ cd9660_root(mp, vpp) int error; struct iso_mnt *imp = VFSTOISOFS (mp); struct iso_directory_record *dp; - + tvp.v_mount = mp; tvp.v_data = &tip; ip = VTOI(&tvp); @@ -473,7 +473,7 @@ cd9660_root(mp, vpp) ip->i_diroff = 0; dp = (struct iso_directory_record *)imp->root; isodirino(&ip->i_number,dp,imp); - + /* * With RRIP we must use the `.' entry of the root directory. * Simply tell iget, that it's a relocated directory. @@ -513,9 +513,9 @@ cd9660_statfs(mp, sbp, p) struct proc *p; { register struct iso_mnt *isomp; - + isomp = VFSTOISOFS(mp); - + sbp->f_type = MOUNT_CD9660; sbp->f_bsize = isomp->logical_block_size; sbp->f_iosize = sbp->f_bsize; /* XXX */ @@ -597,15 +597,15 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) struct iso_directory_record *dirp; struct iso_node tip, *ip, *nip; struct netcred *np; - + imp = VFSTOISOFS (mp); ifhp = (struct ifid *)fhp; - + #ifdef ISOFS_DBG printf("fhtovp: ino %d, start %ld\n", ifhp->ifid_ino, ifhp->ifid_start); #endif - + np = vfs_export_lookup(mp, &imp->im_export, nam); if (np == NULL) return (EACCES); @@ -615,14 +615,14 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) printf("fhtovp: lbn exceed volume space %d\n", lbn); return (ESTALE); } - + off = iso_blkoff(imp, ifhp->ifid_ino); if (off + ISO_DIRECTORY_RECORD_SIZE > imp->logical_block_size) { printf("fhtovp: crosses block boundary %d\n", off + ISO_DIRECTORY_RECORD_SIZE); return (ESTALE); } - + error = bread(imp->im_devvp, btodb(lbn * imp->logical_block_size), imp->logical_block_size, NOCRED, &bp); if (error) { @@ -630,7 +630,7 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) brelse(bp); return (error); } - + dirp = (struct iso_directory_record *)(bp->b_un.b_addr + off); if (off + isonum_711(dirp->length) > imp->logical_block_size) { brelse(bp); @@ -639,7 +639,7 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) isonum_711(dirp->length)); return (ESTALE); } - + if (isonum_733(dirp->extent) + isonum_711(dirp->ext_attr_length) != ifhp->ifid_start) { brelse(bp); @@ -649,7 +649,7 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) return (ESTALE); } brelse(bp); - + ip = &tip; tvp.v_mount = mp; tvp.v_data = ip; @@ -687,13 +687,13 @@ cd9660_vptofh(vp, fhp) { register struct iso_node *ip = VTOI(vp); register struct ifid *ifhp; - + ifhp = (struct ifid *)fhp; ifhp->ifid_len = sizeof(struct ifid); - + ifhp->ifid_ino = ip->i_number; ifhp->ifid_start = ip->iso_start; - + #ifdef ISOFS_DBG printf("vptofh: ino %d, start %ld\n", ifhp->ifid_ino,ifhp->ifid_start); diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 5e403e3..3b538a8 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_vnops.c 8.3 (Berkeley) 1/23/94 - * $Id: cd9660_vnops.c,v 1.12 1995/02/13 06:12:32 phk Exp $ + * $Id: cd9660_vnops.c,v 1.13 1995/03/28 07:46:38 phk Exp $ */ #include <sys/param.h> @@ -81,10 +81,10 @@ cd9660_mknod(ndp, vap, cred, p) struct iso_node *ip; struct iso_dnode *dp; int error; - + vp = ndp->ni_vp; ip = VTOI(vp); - + if (ip->i_mnt->iso_ftype != ISO_FTYPE_RRIP || vap->va_type != vp->v_type || (vap->va_type != VCHR && vap->va_type != VBLK)) { @@ -93,7 +93,7 @@ cd9660_mknod(ndp, vap, cred, p) vput(ndp->ni_vp); return EINVAL; } - + dp = iso_dmap(ip->i_dev,ip->i_number,1); if (ip->inode.iso_rdev == vap->va_rdev || vap->va_rdev == VNOVAL) { /* same as the unmapped one, delete the mapping */ @@ -102,7 +102,7 @@ cd9660_mknod(ndp, vap, cred, p) } else /* enter new mapping */ dp->d_dev = vap->va_rdev; - + /* * Remove inode so that it will be reloaded by iget and * checked to see if it is an alias of an existing entry @@ -237,7 +237,7 @@ cd9660_read(ap) off_t diff; int rasize, error = 0; long size, n, on; - + if (uio->uio_resid == 0) return (0); if (uio->uio_offset < 0) @@ -260,7 +260,7 @@ cd9660_read(ap) if (iso_lblktosize(imp, rablock) <= ip->i_size) error = cluster_read(vp, (off_t)ip->i_size, lbn, size, NOCRED, &bp); - else + else error = bread(vp, lbn, size, NOCRED, &bp); } else { if (vp->v_lastr + 1 == lbn && @@ -380,25 +380,25 @@ iso_uiodir(idp,dp,off) off_t off; { int error; - + dp->d_name[dp->d_namlen] = 0; dp->d_reclen = DIRSIZ(dp); - + if (idp->uio->uio_resid < dp->d_reclen) { idp->eof = 0; return -1; } - + if (idp->cookiep) { if (idp->ncookies <= 0) { idp->eof = 0; return -1; } - + *idp->cookiep++ = off; --idp->ncookies; } - + if ((error = uiomove((caddr_t)dp,dp->d_reclen,idp->uio))) return error; idp->uio_off = off; @@ -413,7 +413,7 @@ iso_shipdir(idp) int cl, sl, assoc; int error; char *cname, *sname; - + cl = idp->current.d_namlen; cname = idp->current.d_name; assoc = (cl > 1) && (*cname == ASSOCCHAR); @@ -421,7 +421,7 @@ assoc = (cl > 1) && (*cname == ASSOCCHAR); cl--; cname++; } - + dp = &idp->saveent; sname = dp->d_name; if (!(sl = dp->d_namlen)) { @@ -483,10 +483,10 @@ cd9660_readdir(ap) u_short tmplen; int ncookies = 0; u_int *cookies = NULL; - + ip = VTOI(ap->a_vp); imp = ip->i_mnt; - + MALLOC(idp,struct isoreaddir *,sizeof(*idp),M_TEMP,M_WAITOK); idp->saveent.d_namlen = 0; idp->assocent.d_namlen = 0; @@ -503,7 +503,7 @@ cd9660_readdir(ap) idp->cookiep = 0; idp->eof = 0; idp->curroff = uio->uio_offset; - + entryoffsetinblock = iso_blkoff(imp, idp->curroff); if (entryoffsetinblock != 0) { if ((error = iso_blkatoff(ip, idp->curroff, &bp))) { @@ -511,16 +511,16 @@ cd9660_readdir(ap) return (error); } } - + endsearch = ip->i_size; - + while (idp->curroff < endsearch) { /* * If offset is on a block boundary, * read the next directory block. * Release previous if it exists. */ - + if (iso_blkoff(imp, idp->curroff) == 0) { if (bp != NULL) brelse(bp); @@ -531,10 +531,10 @@ cd9660_readdir(ap) /* * Get pointer to next entry. */ - + ep = (struct iso_directory_record *) (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); @@ -544,19 +544,19 @@ cd9660_readdir(ap) imp->logical_block_size); continue; } - + if (reclen < ISO_DIRECTORY_RECORD_SIZE) { error = EINVAL; /* illegal entry, stop */ break; } - + if (entryoffsetinblock + reclen > imp->logical_block_size) { error = EINVAL; /* illegal directory, so stop looking */ break; } - + /* XXX: be more intelligent if we can */ idp->current.d_type = DT_UNKNOWN; @@ -566,13 +566,13 @@ cd9660_readdir(ap) else idp->current.d_fileno = dbtob(bp->b_blkno) + idp->curroff; - + if (reclen < ISO_DIRECTORY_RECORD_SIZE + idp->current.d_namlen) { error = EINVAL; /* illegal entry, stop */ break; } - + idp->curroff += reclen; /* * @@ -612,10 +612,10 @@ cd9660_readdir(ap) } if (error) break; - + entryoffsetinblock += reclen; } - + if (!error && imp->iso_ftype == ISO_FTYPE_DEFAULT) { idp->current.d_namlen = 0; error = iso_shipdir(idp); @@ -634,16 +634,16 @@ cd9660_readdir(ap) *ap->a_cookies = cookies; } } - + if (bp) brelse (bp); uio->uio_offset = idp->uio_off; if (ap->a_eofflag) *ap->a_eofflag = idp->eof; - + FREE(idp,M_TEMP); - + return (error); } @@ -665,19 +665,19 @@ cd9660_readlink(ap) } */ *ap; { ISONODE *ip; - ISODIR *dirp; + ISODIR *dirp; ISOMNT *imp; struct buf *bp; u_short symlen; int error; char *symname; - + ip = VTOI(ap->a_vp); imp = ip->i_mnt; - + if (imp->iso_ftype != ISO_FTYPE_RRIP) return EINVAL; - + /* * Get parents directory record block that this inode included. */ @@ -706,7 +706,7 @@ cd9660_readlink(ap) ip->i_number, ip->i_number & imp->im_bmask ); #endif - + /* * Just make sure, we have a right one.... * 1: Check not cross boundary on block @@ -716,13 +716,13 @@ cd9660_readlink(ap) brelse(bp); return EINVAL; } - + /* * Now get a buffer * Abuse a namei buffer for now. */ MALLOC(symname,char *,MAXPATHLEN,M_NAMEI,M_WAITOK); - + /* * Ok, we just gathering a symbolic name in SL record. */ @@ -735,14 +735,14 @@ cd9660_readlink(ap) * Don't forget before you leave from home ;-) */ brelse(bp); - + /* * return with the symbolic name to caller's. */ error = uiomove(symname,symlen,ap->a_uio); - + FREE(symname,M_NAMEI); - + return error; } diff --git a/sys/fs/cd9660/iso.h b/sys/fs/cd9660/iso.h index 858dbb3..406572e 100644 --- a/sys/fs/cd9660/iso.h +++ b/sys/fs/cd9660/iso.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)iso.h 8.2 (Berkeley) 1/23/94 - * $Id: iso.h,v 1.3 1994/09/09 11:11:01 dfr Exp $ + * $Id: iso.h,v 1.4 1995/01/16 17:03:29 joerg Exp $ */ #define ISODCL(from, to) (to - from + 1) @@ -189,16 +189,16 @@ struct iso_mnt { int logical_block_size; int im_bshift; int im_bmask; - + int volume_space_size; char im_fsmnt[50]; struct netexport im_export; - + char root[ISODCL (157, 190)]; int root_extent; int root_size; enum ISO_FTYPE iso_ftype; - + int rr_skip; int rr_skip0; }; @@ -228,13 +228,13 @@ int cd9660_vptofh __P((struct vnode *, struct fid *)); int cd9660_init __P(()); struct iso_node; -int iso_blkatoff __P((struct iso_node *ip, long offset, struct buf **bpp)); +int iso_blkatoff __P((struct iso_node *ip, long offset, struct buf **bpp)); int iso_iget __P((struct iso_node *xp, ino_t ino, int relocated, struct iso_node **ipp, struct iso_directory_record *isodir)); -int iso_iput __P((struct iso_node *ip)); -int iso_ilock __P((struct iso_node *ip)); -int iso_iunlock __P((struct iso_node *ip)); -int cd9660_mountroot __P((void)); +int iso_iput __P((struct iso_node *ip)); +int iso_ilock __P((struct iso_node *ip)); +int iso_iunlock __P((struct iso_node *ip)); +int cd9660_mountroot __P((void)); extern int (**cd9660_vnodeop_p)(); |