mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
Update to the new thread world order for FBSD
Since FreeBSD 5.0, system calls have taken a thread argument instead of a proc argument. Finish catching up. Also remove the retval argument, which is not in the system sysent definition, and is unused. Since we took our sweet time getting around to it, we can also remove large swaths of FreeBSD 4.X-only code from the area. Fix the vop_*_args struct definition comments that had changes in addition to proc-->thread while we're here. Change-Id: Ib469e77655a6c04bfbfe1e5fab54f6f3a6119a85 Reviewed-on: http://gerrit.openafs.org/1675 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
ef2604e453
commit
0b475c0c5f
@ -52,10 +52,8 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
|
||||
}
|
||||
#if defined(AFS_FBSD80_ENV)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
#elif defined(AFS_FBSD50_ENV)
|
||||
VOP_UNLOCK(vp, 0, curthread);
|
||||
#else
|
||||
VOP_UNLOCK(vp, 0, curproc);
|
||||
VOP_UNLOCK(vp, 0, curthread);
|
||||
#endif
|
||||
afile->vnode = vp;
|
||||
afile->size = VTOI(vp)->i_size;
|
||||
@ -76,12 +74,10 @@ afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
|
||||
vn_lock(afile->vnode, LK_EXCLUSIVE | LK_RETRY);
|
||||
code = VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp);
|
||||
VOP_UNLOCK(afile->vnode, 0);
|
||||
#elif defined(AFS_FBSD50_ENV)
|
||||
#else
|
||||
vn_lock(afile->vnode, LK_EXCLUSIVE | LK_RETRY, curthread);
|
||||
code = VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp, curthread);
|
||||
VOP_UNLOCK(afile->vnode, LK_EXCLUSIVE, curthread);
|
||||
#else
|
||||
code = VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp, curproc);
|
||||
#endif
|
||||
AFS_GLOCK();
|
||||
if (code == 0) {
|
||||
@ -126,12 +122,9 @@ osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
|
||||
#if defined(AFS_FBSD80_ENV)
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
code = VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp);
|
||||
#elif defined(AFS_FBSD50_ENV)
|
||||
#else
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
|
||||
code = VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp, curthread);
|
||||
#else
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curproc);
|
||||
code = VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp, curproc);
|
||||
#endif
|
||||
if (code != 0 || tvattr.va_size <= asize)
|
||||
goto out;
|
||||
@ -140,19 +133,15 @@ osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
|
||||
tvattr.va_size = asize;
|
||||
#if defined(AFS_FBSD80_ENV)
|
||||
code = VOP_SETATTR(vp, &tvattr, afs_osi_credp);
|
||||
#elif defined(AFS_FBSD50_ENV)
|
||||
code = VOP_SETATTR(vp, &tvattr, afs_osi_credp, curthread);
|
||||
#else
|
||||
code = VOP_SETATTR(vp, &tvattr, afs_osi_credp, curproc);
|
||||
code = VOP_SETATTR(vp, &tvattr, afs_osi_credp, curthread);
|
||||
#endif
|
||||
|
||||
out:
|
||||
#if defined(AFS_FBSD80_ENV)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
#elif defined(AFS_FBSD50_ENV)
|
||||
VOP_UNLOCK(vp, LK_EXCLUSIVE, curthread);
|
||||
#else
|
||||
VOP_UNLOCK(vp, LK_EXCLUSIVE, curproc);
|
||||
VOP_UNLOCK(vp, LK_EXCLUSIVE, curthread);
|
||||
#endif
|
||||
if (glocked)
|
||||
AFS_GLOCK();
|
||||
|
@ -30,19 +30,9 @@ static int
|
||||
afs_getgroups(struct ucred *cred, int ngroups, gid_t * gidset);
|
||||
|
||||
static int
|
||||
afs_setgroups(struct proc *proc, struct ucred **cred, int ngroups,
|
||||
afs_setgroups(struct thread *td, struct ucred **cred, int ngroups,
|
||||
gid_t * gidset, int change_parent);
|
||||
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
/*
|
||||
* This does nothing useful yet.
|
||||
* In 5.0, creds are associated not with a process, but with a thread.
|
||||
* Probably the right thing to do is replace struct proc with struct thread
|
||||
* everywhere, including setpag.
|
||||
* That will be a tedious undertaking.
|
||||
* For now, I'm just passing curproc to AddPag.
|
||||
* This is probably wrong and I don't know what the consequences might be.
|
||||
*/
|
||||
|
||||
int
|
||||
Afs_xsetgroups(struct thread *td, struct setgroups_args *uap)
|
||||
@ -72,57 +62,17 @@ Afs_xsetgroups(struct thread *td, struct setgroups_args *uap)
|
||||
if (((treq.uid >> 24) & 0xff) == 'A') {
|
||||
AFS_GLOCK();
|
||||
/* we've already done a setpag, so now we redo it */
|
||||
AddPag(curproc, treq.uid, &cr);
|
||||
AddPag(td, treq.uid, &cr);
|
||||
AFS_GUNLOCK();
|
||||
}
|
||||
}
|
||||
crfree(cr);
|
||||
return code;
|
||||
}
|
||||
#else /* FBSD50 */
|
||||
int
|
||||
Afs_xsetgroups(p, args, retval)
|
||||
struct proc *p;
|
||||
void *args;
|
||||
int *retval;
|
||||
{
|
||||
int code = 0;
|
||||
struct vrequest treq;
|
||||
struct ucred *cr;
|
||||
|
||||
cr = crdup(p->p_cred->pc_ucred);
|
||||
|
||||
AFS_STATCNT(afs_xsetgroups);
|
||||
AFS_GLOCK();
|
||||
|
||||
code = afs_InitReq(&treq, cr);
|
||||
AFS_GUNLOCK();
|
||||
crfree(cr);
|
||||
if (code)
|
||||
return setgroups(p, args, retval); /* afs has shut down */
|
||||
|
||||
code = setgroups(p, args, retval);
|
||||
/* Note that if there is a pag already in the new groups we don't
|
||||
* overwrite it with the old pag.
|
||||
*/
|
||||
cr = crdup(p->p_cred->pc_ucred);
|
||||
|
||||
if (PagInCred(cr) == NOPAG) {
|
||||
if (((treq.uid >> 24) & 0xff) == 'A') {
|
||||
AFS_GLOCK();
|
||||
/* we've already done a setpag, so now we redo it */
|
||||
AddPag(p, treq.uid, &cr);
|
||||
AFS_GUNLOCK();
|
||||
}
|
||||
}
|
||||
crfree(cr);
|
||||
return code;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
setpag(struct proc *proc, struct ucred **cred, afs_uint32 pagvalue,
|
||||
setpag(struct thread *td, struct ucred **cred, afs_uint32 pagvalue,
|
||||
afs_uint32 * newpag, int change_parent)
|
||||
{
|
||||
#ifdef AFS_FBSD80_ENV
|
||||
@ -152,7 +102,7 @@ setpag(struct proc *proc, struct ucred **cred, afs_uint32 pagvalue,
|
||||
}
|
||||
*newpag = (pagvalue == -1 ? genpag() : pagvalue);
|
||||
afs_get_groups_from_pag(*newpag, &gidset[1], &gidset[2]);
|
||||
code = afs_setgroups(proc, cred, ngroups, gidset, change_parent);
|
||||
code = afs_setgroups(td, cred, ngroups, gidset, change_parent);
|
||||
#ifdef AFS_FBSD80_ENV
|
||||
osi_Free(gidset, gidset_len * sizeof(gid_t));
|
||||
#endif
|
||||
@ -176,37 +126,8 @@ afs_getgroups(struct ucred *cred, int ngroups, gid_t * gidset)
|
||||
|
||||
|
||||
static int
|
||||
afs_setgroups(struct proc *proc, struct ucred **cred, int ngroups,
|
||||
afs_setgroups(struct thread *td, struct ucred **cred, int ngroups,
|
||||
gid_t * gidset, int change_parent)
|
||||
{
|
||||
#ifndef AFS_FBSD50_ENV
|
||||
int ngrps;
|
||||
int i;
|
||||
gid_t *gp;
|
||||
struct ucred *oldcr, *cr;
|
||||
|
||||
AFS_STATCNT(afs_setgroups);
|
||||
/*
|
||||
* The real setgroups() call does this, so maybe we should too.
|
||||
*
|
||||
*/
|
||||
if (ngroups > NGROUPS)
|
||||
return EINVAL;
|
||||
cr = *cred;
|
||||
cr->cr_ngroups = ngroups;
|
||||
gp = cr->cr_groups;
|
||||
while (ngroups--)
|
||||
*gp++ = *gidset++;
|
||||
if (change_parent) {
|
||||
crhold(cr);
|
||||
oldcr = proc->p_pptr->p_cred->pc_ucred;
|
||||
proc->p_pptr->p_cred->pc_ucred = cr;
|
||||
crfree(oldcr);
|
||||
}
|
||||
crhold(cr);
|
||||
oldcr = proc->p_cred->pc_ucred;
|
||||
proc->p_cred->pc_ucred = cr;
|
||||
crfree(oldcr);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
@ -100,14 +100,11 @@ extern void osi_fbsd_free(void *p);
|
||||
#define osi_suser_client_settings(x) (!priv_check(curthread, PRIV_AFS_ADMIN))
|
||||
#define osi_suser_afs_daemon(x) (!priv_check(curthread, PRIV_AFS_DAEMON))
|
||||
#define afs_suser(x) (osi_suser_client_settings((x)) && osi_suser_afs_daemon((x)))
|
||||
#elif defined(AFS_FBSD50_ENV)
|
||||
#define afs_suser(x) (!suser(curthread))
|
||||
#else
|
||||
#define afs_suser(x) (!suser(curproc))
|
||||
#define afs_suser(x) (!suser(curthread))
|
||||
#endif
|
||||
|
||||
#undef osi_getpid
|
||||
#if defined(AFS_FBSD50_ENV)
|
||||
#define VT_AFS "afs"
|
||||
#define VROOT VV_ROOT
|
||||
#define v_flag v_vflag
|
||||
@ -136,34 +133,6 @@ extern struct thread *afs_global_owner;
|
||||
afs_global_owner = 0; \
|
||||
} while (0)
|
||||
# endif
|
||||
#else /* FBSD50 */
|
||||
extern struct lock afs_global_lock;
|
||||
#define osi_curcred() (curproc->p_cred->pc_ucred)
|
||||
#define osi_getpid() (curproc->p_pid)
|
||||
#define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
|
||||
vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
|
||||
extern struct proc *afs_global_owner;
|
||||
#define AFS_GLOCK() \
|
||||
do { \
|
||||
osi_Assert(curproc); \
|
||||
lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, curproc); \
|
||||
osi_Assert(afs_global_owner == 0); \
|
||||
afs_global_owner = curproc; \
|
||||
} while (0)
|
||||
#define AFS_GUNLOCK() \
|
||||
do { \
|
||||
osi_Assert(curproc); \
|
||||
osi_Assert(afs_global_owner == curproc); \
|
||||
afs_global_owner = 0; \
|
||||
lockmgr(&afs_global_lock, LK_RELEASE, 0, curproc); \
|
||||
} while(0)
|
||||
#define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
|
||||
#define osi_InitGlock() \
|
||||
do { \
|
||||
lockinit(&afs_global_lock, PLOCK, "afs global lock", 0, 0); \
|
||||
afs_global_owner = 0; \
|
||||
} while (0)
|
||||
#endif /* FBSD50 */
|
||||
|
||||
#undef SPLVAR
|
||||
#define SPLVAR int splvar
|
||||
|
@ -20,12 +20,6 @@
|
||||
#include "afsincludes.h" /* Afs-based standard headers */
|
||||
#include <sys/namei.h>
|
||||
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
/* serious cheating */
|
||||
#undef curproc
|
||||
#define curproc curthread
|
||||
#endif
|
||||
|
||||
int
|
||||
osi_lookupname(char *aname, enum uio_seg seg, int followlink,
|
||||
struct vnode **vpp)
|
||||
@ -48,7 +42,7 @@ osi_lookupname(char *aname, enum uio_seg seg, int followlink,
|
||||
#ifdef AFS_FBSD80_ENV
|
||||
flags |= MPSAFE; /* namei must take GIANT if needed */
|
||||
#endif
|
||||
NDINIT(&n, LOOKUP, flags, seg, aname, curproc);
|
||||
NDINIT(&n, LOOKUP, flags, seg, aname, curthread);
|
||||
if ((error = namei(&n)) != 0) {
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
if (glocked)
|
||||
@ -60,10 +54,8 @@ osi_lookupname(char *aname, enum uio_seg seg, int followlink,
|
||||
/* XXX should we do this? Usually NOT (matt) */
|
||||
#if defined(AFS_FBSD80_ENV)
|
||||
/*VOP_UNLOCK(n.ni_vp, 0);*/
|
||||
#elif defined(AFS_FBSD50_ENV)
|
||||
VOP_UNLOCK(n.ni_vp, 0, curthread);
|
||||
#else
|
||||
VOP_UNLOCK(n.ni_vp, 0, curproc);
|
||||
VOP_UNLOCK(n.ni_vp, 0, curthread);
|
||||
#endif
|
||||
NDFREE(&n, NDF_ONLY_PNBUF);
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
|
@ -28,10 +28,8 @@ int afs_init(struct vfsconf *vfc);
|
||||
int afs_uninit(struct vfsconf *vfc);
|
||||
#if defined(AFS_FBSD80_ENV)
|
||||
extern int afs_statfs(struct mount *mp, struct statfs *abp);
|
||||
#elif defined(AFS_FBSD50_ENV)
|
||||
extern int afs_statfs(struct mount *mp, struct statfs *abp, struct thread *th);
|
||||
#else
|
||||
extern int afs_statfs(struct mount *mp, struct statfs *abp, struct proc *p);
|
||||
extern int afs_statfs(struct mount *mp, struct statfs *abp, struct thread *td);
|
||||
#endif
|
||||
|
||||
#endif /* _OSI_PROTO_H_ */
|
||||
|
@ -17,12 +17,6 @@ struct vcache *afs_globalVp = NULL;
|
||||
struct mount *afs_globalVFS = NULL;
|
||||
int afs_pbuf_freecnt = -1;
|
||||
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
#define THREAD_OR_PROC struct thread *p
|
||||
#else
|
||||
#define THREAD_OR_PROC struct proc *p
|
||||
#endif
|
||||
|
||||
extern int Afs_xsetgroups();
|
||||
extern int afs_xioctl();
|
||||
|
||||
@ -64,7 +58,7 @@ afs_uninit(struct vfsconf *vfc)
|
||||
}
|
||||
|
||||
int
|
||||
afs_start(struct mount *mp, int flags, THREAD_OR_PROC)
|
||||
afs_start(struct mount *mp, int flags, struct thread *p)
|
||||
{
|
||||
return (0); /* nothing to do. ? */
|
||||
}
|
||||
@ -76,11 +70,11 @@ afs_omount(struct mount *mp, char *path, caddr_t data)
|
||||
afs_omount(struct mount *mp, char *path, caddr_t data, struct thread *p)
|
||||
#else
|
||||
afs_omount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
|
||||
THREAD_OR_PROC)
|
||||
struct thread *p)
|
||||
#endif
|
||||
{
|
||||
/* ndp contains the mounted-from device. Just ignore it.
|
||||
* we also don't care about our proc struct. */
|
||||
* we also don't care about our thread struct. */
|
||||
size_t size;
|
||||
|
||||
if (mp->mnt_flag & MNT_UPDATE)
|
||||
@ -158,7 +152,7 @@ int
|
||||
#ifdef AFS_FBSD80_ENV
|
||||
afs_unmount(struct mount *mp, int flags)
|
||||
#else
|
||||
afs_unmount(struct mount *mp, int flags, THREAD_OR_PROC)
|
||||
afs_unmount(struct mount *mp, int flags, struct thread *p)
|
||||
#endif
|
||||
{
|
||||
|
||||
@ -198,15 +192,10 @@ afs_root(struct mount *mp, struct vnode **vpp)
|
||||
int error;
|
||||
struct vrequest treq;
|
||||
register struct vcache *tvp = 0;
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
#if !defined(AFS_FBSD53_ENV) || defined(AFS_FBSD80_ENV)
|
||||
struct thread *td = curthread;
|
||||
#endif
|
||||
struct ucred *cr = osi_curcred();
|
||||
#else
|
||||
struct proc *p = curproc;
|
||||
struct ucred *cr = p->p_cred->pc_ucred;
|
||||
#endif
|
||||
|
||||
AFS_GLOCK();
|
||||
AFS_STATCNT(afs_root);
|
||||
@ -270,7 +259,7 @@ int
|
||||
#ifdef AFS_FBSD80_ENV
|
||||
afs_statfs(struct mount *mp, struct statfs *abp)
|
||||
#else
|
||||
afs_statfs(struct mount *mp, struct statfs *abp, THREAD_OR_PROC)
|
||||
afs_statfs(struct mount *mp, struct statfs *abp, struct thread *p)
|
||||
#endif
|
||||
{
|
||||
AFS_GLOCK();
|
||||
@ -306,7 +295,7 @@ afs_sync(struct mount *mp, int waitfor)
|
||||
#elif defined(AFS_FBSD60_ENV)
|
||||
afs_sync(struct mount *mp, int waitfor, struct thread *td)
|
||||
#else
|
||||
afs_sync(struct mount *mp, int waitfor, struct ucred *cred, THREAD_OR_PROC)
|
||||
afs_sync(struct mount *mp, int waitfor, struct ucred *cred, struct thread *p)
|
||||
#endif
|
||||
{
|
||||
return 0;
|
||||
|
@ -59,15 +59,9 @@
|
||||
#if defined(AFS_FBSD80_ENV)
|
||||
#define lock_vnode(v) vn_lock((v), LK_EXCLUSIVE | LK_RETRY)
|
||||
#define unlock_vnode(v) VOP_UNLOCK((v), 0)
|
||||
#elif defined(AFS_FBSD50_ENV)
|
||||
#else
|
||||
#define lock_vnode(v) vn_lock((v), LK_EXCLUSIVE | LK_RETRY, curthread)
|
||||
#define unlock_vnode(v) VOP_UNLOCK((v), 0, curthread)
|
||||
#else
|
||||
#define lock_vnode(v) vn_lock((v), LK_EXCLUSIVE | LK_RETRY, curproc)
|
||||
#define unlock_vnode(v) VOP_UNLOCK((v), 0, curproc)
|
||||
/* need splvm() protection? */
|
||||
#define VM_OBJECT_LOCK(o)
|
||||
#define VM_OBJECT_UNLOCK(o)
|
||||
#endif
|
||||
|
||||
/* Try to discard pages, in order to recycle a vcache entry.
|
||||
@ -162,11 +156,7 @@ osi_VM_StoreAllSegments(struct vcache *avc)
|
||||
do {
|
||||
anyio = 0;
|
||||
if (VOP_GETVOBJECT(vp, &obj) == 0 && (obj->flags & OBJ_MIGHTBEDIRTY)) {
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
if (!vget(vp, LK_EXCLUSIVE | LK_RETRY, curthread)) {
|
||||
#else
|
||||
if (!vget(vp, LK_EXCLUSIVE | LK_RETRY | LK_NOOBJ, curproc)) {
|
||||
#endif
|
||||
if (VOP_GETVOBJECT(vp, &obj) == 0) {
|
||||
VM_OBJECT_LOCK(obj);
|
||||
vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
|
||||
|
@ -474,11 +474,7 @@ afs_vop_lookup(ap)
|
||||
register int flags = ap->a_cnp->cn_flags;
|
||||
int lockparent; /* 1 => lockparent flag is set */
|
||||
int wantparent; /* 1 => wantparent or lockparent flag */
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
struct thread *p = ap->a_cnp->cn_thread;
|
||||
#else
|
||||
struct proc *p = ap->a_cnp->cn_proc;
|
||||
#endif
|
||||
|
||||
dvp = ap->a_dvp;
|
||||
if (dvp->v_type != VDIR) {
|
||||
@ -570,11 +566,7 @@ afs_vop_create(ap)
|
||||
int error = 0;
|
||||
struct vcache *vcp;
|
||||
register struct vnode *dvp = ap->a_dvp;
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
struct thread *p = ap->a_cnp->cn_thread;
|
||||
#else
|
||||
struct proc *p = ap->a_cnp->cn_proc;
|
||||
#endif
|
||||
GETNAME();
|
||||
|
||||
AFS_GLOCK();
|
||||
@ -637,7 +629,8 @@ afs_vop_open(ap)
|
||||
* struct vnode *a_vp;
|
||||
* int a_mode;
|
||||
* struct ucred *a_cred;
|
||||
* struct proc *a_p;
|
||||
* struct thread *a_td;
|
||||
* struct file *a_fp;
|
||||
* } */ *ap;
|
||||
{
|
||||
int error;
|
||||
@ -663,7 +656,7 @@ afs_vop_close(ap)
|
||||
* struct vnode *a_vp;
|
||||
* int a_fflag;
|
||||
* struct ucred *a_cred;
|
||||
* struct proc *a_p;
|
||||
* struct thread *a_td;
|
||||
* } */ *ap;
|
||||
{
|
||||
int code;
|
||||
@ -682,9 +675,9 @@ int
|
||||
afs_vop_access(ap)
|
||||
struct vop_access_args /* {
|
||||
* struct vnode *a_vp;
|
||||
* int a_mode;
|
||||
* accmode_t a_accmode;
|
||||
* struct ucred *a_cred;
|
||||
* struct proc *a_p;
|
||||
* struct thread *a_td;
|
||||
* } */ *ap;
|
||||
{
|
||||
int code;
|
||||
@ -704,7 +697,6 @@ afs_vop_getattr(ap)
|
||||
* struct vnode *a_vp;
|
||||
* struct vattr *a_vap;
|
||||
* struct ucred *a_cred;
|
||||
* struct proc *a_p;
|
||||
* } */ *ap;
|
||||
{
|
||||
int code;
|
||||
@ -720,7 +712,6 @@ afs_vop_setattr(ap)
|
||||
* struct vnode *a_vp;
|
||||
* struct vattr *a_vap;
|
||||
* struct ucred *a_cred;
|
||||
* struct proc *a_p;
|
||||
* } */ *ap;
|
||||
{
|
||||
int code;
|
||||
@ -828,11 +819,7 @@ afs_vop_getpages(struct vop_getpages_args *ap)
|
||||
uio.uio_resid = ap->a_count;
|
||||
uio.uio_segflg = UIO_SYSSPACE;
|
||||
uio.uio_rw = UIO_READ;
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
uio.uio_td = curthread;
|
||||
#else
|
||||
uio.uio_procp = curproc;
|
||||
#endif
|
||||
|
||||
AFS_GLOCK();
|
||||
osi_FlushPages(avc, osi_curcred()); /* hold bozon lock, but not basic vnode lock */
|
||||
@ -1001,11 +988,7 @@ afs_vop_putpages(struct vop_putpages_args *ap)
|
||||
uio.uio_resid = ap->a_count;
|
||||
uio.uio_segflg = UIO_SYSSPACE;
|
||||
uio.uio_rw = UIO_WRITE;
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
uio.uio_td = curthread;
|
||||
#else
|
||||
uio.uio_procp = curproc;
|
||||
#endif
|
||||
sync = IO_VMIO;
|
||||
if (ap->a_sync & VM_PAGER_PUT_SYNC)
|
||||
sync |= IO_SYNC;
|
||||
@ -1033,11 +1016,11 @@ int
|
||||
afs_vop_ioctl(ap)
|
||||
struct vop_ioctl_args /* {
|
||||
* struct vnode *a_vp;
|
||||
* int a_command;
|
||||
* caddr_t a_data;
|
||||
* u_long a_command;
|
||||
* void *a_data;
|
||||
* int a_fflag;
|
||||
* struct ucred *a_cred;
|
||||
* struct proc *a_p;
|
||||
* struct thread *a_td;
|
||||
* } */ *ap;
|
||||
{
|
||||
struct vcache *tvc = VTOAFS(ap->a_vp);
|
||||
@ -1065,7 +1048,7 @@ afs_vop_poll(ap)
|
||||
* struct vnode *a_vp;
|
||||
* int a_events;
|
||||
* struct ucred *a_cred;
|
||||
* struct proc *a_p;
|
||||
* struct thread *td;
|
||||
* } */ *ap;
|
||||
{
|
||||
/*
|
||||
@ -1086,7 +1069,7 @@ afs_vop_mmap(ap)
|
||||
* struct vnode *a_vp;
|
||||
* int a_fflags;
|
||||
* struct ucred *a_cred;
|
||||
* struct proc *a_p;
|
||||
* struct thread *td;
|
||||
* } */ *ap;
|
||||
{
|
||||
return (EINVAL);
|
||||
@ -1096,9 +1079,8 @@ int
|
||||
afs_vop_fsync(ap)
|
||||
struct vop_fsync_args /* {
|
||||
* struct vnode *a_vp;
|
||||
* struct ucred *a_cred;
|
||||
* int a_waitfor;
|
||||
* struct proc *a_p;
|
||||
* struct thread *td;
|
||||
* } */ *ap;
|
||||
{
|
||||
int error;
|
||||
@ -1150,11 +1132,7 @@ afs_vop_link(ap)
|
||||
int error = 0;
|
||||
register struct vnode *dvp = ap->a_tdvp;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
struct thread *p = ap->a_cnp->cn_thread;
|
||||
#else
|
||||
struct proc *p = ap->a_cnp->cn_proc;
|
||||
#endif
|
||||
|
||||
GETNAME();
|
||||
if (dvp->v_mount != vp->v_mount) {
|
||||
@ -1198,11 +1176,7 @@ afs_vop_rename(ap)
|
||||
register struct vnode *tdvp = ap->a_tdvp;
|
||||
struct vnode *fvp = ap->a_fvp;
|
||||
register struct vnode *fdvp = ap->a_fdvp;
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
struct thread *p = fcnp->cn_thread;
|
||||
#else
|
||||
struct proc *p = fcnp->cn_proc;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check for cross-device rename.
|
||||
@ -1304,11 +1278,7 @@ afs_vop_mkdir(ap)
|
||||
register struct vattr *vap = ap->a_vap;
|
||||
int error = 0;
|
||||
struct vcache *vcp;
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
struct thread *p = ap->a_cnp->cn_thread;
|
||||
#else
|
||||
struct proc *p = ap->a_cnp->cn_proc;
|
||||
#endif
|
||||
|
||||
GETNAME();
|
||||
#ifdef DIAGNOSTIC
|
||||
@ -1378,11 +1348,7 @@ afs_vop_symlink(struct vop_symlink_args *ap)
|
||||
error = afs_lookup(VTOAFS(dvp), name, &vcp, cnp->cn_cred);
|
||||
if (error == 0) {
|
||||
newvp = AFSTOV(vcp);
|
||||
#ifdef AFS_FBSD50_ENV
|
||||
ma_vn_lock(newvp, LK_EXCLUSIVE | LK_RETRY, cnp->cn_thread);
|
||||
#else
|
||||
ma_vn_lock(newvp, LK_EXCLUSIVE | LK_RETRY, cnp->cn_proc);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
AFS_GUNLOCK();
|
||||
@ -1463,7 +1429,7 @@ int
|
||||
afs_vop_inactive(ap)
|
||||
struct vop_inactive_args /* {
|
||||
* struct vnode *a_vp;
|
||||
* struct proc *a_p;
|
||||
* struct thread *td;
|
||||
* } */ *ap;
|
||||
{
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
|
@ -191,6 +191,8 @@ afs_pag_wait(afs_ucred_t **acred)
|
||||
int
|
||||
#if defined(AFS_SUN5_ENV)
|
||||
afs_setpag(afs_ucred_t **credpp)
|
||||
#elif defined(AFS_FBSD_ENV)
|
||||
afs_setpag(struct thread *td, void *args)
|
||||
#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
afs_setpag(afs_proc_t *p, void *args, int *retval)
|
||||
#else
|
||||
@ -220,6 +222,8 @@ afs_setpag(void)
|
||||
|
||||
#if defined(AFS_SUN5_ENV)
|
||||
code = AddPag(genpag(), credpp);
|
||||
#elif defined(AFS_FBSD_ENV)
|
||||
code = AddPag(td, genpag(), &td->td_ucred);
|
||||
#elif defined(AFS_XBSD_ENV)
|
||||
code = AddPag(p, genpag(), &p->p_rcred);
|
||||
#elif defined(AFS_AIX41_ENV)
|
||||
@ -295,6 +299,8 @@ afs_setpag(void)
|
||||
int
|
||||
#if defined(AFS_SUN5_ENV)
|
||||
afs_setpag_val(afs_ucred_t **credpp, int pagval)
|
||||
#elif defined(AFS_FBSD_ENV)
|
||||
afs_setpag_val(struct thread *td, void *args, int pagval)
|
||||
#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
afs_setpag_val(afs_proc_t *p, void *args, int *retval, int pagval)
|
||||
#else
|
||||
@ -323,6 +329,8 @@ afs_setpag_val(int pagval)
|
||||
|
||||
#if defined(AFS_SUN5_ENV)
|
||||
code = AddPag(pagval, credpp);
|
||||
#elif defined(AFS_FBSD_ENV)
|
||||
code = AddPag(td, pagval, &td->td_ucred);
|
||||
#elif defined(AFS_XBSD_ENV)
|
||||
code = AddPag(p, pagval, &p->p_rcred);
|
||||
#elif defined(AFS_AIX41_ENV)
|
||||
@ -407,11 +415,12 @@ afs_getpag_val(void)
|
||||
|
||||
|
||||
/* Note - needs to be available on AIX, others can be static - rework this */
|
||||
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
int
|
||||
#if defined(AFS_FBSD_ENV)
|
||||
AddPag(struct thread *p, afs_int32 aval, afs_ucred_t **credpp)
|
||||
#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
AddPag(afs_proc_t *p, afs_int32 aval, afs_ucred_t **credpp)
|
||||
#else
|
||||
int
|
||||
AddPag(afs_int32 aval, afs_ucred_t **credpp)
|
||||
#endif
|
||||
{
|
||||
|
@ -176,6 +176,9 @@ int afspag_PSetTokens(char *ain, afs_int32 ainSize, afs_ucred_t **acred)
|
||||
afs_proc_t *p = current_proc(); /* XXX */
|
||||
char procname[256];
|
||||
proc_selfname(procname, 256);
|
||||
# elif defined(AFS_FBSD_ENV)
|
||||
struct thread *p = curthread;
|
||||
char *procname = p->td_proc->p_comm;
|
||||
# else
|
||||
afs_proc_t *p = curproc; /* XXX */
|
||||
char *procname = p->p_comm;
|
||||
|
@ -947,7 +947,11 @@ afs_pioctl(struct thread *td, void *args, int *retval)
|
||||
|
||||
#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
int
|
||||
# if defined(AFS_FBSD_ENV)
|
||||
afs_pioctl(struct thread *td, void *args)
|
||||
# else
|
||||
afs_pioctl(afs_proc_t *p, void *args, int *retval)
|
||||
# endif
|
||||
{
|
||||
struct a {
|
||||
char *path;
|
||||
@ -964,7 +968,11 @@ afs_pioctl(afs_proc_t *p, void *args, int *retval)
|
||||
# else
|
||||
return (afs_syscall_pioctl
|
||||
(uap->path, uap->cmd, uap->cmarg, uap->follow,
|
||||
# if defined(AFS_FBSD_ENV)
|
||||
td->td_ucred));
|
||||
# else
|
||||
p->p_cred->pc_ucred));
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
|
||||
@ -1838,6 +1846,9 @@ DECL_PIOCTL(PSetTokens)
|
||||
afs_proc_t *p = current_proc(); /* XXX */
|
||||
char procname[256];
|
||||
proc_selfname(procname, 256);
|
||||
# elif defined(AFS_FBSD_ENV)
|
||||
struct thread *p = curthread;
|
||||
char *procname = p->td_proc->p_comm;
|
||||
# else
|
||||
afs_proc_t *p = curproc; /* XXX */
|
||||
char *procname = p->p_comm;
|
||||
|
@ -572,6 +572,8 @@ extern void shutdown_osinet(void);
|
||||
/* afs_osi_pag.c */
|
||||
#if defined(AFS_SUN5_ENV)
|
||||
extern int afs_setpag(afs_ucred_t **credpp);
|
||||
#elif defined(AFS_FBSD_ENV)
|
||||
extern int afs_setpag(struct thread *td, void *args);
|
||||
#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
extern int afs_setpag(afs_proc_t *p, void *args, int *retval);
|
||||
#else
|
||||
@ -580,7 +582,9 @@ extern int afs_setpag(void);
|
||||
|
||||
extern afs_uint32 genpag(void);
|
||||
extern afs_uint32 getpag(void);
|
||||
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
#if defined(AFS_FBSD_ENV)
|
||||
extern int AddPag(struct thread *td, afs_int32 aval, afs_ucred_t **credpp);
|
||||
#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
extern int AddPag(afs_proc_t *p, afs_int32 aval, afs_ucred_t **credpp);
|
||||
#else
|
||||
extern int AddPag(afs_int32 aval, afs_ucred_t **credpp);
|
||||
@ -701,11 +705,16 @@ extern int usr_setpag(afs_ucred_t **cred, afs_uint32 pagvalue,
|
||||
#else
|
||||
# if defined AFS_XBSD_ENV
|
||||
# if !defined(AFS_DFBSD_ENV)
|
||||
# if defined(AFS_FBSD_ENV)
|
||||
extern int setpag(struct thread *td, struct ucred **cred, afs_uint32 pagvalue,
|
||||
afs_uint32 * newpag, int change_parent);
|
||||
# else
|
||||
extern int setpag(afs_proc_t *proc, struct ucred **cred, afs_uint32 pagvalue,
|
||||
afs_uint32 * newpag, int change_parent);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
# endif /* AFS_FBSD_ENV */
|
||||
# endif /* ! AFS_DFBSD_ENV */
|
||||
# endif /* AFS_XBSD_ENV */
|
||||
#endif /* UKERNEL */
|
||||
|
||||
#if defined(AFS_LINUX26_ENV)
|
||||
extern afs_int32 osi_get_group_pag(afs_ucred_t *cred);
|
||||
@ -887,8 +896,8 @@ extern int copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst);
|
||||
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
#ifdef AFS_DARWIN100_ENV
|
||||
extern int afs3_syscall(afs_proc_t *p, void *args, unsigned int *retval);
|
||||
#elif defined(AFS_FBSD50_ENV)
|
||||
extern int afs3_syscall(struct thread *p, void *args, long *retval);
|
||||
#elif defined(AFS_FBSD_ENV)
|
||||
extern int afs3_syscall(struct thread *p, void *args);
|
||||
#else
|
||||
extern int afs3_syscall(afs_proc_t *p, void *args, long *retval);
|
||||
#endif
|
||||
|
@ -497,16 +497,23 @@ afs3_syscall(afs_proc_t *p, void *args, unsigned int *retval)
|
||||
{
|
||||
struct afssysa64 *uap64 = NULL;
|
||||
struct afssysa *uap = NULL;
|
||||
#elif defined(AFS_FBSD_ENV)
|
||||
int
|
||||
afs3_syscall(struct thread *p, void *args)
|
||||
{
|
||||
register struct a {
|
||||
long syscall;
|
||||
long parm1;
|
||||
long parm2;
|
||||
long parm3;
|
||||
long parm4;
|
||||
long parm5;
|
||||
long parm6;
|
||||
} *uap = (struct a *)args;
|
||||
long *retval;
|
||||
#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
int
|
||||
afs3_syscall(p, args, retval)
|
||||
# ifdef AFS_FBSD50_ENV
|
||||
struct thread *p;
|
||||
# else
|
||||
afs_proc_t *p;
|
||||
# endif
|
||||
void *args;
|
||||
long *retval;
|
||||
afs3_syscall(afs_proc_t *p, void *args, long *retval)
|
||||
{
|
||||
register struct a {
|
||||
long syscall;
|
||||
@ -698,7 +705,9 @@ Afs_syscall()
|
||||
AFS_GUNLOCK();
|
||||
#else
|
||||
AFS_GLOCK();
|
||||
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
#if defined(AFS_FBSD_ENV)
|
||||
code = afs_setpag(p, args);
|
||||
#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
code = afs_setpag(p, args, retval);
|
||||
#else /* AFS_DARWIN_ENV || AFS_XBSD_ENV */
|
||||
code = afs_setpag();
|
||||
|
Loading…
Reference in New Issue
Block a user