From bb42c02ce56aec29e3860bec47e47157d0406f20 Mon Sep 17 00:00:00 2001 From: Antoine Verheijen Date: Mon, 21 Jan 2013 02:30:58 -0700 Subject: [PATCH] OpenBSD: Replace "vnodeop_desc" with "vops" in kernel module. In OpenBSD 4.9, the vnode operations vector in the "vnode" struct was changed from using a "vnodeop_desc" struct to a new "vops" struct. This patch makes the appropriate changes to the OpenBSD kernel module support to accommodate the change. Change-Id: Ib47259e1213e29658a691ce3a53d7ac88e8d746b Reviewed-on: http://gerrit.openafs.org/8928 Reviewed-by: Derrick Brashear Tested-by: BuildBot --- src/afs/OBSD/osi_machdep.h | 7 +++++- src/afs/OBSD/osi_vfsops.c | 10 ++++++++ src/afs/OBSD/osi_vnodeops.c | 46 +++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/src/afs/OBSD/osi_machdep.h b/src/afs/OBSD/osi_machdep.h index c0599f2723..0b1e90165a 100644 --- a/src/afs/OBSD/osi_machdep.h +++ b/src/afs/OBSD/osi_machdep.h @@ -230,11 +230,16 @@ extern struct lock afs_global_lock; } while (0) /* vnodes */ +#if defined(AFS_OBSD49_ENV) +extern struct vops afs_vops; +#define IsAfsVnode(v) ((v)->v_op == &afs_vops) +#else extern int (**afs_vnodeop_p) (); +#define IsAfsVnode(v) ((v)->v_op == afs_vnodeop_p) +#endif #define vType(vc) AFSTOV(vc)->v_type #define vSetVfsp(vc, vfsp) AFSTOV(vc)->v_mount = (vfsp) #define vSetType(vc, type) AFSTOV(vc)->v_type = (type) -#define IsAfsVnode(v) ((v)->v_op == afs_vnodeop_p) #define SetAfsVnode(v) /* nothing; done in getnewvnode() */ #define osi_procname(procname, size) strncpy(procname, curproc->p_comm, size) diff --git a/src/afs/OBSD/osi_vfsops.c b/src/afs/OBSD/osi_vfsops.c index d4ab1f60e7..7b4125fb3b 100644 --- a/src/afs/OBSD/osi_vfsops.c +++ b/src/afs/OBSD/osi_vfsops.c @@ -309,10 +309,18 @@ afs_badcall(struct proc *p, void *xx, register_t * yy) return ENOSYS; } +#if defined(AFS_OBSD49_ENV) +extern struct vops afs_vops; +#endif + void afs_obsd_getnewvnode(struct vcache *tvc) { +#if defined(AFS_OBSD49_ENV) + while (getnewvnode(VT_AFS, afs_globalVFS, &afs_vops, &tvc->v)) { +#else while (getnewvnode(VT_AFS, afs_globalVFS, afs_vnodeop_p, &tvc->v)) { +#endif /* no vnodes available, force an alloc (limits be damned)! */ desiredvnodes++; } @@ -441,8 +449,10 @@ afs_vfs_load(struct lkm_table *lkmtp, int cmd) { extern char *memname[]; +#if ! defined(AFS_OBSD49_ENV) vfs_opv_init_explicit(&afs_vnodeop_opv_desc); vfs_opv_init_default(&afs_vnodeop_opv_desc); +#endif if (memname[M_AFSGENERIC] == NULL) memname[M_AFSGENERIC] = afsgenmem; if (memname[M_AFSFID] == NULL) diff --git a/src/afs/OBSD/osi_vnodeops.c b/src/afs/OBSD/osi_vnodeops.c index a3f572edfc..d3b85fd9bd 100644 --- a/src/afs/OBSD/osi_vnodeops.c +++ b/src/afs/OBSD/osi_vnodeops.c @@ -151,6 +151,46 @@ int afs_obsd_advlock(void *); ((int (*) __P((void *)))eopnotsupp) #define afs_obsd_reallocblks afs_obsd_opnotsupp +#if defined(AFS_OBSD49_ENV) + +struct vops afs_vops = { + .vop_lookup = afs_obsd_lookup, + .vop_create = afs_obsd_create, + .vop_mknod = afs_obsd_mknod, + .vop_open = afs_obsd_open, + .vop_close = afs_obsd_close, + .vop_access = afs_obsd_access, + .vop_getattr = afs_obsd_getattr, + .vop_setattr = afs_obsd_setattr, + .vop_read = afs_obsd_read, + .vop_write = afs_obsd_write, + .vop_ioctl = afs_obsd_ioctl, + .vop_poll = afs_obsd_select, + .vop_fsync = afs_obsd_fsync, + .vop_remove = afs_obsd_remove, + .vop_link = afs_obsd_link, + .vop_rename = afs_obsd_rename, + .vop_mkdir = afs_obsd_mkdir, + .vop_rmdir = afs_obsd_rmdir, + .vop_symlink = afs_obsd_symlink, + .vop_readdir = afs_obsd_readdir, + .vop_readlink = afs_obsd_readlink, + .vop_abortop = vop_generic_abortop, + .vop_inactive = afs_obsd_inactive, + .vop_reclaim = afs_obsd_reclaim, + .vop_lock = afs_obsd_lock, + .vop_unlock = afs_obsd_unlock, + .vop_bmap = afs_obsd_bmap, + .vop_strategy = afs_obsd_strategy, + .vop_print = afs_obsd_print, + .vop_islocked = afs_obsd_islocked, + .vop_pathconf = afs_obsd_pathconf, + .vop_advlock = afs_obsd_advlock, + .vop_bwrite = vop_generic_bwrite, +}; + +#else + /* Global vfs data structures for AFS. */ int (**afs_vnodeop_p) __P((void *)); struct vnodeopv_entry_desc afs_vnodeop_entries[] = { @@ -202,6 +242,8 @@ struct vnodeopv_entry_desc afs_vnodeop_entries[] = { struct vnodeopv_desc afs_vnodeop_opv_desc = { &afs_vnodeop_p, afs_vnodeop_entries }; +#endif + #define GETNAME() \ struct componentname *cnp = ap->a_cnp; \ char *name; \ @@ -676,7 +718,11 @@ afs_obsd_rename(void *v) if ((fcnp->cn_flags & SAVESTART) == 0) panic("afs_rename: lost from startdir"); fcnp->cn_nameiop = DELETE; +#if defined(AFS_OBSD49_ENV) + (void)vfs_relookup(fdvp, &fvp, fcnp); +#else (void)relookup(fdvp, &fvp, fcnp); +#endif return (VOP_REMOVE(fdvp, fvp, fcnp)); }