b_un.b_addr -> b_data

This commit is contained in:
mycroft 1994-06-14 23:54:44 +00:00
parent 0ae2853c67
commit 39f627ae40
5 changed files with 97 additions and 73 deletions

View File

@ -37,7 +37,7 @@
* *
* from: @(#)ufs_lookup.c 7.33 (Berkeley) 5/19/91 * from: @(#)ufs_lookup.c 7.33 (Berkeley) 5/19/91
* from: @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94 * from: @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94
* $Id: cd9660_lookup.c,v 1.1 1994/06/08 11:22:49 mycroft Exp $ * $Id: cd9660_lookup.c,v 1.2 1994/06/14 23:54:44 mycroft Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -250,7 +250,7 @@ searchloop:
* Get pointer to next entry. * Get pointer to next entry.
*/ */
ep = (struct iso_directory_record *) ep = (struct iso_directory_record *)
(bp->b_un.b_addr + entryoffsetinblock); (bp->b_data + entryoffsetinblock);
reclen = isonum_711 (ep->length); reclen = isonum_711 (ep->length);
if (reclen == 0) { if (reclen == 0) {
@ -341,8 +341,8 @@ foundino:
if (error = iso_blkatoff(dp, saveoffset, &bp)) if (error = iso_blkatoff(dp, saveoffset, &bp))
return (error); return (error);
} }
ep = (struct iso_directory_record *)(bp->b_un.b_addr ep = (struct iso_directory_record *)
+ iso_blkoff(imp,saveoffset)); (bp->b_data + iso_blkoff(imp,saveoffset));
dp->i_offset = saveoffset; dp->i_offset = saveoffset;
} }
goto found; goto found;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94 * from: @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94
* $Id: cd9660_node.c,v 1.1 1994/06/08 11:22:51 mycroft Exp $ * $Id: cd9660_node.c,v 1.2 1994/06/14 23:55:04 mycroft Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -248,7 +248,7 @@ loop:
*ipp = 0; *ipp = 0;
return error; return error;
} }
isodir = (struct iso_directory_record *)bp->b_un.b_addr; isodir = (struct iso_directory_record *)bp->b_data;
} }
ip->iso_extent = isonum_733(isodir->extent); ip->iso_extent = isonum_733(isodir->extent);
@ -478,7 +478,7 @@ cd9660_defattr(isodir,inop,bp)
bp = bp2; bp = bp2;
} }
if (bp) { if (bp) {
ap = (struct iso_extended_attributes *)bp->b_un.b_addr; ap = (struct iso_extended_attributes *)bp->b_data;
if (isonum_711(ap->version) == 1) { if (isonum_711(ap->version) == 1) {
if (!(ap->perm[0]&0x40)) if (!(ap->perm[0]&0x40))
@ -528,7 +528,7 @@ cd9660_deftstamp(isodir,inop,bp)
bp = bp2; bp = bp2;
} }
if (bp) { if (bp) {
ap = (struct iso_extended_attributes *)bp->b_un.b_addr; ap = (struct iso_extended_attributes *)bp->b_data;
if (isonum_711(ap->version) == 1) { if (isonum_711(ap->version) == 1) {
if (!cd9660_tstamp_conv17(ap->ftime,&inop->inode.iso_atime)) if (!cd9660_tstamp_conv17(ap->ftime,&inop->inode.iso_atime))

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)cd9660_rrip.c 8.2 (Berkeley) 1/23/94 * from: @(#)cd9660_rrip.c 8.2 (Berkeley) 1/23/94
* $Id: cd9660_rrip.c,v 1.1 1994/06/08 11:22:53 mycroft Exp $ * $Id: cd9660_rrip.c,v 1.2 1994/06/14 23:55:25 mycroft Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -529,7 +529,7 @@ cd9660_rrip_loop(isodir,ana,table)
ana->imp->logical_block_size,NOCRED,&bp)) ana->imp->logical_block_size,NOCRED,&bp))
/* what to do now? */ /* what to do now? */
break; break;
phead = (ISO_SUSP_HEADER *)(bp->b_un.b_addr + ana->iso_ce_off); phead = (ISO_SUSP_HEADER *)(bp->b_data + ana->iso_ce_off);
pend = (ISO_SUSP_HEADER *) ((char *)phead + ana->iso_ce_len); pend = (ISO_SUSP_HEADER *) ((char *)phead + ana->iso_ce_len);
} else } else
break; break;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)cd9660_vfsops.c 8.3 (Berkeley) 1/31/94 * from: @(#)cd9660_vfsops.c 8.3 (Berkeley) 1/31/94
* $Id: cd9660_vfsops.c,v 1.1 1994/06/08 11:22:57 mycroft Exp $ * $Id: cd9660_vfsops.c,v 1.2 1994/06/14 23:55:44 mycroft Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -263,7 +263,7 @@ static iso_mountfs(devvp, mp, p, argp)
iso_bsize, NOCRED, &bp)) iso_bsize, NOCRED, &bp))
goto out; goto out;
vdp = (struct iso_volume_descriptor *)bp->b_un.b_addr; vdp = (struct iso_volume_descriptor *)bp->b_data;
if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) { if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) {
error = EINVAL; error = EINVAL;
goto out; goto out;
@ -332,7 +332,7 @@ static iso_mountfs(devvp, mp, p, argp)
isomp->logical_block_size,NOCRED,&bp)) isomp->logical_block_size,NOCRED,&bp))
goto out; goto out;
rootp = (struct iso_directory_record *)bp->b_un.b_addr; rootp = (struct iso_directory_record *)bp->b_data;
if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) { if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) {
argp->flags |= ISOFSMNT_NORRIP; argp->flags |= ISOFSMNT_NORRIP;
@ -616,7 +616,7 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
return (error); return (error);
} }
dirp = (struct iso_directory_record *)(bp->b_un.b_addr + off); dirp = (struct iso_directory_record *)(bp->b_data + off);
if (off + isonum_711(dirp->length) > imp->logical_block_size) { if (off + isonum_711(dirp->length) > imp->logical_block_size) {
brelse(bp); brelse(bp);
printf("fhtovp: directory crosses block boundary %d[off=%d/len=%d]\n", printf("fhtovp: directory crosses block boundary %d[off=%d/len=%d]\n",

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)cd9660_vnops.c 8.3 (Berkeley) 1/23/94 * from: @(#)cd9660_vnops.c 8.3 (Berkeley) 1/23/94
* $Id: cd9660_vnops.c,v 1.1 1994/06/08 11:22:58 mycroft Exp $ * $Id: cd9660_vnops.c,v 1.2 1994/06/14 23:56:02 mycroft Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -81,10 +81,10 @@ cd9660_mknod(ndp, vap, cred, p)
struct iso_node *ip; struct iso_node *ip;
struct iso_dnode *dp; struct iso_dnode *dp;
int error; int error;
vp = ndp->ni_vp; vp = ndp->ni_vp;
ip = VTOI(vp); ip = VTOI(vp);
if (ip->i_mnt->iso_ftype != ISO_FTYPE_RRIP if (ip->i_mnt->iso_ftype != ISO_FTYPE_RRIP
|| vap->va_type != vp->v_type || vap->va_type != vp->v_type
|| (vap->va_type != VCHR && vap->va_type != VBLK)) { || (vap->va_type != VCHR && vap->va_type != VBLK)) {
@ -93,7 +93,7 @@ cd9660_mknod(ndp, vap, cred, p)
vput(ndp->ni_vp); vput(ndp->ni_vp);
return (EINVAL); return (EINVAL);
} }
dp = iso_dmap(ip->i_dev,ip->i_number,1); dp = iso_dmap(ip->i_dev,ip->i_number,1);
if (ip->inode.iso_rdev == vap->va_rdev || vap->va_rdev == VNOVAL) { if (ip->inode.iso_rdev == vap->va_rdev || vap->va_rdev == VNOVAL) {
/* same as the unmapped one, delete the mapping */ /* same as the unmapped one, delete the mapping */
@ -102,7 +102,7 @@ cd9660_mknod(ndp, vap, cred, p)
} else } else
/* enter new mapping */ /* enter new mapping */
dp->d_dev = vap->va_rdev; dp->d_dev = vap->va_rdev;
/* /*
* Remove inode so that it will be reloaded by iget and * Remove inode so that it will be reloaded by iget and
* checked to see if it is an alias of an existing entry * checked to see if it is an alias of an existing entry
@ -166,26 +166,50 @@ cd9660_access(ap)
struct proc *a_p; struct proc *a_p;
} */ *ap; } */ *ap;
{ {
register struct iso_node *ip = VTOI(ap->a_vp); struct iso_node *ip = VTOI(ap->a_vp);
register int mode = ap->a_mode;
struct ucred *cred = ap->a_cred; struct ucred *cred = ap->a_cred;
register gid_t *gp; mode_t mask, mode = ap->a_mode;
gid_t *gp;
int i; int i;
/* User id 0 always gets access. */
if (cred->cr_uid == 0) if (cred->cr_uid == 0)
return (0); return (0);
if (cred->cr_uid != ip->inode.iso_uid) { mask = 0;
mode >>= 3;
gp = cred->cr_groups; /* Otherwise, check the owner. */
for (i = 0; i < cred->cr_ngroups; i++, gp++) if (cred->cr_uid == ip->inode.iso_uid) {
if (ip->inode.iso_gid == *gp) if (mode & VEXEC)
goto found; mask |= S_IXUSR;
mode >>= 3; if (mode & VREAD)
found: mask |= S_IRUSR;
if (mode & VWRITE)
mask |= S_IWUSR;
return ((ip->inode.iso_mode & mask) == mask ? 0 : EACCES);
} }
return ((ip->inode.iso_mode & mode) == mode ? 0 : EACCES); /* Otherwise, check the groups. */
for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++)
if (ip->inode.iso_gid == *gp) {
if (mode & VEXEC)
mask |= S_IXGRP;
if (mode & VREAD)
mask |= S_IRGRP;
if (mode & VWRITE)
mask |= S_IWGRP;
return ((ip->inode.iso_mode & mask) == mask ?
0 : EACCES);
}
/* Otherwise, check everyone else. */
if (mode & VEXEC)
mask |= S_IXOTH;
if (mode & VREAD)
mask |= S_IROTH;
if (mode & VWRITE)
mask |= S_IWOTH;
return ((ip->inode.iso_mode & mask) == mask ? 0 : EACCES);
} }
cd9660_getattr(ap) cd9660_getattr(ap)
@ -254,7 +278,7 @@ cd9660_read(ap)
off_t diff; off_t diff;
int rasize, error = 0; int rasize, error = 0;
long size, n, on; long size, n, on;
if (uio->uio_resid == 0) if (uio->uio_resid == 0)
return (0); return (0);
if (uio->uio_offset < 0) if (uio->uio_offset < 0)
@ -277,7 +301,7 @@ cd9660_read(ap)
if (iso_lblktosize(imp, rablock) <= ip->i_size) if (iso_lblktosize(imp, rablock) <= ip->i_size)
error = cluster_read(vp, (off_t)ip->i_size, error = cluster_read(vp, (off_t)ip->i_size,
lbn, size, NOCRED, &bp); lbn, size, NOCRED, &bp);
else else
error = bread(vp, lbn, size, NOCRED, &bp); error = bread(vp, lbn, size, NOCRED, &bp);
} else { } else {
if (vp->v_lastr + 1 == lbn && if (vp->v_lastr + 1 == lbn &&
@ -295,7 +319,7 @@ cd9660_read(ap)
return (error); return (error);
} }
error = uiomove(bp->b_un.b_addr + on, (int)n, uio); error = uiomove(bp->b_data + on, (int)n, uio);
if (n + on == imp->logical_block_size || if (n + on == imp->logical_block_size ||
uio->uio_offset == (off_t)ip->i_size) uio->uio_offset == (off_t)ip->i_size)
bp->b_flags |= B_AGE; bp->b_flags |= B_AGE;
@ -400,25 +424,25 @@ iso_uiodir(idp,dp,off)
off_t off; off_t off;
{ {
int error; int error;
dp->d_name[dp->d_namlen] = 0; dp->d_name[dp->d_namlen] = 0;
dp->d_reclen = DIRSIZ(dp); dp->d_reclen = DIRSIZ(dp);
if (idp->uio->uio_resid < dp->d_reclen) { if (idp->uio->uio_resid < dp->d_reclen) {
idp->eofflag = 0; idp->eofflag = 0;
return (-1); return (-1);
} }
if (idp->cookies) { if (idp->cookies) {
if (idp->ncookies <= 0) { if (idp->ncookies <= 0) {
idp->eofflag = 0; idp->eofflag = 0;
return (-1); return (-1);
} }
*idp->cookies++ = off; *idp->cookies++ = off;
--idp->ncookies; --idp->ncookies;
} }
if (error = uiomove(dp,dp->d_reclen,idp->uio)) if (error = uiomove(dp,dp->d_reclen,idp->uio))
return (error); return (error);
idp->uio_off = off; idp->uio_off = off;
@ -433,14 +457,14 @@ iso_shipdir(idp)
int cl, sl, assoc; int cl, sl, assoc;
int error; int error;
char *cname, *sname; char *cname, *sname;
cl = idp->current.d_namlen; cl = idp->current.d_namlen;
cname = idp->current.d_name; cname = idp->current.d_name;
if (assoc = cl > 1 && *cname == ASSOCCHAR) { if (assoc = cl > 1 && *cname == ASSOCCHAR) {
cl--; cl--;
cname++; cname++;
} }
dp = &idp->saveent; dp = &idp->saveent;
sname = dp->d_name; sname = dp->d_name;
if (!(sl = dp->d_namlen)) { if (!(sl = dp->d_namlen)) {
@ -501,10 +525,10 @@ cd9660_readdir(ap)
struct iso_mnt *imp; struct iso_mnt *imp;
struct iso_node *ip; struct iso_node *ip;
struct buf *bp = NULL; struct buf *bp = NULL;
ip = VTOI(ap->a_vp); ip = VTOI(ap->a_vp);
imp = ip->i_mnt; imp = ip->i_mnt;
MALLOC(idp,struct isoreaddir *,sizeof(*idp),M_TEMP,M_WAITOK); MALLOC(idp,struct isoreaddir *,sizeof(*idp),M_TEMP,M_WAITOK);
idp->saveent.d_namlen = 0; idp->saveent.d_namlen = 0;
idp->assocent.d_namlen = 0; idp->assocent.d_namlen = 0;
@ -513,7 +537,7 @@ cd9660_readdir(ap)
idp->cookies = ap->a_cookies; idp->cookies = ap->a_cookies;
idp->ncookies = ap->a_ncookies; idp->ncookies = ap->a_ncookies;
idp->curroff = uio->uio_offset; idp->curroff = uio->uio_offset;
entryoffsetinblock = iso_blkoff(imp, idp->curroff); entryoffsetinblock = iso_blkoff(imp, idp->curroff);
if (entryoffsetinblock != 0) { if (entryoffsetinblock != 0) {
if (error = iso_blkatoff(ip, idp->curroff, &bp)) { if (error = iso_blkatoff(ip, idp->curroff, &bp)) {
@ -521,16 +545,16 @@ cd9660_readdir(ap)
return (error); return (error);
} }
} }
endsearch = ip->i_size; endsearch = ip->i_size;
while (idp->curroff < endsearch) { while (idp->curroff < endsearch) {
/* /*
* If offset is on a block boundary, * If offset is on a block boundary,
* read the next directory block. * read the next directory block.
* Release previous if it exists. * Release previous if it exists.
*/ */
if (iso_blkoff(imp, idp->curroff) == 0) { if (iso_blkoff(imp, idp->curroff) == 0) {
if (bp != NULL) if (bp != NULL)
brelse(bp); brelse(bp);
@ -541,10 +565,10 @@ cd9660_readdir(ap)
/* /*
* Get pointer to next entry. * Get pointer to next entry.
*/ */
ep = (struct iso_directory_record *) ep = (struct iso_directory_record *)
(bp->b_un.b_addr + entryoffsetinblock); (bp->b_data + entryoffsetinblock);
reclen = isonum_711 (ep->length); reclen = isonum_711 (ep->length);
if (reclen == 0) { if (reclen == 0) {
/* skip to next block, if any */ /* skip to next block, if any */
@ -552,32 +576,32 @@ cd9660_readdir(ap)
imp->logical_block_size); imp->logical_block_size);
continue; continue;
} }
if (reclen < ISO_DIRECTORY_RECORD_SIZE) { if (reclen < ISO_DIRECTORY_RECORD_SIZE) {
error = EINVAL; error = EINVAL;
/* illegal entry, stop */ /* illegal entry, stop */
break; break;
} }
if (entryoffsetinblock + reclen > imp->logical_block_size) { if (entryoffsetinblock + reclen > imp->logical_block_size) {
error = EINVAL; error = EINVAL;
/* illegal directory, so stop looking */ /* illegal directory, so stop looking */
break; break;
} }
idp->current.d_namlen = isonum_711 (ep->name_len); idp->current.d_namlen = isonum_711 (ep->name_len);
if (isonum_711(ep->flags)&2) if (isonum_711(ep->flags)&2)
isodirino(&idp->current.d_fileno,ep,imp); isodirino(&idp->current.d_fileno,ep,imp);
else else
idp->current.d_fileno = dbtob(bp->b_blkno) + idp->current.d_fileno = dbtob(bp->b_blkno) +
idp->curroff; idp->curroff;
if (reclen < ISO_DIRECTORY_RECORD_SIZE + idp->current.d_namlen) { if (reclen < ISO_DIRECTORY_RECORD_SIZE + idp->current.d_namlen) {
error = EINVAL; error = EINVAL;
/* illegal entry, stop */ /* illegal entry, stop */
break; break;
} }
idp->curroff += reclen; idp->curroff += reclen;
/* /*
* *
@ -616,25 +640,25 @@ cd9660_readdir(ap)
} }
if (error) if (error)
break; break;
entryoffsetinblock += reclen; entryoffsetinblock += reclen;
} }
if (!error && imp->iso_ftype == ISO_FTYPE_DEFAULT) { if (!error && imp->iso_ftype == ISO_FTYPE_DEFAULT) {
idp->current.d_namlen = 0; idp->current.d_namlen = 0;
error = iso_shipdir(idp); error = iso_shipdir(idp);
} }
if (error < 0) if (error < 0)
error = 0; error = 0;
if (bp) if (bp)
brelse (bp); brelse (bp);
uio->uio_offset = idp->uio_off; uio->uio_offset = idp->uio_off;
*ap->a_eofflag = idp->eofflag; *ap->a_eofflag = idp->eofflag;
FREE(idp,M_TEMP); FREE(idp,M_TEMP);
return (error); return (error);
} }
@ -656,20 +680,20 @@ cd9660_readlink(ap)
} */ *ap; } */ *ap;
{ {
ISONODE *ip; ISONODE *ip;
ISODIR *dirp; ISODIR *dirp;
ISOMNT *imp; ISOMNT *imp;
struct buf *bp; struct buf *bp;
u_short symlen; u_short symlen;
int error; int error;
char *symname; char *symname;
ino_t ino; ino_t ino;
ip = VTOI(ap->a_vp); ip = VTOI(ap->a_vp);
imp = ip->i_mnt; imp = ip->i_mnt;
if (imp->iso_ftype != ISO_FTYPE_RRIP) if (imp->iso_ftype != ISO_FTYPE_RRIP)
return (EINVAL); return (EINVAL);
/* /*
* Get parents directory record block that this inode included. * Get parents directory record block that this inode included.
*/ */
@ -686,7 +710,7 @@ cd9660_readlink(ap)
/* /*
* Setup the directory pointer for this inode * Setup the directory pointer for this inode
*/ */
dirp = (ISODIR *)(bp->b_un.b_addr + (ip->i_number & imp->im_bmask)); dirp = (ISODIR *)(bp->b_data + (ip->i_number & imp->im_bmask));
#ifdef DEBUG #ifdef DEBUG
printf("lbn=%d,off=%d,bsize=%d,DEV_BSIZE=%d, dirp= %08x, b_addr=%08x, offset=%08x(%08x)\n", printf("lbn=%d,off=%d,bsize=%d,DEV_BSIZE=%d, dirp= %08x, b_addr=%08x, offset=%08x(%08x)\n",
(daddr_t)(ip->i_number >> imp->im_bshift), (daddr_t)(ip->i_number >> imp->im_bshift),
@ -694,11 +718,11 @@ cd9660_readlink(ap)
imp->logical_block_size, imp->logical_block_size,
DEV_BSIZE, DEV_BSIZE,
dirp, dirp,
bp->b_un.b_addr, bp->b_data,
ip->i_number, ip->i_number,
ip->i_number & imp->im_bmask ); ip->i_number & imp->im_bmask );
#endif #endif
/* /*
* Just make sure, we have a right one.... * Just make sure, we have a right one....
* 1: Check not cross boundary on block * 1: Check not cross boundary on block
@ -708,13 +732,13 @@ cd9660_readlink(ap)
brelse(bp); brelse(bp);
return (EINVAL); return (EINVAL);
} }
/* /*
* Now get a buffer * Now get a buffer
* Abuse a namei buffer for now. * Abuse a namei buffer for now.
*/ */
MALLOC(symname,char *,MAXPATHLEN,M_NAMEI,M_WAITOK); MALLOC(symname,char *,MAXPATHLEN,M_NAMEI,M_WAITOK);
/* /*
* Ok, we just gathering a symbolic name in SL record. * Ok, we just gathering a symbolic name in SL record.
*/ */
@ -727,14 +751,14 @@ cd9660_readlink(ap)
* Don't forget before you leave from home ;-) * Don't forget before you leave from home ;-)
*/ */
brelse(bp); brelse(bp);
/* /*
* return with the symbolic name to caller's. * return with the symbolic name to caller's.
*/ */
error = uiomove(symname,symlen,ap->a_uio); error = uiomove(symname,symlen,ap->a_uio);
FREE(symname,M_NAMEI); FREE(symname,M_NAMEI);
return (error); return (error);
} }