AFS_ASSERT_GLOCK();
if (ino->ufs > n_osi_files) {
- u.u_error = ENOENT;
+ get_user_struct()->u_error = ENOENT;
return NULL;
}
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;
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;
AFS_GUNLOCK();
rc = ftruncate(fp->fd, len);
if (rc < 0) {
- u.u_error = errno;
+ get_user_struct()->u_error = errno;
AFS_GLOCK();
return -1;
}
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;
}
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;
}
AFS_GUNLOCK();
rc = fstat(fp->fd, &st);
if (rc < 0) {
- u.u_error = errno;
+ get_user_struct()->u_error = errno;
AFS_GLOCK();
return -1;
}
uioP->uio_iov[0].iov_len);
}
if (rc < 0) {
- return u.u_error;
+ return get_user_struct()->u_error;
}
uioP->uio_resid -= rc;
/*
* 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();
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;
/*
* 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);
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);
/*
* 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;
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;
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;
}
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;
}
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;
/*
* 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;
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;
/*
* 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;
* 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;
/*
* 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;
/*
* 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;
}
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;
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;
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;
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;
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;
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;
}
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;
/*
* 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) {
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;
/*
* 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;
/*
* 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;
/*
* 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) {
/*
* 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;
/*
* 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;
/*
* 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;
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;