From 92946910e205252c23e435ff8fef2a3f29ea9592 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Thu, 4 Feb 2010 16:08:26 +0000 Subject: [PATCH] UKERNEL: End the #define u insanity UKERNEL redefines the character 'u' to do a function call. This hurts other kernel developers in all sorts of interesting ways. Remove the definition, and instead explicitly reference the get_user_struct() function in those places that we need to. Change-Id: I64be2eb527c779df0a3d4508444ed68f3634667d Reviewed-on: http://gerrit.openafs.org/1243 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/UKERNEL/afs_usrops.c | 106 +++++++++++++++--------------- src/afs/UKERNEL/osi_machdep.h | 4 ++ src/afs/UKERNEL/osi_vfsops.c | 2 +- src/afs/UKERNEL/sysincludes.h | 3 +- src/afs/VNOPS/afs_vnop_flock.c | 14 +++- src/afs/VNOPS/afs_vnop_strategy.c | 2 + src/afs/afs_osi.h | 2 + src/afs/afs_osi_pag.c | 8 +++ src/afs/afs_pioctl.c | 12 ++++ src/afs/afs_syscall.c | 4 +- src/afs/lock.h | 6 +- src/auth/ktc.c | 4 +- 12 files changed, 106 insertions(+), 61 deletions(-) diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index 353d0e70b..fe4e2ad50 100644 --- a/src/afs/UKERNEL/afs_usrops.c +++ b/src/afs/UKERNEL/afs_usrops.c @@ -708,7 +708,7 @@ osi_UFSOpen(afs_dcache_id_t *ino) AFS_ASSERT_GLOCK(); if (ino->ufs > n_osi_files) { - u.u_error = ENOENT; + get_user_struct()->u_error = ENOENT; return NULL; } @@ -717,14 +717,14 @@ osi_UFSOpen(afs_dcache_id_t *ino) usr_assert(fp != NULL); fp->fd = open(osi_file_table[ino->ufs - 1].name, O_RDWR | O_CREAT, 0); if (fp->fd < 0) { - u.u_error = errno; + get_user_struct()->u_error = errno; afs_osi_Free((char *)fp, sizeof(struct osi_file)); AFS_GLOCK(); return NULL; } rc = fstat(fp->fd, &st); if (rc < 0) { - u.u_error = errno; + get_user_struct()->u_error = errno; afs_osi_Free((void *)fp, sizeof(struct osi_file)); AFS_GLOCK(); return NULL; @@ -747,7 +747,7 @@ osi_UFSClose(struct osi_file *fp) AFS_GUNLOCK(); rc = close(fp->fd); if (rc < 0) { - u.u_error = errno; + get_user_struct()->u_error = errno; afs_osi_Free((void *)fp, sizeof(struct osi_file)); AFS_GLOCK(); return -1; @@ -767,7 +767,7 @@ osi_UFSTruncate(struct osi_file *fp, afs_int32 len) AFS_GUNLOCK(); rc = ftruncate(fp->fd, len); if (rc < 0) { - u.u_error = errno; + get_user_struct()->u_error = errno; AFS_GLOCK(); return -1; } @@ -791,21 +791,21 @@ afs_osi_Read(struct osi_file *fp, int offset, void *buf, afs_int32 len) rc = lseek(fp->fd, fp->offset, SEEK_SET); } if (rc < 0) { - u.u_error = errno; + get_user_struct()->u_error = errno; AFS_GLOCK(); return -1; } fp->offset = rc; ret = read(fp->fd, buf, len); if (ret < 0) { - u.u_error = errno; + get_user_struct()->u_error = errno; AFS_GLOCK(); return -1; } fp->offset += ret; rc = fstat(fp->fd, &st); if (rc < 0) { - u.u_error = errno; + get_user_struct()->u_error = errno; AFS_GLOCK(); return -1; } @@ -829,21 +829,21 @@ afs_osi_Write(struct osi_file *fp, afs_int32 offset, void *buf, afs_int32 len) rc = lseek(fp->fd, fp->offset, SEEK_SET); } if (rc < 0) { - u.u_error = errno; + get_user_struct()->u_error = errno; AFS_GLOCK(); return -1; } fp->offset = rc; ret = write(fp->fd, buf, len); if (ret < 0) { - u.u_error = errno; + get_user_struct()->u_error = errno; AFS_GLOCK(); return -1; } fp->offset += ret; rc = fstat(fp->fd, &st); if (rc < 0) { - u.u_error = errno; + get_user_struct()->u_error = errno; AFS_GLOCK(); return -1; } @@ -861,7 +861,7 @@ afs_osi_Stat(struct osi_file *fp, struct osi_stat *stp) AFS_GUNLOCK(); rc = fstat(fp->fd, &st); if (rc < 0) { - u.u_error = errno; + get_user_struct()->u_error = errno; AFS_GLOCK(); return -1; } @@ -898,7 +898,7 @@ afs_osi_VOP_RDWR(struct usr_vnode *vnodeP, struct usr_uio *uioP, int rw, uioP->uio_iov[0].iov_len); } if (rc < 0) { - return u.u_error; + return get_user_struct()->u_error; } uioP->uio_resid -= rc; @@ -1980,8 +1980,8 @@ syscallThread(void *argp) /* * AFS daemons run authenticated */ - u.u_viceid = getuid(); - crp = u.u_cred; + get_user_struct()->u_viceid = getuid(); + crp = get_user_struct()->u_cred; afs_set_cr_uid(crp, getuid()); afs_set_cr_ruid(crp, getuid()); crp->cr_suid = getuid(); @@ -2041,8 +2041,8 @@ call_syscall(long syscall, long afscall, long param1, long param2, a.parm3 = param3; a.parm4 = param4; - u.u_error = 0; - u.u_ap = (char *)&a; + get_user_struct()->u_error = 0; + get_user_struct()->u_ap = (char *)&a; code = Afs_syscall(); return code; @@ -2263,7 +2263,7 @@ uafs_LookupName(char *path, struct usr_vnode *parentVp, /* * We need execute permission to search a directory */ - code = afs_access(VTOAFS(vp), VEXEC, u.u_cred); + code = afs_access(VTOAFS(vp), VEXEC, get_user_struct()->u_cred); if (code != 0) { VN_RELE(vp); afs_osi_Free(tmpPath, strlen(path) + 1); @@ -2278,13 +2278,13 @@ uafs_LookupName(char *path, struct usr_vnode *parentVp, nextVp = NULL; #ifdef AFS_WEB_ENHANCEMENTS if ((nextPathP != NULL && *nextPathP != '\0') || !no_eval_mtpt) - code = afs_lookup(VTOAFS(vp), pathP, &nextVc, u.u_cred, 0); + code = afs_lookup(VTOAFS(vp), pathP, &nextVc, get_user_struct()->u_cred, 0); else code = - afs_lookup(VTOAFS(vp), pathP, &nextVc, u.u_cred, + afs_lookup(VTOAFS(vp), pathP, &nextVc, get_user_struct()->u_cred, AFS_LOOKUP_NOEVAL); #else - code = afs_lookup(VTOAFS(vp), pathP, &nextVc, u.u_cred, 0); + code = afs_lookup(VTOAFS(vp), pathP, &nextVc, get_user_struct()->u_cred, 0); #endif /* AFS_WEB_ENHANCEMENTS */ if (nextVc) nextVp=AFSTOV(nextVc); @@ -2377,7 +2377,7 @@ uafs_LookupLink(struct usr_vnode *vp, struct usr_vnode *parentVp, /* * Read the link data */ - code = afs_readlink(VTOAFS(vp), &uio, u.u_cred); + code = afs_readlink(VTOAFS(vp), &uio, get_user_struct()->u_cred); if (code) { afs_osi_Free(pathP, MAX_OSI_PATH + 1); return code; @@ -2578,10 +2578,10 @@ uafs_mkdir_r(char *path, int mode) usr_vattr_null(&attrs); attrs.va_type = VREG; attrs.va_mode = mode; - attrs.va_uid = afs_cr_uid(u.u_cred); - attrs.va_gid = afs_cr_gid(u.u_cred); + attrs.va_uid = afs_cr_uid(get_user_struct()->u_cred); + attrs.va_gid = afs_cr_gid(get_user_struct()->u_cred); dirP = NULL; - code = afs_mkdir(VTOAFS(parentP), nameP, &attrs, &dirP, u.u_cred); + code = afs_mkdir(VTOAFS(parentP), nameP, &attrs, &dirP, get_user_struct()->u_cred); VN_RELE(parentP); if (code != 0) { errno = code; @@ -2677,8 +2677,8 @@ uafs_open_r(char *path, int flags, int mode) usr_vattr_null(&attrs); attrs.va_type = VREG; attrs.va_mode = mode; - attrs.va_uid = afs_cr_uid(u.u_cred); - attrs.va_gid = afs_cr_gid(u.u_cred); + attrs.va_uid = afs_cr_uid(get_user_struct()->u_cred); + attrs.va_gid = afs_cr_gid(get_user_struct()->u_cred); if (flags & O_TRUNC) { attrs.va_size = 0; } @@ -2687,7 +2687,7 @@ uafs_open_r(char *path, int flags, int mode) code = afs_create(VTOAFS(dirP), nameP, &attrs, (flags & O_EXCL) ? usr_EXCL : usr_NONEXCL, mode, - &vc, u.u_cred); + &vc, get_user_struct()->u_cred); VN_RELE(dirP); if (code != 0) { errno = code; @@ -2715,7 +2715,7 @@ uafs_open_r(char *path, int flags, int mode) } if (!fileMode) fileMode = VREAD; /* since O_RDONLY is 0 */ - code = afs_access(VTOAFS(fileP), fileMode, u.u_cred); + code = afs_access(VTOAFS(fileP), fileMode, get_user_struct()->u_cred); if (code != 0) { VN_RELE(fileP); errno = code; @@ -2725,7 +2725,7 @@ uafs_open_r(char *path, int flags, int mode) /* * Get the file attributes, all we need is the size */ - code = afs_getattr(VTOAFS(fileP), &attrs, u.u_cred); + code = afs_getattr(VTOAFS(fileP), &attrs, get_user_struct()->u_cred); if (code != 0) { VN_RELE(fileP); errno = code; @@ -2768,7 +2768,7 @@ uafs_open_r(char *path, int flags, int mode) usr_vattr_null(&attrs); attrs.va_mask = ATTR_SIZE; attrs.va_size = 0; - code = afs_setattr(VTOAFS(fileP), &attrs, u.u_cred); + code = afs_setattr(VTOAFS(fileP), &attrs, get_user_struct()->u_cred); if (code != 0) { VN_RELE(fileP); errno = code; @@ -2780,7 +2780,7 @@ uafs_open_r(char *path, int flags, int mode) /* * do the open */ - code = afs_open(&vc, openFlags, u.u_cred); + code = afs_open(&vc, openFlags, get_user_struct()->u_cred); if (code != 0) { VN_RELE(fileP); errno = code; @@ -2886,7 +2886,7 @@ uafs_pwrite_r(int fd, char *buf, int len, off_t offset) * do the write */ - code = afs_write(VTOAFS(fileP), &uio, afs_FileFlags[fd], u.u_cred, 0); + code = afs_write(VTOAFS(fileP), &uio, afs_FileFlags[fd], get_user_struct()->u_cred, 0); if (code) { errno = code; return -1; @@ -2952,7 +2952,7 @@ uafs_pread_r(int fd, char *buf, int len, off_t offset) /* * do the read */ - code = afs_read(VTOAFS(fileP), &uio, u.u_cred, 0, &bufP, 0); + code = afs_read(VTOAFS(fileP), &uio, get_user_struct()->u_cred, 0, &bufP, 0); if (code) { errno = code; return -1; @@ -2978,7 +2978,7 @@ uafs_GetAttr(struct usr_vnode *vp, struct stat *stats) /* * Get the attributes */ - code = afs_getattr(VTOAFS(vp), &attrs, u.u_cred); + code = afs_getattr(VTOAFS(vp), &attrs, get_user_struct()->u_cred); if (code != 0) { return code; } @@ -3130,7 +3130,7 @@ uafs_chmod_r(char *path, int mode) usr_vattr_null(&attrs); attrs.va_mask = ATTR_MODE; attrs.va_mode = mode; - code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred); + code = afs_setattr(VTOAFS(vp), &attrs, get_user_struct()->u_cred); VN_RELE(vp); if (code != 0) { errno = code; @@ -3167,7 +3167,7 @@ uafs_fchmod_r(int fd, int mode) usr_vattr_null(&attrs); attrs.va_mask = ATTR_MODE; attrs.va_mode = mode; - code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred); + code = afs_setattr(VTOAFS(vp), &attrs, get_user_struct()->u_cred); if (code != 0) { errno = code; return -1; @@ -3203,7 +3203,7 @@ uafs_truncate_r(char *path, int length) usr_vattr_null(&attrs); attrs.va_mask = ATTR_SIZE; attrs.va_size = length; - code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred); + code = afs_setattr(VTOAFS(vp), &attrs, get_user_struct()->u_cred); VN_RELE(vp); if (code != 0) { errno = code; @@ -3240,7 +3240,7 @@ uafs_ftruncate_r(int fd, int length) usr_vattr_null(&attrs); attrs.va_mask = ATTR_SIZE; attrs.va_size = length; - code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred); + code = afs_setattr(VTOAFS(vp), &attrs, get_user_struct()->u_cred); if (code != 0) { errno = code; return -1; @@ -3282,7 +3282,7 @@ uafs_lseek_r(int fd, int offset, int whence) newpos = offset; break; case SEEK_END: - code = afs_getattr(VTOAFS(vp), &attrs, u.u_cred); + code = afs_getattr(VTOAFS(vp), &attrs, get_user_struct()->u_cred); if (code != 0) { errno = code; return -1; @@ -3327,7 +3327,7 @@ uafs_fsync_r(int fd) return -1; } - code = afs_fsync(VTOAFS(fileP), u.u_cred); + code = afs_fsync(VTOAFS(fileP), get_user_struct()->u_cred); if (code != 0) { errno = code; return -1; @@ -3362,7 +3362,7 @@ uafs_close_r(int fd) } afs_FileTable[fd] = NULL; - code = afs_close(VTOAFS(fileP), afs_FileFlags[fd], u.u_cred); + code = afs_close(VTOAFS(fileP), afs_FileFlags[fd], get_user_struct()->u_cred); VN_RELE(fileP); if (code != 0) { errno = code; @@ -3437,7 +3437,7 @@ uafs_link_r(char *existing, char *new) /* * Create the link */ - code = afs_link(VTOAFS(existP), VTOAFS(dirP), nameP, u.u_cred); + code = afs_link(VTOAFS(existP), VTOAFS(dirP), nameP, get_user_struct()->u_cred); VN_RELE(existP); VN_RELE(dirP); if (code != 0) { @@ -3504,9 +3504,9 @@ uafs_symlink_r(char *target, char *source) usr_vattr_null(&attrs); attrs.va_type = VLNK; attrs.va_mode = 0777; - attrs.va_uid = afs_cr_uid(u.u_cred); - attrs.va_gid = afs_cr_gid(u.u_cred); - code = afs_symlink(VTOAFS(dirP), nameP, &attrs, target, u.u_cred); + attrs.va_uid = afs_cr_uid(get_user_struct()->u_cred); + attrs.va_gid = afs_cr_gid(get_user_struct()->u_cred); + code = afs_symlink(VTOAFS(dirP), nameP, &attrs, target, get_user_struct()->u_cred); VN_RELE(dirP); if (code != 0) { errno = code; @@ -3563,7 +3563,7 @@ uafs_readlink_r(char *path, char *buf, int len) /* * Read the the link */ - code = afs_readlink(VTOAFS(vp), &uio, u.u_cred); + code = afs_readlink(VTOAFS(vp), &uio, get_user_struct()->u_cred); VN_RELE(vp); if (code) { errno = code; @@ -3629,7 +3629,7 @@ uafs_unlink_r(char *path) /* * Remove the file */ - code = afs_remove(VTOAFS(dirP), nameP, u.u_cred); + code = afs_remove(VTOAFS(dirP), nameP, get_user_struct()->u_cred); VN_RELE(dirP); if (code != 0) { errno = code; @@ -3706,7 +3706,7 @@ uafs_rename_r(char *old, char *new) /* * Rename the file */ - code = afs_rename(VTOAFS(odirP), onameP, VTOAFS(ndirP), nnameP, u.u_cred); + code = afs_rename(VTOAFS(odirP), onameP, VTOAFS(ndirP), nnameP, get_user_struct()->u_cred); VN_RELE(odirP); VN_RELE(ndirP); if (code != 0) { @@ -3770,7 +3770,7 @@ uafs_rmdir_r(char *path) /* * Remove the directory */ - code = afs_rmdir(VTOAFS(dirP), nameP, u.u_cred); + code = afs_rmdir(VTOAFS(dirP), nameP, get_user_struct()->u_cred); VN_RELE(dirP); if (code != 0) { errno = code; @@ -3918,7 +3918,7 @@ uafs_getdents_r(int fd, struct min_direct *buf, int len) /* * read the next chunk from the directory */ - code = afs_readdir(VTOAFS(vp), &uio, u.u_cred); + code = afs_readdir(VTOAFS(vp), &uio, get_user_struct()->u_cred); if (code != 0) { errno = code; return -1; @@ -3982,7 +3982,7 @@ uafs_readdir_r(usr_DIR * dirp) /* * read the next chunk from the directory */ - code = afs_readdir(VTOAFS(vp), &uio, u.u_cred); + code = afs_readdir(VTOAFS(vp), &uio, get_user_struct()->u_cred); if (code != 0) { errno = code; return NULL; @@ -4308,7 +4308,7 @@ uafs_getRights(char *path) PRSFS_READ | PRSFS_WRITE | PRSFS_INSERT | PRSFS_LOOKUP | PRSFS_DELETE | PRSFS_LOCK | PRSFS_ADMINISTER; - afs_rights = afs_getRights(VTOAFS(vp), afs_rights, u.u_cred); + afs_rights = afs_getRights(VTOAFS(vp), afs_rights, get_user_struct()->u_cred); AFS_GUNLOCK(); return afs_rights; diff --git a/src/afs/UKERNEL/osi_machdep.h b/src/afs/UKERNEL/osi_machdep.h index b41b261e0..3da01dbf1 100644 --- a/src/afs/UKERNEL/osi_machdep.h +++ b/src/afs/UKERNEL/osi_machdep.h @@ -83,4 +83,8 @@ extern int afs_bufferpages; extern int afs_suser(void *credp); +#define setuerror(erval) get_user_struct()->u_error = (erval) +#define getuerror(erval) get_user_struct()->u_error +#define osi_curcred() get_user_struct()->u_cred + #endif /* _OSI_MACHDEP_H_ */ diff --git a/src/afs/UKERNEL/osi_vfsops.c b/src/afs/UKERNEL/osi_vfsops.c index abaa42aef..0b2463c8a 100644 --- a/src/afs/UKERNEL/osi_vfsops.c +++ b/src/afs/UKERNEL/osi_vfsops.c @@ -78,7 +78,7 @@ afs_root(OSI_VFS_DECL(afsp), struct vnode **avpp) afs_globalVp = NULL; } - if (!(code = afs_InitReq(&treq, u.u_cred)) + if (!(code = afs_InitReq(&treq, get_user_struct()->u_cred)) && !(code = afs_CheckInit())) { tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL); /* we really want this to stay around */ diff --git a/src/afs/UKERNEL/sysincludes.h b/src/afs/UKERNEL/sysincludes.h index d2b124902..ff768a7df 100644 --- a/src/afs/UKERNEL/sysincludes.h +++ b/src/afs/UKERNEL/sysincludes.h @@ -1013,7 +1013,7 @@ do { \ AFS_ASSERT_GLOCK(); \ usr_assert((vp)->v_count > 0); \ if (--((vp)->v_count) == 0) \ - afs_inactive(VTOAFS(vp), u.u_cred); \ + afs_inactive(VTOAFS(vp), get_user_struct()->u_cred); \ } while(0) struct usr_statfs { @@ -1399,7 +1399,6 @@ struct usr_user { } u_r; }; #define u_rval1 u_r.r_val1 -#define u (*(get_user_struct())) extern struct usr_user *get_user_struct(void); diff --git a/src/afs/VNOPS/afs_vnop_flock.c b/src/afs/VNOPS/afs_vnop_flock.c index 1e783b53d..7143181c8 100644 --- a/src/afs/VNOPS/afs_vnop_flock.c +++ b/src/afs/VNOPS/afs_vnop_flock.c @@ -143,6 +143,16 @@ lockIdSet(struct AFS_FLOCK *flock, struct SimpleLocks *slp, int clid) flock->l_pid = getpid(); } } +#elif defined(UKERNEL) +void +lockIdSet(struct AFS_FLOCK *flock, struct SimpleLocks *slp, int clid) +{ + if (slp) { + slp->pid = get_user_struct()->u_procp->p_pid; + } else { + flock->l_pid = get_user_struct()->u_procp->p_pid; + } +} #else void lockIdSet(struct AFS_FLOCK *flock, struct SimpleLocks *slp, int clid) @@ -177,7 +187,9 @@ lockIdcmp2(struct AFS_FLOCK *flock1, struct vcache *vp, #if !defined(AFS_AIX41_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_SGI65_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV) #ifdef AFS_SGI64_ENV afs_proc_t *procp = curprocp; -#else /* AFS_SGI64_ENV */ +#elif defined(UKERNEL) + afs_proc_t *procp = get_user_struct()->u_procp; +#else afs_proc_t *procp = u.u_procp; #endif /* AFS_SGI64_ENV */ #endif diff --git a/src/afs/VNOPS/afs_vnop_strategy.c b/src/afs/VNOPS/afs_vnop_strategy.c index 932da2403..4bc98f434 100644 --- a/src/afs/VNOPS/afs_vnop_strategy.c +++ b/src/afs/VNOPS/afs_vnop_strategy.c @@ -40,6 +40,8 @@ int afs_ustrategy(register struct buf *abp) register afs_int32 len = abp->b_bcount; #ifdef AFS_AIX41_ENV struct ucred *credp; +#elif defined(UKERNEL) + afs_ucred_t *credp = get_user_struct()->u_cred; #elif !defined(AFS_SUN5_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV) afs_ucred_t *credp = u.u_cred; #endif diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index 04bf1f730..ff43371b1 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -393,8 +393,10 @@ typedef struct timeval osi_timeval_t; /* * encapsulation of kernel data structure accesses */ +#ifndef UKERNEL #define setuerror(erval) u.u_error = (erval) #define getuerror() u.u_error +#endif /* Macros for vcache/vnode and vfs arguments to vnode and vfs ops. * These are required for IRIX 6.4 and later, which pass behavior pointers. diff --git a/src/afs/afs_osi_pag.c b/src/afs/afs_osi_pag.c index f6356dbb7..074e85f9a 100644 --- a/src/afs/afs_osi_pag.c +++ b/src/afs/afs_osi_pag.c @@ -264,6 +264,8 @@ afs_setpag(void) code = AddPag(p, genpag(), &credp); crfree(credp); } +#elif defined(UKERNEL) + code = AddPag(genpag(), &(get_user_struct()->u_cred)); #else code = AddPag(genpag(), &u.u_cred); #endif @@ -359,6 +361,8 @@ afs_setpag_val(int pagval) code = AddPag(p, pagval, &credp); crfree(credp); } +#elif defined(UKERNEL) + code = AddPag(pagval, &(get_user_struct()->u_cred)); #else code = AddPag(pagval, &u.u_cred); #endif @@ -379,7 +383,11 @@ int afs_getpag_val(void) { int pagvalue; +#ifdef UKERNEL + afs_ucred_t *credp = get_user_struct()->u_cred; +#else afs_ucred_t *credp = u.u_cred; +#endif gid_t gidset0, gidset1; #ifdef AFS_SUN510_ENV const gid_t *gids; diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 26f45c615..c4e6a82df 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -605,6 +605,15 @@ afs_xioctl(struct inode *ip, struct file *fp, unsigned int com, unsigned long arg) { struct afs_ioctl_sys ua, *uap = &ua; +# elif defined(UKERNEL) +int +afs_xioctl(void) +{ + register struct a { + int fd; + int com; + caddr_t arg; + } *uap = (struct a *)get_user_struct()->u_ap; # else int afs_xioctl(void) @@ -1063,6 +1072,9 @@ afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, int follow) } #elif defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) code = afs_HandlePioctl(vp, com, &data, follow, &credp); +#elif defined(UKERNEL) + code = afs_HandlePioctl(vp, com, &data, follow, + &(get_user_struct()->u_cred)); #else code = afs_HandlePioctl(vp, com, &data, follow, &u.u_cred); #endif diff --git a/src/afs/afs_syscall.c b/src/afs/afs_syscall.c index cc7ca9261..90729edeb 100644 --- a/src/afs/afs_syscall.c +++ b/src/afs/afs_syscall.c @@ -552,7 +552,7 @@ Afs_syscall() long parm4; long parm5; long parm6; - } *uap = (struct a *)u.u_ap; + } *uap = (struct a *)get_user_struct()->u_ap; # else /* UKERNEL */ int Afs_syscall() @@ -569,6 +569,8 @@ Afs_syscall() # endif /* UKERNEL */ # if defined(AFS_HPUX_ENV) long *retval = &u.u_rval1; +# elif defined(UKERNEL) + int *retval = &(get_user_struct()->u_rval1); # else int *retval = &u.u_rval1; # endif diff --git a/src/afs/lock.h b/src/afs/lock.h index 853aba041..d8ba99a17 100644 --- a/src/afs/lock.h +++ b/src/afs/lock.h @@ -70,7 +70,11 @@ typedef struct afs_bozoLock afs_bozoLock_t; #define BEGINMAC do { #define ENDMAC } while (0) -#if defined(AFS_SUN57_ENV) +#if defined(UKERNEL) +typedef unsigned int afs_lock_tracker_t; +# define MyPidxx (get_user_struct()->u_procp->p_pid ) +# define MyPidxx2Pid(x) (x) +#elif defined(AFS_SUN57_ENV) typedef kthread_t * afs_lock_tracker_t; # define MyPidxx (curthread) # define MyPidxx2Pid(x) (x ? ttoproc(x)->p_pid : 0) diff --git a/src/auth/ktc.c b/src/auth/ktc.c index bc221956c..6ee1b84d5 100644 --- a/src/auth/ktc.c +++ b/src/auth/ktc.c @@ -364,8 +364,8 @@ OldSetToken(struct ktc_principal *aserver, struct ktc_token *atoken, /* * Information needed by the user space cache manager */ - u.u_expiration = ct.EndTimestamp; - u.u_viceid = ct.ViceId; + get_user_struct()->u_expiration = ct.EndTimestamp; + get_user_struct()->u_viceid = ct.ViceId; #endif temp = sizeof(struct ClearToken); -- 2.39.5