summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-24 09:37:04 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-24 09:37:04 +0000
commitd1e286aee3e9807d435c8e5e4b402d5eebcfb708 (patch)
tree41ba0b11246854fb0677acfa743d0718447dfbcc /sys
parent7102964779390c6ec9a75a2fae4541ea2d5e4da9 (diff)
Add forward decls.
Fix vop_link, vop_symlink, and vop_remove semantics in several ways: * Change the argument names to vop_link so they actually make sense. * Implement vop_link and vop_symlink for all file systems, so they do proper cleanup. * Require the file system to decide whether or not linking and unlinking of directories is allowed, and disable it for all current file systems. Adosfs prototyping changes. Compiler warning police.
Diffstat (limited to 'sys')
-rw-r--r--sys/adosfs/adlookup.c48
-rw-r--r--sys/adosfs/adosfs.h8
-rw-r--r--sys/adosfs/adutil.c10
-rw-r--r--sys/adosfs/advfsops.c59
-rw-r--r--sys/adosfs/advnops.c380
5 files changed, 305 insertions, 200 deletions
diff --git a/sys/adosfs/adlookup.c b/sys/adosfs/adlookup.c
index d846ae854af..5ffb3755051 100644
--- a/sys/adosfs/adlookup.c
+++ b/sys/adosfs/adlookup.c
@@ -1,4 +1,4 @@
-/* $NetBSD: adlookup.c,v 1.10 1995/08/18 15:14:33 chopps Exp $ */
+/* $NetBSD: adlookup.c,v 1.12 1996/02/13 17:05:47 christos Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -42,26 +42,8 @@
#define strmatch(s1, l1, s2, l2) \
((l1) == (l2) && bcmp((s1), (s2), (l1)) == 0)
#else
-int
-strmatch(s1, l1, s2, l2)
- char *s1, *s2;
- int l1, l2;
-{
- if (l1 != l2)
- return 0;
- while (--l1 >= 0) {
- char c;
- c = *s1++;
- if (c != *s2) {
- if (c >= 'A' && c <= 'Z' && c + ('a' - 'A') != *s2)
- return 0;
- if (c >= 'a' && c <= 'z' && c + ('A' - 'a') != *s2)
- return 0;
- }
- ++s2;
- }
- return 1;
-}
+#define strmatch(s1, l1, s2, l2) \
+ ((l1) == (l2) && strncasecmp((s1), (s2), (l1)) == 0)
#endif
/*
@@ -76,13 +58,14 @@ strmatch(s1, l1, s2, l2)
* LOOKUP always unlocks parent if last element. (not now!?!?)
*/
int
-adosfs_lookup(sp)
+adosfs_lookup(v)
+ void *v;
+{
struct vop_lookup_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
- } */ *sp;
-{
+ } */ *sp = v;
int nameiop, last, lockp, wantp, flags, error, vpid, nocache, i;
struct componentname *cnp;
struct vnode **vpp; /* place to store result */
@@ -117,13 +100,13 @@ adosfs_lookup(sp)
*/
if (vdp->v_type != VDIR)
return (ENOTDIR);
- if (error = VOP_ACCESS(vdp, VEXEC, ucp, cnp->cn_proc))
+ if ((error = VOP_ACCESS(vdp, VEXEC, ucp, cnp->cn_proc)) != 0)
return (error);
/*
* cache lookup algorithm borrowed from ufs_lookup()
* its not consistent with otherthings in this function..
*/
- if (error = cache_lookup(vdp, vpp, cnp)) {
+ if ((error = cache_lookup(vdp, vpp, cnp)) != 0) {
if (error == ENOENT)
return (error);
@@ -150,7 +133,7 @@ adosfs_lookup(sp)
VOP_UNLOCK(vdp);
}
*vpp = NULL;
- if (error = VOP_LOCK(vdp))
+ if ((error = VOP_LOCK(vdp)) != 0)
return (error);
}
@@ -185,7 +168,8 @@ adosfs_lookup(sp)
*
*/
VOP_UNLOCK(vdp); /* race */
- if (error = VFS_VGET(vdp->v_mount, (ino_t)adp->pblock, vpp))
+ if ((error = VFS_VGET(vdp->v_mount,
+ (ino_t)adp->pblock, vpp)) != 0)
VOP_LOCK(vdp);
else if (last && lockp && (error = VOP_LOCK(vdp)))
vput(*vpp);
@@ -205,7 +189,7 @@ adosfs_lookup(sp)
bn = adp->tab[hval];
i = min(adp->tabi[hval], 0);
while (bn != 0) {
- if (error = VFS_VGET(vdp->v_mount, (ino_t)bn, vpp)) {
+ if ((error = VFS_VGET(vdp->v_mount, (ino_t)bn, vpp)) != 0) {
#ifdef ADOSFS_DIAGNOSTIC
printf("[aget] %d)", error);
#endif
@@ -238,7 +222,7 @@ adosfs_lookup(sp)
* not found
*/
if ((nameiop == CREATE || nameiop == RENAME) && last) {
- if (error = VOP_ACCESS(vdp, VWRITE, ucp, cnp->cn_proc)) {
+ if ((error = VOP_ACCESS(vdp, VWRITE, ucp, cnp->cn_proc)) != 0) {
#ifdef ADOSFS_DIAGNOSTIC
printf("[VOP_ACCESS] %d)", error);
#endif
@@ -261,7 +245,7 @@ adosfs_lookup(sp)
found:
if (nameiop == DELETE && last) {
- if (error = VOP_ACCESS(vdp, VWRITE, ucp, cnp->cn_proc)) {
+ if ((error = VOP_ACCESS(vdp, VWRITE, ucp, cnp->cn_proc)) != 0) {
if (vdp != *vpp)
vput(*vpp);
*vpp = NULL;
@@ -272,7 +256,7 @@ found:
if (nameiop == RENAME && wantp && last) {
if (vdp == *vpp)
return(EISDIR);
- if (error = VOP_ACCESS(vdp, VWRITE, ucp, cnp->cn_proc)) {
+ if ((error = VOP_ACCESS(vdp, VWRITE, ucp, cnp->cn_proc)) != 0) {
vput(*vpp);
*vpp = NULL;
return (error);
diff --git a/sys/adosfs/adosfs.h b/sys/adosfs/adosfs.h
index dcd4e1b6d61..d92510fd2d5 100644
--- a/sys/adosfs/adosfs.h
+++ b/sys/adosfs/adosfs.h
@@ -1,4 +1,4 @@
-/* $NetBSD: adosfs.h,v 1.8 1995/08/18 15:14:35 chopps Exp $ */
+/* $NetBSD: adosfs.h,v 1.9 1996/02/09 19:06:39 christos Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -124,11 +124,13 @@ struct adosfsmount {
long adoswordn __P((struct buf *, int));
long adoscksum __P((struct buf *, long));
int adoshash __P((const char *, int, int));
+int adunixprot __P((int));
+int adosfs_getblktype __P((struct adosfsmount *, struct buf *));
struct vnode *adosfs_ahashget __P((struct mount *, ino_t));
void adosfs_ainshash __P((struct adosfsmount *, struct anode *));
void adosfs_aremhash __P((struct anode *));
-int adosfs_lookup __P((struct vop_lookup_args *));
+int adosfs_lookup __P((void *));
-int (**adosfs_vnodeop_p)();
+int (**adosfs_vnodeop_p) __P((void *));
diff --git a/sys/adosfs/adutil.c b/sys/adosfs/adutil.c
index 2dc7226a5ea..07434e32251 100644
--- a/sys/adosfs/adutil.c
+++ b/sys/adosfs/adutil.c
@@ -1,4 +1,4 @@
-/* $NetBSD: adutil.c,v 1.7 1995/01/18 09:17:33 mycroft Exp $ */
+/* $NetBSD: adutil.c,v 1.8 1996/02/09 19:06:41 christos Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -33,6 +33,7 @@
#include <sys/vnode.h>
#include <sys/mount.h>
#include <sys/proc.h>
+#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/time.h>
#include <sys/queue.h>
@@ -43,6 +44,7 @@
* look for anode in the mount's hash table, return locked.
*/
#define AHASH(an) ((an) & (ANODEHASHSZ - 1))
+static int toupper __P((int));
struct vnode *
adosfs_ahashget(mp, an)
@@ -143,9 +145,9 @@ adunixprot(adprot)
}
}
-static char
+static int
toupper(ch)
- char ch;
+ int ch;
{
if (ch >= 'a' && ch <= 'z')
return(ch & ~(0x20));
@@ -180,6 +182,7 @@ adoshash(nam, namlen, nelt)
return(val % nelt);
}
+#ifdef notyet
/*
* datestamp is local time, tv is to be UTC
*/
@@ -199,6 +202,7 @@ tvtods(tvp, dsp)
struct datestamp *dsp;
{
}
+#endif
long
adoswordn(bp, wn)
diff --git a/sys/adosfs/advfsops.c b/sys/adosfs/advfsops.c
index 4905eccbd1b..7d34dda25ee 100644
--- a/sys/adosfs/advfsops.c
+++ b/sys/adosfs/advfsops.c
@@ -45,6 +45,22 @@
#include <sys/buf.h>
#include <adosfs/adosfs.h>
+void adosfs_init __P((void));
+int adosfs_mount __P((struct mount *, char *, caddr_t, struct nameidata *,
+ struct proc *));
+int adosfs_start __P((struct mount *, int, struct proc *));
+int adosfs_unmount __P((struct mount *, int, struct proc *));
+int adosfs_root __P((struct mount *, struct vnode **));
+int adosfs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
+int adosfs_statfs __P((struct mount *, struct statfs *, struct proc *));
+int adosfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
+int adosfs_vget __P((struct mount *, ino_t, struct vnode **));
+int adosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
+ struct vnode **, int *, struct ucred **));
+int adosfs_vptofh __P((struct vnode *, struct fid *));
+
+int adosfs_mountfs __P((struct vnode *, struct mount *, struct proc *));
+
int
adosfs_mount(mp, path, data, ndp, p)
struct mount *mp;
@@ -60,7 +76,8 @@ adosfs_mount(mp, path, data, ndp, p)
int error;
mode_t accessmode;
- if (error = copyin(data, (caddr_t)&args, sizeof(struct adosfs_args)))
+ error = copyin(data, (caddr_t)&args, sizeof(struct adosfs_args));
+ if (error)
return(error);
#if 0
@@ -83,7 +100,7 @@ adosfs_mount(mp, path, data, ndp, p)
* and verify that it refers to a sensible block device.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
- if (error = namei(ndp))
+ if ((error = namei(ndp)) != 0)
return (error);
devvp = ndp->ni_vp;
@@ -104,14 +121,15 @@ adosfs_mount(mp, path, data, ndp, p)
if ((mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
VOP_LOCK(devvp);
- if (error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p)) {
+ error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p);
+ if (error) {
vput(devvp);
return (error);
}
VOP_UNLOCK(devvp);
}
/* MNT_UPDATE? */
- if (error = adosfs_mountfs(devvp, mp, p)) {
+ if ((error = adosfs_mountfs(devvp, mp, p)) != 0) {
vrele(devvp);
return (error);
}
@@ -148,19 +166,20 @@ adosfs_mountfs(devvp, mp, p)
* (except for root, which might share swap device for miniroot).
* Flush out any old buffers remaining from a previous use.
*/
- if (error = vfs_mountedon(devvp))
+ if ((error = vfs_mountedon(devvp)) != 0)
return (error);
if (vcount(devvp) > 1 && devvp != rootvp)
return (EBUSY);
- if (error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0))
+ if ((error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0)) != 0)
return (error);
/*
* open blkdev and read root block
*/
- if (error = VOP_OPEN(devvp, FREAD, NOCRED, p))
+ if ((error = VOP_OPEN(devvp, FREAD, NOCRED, p)) != 0)
return (error);
- if (error = VOP_IOCTL(devvp, DIOCGDINFO,(caddr_t)&dl, FREAD, NOCRED, p))
+ error = VOP_IOCTL(devvp, DIOCGDINFO,(caddr_t)&dl, FREAD, NOCRED, p);
+ if (error)
goto fail;
parp = &dl.d_partitions[part];
@@ -190,7 +209,7 @@ adosfs_mountfs(devvp, mp, p)
/*
* get the root anode, if not a valid fs this will fail.
*/
- if (error = VFS_ROOT(mp, &rvp))
+ if ((error = VFS_ROOT(mp, &rvp)) != 0)
goto fail;
vput(rvp);
@@ -225,7 +244,7 @@ adosfs_unmount(mp, mntflags, p)
flags = 0;
if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
- if (error = vflush(mp, NULLVP, flags))
+ if ((error = vflush(mp, NULLVP, flags)) != 0)
return (error);
amp = VFSTOADOSFS(mp);
amp->devvp->v_specflags &= ~SI_MOUNTEDON;
@@ -245,7 +264,7 @@ adosfs_root(mp, vpp)
struct vnode *nvp;
int error;
- if (error = VFS_VGET(mp, (ino_t)VFSTOADOSFS(mp)->rootb, &nvp))
+ if ((error = VFS_VGET(mp, (ino_t)VFSTOADOSFS(mp)->rootb, &nvp)) != 0)
return (error);
*vpp = nvp;
return (0);
@@ -300,10 +319,11 @@ adosfs_vget(mp, an, vpp)
/*
* check hash table. we are done if found
*/
- if (*vpp = adosfs_ahashget(mp, an))
+ if ((*vpp = adosfs_ahashget(mp, an)) != NULL)
return (0);
- if (error = getnewvnode(VT_ADOSFS, mp, adosfs_vnodeop_p, &vp))
+ error = getnewvnode(VT_ADOSFS, mp, adosfs_vnodeop_p, &vp);
+ if (error)
return (error);
/*
@@ -317,7 +337,7 @@ adosfs_vget(mp, an, vpp)
ap->nwords = amp->nwords;
adosfs_ainshash(amp, ap);
- if (error = bread(amp->devvp, an, amp->bsize, NOCRED, &bp)) {
+ if ((error = bread(amp->devvp, an, amp->bsize, NOCRED, &bp)) != 0) {
vput(vp);
return (error);
}
@@ -495,7 +515,9 @@ adosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
{
struct ifid *ifhp = (struct ifid *)fhp;
struct adosfsmount *amp = VFSTOADOSFS(mp);
+#if 0
struct anode *ap;
+#endif
struct netcred *np;
struct vnode *nvp;
int error;
@@ -511,7 +533,7 @@ adosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
if (np == NULL)
return (EACCES);
- if (error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) {
+ if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) {
*vpp = NULLVP;
return (error);
}
@@ -561,9 +583,11 @@ adosfs_quotactl(mp, cmds, uid, arg, p)
}
int
-adosfs_sync(mp, waitfor)
+adosfs_sync(mp, waitfor, uc, p)
struct mount *mp;
int waitfor;
+ struct ucred *uc;
+ struct proc *p;
{
#ifdef ADOSFS_DIAGNOSTIC
printf("ad_sync(%x, %x)\n", mp, waitfor);
@@ -571,10 +595,9 @@ adosfs_sync(mp, waitfor)
return(0);
}
-int
+void
adosfs_init()
{
- return(0);
}
/*
diff --git a/sys/adosfs/advnops.c b/sys/adosfs/advnops.c
index eec58ecbc30..6f909df3f98 100644
--- a/sys/adosfs/advnops.c
+++ b/sys/adosfs/advnops.c
@@ -41,21 +41,122 @@
#include <sys/malloc.h>
#include <sys/stat.h>
#include <sys/unistd.h>
+#include <sys/proc.h>
#include <miscfs/specfs/specdev.h>
#include <adosfs/adosfs.h>
extern struct vnodeops adosfs_vnodeops;
+int adosfs_open __P((void *));
+int adosfs_getattr __P((void *));
+int adosfs_read __P((void *));
+int adosfs_write __P((void *));
+int adosfs_ioctl __P((void *));
+int adosfs_select __P((void *));
+int adosfs_strategy __P((void *));
+int adosfs_link __P((void *));
+int adosfs_symlink __P((void *));
+int adosfs_abortop __P((void *));
+int adosfs_lock __P((void *));
+int adosfs_unlock __P((void *));
+int adosfs_bmap __P((void *));
+int adosfs_print __P((void *));
+int adosfs_readdir __P((void *));
+int adosfs_access __P((void *));
+int adosfs_readlink __P((void *));
+int adosfs_inactive __P((void *));
+int adosfs_islocked __P((void *));
+int adosfs_reclaim __P((void *));
+int adosfs_pathconf __P((void *));
+int adnullop __P((void *));
+int adenotsup __P((void *));
+
+#define adosfs_close adnullop
+#define adosfs_fsync adnullop
+#ifdef NFSSERVER
+int lease_check __P((void *));
+#define adosfs_lease_check lease_check
+#else
+#define adosfs_lease_check adnullop
+#endif
+#define adosfs_seek adnullop
+#define adosfs_vfree adnullop
+
+#define adosfs_advlock adenotsup
+#define adosfs_blkatoff adenotsup
+#define adosfs_bwrite adenotsup
+#define adosfs_create adenotsup
+#define adosfs_mkdir adenotsup
+#define adosfs_mknod adenotsup
+#define adosfs_mmap adenotsup
+#define adosfs_remove adenotsup
+#define adosfs_rename adenotsup
+#define adosfs_rmdir adenotsup
+#define adosfs_setattr adenotsup
+#define adosfs_truncate adenotsup
+#define adosfs_update adenotsup
+#define adosfs_valloc adenotsup
+
+struct vnodeopv_entry_desc adosfs_vnodeop_entries[] = {
+ { &vop_default_desc, vn_default_error },
+ { &vop_lookup_desc, adosfs_lookup }, /* lookup */
+ { &vop_create_desc, adosfs_create }, /* create */
+ { &vop_mknod_desc, adosfs_mknod }, /* mknod */
+ { &vop_open_desc, adosfs_open }, /* open */
+ { &vop_close_desc, adosfs_close }, /* close */
+ { &vop_access_desc, adosfs_access }, /* access */
+ { &vop_getattr_desc, adosfs_getattr }, /* getattr */
+ { &vop_setattr_desc, adosfs_setattr }, /* setattr */
+ { &vop_read_desc, adosfs_read }, /* read */
+ { &vop_write_desc, adosfs_write }, /* write */
+ { &vop_lease_desc, adosfs_lease_check }, /* lease */
+ { &vop_ioctl_desc, adosfs_ioctl }, /* ioctl */
+ { &vop_select_desc, adosfs_select }, /* select */
+ { &vop_mmap_desc, adosfs_mmap }, /* mmap */
+ { &vop_fsync_desc, adosfs_fsync }, /* fsync */
+ { &vop_seek_desc, adosfs_seek }, /* seek */
+ { &vop_remove_desc, adosfs_remove }, /* remove */
+ { &vop_link_desc, adosfs_link }, /* link */
+ { &vop_rename_desc, adosfs_rename }, /* rename */
+ { &vop_mkdir_desc, adosfs_mkdir }, /* mkdir */
+ { &vop_rmdir_desc, adosfs_rmdir }, /* rmdir */
+ { &vop_symlink_desc, adosfs_symlink }, /* symlink */
+ { &vop_readdir_desc, adosfs_readdir }, /* readdir */
+ { &vop_readlink_desc, adosfs_readlink }, /* readlink */
+ { &vop_abortop_desc, adosfs_abortop }, /* abortop */
+ { &vop_inactive_desc, adosfs_inactive }, /* inactive */
+ { &vop_reclaim_desc, adosfs_reclaim }, /* reclaim */
+ { &vop_lock_desc, adosfs_lock }, /* lock */
+ { &vop_unlock_desc, adosfs_unlock }, /* unlock */
+ { &vop_bmap_desc, adosfs_bmap }, /* bmap */
+ { &vop_strategy_desc, adosfs_strategy }, /* strategy */
+ { &vop_print_desc, adosfs_print }, /* print */
+ { &vop_islocked_desc, adosfs_islocked }, /* islocked */
+ { &vop_pathconf_desc, adosfs_pathconf }, /* pathconf */
+ { &vop_advlock_desc, adosfs_advlock }, /* advlock */
+ { &vop_blkatoff_desc, adosfs_blkatoff }, /* blkatoff */
+ { &vop_valloc_desc, adosfs_valloc }, /* valloc */
+ { &vop_vfree_desc, adosfs_vfree }, /* vfree */
+ { &vop_truncate_desc, adosfs_truncate }, /* truncate */
+ { &vop_update_desc, adosfs_update }, /* update */
+ { &vop_bwrite_desc, adosfs_bwrite }, /* bwrite */
+ { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
+};
+
+struct vnodeopv_desc adosfs_vnodeop_opv_desc =
+ { &adosfs_vnodeop_p, adosfs_vnodeop_entries };
+
int
-adosfs_open(sp)
+adosfs_open(v)
+ void *v;
+{
+#ifdef ADOSFS_DIAGNOSTIC
struct vop_open_args /* {
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct proc *a_p;
- } */ *sp;
-{
-#ifdef ADOSFS_DIAGNOSTIC
+ } */ *sp = v;
advopprint(sp);
printf(" 0)");
#endif
@@ -63,14 +164,15 @@ adosfs_open(sp)
}
int
-adosfs_getattr(sp)
+adosfs_getattr(v)
+ void *v;
+{
struct vop_getattr_args /* {
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
struct proc *a_p;
- } */ *sp;
-{
+ } */ *sp = v;
struct vattr *vap;
struct adosfsmount *amp;
struct anode *ap;
@@ -127,20 +229,20 @@ adosfs_getattr(sp)
* deleted or changed (data block pointer blocks moving about.)
*/
int
-adosfs_read(sp)
+adosfs_read(v)
+ void *v;
+{
struct vop_read_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
- } */ *sp;
-{
+ } */ *sp = v;
struct adosfsmount *amp;
struct anode *ap;
struct uio *uio;
struct buf *bp;
- struct fs *fs;
- daddr_t lbn, bn;
+ daddr_t lbn;
int size, diff, error;
long n, on;
@@ -218,15 +320,16 @@ reterr:
}
int
-adosfs_write(sp)
+adosfs_write(v)
+ void *v;
+{
+#ifdef ADOSFS_DIAGNOSTIC
struct vop_write_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
- } */ *sp;
-{
-#ifdef ADOSFS_DIAGNOSTIC
+ } */ *sp = v;
advopprint(sp);
printf(" EOPNOTSUPP)");
#endif
@@ -238,7 +341,10 @@ adosfs_write(sp)
*/
/* ARGSUSED */
int
-adosfs_ioctl(sp)
+adosfs_ioctl(v)
+ void *v;
+{
+#ifdef ADOSFS_DIAGNOSTIC
struct vop_ioctl_args /* {
struct vnode *a_vp;
u_long a_command;
@@ -246,9 +352,7 @@ adosfs_ioctl(sp)
int a_fflag;
struct ucred *a_cred;
struct proc *a_p;
- } */ *sp;
-{
-#ifdef ADOSFS_DIAGNOSTIC
+ } */ *sp = v;
advopprint(sp);
printf(" ENOTTY)");
#endif
@@ -257,19 +361,20 @@ adosfs_ioctl(sp)
/* ARGSUSED */
int
-adosfs_select(sp)
+adosfs_select(v)
+ void *v;
+{
+#ifdef ADOSFS_DIAGNOSTIC
struct vop_select_args /* {
struct vnode *a_vp;
int a_which;
int a_fflags;
struct ucred *a_cred;
struct proc *a_p;
- } */ *sp;
-{
+ } */ *sp = v;
/*
* sure there's something to read...
*/
-#ifdef ADOSFS_DIAGNOSTIC
advopprint(sp);
printf(" 1)");
#endif
@@ -280,11 +385,12 @@ adosfs_select(sp)
* Just call the device strategy routine
*/
int
-adosfs_strategy(sp)
+adosfs_strategy(v)
+ void *v;
+{
struct vop_strategy_args /* {
struct buf *a_bp;
- } */ *sp;
-{
+ } */ *sp = v;
struct buf *bp;
struct anode *ap;
struct vnode *vp;
@@ -304,8 +410,8 @@ adosfs_strategy(sp)
vp = bp->b_vp;
ap = VTOA(vp);
if (bp->b_blkno == bp->b_lblkno) {
- if (error =
- VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno, NULL)) {
+ error = VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno, NULL);
+ if (error) {
bp->b_flags |= B_ERROR;
biodone(bp);
goto reterr;
@@ -326,15 +432,62 @@ reterr:
return(error);
}
+int
+adosfs_link(v)
+ void *v;
+{
+ struct vop_link_args /* {
+ struct vnode *a_dvp;
+ struct vnode *a_vp;
+ struct componentname *a_cnp;
+ } */ *ap = v;
+
+ VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
+ vput(ap->a_dvp);
+ return (EROFS);
+}
+
+int
+adosfs_symlink(v)
+ void *v;
+{
+ struct vop_symlink_args /* {
+ struct vnode *a_dvp;
+ struct vnode **a_vpp;
+ struct componentname *a_cnp;
+ struct vattr *a_vap;
+ char *a_target;
+ } */ *ap = v;
+
+ VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
+ vput(ap->a_dvp);
+ return (EROFS);
+}
+
+int
+adosfs_abortop(v)
+ void *v;
+{
+ struct vop_abortop_args /* {
+ struct vnode *a_dvp;
+ struct componentname *a_cnp;
+ } */ *ap = v;
+
+ if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ return (0);
+}
+
/*
* lock the anode
*/
int
-adosfs_lock(sp)
+adosfs_lock(v)
+ void *v;
+{
struct vop_lock_args /* {
struct vnode *a_vp;
- } */ *sp;
-{
+ } */ *sp = v;
struct vnode *vp;
struct anode *ap;
@@ -366,11 +519,12 @@ start:
* unlock an anode
*/
int
-adosfs_unlock(sp)
+adosfs_unlock(v)
+ void *v;
+{
struct vop_unlock_args /* {
struct vnode *a_vp;
- } */ *sp;
-{
+ } */ *sp = v;
struct anode *ap;
#ifdef ADOSFS_DIAGNOSTIC
@@ -394,15 +548,16 @@ adosfs_unlock(sp)
* Wait until the vnode has finished changing state.
*/
int
-adosfs_bmap(sp)
+adosfs_bmap(v)
+ void *v;
+{
struct vop_bmap_args /* {
struct vnode *a_vp;
daddr_t a_bn;
struct vnode **a_vpp;
daddr_t *a_bnp;
int *a_runp;
- } */ *sp;
-{
+ } */ *sp = v;
struct anode *ap;
struct buf *flbp;
long nb, flblk, flblkoff, fcnt;
@@ -467,8 +622,9 @@ adosfs_bmap(sp)
error = EINVAL;
goto reterr;
}
- if (error = bread(ap->amp->devvp, nb, ap->amp->bsize,
- NOCRED, &flbp))
+ error = bread(ap->amp->devvp, nb, ap->amp->bsize,
+ NOCRED, &flbp);
+ if (error)
goto reterr;
if (adoscksum(flbp, ap->nwords)) {
#ifdef DIAGNOSTIC
@@ -518,11 +674,14 @@ reterr:
*/
/* ARGSUSED */
int
-adosfs_print(sp)
+adosfs_print(v)
+ void *v;
+{
+#if 0
struct vop_print_args /* {
struct vnode *a_vp;
- } */ *sp;
-{
+ } */ *sp = v;
+#endif
return(0);
}
@@ -535,7 +694,9 @@ struct adirent {
};
int
-adosfs_readdir(sp)
+adosfs_readdir(v)
+ void *v;
+{
struct vop_readdir_args /* {
struct vnode *a_vp;
struct uio *a_uio;
@@ -543,15 +704,14 @@ adosfs_readdir(sp)
int *a_eofflag;
u_long *a_cookies;
int a_ncookies;
- } */ *sp;
-{
+ } */ *sp = v;
int error, useri, chainc, hashi, scanned, uavail;
struct adirent ad, *adp;
struct anode *pap, *ap;
struct adosfsmount *amp;
struct vnode *vp;
struct uio *uio;
- u_long nextbn, resid;
+ u_long nextbn;
off_t uoff;
#ifdef ADOSFS_DIAGNOSTIC
@@ -615,7 +775,8 @@ adosfs_readdir(sp)
*/
ap = NULL;
do {
- if (error = VFS_VGET(amp->mp, (ino_t)nextbn, &vp))
+ error = VFS_VGET(amp->mp, (ino_t)nextbn, &vp);
+ if (error)
goto reterr;
ap = VTOA(vp);
scanned++;
@@ -671,7 +832,7 @@ adosfs_readdir(sp)
bcopy(ap->name, adp->name, adp->namlen);
vput(vp);
- error = uiomove(adp, sizeof(struct adirent), uio);
+ error = uiomove((caddr_t) adp, sizeof(struct adirent), uio);
if (error)
break;
if (sp->a_cookies) {
@@ -694,14 +855,15 @@ reterr:
int
-adosfs_access(sp)
+adosfs_access(v)
+ void *v;
+{
struct vop_access_args /* {
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct proc *a_p;
- } */ *sp;
-{
+ } */ *sp = v;
struct anode *ap;
int error;
@@ -728,13 +890,14 @@ adosfs_access(sp)
/*ARGSUSED*/
int
-adosfs_readlink(sp)
+adosfs_readlink(v)
+ void *v;
+{
struct vop_readlink_args /* {
struct vnode *a_vp;
struct uio *a_uio;
struct ucred *a_cred;
- } */ *sp;
-{
+ } */ *sp = v;
struct anode *ap;
int error;
@@ -758,11 +921,12 @@ adosfs_readlink(sp)
/*ARGSUSED*/
int
-adosfs_inactive(sp)
+adosfs_inactive(v)
+ void *v;
+{
struct vop_inactive_args /* {
struct vnode *a_vp;
- } */ *sp;
-{
+ } */ *sp = v;
#ifdef ADOSFS_DIAGNOSTIC
advopprint(sp);
#endif
@@ -774,12 +938,14 @@ adosfs_inactive(sp)
#endif
return(0);
}
+
int
-adosfs_islocked(sp)
+adosfs_islocked(v)
+ void *v;
+{
struct vop_islocked_args /* {
struct vnode *a_vp;
- } */ *sp;
-{
+ } */ *sp = v;
int locked;
#ifdef ADOSFS_DIAGNOSTIC
@@ -799,11 +965,12 @@ adosfs_islocked(sp)
* no lock needed we are being called from vclean()
*/
int
-adosfs_reclaim(sp)
+adosfs_reclaim(v)
+ void *v;
+{
struct vop_reclaim_args /* {
struct vnode *a_vp;
- } */ *sp;
-{
+ } */ *sp = v;
struct vnode *vp;
struct anode *ap;
@@ -829,13 +996,15 @@ adosfs_reclaim(sp)
* investigate exactly what each return type means as they are probably
* not valid currently
*/
-adosfs_pathconf(sp)
+int
+adosfs_pathconf(v)
+ void *v;
+{
struct vop_pathconf_args /* {
struct vnode *a_vp;
int a_name;
register_t *a_retval;
- } */ *sp;
-{
+ } */ *sp = v;
switch (sp->a_name) {
case _PC_LINK_MAX:
@@ -883,80 +1052,3 @@ adnullop(sp)
#endif
return(0);
}
-
-#define adosfs_close ((int (*) __P((struct vop_close_args *)))adnullop)
-#define adosfs_fsync ((int (*) __P((struct vop_fsync_args *)))adnullop)
-#ifdef NFSSERVER
-int lease_check __P((struct vop_lease_args *));
-#define adosfs_lease_check lease_check
-#else
-#define adosfs_lease_check ((int (*) __P((struct vop_lease_args *)))adnullop)
-#endif
-#define adosfs_seek ((int (*) __P((struct vop_seek_args *)))adnullop)
-#define adosfs_vfree ((int (*) __P((struct vop_vfree_args *)))adnullop)
-
-#define adosfs_abortop ((int (*) __P((struct vop_abortop_args *)))adenotsup)
-#define adosfs_advlock ((int (*) __P((struct vop_advlock_args *)))adenotsup)
-#define adosfs_blkatoff ((int (*) __P((struct vop_blkatoff_args *)))adenotsup)
-#define adosfs_bwrite ((int (*) __P((struct vop_bwrite_args *)))adenotsup)
-#define adosfs_create ((int (*) __P((struct vop_create_args *)))adenotsup)
-#define adosfs_link ((int (*) __P((struct vop_link_args *)))adenotsup)
-#define adosfs_mkdir ((int (*) __P((struct vop_mkdir_args *)))adenotsup)
-#define adosfs_mknod ((int (*) __P((struct vop_mknod_args *)))adenotsup)
-#define adosfs_mmap ((int (*) __P((struct vop_mmap_args *)))adenotsup)
-#define adosfs_remove ((int (*) __P((struct vop_remove_args *)))adenotsup)
-#define adosfs_rename ((int (*) __P((struct vop_rename_args *)))adenotsup)
-#define adosfs_rmdir ((int (*) __P((struct vop_rmdir_args *)))adenotsup)
-#define adosfs_setattr ((int (*) __P((struct vop_setattr_args *)))adenotsup)
-#define adosfs_symlink ((int (*) __P((struct vop_symlink_args *)))adenotsup)
-#define adosfs_truncate ((int (*) __P((struct vop_truncate_args *)))adenotsup)
-#define adosfs_update ((int (*) __P((struct vop_update_args *)))adenotsup)
-#define adosfs_valloc ((int (*) __P((struct vop_valloc_args *)))adenotsup)
-
-struct vnodeopv_entry_desc adosfs_vnodeop_entries[] = {
- { &vop_default_desc, vn_default_error },
- { &vop_lookup_desc, adosfs_lookup }, /* lookup */
- { &vop_create_desc, adosfs_create }, /* create */
- { &vop_mknod_desc, adosfs_mknod }, /* mknod */
- { &vop_open_desc, adosfs_open }, /* open */
- { &vop_close_desc, adosfs_close }, /* close */
- { &vop_access_desc, adosfs_access }, /* access */
- { &vop_getattr_desc, adosfs_getattr }, /* getattr */
- { &vop_setattr_desc, adosfs_setattr }, /* setattr */
- { &vop_read_desc, adosfs_read }, /* read */
- { &vop_write_desc, adosfs_write }, /* write */
- { &vop_lease_desc, adosfs_lease_check }, /* lease */
- { &vop_ioctl_desc, adosfs_ioctl }, /* ioctl */
- { &vop_select_desc, adosfs_select }, /* select */
- { &vop_mmap_desc, adosfs_mmap }, /* mmap */
- { &vop_fsync_desc, adosfs_fsync }, /* fsync */
- { &vop_seek_desc, adosfs_seek }, /* seek */
- { &vop_remove_desc, adosfs_remove }, /* remove */
- { &vop_link_desc, adosfs_link }, /* link */
- { &vop_rename_desc, adosfs_rename }, /* rename */
- { &vop_mkdir_desc, adosfs_mkdir }, /* mkdir */
- { &vop_rmdir_desc, adosfs_rmdir }, /* rmdir */
- { &vop_symlink_desc, adosfs_symlink }, /* symlink */
- { &vop_readdir_desc, adosfs_readdir }, /* readdir */
- { &vop_readlink_desc, adosfs_readlink }, /* readlink */
- { &vop_abortop_desc, adosfs_abortop }, /* abortop */
- { &vop_inactive_desc, adosfs_inactive }, /* inactive */
- { &vop_reclaim_desc, adosfs_reclaim }, /* reclaim */
- { &vop_lock_desc, adosfs_lock }, /* lock */
- { &vop_unlock_desc, adosfs_unlock }, /* unlock */
- { &vop_bmap_desc, adosfs_bmap }, /* bmap */
- { &vop_strategy_desc, adosfs_strategy }, /* strategy */
- { &vop_print_desc, adosfs_print }, /* print */
- { &vop_islocked_desc, adosfs_islocked }, /* islocked */
- { &vop_pathconf_desc, adosfs_pathconf }, /* pathconf */
- { &vop_advlock_desc, adosfs_advlock }, /* advlock */
- { &vop_blkatoff_desc, adosfs_blkatoff }, /* blkatoff */
- { &vop_valloc_desc, adosfs_valloc }, /* valloc */
- { &vop_vfree_desc, adosfs_vfree }, /* vfree */
- { &vop_truncate_desc, adosfs_truncate }, /* truncate */
- { &vop_update_desc, adosfs_update }, /* update */
- { &vop_bwrite_desc, adosfs_bwrite }, /* bwrite */
- { (struct vnodeop_desc*)NULL, (int(*)())NULL }
-};
-struct vnodeopv_desc adosfs_vnodeop_opv_desc =
- { &adosfs_vnodeop_p, adosfs_vnodeop_entries };