diff options
Diffstat (limited to 'sys/isofs')
-rw-r--r-- | sys/isofs/cd9660/cd9660_bmap.c | 5 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_lookup.c | 9 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_node.c | 20 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_node.h | 85 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_rrip.c | 299 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_util.c | 9 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_vfsops.c | 102 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_vnops.c | 102 | ||||
-rw-r--r-- | sys/isofs/cd9660/iso.h | 172 |
9 files changed, 405 insertions, 398 deletions
diff --git a/sys/isofs/cd9660/cd9660_bmap.c b/sys/isofs/cd9660/cd9660_bmap.c index e88810b1d38..e99b3857754 100644 --- a/sys/isofs/cd9660/cd9660_bmap.c +++ b/sys/isofs/cd9660/cd9660_bmap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: cd9660_bmap.c,v 1.2 1996/02/29 10:12:14 niklas Exp $ */ -/* $NetBSD: cd9660_bmap.c,v 1.6 1996/02/09 21:31:50 christos Exp $ */ +/* $OpenBSD: cd9660_bmap.c,v 1.3 1997/11/08 17:21:05 niklas Exp $ */ +/* $NetBSD: cd9660_bmap.c,v 1.7 1997/01/24 00:27:29 cgd Exp $ */ /*- * Copyright (c) 1994 @@ -49,6 +49,7 @@ #include <sys/mount.h> #include <isofs/cd9660/iso.h> +#include <isofs/cd9660/cd9660_extern.h> #include <isofs/cd9660/cd9660_node.h> /* diff --git a/sys/isofs/cd9660/cd9660_lookup.c b/sys/isofs/cd9660/cd9660_lookup.c index 2303ba5ade3..9792882bc13 100644 --- a/sys/isofs/cd9660/cd9660_lookup.c +++ b/sys/isofs/cd9660/cd9660_lookup.c @@ -1,5 +1,5 @@ -/* $OpenBSD: cd9660_lookup.c,v 1.5 1997/11/06 05:58:09 csapuntz Exp $ */ -/* $NetBSD: cd9660_lookup.c,v 1.14 1996/02/09 21:31:56 christos Exp $ */ +/* $OpenBSD: cd9660_lookup.c,v 1.6 1997/11/08 17:21:06 niklas Exp $ */ +/* $NetBSD: cd9660_lookup.c,v 1.18 1997/05/08 16:19:59 mycroft Exp $ */ /*- * Copyright (c) 1989, 1993, 1994 @@ -52,6 +52,7 @@ #include <sys/systm.h> #include <isofs/cd9660/iso.h> +#include <isofs/cd9660/cd9660_extern.h> #include <isofs/cd9660/cd9660_node.h> #include <isofs/cd9660/iso_rrip.h> #include <isofs/cd9660/cd9660_rrip.h> @@ -75,7 +76,7 @@ struct nchstats iso_nchstats; * be "."., but the caller must check to ensure it does an vrele and iput * instead of two iputs. * - * Overall outline of ufs_lookup: + * Overall outline of cd9660_lookup: * * check accessibility of directory * look for name in cache, if found, then if at end of path @@ -143,8 +144,6 @@ cd9660_lookup(v) /* * Check accessiblity of directory. */ - if (vdp->v_type != VDIR) - return (ENOTDIR); if ((error = VOP_ACCESS(vdp, VEXEC, cred, cnp->cn_proc)) != 0) return (error); diff --git a/sys/isofs/cd9660/cd9660_node.c b/sys/isofs/cd9660/cd9660_node.c index 712ebfaa4a3..56543062d35 100644 --- a/sys/isofs/cd9660/cd9660_node.c +++ b/sys/isofs/cd9660/cd9660_node.c @@ -1,5 +1,5 @@ -/* $OpenBSD: cd9660_node.c,v 1.6 1997/11/06 05:58:10 csapuntz Exp $ */ -/* $NetBSD: cd9660_node.c,v 1.15 1996/02/09 21:31:58 christos Exp $ */ +/* $OpenBSD: cd9660_node.c,v 1.7 1997/11/08 17:21:06 niklas Exp $ */ +/* $NetBSD: cd9660_node.c,v 1.17 1997/05/05 07:13:57 mycroft Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1994 @@ -54,6 +54,7 @@ #include <sys/stat.h> #include <isofs/cd9660/iso.h> +#include <isofs/cd9660/cd9660_extern.h> #include <isofs/cd9660/cd9660_node.h> #include <isofs/cd9660/iso_rrip.h> @@ -74,6 +75,7 @@ u_long idvhash; int prtactive; /* 1 => print out reclaim of active vnodes */ static u_int cd9660_chars2ui __P((u_char *, int)); + /* * Initialize hash links for inodes and dnodes. */ @@ -247,7 +249,7 @@ cd9660_inactive(v) if (ip->inode.iso_mode == 0) vrecycle(vp, (struct simplelock *)0, p); - return error; + return (error); } /* @@ -407,7 +409,7 @@ cd9660_tstamp_conv7(pi,pu) if (y < 1970) { pu->tv_sec = 0; pu->tv_nsec = 0; - return 0; + return (0); } else { #ifdef ORIGINAL /* computes day number relative to Sept. 19th,1989 */ @@ -428,7 +430,7 @@ cd9660_tstamp_conv7(pi,pu) } pu->tv_sec = crtime; pu->tv_nsec = 0; - return 1; + return (1); } static u_int @@ -442,7 +444,7 @@ cd9660_chars2ui(begin,len) rc *= 10; rc += *begin++ - '0'; } - return rc; + return (rc); } int @@ -473,7 +475,7 @@ cd9660_tstamp_conv17(pi,pu) /* difference of GMT */ buf[6] = pi[16]; - return cd9660_tstamp_conv7(buf,pu); + return (cd9660_tstamp_conv7(buf,pu)); } ino_t @@ -483,7 +485,7 @@ isodirino(isodir, imp) { ino_t ino; - ino = (isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length)) - << imp->im_bshift; + ino = (isonum_733(isodir->extent) + + isonum_711(isodir->ext_attr_length)) << imp->im_bshift; return (ino); } diff --git a/sys/isofs/cd9660/cd9660_node.h b/sys/isofs/cd9660/cd9660_node.h index a5e31291e0a..3d11161935f 100644 --- a/sys/isofs/cd9660/cd9660_node.h +++ b/sys/isofs/cd9660/cd9660_node.h @@ -1,5 +1,5 @@ -/* $OpenBSD: cd9660_node.h,v 1.5 1997/11/06 05:58:11 csapuntz Exp $ */ -/* $NetBSD: cd9660_node.h,v 1.11 1996/02/09 21:32:00 christos Exp $ */ +/* $OpenBSD: cd9660_node.h,v 1.6 1997/11/08 17:21:07 niklas Exp $ */ +/* $NetBSD: cd9660_node.h,v 1.15 1997/04/11 21:52:01 kleink Exp $ */ /*- * Copyright (c) 1994 @@ -108,47 +108,46 @@ struct iso_node { /* * Prototypes for ISOFS vnode operations */ -int cd9660_enotsupp __P((void *)); -int cd9660_lookup __P((void *)); -int cd9660_open __P((void *)); -int cd9660_close __P((void *)); -int cd9660_access __P((void *)); -int cd9660_getattr __P((void *)); -int cd9660_setattr __P((void *)); -int cd9660_read __P((void *)); -int cd9660_ioctl __P((void *)); -int cd9660_select __P((void *)); -int cd9660_mmap __P((void *)); -int cd9660_seek __P((void *)); -int cd9660_readdir __P((void *)); -int cd9660_readlink __P((void *)); -int cd9660_abortop __P((void *)); -int cd9660_inactive __P((void *)); -int cd9660_reclaim __P((void *)); -int cd9660_link __P((void *)); -int cd9660_symlink __P((void *)); -int cd9660_bmap __P((void *)); -int cd9660_lock __P((void *)); -int cd9660_unlock __P((void *)); -int cd9660_strategy __P((void *)); -int cd9660_print __P((void *)); -int cd9660_islocked __P((void *)); -int cd9660_pathconf __P((void *)); -int cd9660_blkatoff __P((void *)); +int cd9660_lookup __P((void *)); +int cd9660_open __P((void *)); +int cd9660_close __P((void *)); +int cd9660_access __P((void *)); +int cd9660_getattr __P((void *)); +int cd9660_setattr __P((void *)); +int cd9660_read __P((void *)); +int cd9660_ioctl __P((void *)); +int cd9660_select __P((void *)); +int cd9660_mmap __P((void *)); +int cd9660_seek __P((void *)); +int cd9660_readdir __P((void *)); +int cd9660_readlink __P((void *)); +int cd9660_abortop __P((void *)); +int cd9660_inactive __P((void *)); +int cd9660_reclaim __P((void *)); +int cd9660_link __P((void *)); +int cd9660_symlink __P((void *)); +int cd9660_bmap __P((void *)); +int cd9660_lock __P((void *)); +int cd9660_unlock __P((void *)); +int cd9660_strategy __P((void *)); +int cd9660_print __P((void *)); +int cd9660_islocked __P((void *)); +int cd9660_pathconf __P((void *)); +int cd9660_blkatoff __P((void *)); -void cd9660_defattr __P((struct iso_directory_record *, - struct iso_node *, struct buf *)); -void cd9660_deftstamp __P((struct iso_directory_record *, - struct iso_node *, struct buf *)); -struct vnode *cd9660_ihashget __P((dev_t, ino_t)); -void cd9660_ihashins __P((struct iso_node *)); -void cd9660_ihashrem __P((struct iso_node *)); -int cd9660_tstamp_conv7 __P((u_char *, struct timespec *)); -int cd9660_tstamp_conv17 __P((u_char *, struct timespec *)); -int cd9660_vget_internal __P((struct mount *, ino_t, struct vnode **, int, - struct iso_directory_record *)); -ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *)); +void cd9660_defattr __P((struct iso_directory_record *, struct iso_node *, + struct buf *)); +void cd9660_deftstamp __P((struct iso_directory_record *, struct iso_node *, + struct buf *)); +struct vnode *cd9660_ihashget __P((dev_t, ino_t)); +void cd9660_ihashins __P((struct iso_node *)); +void cd9660_ihashrem __P((struct iso_node *)); +int cd9660_tstamp_conv7 __P((u_char *, struct timespec *)); +int cd9660_tstamp_conv17 __P((u_char *, struct timespec *)); +int cd9660_vget_internal __P((struct mount *, ino_t, struct vnode **, int, + struct iso_directory_record *)); +ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *)); #ifdef ISODEVMAP -struct iso_dnode *iso_dmap __P((dev_t, ino_t, int)); -void iso_dunmap __P((dev_t)); +struct iso_dnode *iso_dmap __P((dev_t, ino_t, int)); +void iso_dunmap __P((dev_t)); #endif diff --git a/sys/isofs/cd9660/cd9660_rrip.c b/sys/isofs/cd9660/cd9660_rrip.c index c4bb7b24cc2..9bd8eb89094 100644 --- a/sys/isofs/cd9660/cd9660_rrip.c +++ b/sys/isofs/cd9660/cd9660_rrip.c @@ -1,5 +1,5 @@ -/* $OpenBSD: cd9660_rrip.c,v 1.3 1996/10/04 03:05:30 deraadt Exp $ */ -/* $NetBSD: cd9660_rrip.c,v 1.12 1996/02/09 21:32:02 christos Exp $ */ +/* $OpenBSD: cd9660_rrip.c,v 1.4 1997/11/08 17:21:07 niklas Exp $ */ +/* $NetBSD: cd9660_rrip.c,v 1.17 1997/01/24 00:27:32 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -55,6 +55,7 @@ #include <sys/time.h> #include <isofs/cd9660/iso.h> +#include <isofs/cd9660/cd9660_extern.h> #include <isofs/cd9660/cd9660_node.h> #include <isofs/cd9660/cd9660_rrip.h> #include <isofs/cd9660/iso_rrip.h> @@ -81,7 +82,7 @@ static int cd9660_rrip_cont __P((void *, ISO_RRIP_ANALYZE *)); static int cd9660_rrip_stop __P((void *, ISO_RRIP_ANALYZE *)); static int cd9660_rrip_extref __P((void *, ISO_RRIP_ANALYZE *)); static int cd9660_rrip_loop __P((struct iso_directory_record *, - ISO_RRIP_ANALYZE *, RRIP_TABLE *)); + ISO_RRIP_ANALYZE *, RRIP_TABLE *)); /* * POSIX file attribute */ @@ -91,12 +92,13 @@ cd9660_rrip_attr(v, ana) ISO_RRIP_ANALYZE *ana; { ISO_RRIP_ATTR *p = v; + ana->inop->inode.iso_mode = isonum_733(p->mode); ana->inop->inode.iso_uid = isonum_733(p->uid); ana->inop->inode.iso_gid = isonum_733(p->gid); ana->inop->inode.iso_links = isonum_733(p->links); ana->fields &= ~ISO_SUSP_ATTR; - return ISO_SUSP_ATTR; + return (ISO_SUSP_ATTR); } static void @@ -105,9 +107,10 @@ cd9660_rrip_defattr(v, ana) ISO_RRIP_ANALYZE *ana; { struct iso_directory_record *isodir = v; + /* But this is a required field! */ printf("RRIP without PX field?\n"); - cd9660_defattr(isodir,ana->inop,NULL); + cd9660_defattr(isodir, ana->inop, NULL); } /* @@ -125,8 +128,8 @@ cd9660_rrip_slink(v, ana) char *outbuf, *inbuf; pcomp = (ISO_RRIP_SLINK_COMPONENT *)p->component; - pcompe = (ISO_RRIP_SLINK_COMPONENT *) - ((char *)p + isonum_711(p->h.length)); + pcompe = + (ISO_RRIP_SLINK_COMPONENT *)((char *)p + isonum_711(p->h.length)); len = *ana->outlen; outbuf = ana->outbuf; cont = ana->cont; @@ -134,10 +137,9 @@ cd9660_rrip_slink(v, ana) /* * Gathering a Symbolic name from each component with path */ - for (; - pcomp < pcompe; - pcomp = (ISO_RRIP_SLINK_COMPONENT *)((char *)pcomp + ISO_RRIP_SLSIZ - + isonum_711(pcomp->clen))) { + for (; pcomp < pcompe; + pcomp = (ISO_RRIP_SLINK_COMPONENT *) + ((char *)pcomp + ISO_RRIP_SLSIZ + isonum_711(pcomp->clen))) { if (!cont) { if (len < ana->maxlen) { @@ -204,13 +206,12 @@ cd9660_rrip_slink(v, ana) ana->fields = 0; ana->outbuf -= *ana->outlen; *ana->outlen = 0; - return 0; + return (0); } - bcopy(inbuf,outbuf,wlen); + bcopy(inbuf, outbuf, wlen); outbuf += wlen; len += wlen; - } ana->outbuf = outbuf; *ana->outlen = len; @@ -218,9 +219,9 @@ cd9660_rrip_slink(v, ana) if (!isonum_711(p->flags)) { ana->fields &= ~ISO_SUSP_SLINK; - return ISO_SUSP_SLINK; + return (ISO_SUSP_SLINK); } - return 0; + return (0); } /* @@ -277,17 +278,17 @@ cd9660_rrip_altname(v, ana) ana->fields &= ~ISO_SUSP_ALTNAME; ana->outbuf -= *ana->outlen - wlen; *ana->outlen = 0; - return 0; + return (0); } - bcopy(inbuf,ana->outbuf,wlen); + bcopy(inbuf, ana->outbuf, wlen); ana->outbuf += wlen; if (!cont) { ana->fields &= ~ISO_SUSP_ALTNAME; - return ISO_SUSP_ALTNAME; + return (ISO_SUSP_ALTNAME); } - return 0; + return (0); } static void @@ -296,12 +297,13 @@ cd9660_rrip_defname(v, ana) ISO_RRIP_ANALYZE *ana; { struct iso_directory_record *isodir = v; - strcpy(ana->outbuf,".."); + + strcpy(ana->outbuf, ".."); switch (*isodir->name) { default: - isofntrans(isodir->name,isonum_711(isodir->name_len), - ana->outbuf,ana->outlen, - 1,isonum_711(isodir->flags)&4); + isofntrans(isodir->name, isonum_711(isodir->name_len), + ana->outbuf, ana->outlen, 1, + isonum_711(isodir->flags) & 4); break; case 0: *ana->outlen = 1; @@ -321,9 +323,10 @@ cd9660_rrip_pclink(v, ana) ISO_RRIP_ANALYZE *ana; { ISO_RRIP_CLINK *p = v; + *ana->inump = isonum_733(p->dir_loc) << ana->imp->im_bshift; - ana->fields &= ~(ISO_SUSP_CLINK|ISO_SUSP_PLINK); - return *p->h.type == 'C' ? ISO_SUSP_CLINK : ISO_SUSP_PLINK; + ana->fields &= ~(ISO_SUSP_CLINK | ISO_SUSP_PLINK); + return (*p->h.type == 'C' ? ISO_SUSP_CLINK : ISO_SUSP_PLINK); } /* @@ -338,7 +341,8 @@ cd9660_rrip_reldir(v, ana) /* special hack to make caller aware of RE field */ *ana->outlen = 0; ana->fields = 0; - return ISO_SUSP_RELDIR|ISO_SUSP_ALTNAME|ISO_SUSP_CLINK|ISO_SUSP_PLINK; + return (ISO_SUSP_RELDIR | ISO_SUSP_ALTNAME | ISO_SUSP_CLINK | + ISO_SUSP_PLINK); } static int @@ -352,51 +356,63 @@ cd9660_rrip_tstamp(v, ana) 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) + 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); + if (*p->flags & ISO_SUSP_TSTAMP_MODIFY) { + cd9660_tstamp_conv7(ptime, + &ana->inop->inode.iso_mtime); ptime += 7; } else - bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec)); + 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); + if (*p->flags & ISO_SUSP_TSTAMP_ACCESS) { + cd9660_tstamp_conv7(ptime, + &ana->inop->inode.iso_atime); ptime += 7; } else - ana->inop->inode.iso_atime = ana->inop->inode.iso_mtime; + 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); + if (*p->flags & ISO_SUSP_TSTAMP_ATTR) + cd9660_tstamp_conv7(ptime, + &ana->inop->inode.iso_ctime); else - ana->inop->inode.iso_ctime = ana->inop->inode.iso_mtime; + ana->inop->inode.iso_ctime = + ana->inop->inode.iso_mtime; } else { - if (*p->flags&ISO_SUSP_TSTAMP_CREAT) + 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); + 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)); + 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); + 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; + 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); + 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->inop->inode.iso_ctime = + ana->inop->inode.iso_mtime; } ana->fields &= ~ISO_SUSP_TSTAMP; - return ISO_SUSP_TSTAMP; + return (ISO_SUSP_TSTAMP); } static void @@ -405,7 +421,8 @@ cd9660_rrip_deftstamp(v, ana) ISO_RRIP_ANALYZE *ana; { struct iso_directory_record *isodir = v; - cd9660_deftstamp(isodir,ana->inop,NULL); + + cd9660_deftstamp(isodir, ana->inop, NULL); } /* @@ -427,7 +444,7 @@ cd9660_rrip_device(v, ana) else ana->inop->inode.iso_rdev = makedev(high, minor(low)); ana->fields &= ~ISO_SUSP_DEVICE; - return ISO_SUSP_DEVICE; + return (ISO_SUSP_DEVICE); } /* @@ -439,12 +456,14 @@ cd9660_rrip_idflag(v, ana) ISO_RRIP_ANALYZE *ana; { ISO_RRIP_IDFLAG *p = v; - ana->fields &= isonum_711(p->flags)|~0xff; /* don't touch high bits */ + + /* don't touch high bits */ + ana->fields &= isonum_711(p->flags) | ~0xff; /* special handling of RE field */ - if (ana->fields&ISO_SUSP_RELDIR) - return cd9660_rrip_reldir(p,ana); + if (ana->fields & ISO_SUSP_RELDIR) + return (cd9660_rrip_reldir(p, ana)); - return ISO_SUSP_IDFLAG; + return (ISO_SUSP_IDFLAG); } /* @@ -456,10 +475,11 @@ cd9660_rrip_cont(v, ana) ISO_RRIP_ANALYZE *ana; { ISO_RRIP_CONT *p = v; + ana->iso_ce_blk = isonum_733(p->location); ana->iso_ce_off = isonum_733(p->offset); ana->iso_ce_len = isonum_733(p->length); - return ISO_SUSP_CONT; + return (ISO_SUSP_CONT); } /* @@ -470,7 +490,7 @@ cd9660_rrip_stop(v, ana) void *v; ISO_RRIP_ANALYZE *ana; { - return ISO_SUSP_STOP; + return (ISO_SUSP_STOP); } /* @@ -484,24 +504,24 @@ cd9660_rrip_extref(v, ana) ISO_RRIP_EXTREF *p = v; if (isonum_711(p->version) != 1) - return 0; - if (isonum_711(p->len_id) != 9 - && isonum_711(p->len_id) != 10) - return 0; - if (isonum_711(p->len_id) == 9 - && bcmp((char *)p + 8, "IEEE_1282", 9)) - return 0; - if (isonum_711(p->len_id) == 10 - && bcmp((char *)p + 8, "IEEE_P1282", 10) - && bcmp((char *)p + 8, "RRIP_1991A", 10)) - return 0; + return (0); + if (isonum_711(p->len_id) != 9 && + isonum_711(p->len_id) != 10) + return (0); + if (isonum_711(p->len_id) == 9 && + bcmp((char *)p + 8, "IEEE_1282", 9)) + return (0); + if (isonum_711(p->len_id) == 10 && + bcmp((char *)p + 8, "IEEE_P1282", 10) && + bcmp((char *)p + 8, "RRIP_1991A", 10)) + return (0); ana->fields &= ~ISO_SUSP_EXTREF; - return ISO_SUSP_EXTREF; + return (ISO_SUSP_EXTREF); } static int -cd9660_rrip_loop(isodir,ana,table) +cd9660_rrip_loop(isodir, ana, table) struct iso_directory_record *isodir; ISO_RRIP_ANALYZE *ana; RRIP_TABLE *table; @@ -515,21 +535,22 @@ cd9660_rrip_loop(isodir,ana,table) /* * Note: If name length is odd, - * it will be padding 1 byte after the name + * it will be padded by 1 byte after the name */ pwhead = isodir->name + isonum_711(isodir->name_len); - if (!(isonum_711(isodir->name_len)&1)) + 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) + 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)); + pend = + (ISO_SUSP_HEADER *)((char *)isodir + isonum_711(isodir->length)); result = 0; while (1) { @@ -540,16 +561,18 @@ cd9660_rrip_loop(isodir,ana,table) while (pend >= phead + 1) { if (isonum_711(phead->version) == 1) { for (ptable = table; ptable->func; ptable++) { - if (*phead->type == *ptable->type - && phead->type[1] == ptable->type[1]) { - result |= ptable->func(phead,ana); + if (*phead->type == *ptable->type && + phead->type[1] == ptable->type[1]) + { + result |= + ptable->func(phead, ana); break; } } if (!ana->fields) break; } - if (result&ISO_SUSP_STOP) { + if (result & ISO_SUSP_STOP) { result &= ~ISO_SUSP_STOP; break; } @@ -560,20 +583,23 @@ cd9660_rrip_loop(isodir,ana,table) * move to next SUSP * Hopefully this works with newer versions, too */ - phead = (ISO_SUSP_HEADER *)((char *)phead + isonum_711(phead->length)); + 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 - || bread(ana->imp->im_devvp, - ana->iso_ce_blk << - (ana->imp->im_bshift - DEV_BSHIFT), - ana->imp->logical_block_size, NOCRED, &bp)) + if (ana->iso_ce_blk >= ana->imp->volume_space_size || + ana->iso_ce_off + ana->iso_ce_len > + ana->imp->logical_block_size || + bread(ana->imp->im_devvp, ana->iso_ce_blk << + (ana->imp->im_bshift - DEV_BSHIFT), + ana->imp->logical_block_size, NOCRED, &bp)) /* what to do now? */ break; - phead = (ISO_SUSP_HEADER *)(bp->b_data + ana->iso_ce_off); - pend = (ISO_SUSP_HEADER *) ((char *)phead + ana->iso_ce_len); + phead = + (ISO_SUSP_HEADER *)(bp->b_data + ana->iso_ce_off); + pend = (ISO_SUSP_HEADER *) + ((char *)phead + ana->iso_ce_len); } else break; } @@ -584,23 +610,30 @@ cd9660_rrip_loop(isodir,ana,table) * (attribute/time stamp) */ for (ptable = table; ptable->func2; ptable++) - if (!(ptable->result&result)) - ptable->func2(isodir,ana); + if (!(ptable->result & result)) + ptable->func2(isodir, ana); - return result; + return (result); } /* * Get Attributes. */ static RRIP_TABLE rrip_table_analyze[] = { - { "PX", cd9660_rrip_attr, cd9660_rrip_defattr, ISO_SUSP_ATTR }, - { "TF", cd9660_rrip_tstamp, cd9660_rrip_deftstamp, ISO_SUSP_TSTAMP }, - { "PN", cd9660_rrip_device, 0, ISO_SUSP_DEVICE }, - { "RR", cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG }, - { "CE", cd9660_rrip_cont, 0, ISO_SUSP_CONT }, - { "ST", cd9660_rrip_stop, 0, ISO_SUSP_STOP }, - { "", 0, 0, 0 } + { "PX", cd9660_rrip_attr, cd9660_rrip_defattr, + ISO_SUSP_ATTR }, + { "TF", cd9660_rrip_tstamp, cd9660_rrip_deftstamp, + ISO_SUSP_TSTAMP }, + { "PN", cd9660_rrip_device, 0, + ISO_SUSP_DEVICE }, + { "RR", cd9660_rrip_idflag, 0, + ISO_SUSP_IDFLAG }, + { "CE", cd9660_rrip_cont, 0, + ISO_SUSP_CONT }, + { "ST", cd9660_rrip_stop, 0, + ISO_SUSP_STOP }, + { "", 0, 0, + 0 } }; int @@ -613,27 +646,35 @@ cd9660_rrip_analyze(isodir, inop, imp) analyze.inop = inop; analyze.imp = imp; - analyze.fields = ISO_SUSP_ATTR|ISO_SUSP_TSTAMP|ISO_SUSP_DEVICE; + analyze.fields = ISO_SUSP_ATTR | ISO_SUSP_TSTAMP | ISO_SUSP_DEVICE; - return cd9660_rrip_loop(isodir,&analyze,rrip_table_analyze); + return (cd9660_rrip_loop(isodir, &analyze, rrip_table_analyze)); } /* * Get Alternate Name. */ static RRIP_TABLE rrip_table_getname[] = { - { "NM", cd9660_rrip_altname, cd9660_rrip_defname, ISO_SUSP_ALTNAME }, - { "CL", cd9660_rrip_pclink, 0, ISO_SUSP_CLINK|ISO_SUSP_PLINK }, - { "PL", cd9660_rrip_pclink, 0, ISO_SUSP_CLINK|ISO_SUSP_PLINK }, - { "RE", cd9660_rrip_reldir, 0, ISO_SUSP_RELDIR }, - { "RR", cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG }, - { "CE", cd9660_rrip_cont, 0, ISO_SUSP_CONT }, - { "ST", cd9660_rrip_stop, 0, ISO_SUSP_STOP }, - { "", 0, 0, 0 } + { "NM", cd9660_rrip_altname, cd9660_rrip_defname, + ISO_SUSP_ALTNAME }, + { "CL", cd9660_rrip_pclink, 0, + ISO_SUSP_CLINK|ISO_SUSP_PLINK }, + { "PL", cd9660_rrip_pclink, 0, + ISO_SUSP_CLINK|ISO_SUSP_PLINK }, + { "RE", cd9660_rrip_reldir, 0, + ISO_SUSP_RELDIR }, + { "RR", cd9660_rrip_idflag, 0, + ISO_SUSP_IDFLAG }, + { "CE", cd9660_rrip_cont, 0, + ISO_SUSP_CONT }, + { "ST", cd9660_rrip_stop, 0, + ISO_SUSP_STOP }, + { "", 0, 0, + 0 } }; int -cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp) +cd9660_rrip_getname(isodir, outbuf, outlen, inump, imp) struct iso_directory_record *isodir; char *outbuf; u_short *outlen; @@ -648,34 +689,34 @@ cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp) analyze.maxlen = NAME_MAX; analyze.inump = inump; analyze.imp = imp; - analyze.fields = ISO_SUSP_ALTNAME|ISO_SUSP_RELDIR|ISO_SUSP_CLINK|ISO_SUSP_PLINK; + 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); + 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); + return (cd9660_rrip_loop(isodir, &analyze, tab)); } /* * Get Symbolic Link. */ static RRIP_TABLE rrip_table_getsymname[] = { - { "SL", cd9660_rrip_slink, 0, ISO_SUSP_SLINK }, - { "RR", cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG }, - { "CE", cd9660_rrip_cont, 0, ISO_SUSP_CONT }, - { "ST", cd9660_rrip_stop, 0, ISO_SUSP_STOP }, - { "", 0, 0, 0 } + { "SL", cd9660_rrip_slink, 0, ISO_SUSP_SLINK }, + { "RR", cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG }, + { "CE", cd9660_rrip_cont, 0, ISO_SUSP_CONT }, + { "ST", cd9660_rrip_stop, 0, ISO_SUSP_STOP }, + { "", 0, 0, 0 } }; int -cd9660_rrip_getsymname(isodir,outbuf,outlen,imp) +cd9660_rrip_getsymname(isodir, outbuf, outlen, imp) struct iso_directory_record *isodir; char *outbuf; u_short *outlen; @@ -692,7 +733,7 @@ cd9660_rrip_getsymname(isodir,outbuf,outlen,imp) analyze.fields = ISO_SUSP_SLINK; return (cd9660_rrip_loop(isodir, &analyze, rrip_table_getsymname) & - ISO_SUSP_SLINK); + ISO_SUSP_SLINK); } static RRIP_TABLE rrip_table_extref[] = { @@ -707,7 +748,7 @@ static RRIP_TABLE rrip_table_extref[] = { * Note: We insist on the ER field. */ int -cd9660_rrip_offset(isodir,imp) +cd9660_rrip_offset(isodir, imp) struct iso_directory_record *isodir; struct iso_mnt *imp; { @@ -716,19 +757,19 @@ cd9660_rrip_offset(isodir,imp) imp->rr_skip0 = 0; p = (ISO_RRIP_OFFSET *)(isodir->name + 1); - if (bcmp(p,"SP\7\1\276\357",6)) { + if (bcmp(p, "SP\7\1\276\357", 6)) { /* Maybe, it's a CDROM XA disc? */ imp->rr_skip0 = 15; p = (ISO_RRIP_OFFSET *)((char *)p + 15); - if (bcmp(p,"SP\7\1\276\357",6)) - return -1; + 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; + if (!(cd9660_rrip_loop(isodir, &analyze, rrip_table_extref) & + ISO_SUSP_EXTREF)) + return (-1); - return isonum_711(p->skip); + return (isonum_711(p->skip)); } diff --git a/sys/isofs/cd9660/cd9660_util.c b/sys/isofs/cd9660/cd9660_util.c index 4dbfaf9888b..aa29e2edd54 100644 --- a/sys/isofs/cd9660/cd9660_util.c +++ b/sys/isofs/cd9660/cd9660_util.c @@ -1,5 +1,5 @@ -/* $OpenBSD: cd9660_util.c,v 1.3 1996/04/19 16:08:41 niklas Exp $ */ -/* $NetBSD: cd9660_util.c,v 1.10 1996/02/29 20:36:39 gwr Exp $ */ +/* $OpenBSD: cd9660_util.c,v 1.4 1997/11/08 17:21:07 niklas Exp $ */ +/* $NetBSD: cd9660_util.c,v 1.12 1997/01/24 00:27:33 cgd Exp $ */ /*- * Copyright (c) 1994 @@ -53,12 +53,11 @@ #include <sys/conf.h> #include <sys/mount.h> #include <sys/vnode.h> -#include <miscfs/specfs/specdev.h> /* XXX */ -#include <miscfs/fifofs/fifo.h> /* XXX */ #include <sys/malloc.h> #include <sys/dirent.h> #include <isofs/cd9660/iso.h> +#include <isofs/cd9660/cd9660_extern.h> /* * translate and compare a filename @@ -66,7 +65,7 @@ */ int isofncmp(fn, fnlen, isofn, isolen) - u_char *fn, *isofn; + const u_char *fn, *isofn; int fnlen, isolen; { int i, j; diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index 222a037cfac..8978dd8f650 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -1,5 +1,5 @@ -/* $OpenBSD: cd9660_vfsops.c,v 1.11 1997/11/06 05:58:11 csapuntz Exp $ */ -/* $NetBSD: cd9660_vfsops.c,v 1.20 1996/02/09 21:32:08 christos Exp $ */ +/* $OpenBSD: cd9660_vfsops.c,v 1.12 1997/11/08 17:21:08 niklas Exp $ */ +/* $NetBSD: cd9660_vfsops.c,v 1.26 1997/06/13 15:38:58 pk Exp $ */ /*- * Copyright (c) 1994 @@ -60,6 +60,7 @@ #define b_cylin b_resid #include <isofs/cd9660/iso.h> +#include <isofs/cd9660/cd9660_extern.h> #include <isofs/cd9660/iso_rrip.h> #include <isofs/cd9660/cd9660_node.h> @@ -82,10 +83,10 @@ struct vfsops cd9660_vfsops = { * Called by vfs_mountroot when iso is going to be mounted as root. */ -static int iso_mountfs __P((struct vnode *devvp, struct mount *mp, - struct proc *p, struct iso_args *argp)); -int iso_disklabelspoof __P((dev_t dev, void (*strat) __P((struct buf *)), - struct disklabel *lp)); +static int iso_mountfs __P((struct vnode *devvp, struct mount *mp, + struct proc *p, struct iso_args *argp)); +int iso_disklabelspoof __P((dev_t dev, void (*strat) __P((struct buf *)), + struct disklabel *lp)); int cd9660_mountroot() @@ -105,7 +106,6 @@ cd9660_mountroot() return (error); } - if ((error = vfs_rootmountalloc("cd9660", "root_device", &mp)) != 0) return (error); args.flags = ISOFSMNT_ROOT; @@ -169,11 +169,11 @@ cd9660_mount(mp, path, data, ndp, p) if (devvp->v_type != VBLK) { vrele(devvp); - return ENOTBLK; + return (ENOTBLK); } if (major(devvp->v_rdev) >= nblkdev) { vrele(devvp); - return ENXIO; + return (ENXIO); } if ((mp->mnt_flag & MNT_UPDATE) == 0) error = iso_mountfs(devvp, mp, p, &args); @@ -185,16 +185,16 @@ cd9660_mount(mp, path, data, ndp, p) } if (error) { vrele(devvp); - return error; + return (error); } imp = VFSTOISOFS(mp); - (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size); + (void)copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); - (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, + (void)copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); - (void) cd9660_statfs(mp, &mp->mnt_stat, p); - return 0; + (void)cd9660_statfs(mp, &mp->mnt_stat, p); + return (0); } /* @@ -222,7 +222,7 @@ iso_mountfs(devvp, mp, p, argp) int logical_block_size; if (!ronly) - return EROFS; + return (EROFS); /* * Disallow multiple mounts of the same device. @@ -231,15 +231,15 @@ iso_mountfs(devvp, mp, p, argp) * Flush out any old buffers remaining from a previous use. */ if ((error = vfs_mountedon(devvp)) != 0) - return error; + return (error); if (vcount(devvp) > 1 && devvp != rootvp) - return EBUSY; + return (EBUSY); if ((error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0)) != 0) return (error); error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p); if (error) - return error; + return (error); needclose = 1; /* This is the "logical sector size". The standard says this @@ -311,17 +311,16 @@ iso_mountfs(devvp, mp, p, argp) isomp->im_mountp = mp; isomp->im_dev = dev; isomp->im_devvp = devvp; - + devvp->v_specmountpoint = mp; - + /* Check the Rock Ridge Extention support */ if (!(argp->flags & ISOFSMNT_NORRIP)) { - if ((error = bread(isomp->im_devvp, - (isomp->root_extent + isonum_711(rootp->ext_attr_length)) << - (isomp->im_bshift - DEV_BSHIFT), - isomp->logical_block_size, NOCRED, - &bp)) != 0) - goto out; + if ((error = bread(isomp->im_devvp, (isomp->root_extent + + isonum_711(rootp->ext_attr_length)) << + (isomp->im_bshift - DEV_BSHIFT), + isomp->logical_block_size, NOCRED, &bp)) != 0) + goto out; rootp = (struct iso_directory_record *)bp->b_data; @@ -339,8 +338,9 @@ iso_mountfs(devvp, mp, p, argp) brelse(bp); bp = NULL; } - isomp->im_flags = argp->flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS|ISOFSMNT_EXTATT); - switch (isomp->im_flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS)) { + 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; @@ -352,17 +352,18 @@ iso_mountfs(devvp, mp, p, argp) break; } - return 0; + return (0); out: if (bp) brelse(bp); if (needclose) - (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p); + (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, + p); if (isomp) { free((caddr_t)isomp, M_ISOFSMNT); mp->mnt_data = (qaddr_t)0; } - return error; + return (error); } /* @@ -459,7 +460,7 @@ cd9660_start(mp, flags, p) int flags; struct proc *p; { - return 0; + return (0); } /* @@ -479,7 +480,7 @@ cd9660_unmount(mp, mntflags, p) #if 0 mntflushbuf(mp, 0); if (mntinvalbuf(mp)) - return EBUSY; + return (EBUSY); #endif if ((error = vflush(mp, NULLVP, flags)) != 0) return (error); @@ -518,7 +519,7 @@ cd9660_root(mp, vpp) * Simply tell vget, that it's a relocated directory. */ return (cd9660_vget_internal(mp, ino, vpp, - imp->iso_ftype == ISO_FTYPE_RRIP, dp)); + imp->iso_ftype == ISO_FTYPE_RRIP, dp)); } /* @@ -564,11 +565,12 @@ cd9660_statfs(mp, sbp, p) sbp->f_ffree = 0; /* free file nodes */ if (sbp != &mp->mnt_stat) { bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); - bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); + bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, + MNAMELEN); } /* Use the first spare for flags: */ sbp->f_spare[0] = isomp->im_flags; - return 0; + return (0); } /* ARGSUSED */ @@ -617,8 +619,8 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) int error; #ifdef ISOFS_DBG - printf("fhtovp: ino %d, start %ld\n", - ifhp->ifid_ino, ifhp->ifid_start); + printf("fhtovp: ino %d, start %ld\n", ifhp->ifid_ino, + ifhp->ifid_start); #endif /* @@ -659,11 +661,11 @@ cd9660_vget(mp, ino, vpp) */ return (cd9660_vget_internal(mp, ino, vpp, #if 0 - VFSTOISOFS(mp)->iso_ftype == ISO_FTYPE_RRIP, + VFSTOISOFS(mp)->iso_ftype == ISO_FTYPE_RRIP, #else - 0, + 0, #endif - NULL)); + NULL)); } int @@ -719,10 +721,11 @@ cd9660_vget_internal(mp, ino, vpp, relocated, isodir) } off = blkoff(imp, ino); - if (off + ISO_DIRECTORY_RECORD_SIZE > imp->logical_block_size) { + if (off + ISO_DIRECTORY_RECORD_SIZE > imp->logical_block_size) + { vput(vp); printf("fhtovp: crosses block boundary %d\n", - off + ISO_DIRECTORY_RECORD_SIZE); + off + ISO_DIRECTORY_RECORD_SIZE); return (ESTALE); } @@ -743,8 +746,8 @@ cd9660_vget_internal(mp, ino, vpp, relocated, isodir) if (bp != 0) brelse(bp); printf("fhtovp: directory crosses block boundary %d[off=%d/len=%d]\n", - off +isonum_711(isodir->length), off, - isonum_711(isodir->length)); + off +isonum_711(isodir->length), off, + isonum_711(isodir->length)); return (ESTALE); } @@ -754,8 +757,9 @@ cd9660_vget_internal(mp, ino, vpp, relocated, isodir) if (bp != 0) brelse(bp); printf("fhtovp: file start miss %d vs %d\n", - isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length), - ifhp->ifid_start); + isonum_733(isodir->extent) + + isonum_711(isodir->ext_attr_length), + ifhp->ifid_start); return (ESTALE); } #endif @@ -894,7 +898,7 @@ cd9660_vptofh(vp, fhp) #ifdef ISOFS_DBG printf("vptofh: ino %d, start %ld\n", - ifhp->ifid_ino,ifhp->ifid_start); + ifhp->ifid_ino,ifhp->ifid_start); #endif - return 0; + return (0); } diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index c1e533b78fa..7310d19bd02 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -1,5 +1,5 @@ -/* $OpenBSD: cd9660_vnops.c,v 1.8 1997/11/06 05:58:12 csapuntz Exp $ */ -/* $NetBSD: cd9660_vnops.c,v 1.32 1996/03/16 20:25:40 ws Exp $ */ +/* $OpenBSD: cd9660_vnops.c,v 1.9 1997/11/08 17:21:08 niklas Exp $ */ +/* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */ /*- * Copyright (c) 1994 @@ -53,12 +53,14 @@ #include <sys/conf.h> #include <sys/mount.h> #include <sys/vnode.h> -#include <miscfs/specfs/specdev.h> -#include <miscfs/fifofs/fifo.h> #include <sys/malloc.h> #include <sys/dirent.h> +#include <miscfs/fifofs/fifo.h> +#include <miscfs/specfs/specdev.h> + #include <isofs/cd9660/iso.h> +#include <isofs/cd9660/cd9660_extern.h> #include <isofs/cd9660/cd9660_node.h> #include <isofs/cd9660/iso_rrip.h> @@ -144,41 +146,40 @@ cd9660_mknod(ndp, vap, cred, p) */ int cd9660_setattr(v) - void *v; - + void *v; { - struct vop_setattr_args /* { - struct vnodeop_desc *a_desc; - struct vnode *a_vp; - struct vattr *a_vap; - struct ucred *a_cred; - struct proc *a_p; - } */ *ap = v; - struct vnode *vp = ap->a_vp; - struct vattr *vap = ap->a_vap; - - if (vap->va_flags != VNOVAL || vap->va_uid != (uid_t)VNOVAL || - vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL || - vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL) - return (EROFS); - if (vap->va_size != VNOVAL) { - switch (vp->v_type) { - case VDIR: - return (EISDIR); - case VLNK: - case VREG: - return (EROFS); - case VCHR: - case VBLK: - case VSOCK: - case VFIFO: - return (0); - default: - return (EINVAL); - } - } - - return (EINVAL); + struct vop_setattr_args /* { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct vattr *a_vap; + struct ucred *a_cred; + struct proc *a_p; + } */ *ap = v; + struct vnode *vp = ap->a_vp; + struct vattr *vap = ap->a_vap; + + if (vap->va_flags != VNOVAL || vap->va_uid != (uid_t)VNOVAL || + vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL || + vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL) + return (EROFS); + if (vap->va_size != VNOVAL) { + switch (vp->v_type) { + case VDIR: + return (EISDIR); + case VLNK: + case VREG: + return (EROFS); + case VCHR: + case VBLK: + case VSOCK: + case VFIFO: + return (0); + default: + return (EINVAL); + } + } + + return (EINVAL); } /* @@ -224,7 +225,7 @@ cd9660_access(v) } */ *ap = v; struct iso_node *ip = VTOI(ap->a_vp); - return (vaccess(ip->inode.iso_mode, ip->inode.iso_uid, + return (vaccess(ip->inode.iso_mode & ALLPERMS, ip->inode.iso_uid, ip->inode.iso_gid, ap->a_mode, ap->a_cred)); } @@ -245,7 +246,7 @@ cd9660_getattr(v) vap->va_fsid = ip->i_dev; vap->va_fileid = ip->i_number; - vap->va_mode = ip->inode.iso_mode; + vap->va_mode = ip->inode.iso_mode & ALLPERMS; vap->va_nlink = ip->inode.iso_links; vap->va_uid = ip->inode.iso_uid; vap->va_gid = ip->inode.iso_gid; @@ -255,7 +256,7 @@ cd9660_getattr(v) vap->va_rdev = ip->inode.iso_rdev; vap->va_size = (u_quad_t) ip->i_size; - if (ip->i_size == 0 && (vap->va_mode & S_IFMT) == S_IFLNK) { + if (ip->i_size == 0 && vp->v_type == VLNK) { struct vop_readlink_args rdlnk; struct iovec aiov; struct uio auio; @@ -286,15 +287,15 @@ cd9660_getattr(v) return (0); } -#if ISO_DEFAULT_BLOCK_SIZE >= NBPG #ifdef DEBUG extern int doclusterread; #else #define doclusterread 1 #endif -#else -#define doclusterread 0 -#endif + +/* XXX until cluster routines can handle block sizes less than one page */ +#define cd9660_doclusterread \ + (doclusterread && (ISO_DEFAULT_BLOCK_SIZE >= NBPG)) /* * Vnode op for reading. @@ -337,7 +338,7 @@ cd9660_read(v) n = diff; size = blksize(imp, ip, lbn); rablock = lbn + 1; - if (doclusterread) { + if (cd9660_doclusterread) { if (lblktosize(imp, rablock) <= ip->i_size) error = cluster_read(vp, (off_t)ip->i_size, lbn, size, NOCRED, &bp); @@ -364,7 +365,7 @@ cd9660_read(v) if (n + on == imp->logical_block_size || uio->uio_offset == (off_t)ip->i_size) bp->b_flags |= B_AGE; - brelse(bp); + brelse(bp); } while (error == 0 && uio->uio_resid > 0 && n != 0); return (error); } @@ -416,7 +417,6 @@ cd9660_seek(v) return (0); } - int iso_uiodir(idp,dp,off) struct isoreaddir *idp; @@ -684,7 +684,7 @@ cd9660_readdir(v) } if (bp) - brelse (bp); + brelse (bp); uio->uio_offset = idp->uio_off; *ap->a_eofflag = idp->eofflag; @@ -720,7 +720,7 @@ cd9660_readlink(v) u_short symlen; int error; char *symname; - + ip = VTOI(ap->a_vp); imp = ip->i_mnt; uio = ap->a_uio; @@ -849,7 +849,7 @@ cd9660_lock(v) void *v; { struct vop_lock_args /* { - struct vnode *a_vp; + struct vnode *a_vp; } */ *ap = v; struct vnode *vp = ap->a_vp; diff --git a/sys/isofs/cd9660/iso.h b/sys/isofs/cd9660/iso.h index 793cff746e0..105ccb693e0 100644 --- a/sys/isofs/cd9660/iso.h +++ b/sys/isofs/cd9660/iso.h @@ -1,5 +1,5 @@ -/* $OpenBSD: iso.h,v 1.6 1997/11/06 05:58:13 csapuntz Exp $ */ -/* $NetBSD: iso.h,v 1.11 1996/03/16 20:25:42 ws Exp $ */ +/* $OpenBSD: iso.h,v 1.7 1997/11/08 17:21:09 niklas Exp $ */ +/* $NetBSD: iso.h,v 1.20 1997/07/07 22:45:34 cgd Exp $ */ /*- * Copyright (c) 1994 @@ -41,6 +41,12 @@ * @(#)iso.h 8.4 (Berkeley) 12/5/94 */ +/* + * Definitions describing ISO9660 file system structure, as well as + * the functions necessary to access fields of ISO9660 file system + * structures. + */ + #define ISODCL(from, to) (to - from + 1) struct iso_volume_descriptor { @@ -130,67 +136,16 @@ struct iso_extended_attributes { u_char len_au [ISODCL (247, 250)]; /* 723 */ }; -/* CD-ROM Format type */ -enum ISO_FTYPE { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP, ISO_FTYPE_ECMA }; - -#ifndef ISOFSMNT_ROOT -#define ISOFSMNT_ROOT 0 -#endif - -struct iso_mnt { - int im_flags; - - struct mount *im_mountp; - dev_t im_dev; - struct vnode *im_devvp; - - int logical_block_size; - int im_bshift; - int im_bmask; - - int volume_space_size; - 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; -}; - -#define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data)) - -#define blkoff(imp, loc) ((loc) & (imp)->im_bmask) -#define lblktosize(imp, blk) ((blk) << (imp)->im_bshift) -#define lblkno(imp, loc) ((loc) >> (imp)->im_bshift) -#define blksize(imp, ip, lbn) ((imp)->logical_block_size) - -int cd9660_mount __P((struct mount *, - char *, caddr_t, struct nameidata *, struct proc *)); -int cd9660_start __P((struct mount *, int, struct proc *)); -int cd9660_unmount __P((struct mount *, int, struct proc *)); -int cd9660_root __P((struct mount *, struct vnode **)); -int cd9660_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *)); -int cd9660_statfs __P((struct mount *, struct statfs *, struct proc *)); -int cd9660_sync __P((struct mount *, int, struct ucred *, struct proc *)); -int cd9660_vget __P((struct mount *, ino_t, struct vnode **)); -int cd9660_fhtovp __P((struct mount *, struct fid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); -int cd9660_vptofh __P((struct vnode *, struct fid *)); -int cd9660_init __P((struct vfsconf *)); -#define cd9660_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ - size_t, struct proc *)))eopnotsupp) - -int cd9660_mountroot __P((void)); - -extern int (**cd9660_vnodeop_p) __P((void *)); -extern int (**cd9660_specop_p) __P((void *)); -#ifdef FIFO -extern int (**cd9660_fifoop_p) __P((void *)); -#endif +static __inline int isonum_711 __P((u_char *)) __attribute__ ((unused)); +static __inline int isonum_712 __P((char *)) __attribute__ ((unused)); +static __inline int isonum_721 __P((u_char *)) __attribute__ ((unused)); +static __inline int isonum_722 __P((u_char *)) __attribute__ ((unused)); +static __inline int isonum_723 __P((u_char *)) __attribute__ ((unused)); +static __inline int isonum_731 __P((u_char *)) __attribute__ ((unused)); +static __inline int isonum_732 __P((u_char *)) __attribute__ ((unused)); +static __inline int isonum_733 __P((u_char *)) __attribute__ ((unused)); +/* 7.1.1: unsigned char */ static __inline int #if __STDC__ isonum_711(u_char *p) @@ -202,6 +157,7 @@ isonum_711(p) return *p; } +/* 7.1.2: signed(?) char */ static __inline int #if __STDC__ isonum_712(char *p) @@ -213,34 +169,31 @@ isonum_712(p) return *p; } -#ifndef UNALIGNED_ACCESS - +/* 7.2.1: unsigned little-endian 16-bit value. NOT USED IN KERNEL. */ static __inline int -#if __STDC__ -isonum_723(u_char *p) -#else -isonum_723(p) +isonum_721(p) u_char *p; -#endif { - return *p|(p[1] << 8); -} - -static __inline int -#if __STDC__ -isonum_733(u_char *p) +#if defined(UNALIGNED_ACCESS) && (BYTE_ORDER == LITTLE_ENDIAN) + return *(u_int16t *)p; #else -isonum_733(p) - u_char *p; + return *p|((char)p[1] << 8); #endif -{ - return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24); } -#else /* UNALIGNED_ACCESS */ - -#if BYTE_ORDER == LITTLE_ENDIAN +/* 7.2.2: unsigned big-endian 16-bit value. NOT USED IN KERNEL. */ +static __inline int +isonum_722(p) + unsigned char *p; +{ +#if defined(UNALIGNED_ACCESS) && (BYTE_ORDER == BIG_ENDIAN) + return *(u_int16t *)p; +#else + return ((char)*p << 8)|p[1]; +#endif +} +/* 7.2.3: unsigned both-endian (little, then big) 16-bit value */ static __inline int #if __STDC__ isonum_723(u_char *p) @@ -249,35 +202,43 @@ isonum_723(p) u_char *p; #endif { +#if defined(UNALIGNED_ACCESS) && \ + ((BYTE_ORDER == LITTLE_ENDIAN) || (BYTE_ORDER == BIG_ENDIAN)) +#if BYTE_ORDER == LITTLE_ENDIAN return *(u_int16t *)p; +#else + return *(u_int16t *)(p + 2); +#endif +#else /* !UNALIGNED_ACCESS or weird byte order */ + return *p|(p[1] << 8); +#endif } +/* 7.3.1: unsigned little-endian 32-bit value. NOT USED IN KERNEL. */ static __inline int -#if __STDC__ -isonum_733(u_char *p) -#else -isonum_733(p) +isonum_731(p) u_char *p; -#endif { +#if defined(UNALIGNED_ACCESS) && (BYTE_ORDER == LITTLE_ENDIAN) return *(u_int32t *)p; -} - +#else + return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24); #endif +} -#if BYTE_ORDER == BIG_ENDIAN - +/* 7.3.2: unsigned big-endian 32-bit value. NOT USED IN KERNEL. */ static __inline int -#if __STDC__ -isonum_723(u_char *p) +isonum_732(p) + unsigned char *p; +{ +#if defined(UNALIGNED_ACCESS) && (BYTE_ORDER == BIG_ENDIAN) + return *(u_int32t *)p; #else -isonum_723(p) - u_char *p; + return (*p << 24)|(p[1] << 16)|(p[2] << 8)|p[3]; #endif -{ - return *(u_int16t *)(p + 2); } +/* 7.3.3: unsigned both-endian (little, then big) 32-bit value */ static __inline int #if __STDC__ isonum_733(u_char *p) @@ -286,16 +247,17 @@ isonum_733(p) u_char *p; #endif { +#if defined(UNALIGNED_ACCESS) && \ + ((BYTE_ORDER == LITTLE_ENDIAN) || (BYTE_ORDER == BIG_ENDIAN)) +#if BYTE_ORDER == LITTLE_ENDIAN + return *(u_int32t *)p; +#else return *(u_int32t *)(p + 4); -} - #endif - -#endif /* UNALIGNED_ACCESS */ - -int isofncmp __P((u_char *, int, u_char *, int)); -void isofntrans __P((u_char *, int, u_char *, u_short *, int, int)); -ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *)); +#else /* !UNALIGNED_ACCESS or weird byte order */ + return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24); +#endif +} /* * Associated files have a leading '='. |