osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw)
{
struct file *filp = osifile->filp;
- KERNEL_SPACE_DECL;
+ mm_segment_t old_fs = {0};
int code = 0;
struct iovec *iov;
size_t count;
savelim = current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur;
current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
- if (uiop->uio_seg == AFS_UIOSYS)
- TO_USER_SPACE();
+ if (uiop->uio_seg == AFS_UIOSYS) {
+ /* Switch into user space */
+ old_fs = get_fs();
+ set_fs(get_ds());
+ }
/* seek to the desired position. Return -1 on error. */
if (vfs_llseek(filp, (loff_t) uiop->uio_offset, 0) != uiop->uio_offset) {
}
out:
- if (uiop->uio_seg == AFS_UIOSYS)
- TO_KERNEL_SPACE();
+ if (uiop->uio_seg == AFS_UIOSYS) {
+ /* Switch back into kernel space */
+ set_fs(old_fs);
+ }
current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = savelim;
#define IsAfsVnode(V) ((V)->i_sb == afs_globalVFS) /* test superblock instead */
#define SetAfsVnode(V) /* unnecessary */
-/* We often need to pretend we're in user space to get memory transfers
- * right for the kernel calls we use.
- */
#include <asm/uaccess.h>
-#ifdef KERNEL_SPACE_DECL
-#undef KERNEL_SPACE_DECL
-#undef TO_USER_SPACE
-#undef TO_KERNEL_SPACE
-#endif
-#define KERNEL_SPACE_DECL mm_segment_t _fs_space_decl={0}
-#define TO_USER_SPACE() { _fs_space_decl = get_fs(); set_fs(get_ds()); }
-#define TO_KERNEL_SPACE() set_fs(_fs_space_decl)
-
#define copyin(F, T, C) (copy_from_user ((char*)(T), (char*)(F), (C)) > 0 ? EFAULT : 0)
static inline long copyinstr(char *from, char *to, int count, int *length) {
long tmp;