Update of /cvsroot/ssic-linux/openssi/kernel/include/cluster/ssi
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1091/kernel/include/cluster/ssi
Modified Files:
rcopy.h rcopy_types.h
Added Files:
rcopy_uaccess.h
Log Message:
Merge different version of rcopy hooks.
Index: rcopy.h
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/include/cluster/ssi/rcopy.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- rcopy.h 20 Oct 2004 03:23:36 -0000 1.6
+++ rcopy.h 28 Oct 2004 02:25:42 -0000 1.7
@@ -20,10 +20,13 @@
* Questions/Comments/Bugfixes to ssic-linux-devel@xxxxxxxxxxxxxxxxxxxxx
*
*/
+
#ifndef _SSI_RCOPY_H
#define _SSI_RCOPY_H
#include <linux/sched.h>
+#include <asm/current.h>
+
#include <cluster/ssi/rcopy_types.h>
#include <cluster/assert.h>
@@ -32,14 +35,15 @@
#if defined(CONFIG_SSI)
/* Support for SSI client/server code. */
-#ifdef CONFIG_X86_4G
-#define ssi_rcopy_is_remote(_addr) \
- (current->cltnode != 0 && !segment_eq(get_fs(), KERNEL_DS))
-#else
-#define ssi_rcopy_is_remote(_addr) \
- (current->cltnode != 0 && !segment_eq(get_fs(), KERNEL_DS) && \
- (unsigned long)(_addr) < TASK_SIZE)
-#endif
+
+static inline int
+ssi_rcopy_is_remote(const void *_addr)
+{
+ u_long addr = (u_long)_addr;
+ struct task_struct *p = current;
+
+ return (p->cltnode != 0 && addr < p->rcopy_task_size);
+}
extern void ssi_procstate_get(ssi_procstate_t *);
--- NEW FILE: rcopy_uaccess.h ---
/*
* SSI rcopy header file.
* Copyright 2001 Compaq Computer Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE
* or NON INFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Questions/Comments/Bugfixes to ssic-linux-devel@xxxxxxxxxxxxxxxxxxxxx
*
*/
#ifndef _SSI_RCOPY_UACCESS_H
#define _SSI_RCOPY_UACCESS_H
#ifdef CONFIG_SSI
#include <cluster/ssi/rcopy.h>
static inline unsigned long
__clear_user(void *mem, unsigned long len)
{
if (ssi_rcopy_is_remote(mem))
return ssi_rcopy_clear_user(mem, len);
return __clear_user_lcl(mem, len);
}
static inline unsigned long
clear_user(void *mem, unsigned long len)
{
if (ssi_rcopy_is_remote(mem))
return ssi_rcopy_clear_user(mem, len);
return clear_user_lcl(mem, len);
}
static inline unsigned long
__copy_to_user(void *to, const void *from, unsigned long n)
{
unsigned long ret;
if (ssi_rcopy_is_remote(to))
ret = ssi_rcopy_to_user(to, from, n);
else
ret = __copy_to_user_lcl(to, from, n);
return ret;
}
static inline unsigned long
copy_to_user(void *to, const void *from, unsigned long n)
{
unsigned long ret;
if (ssi_rcopy_is_remote(to))
ret = ssi_rcopy_to_user(to, from, n);
else
ret = copy_to_user_lcl(to, from, n);
return ret;
}
static inline unsigned long
__copy_from_user(void *to, const void *from, unsigned long n)
{
unsigned long ret;
if (ssi_rcopy_is_remote(from))
ret = ssi_rcopy_from_user(to, from, n);
else
ret = __copy_from_user_lcl(to, from, n);
return ret;
}
static inline unsigned long
copy_from_user(void *to, const void *from, unsigned long n)
{
unsigned long ret;
if (ssi_rcopy_is_remote(from))
ret = ssi_rcopy_from_user(to, from, n);
else
ret = copy_from_user_lcl(to, from, n);
return ret;
}
#define __get_user(x, ptr) \
({ int __gux_err; \
__typeof__(*(ptr)) __gux_val; \
__typeof__(ptr) __gux_addr = (ptr); \
if (ssi_rcopy_is_remote(__gux_addr)) { \
if (!ssi_rcopy_from_user(&__gux_val, __gux_addr, \
sizeof(__gux_val))) \
__gux_err = 0; \
else \
__gux_err = -EFAULT; \
} else \
__gux_err = __get_user_lcl(__gux_val, __gux_addr); \
(x) = __gux_val; \
__gux_err; \
})
#define get_user(x, ptr) \
({ int __gux_err; \
__typeof__(*(ptr)) __gux_val; \
__typeof__(ptr) __gux_addr = (ptr); \
if (ssi_rcopy_is_remote(__gux_addr)) { \
if (!ssi_rcopy_from_user(&__gux_val, __gux_addr, \
sizeof(__gux_val))) \
__gux_err = 0; \
else \
__gux_err = -EFAULT; \
} else \
__gux_err = get_user_lcl(__gux_val, __gux_addr); \
(x) = __gux_val; \
__gux_err; \
})
#define __put_user(x, ptr) \
({ int __pux_err; \
__typeof__(*(ptr)) __pux_val = (__typeof__(*(ptr)))(x); \
__typeof__(ptr) __pux_addr = (ptr); \
if (ssi_rcopy_is_remote(__pux_addr)) { \
if (!ssi_rcopy_to_user(__pux_addr, &__pux_val, \
sizeof(__pux_val))) \
__pux_err = 0; \
else \
__pux_err = -EFAULT; \
} else \
__pux_err = __put_user_lcl(__pux_val, __pux_addr); \
__pux_err; \
})
#define put_user(x,ptr) \
({ int __pux_err; \
__typeof__(*(ptr)) __pux_val = (__typeof__(*(ptr)))(x); \
__typeof__(ptr) __pux_addr = (ptr); \
if (ssi_rcopy_is_remote(__pux_addr)) { \
if (!ssi_rcopy_to_user(__pux_addr, &__pux_val, \
sizeof(__pux_val))) \
__pux_err = 0; \
else \
__pux_err = -EFAULT; \
} else \
__pux_err = put_user_lcl(__pux_val, __pux_addr); \
__pux_err; \
})
static inline long
strlen_user(const char *str)
{
unsigned long ret;
if (ssi_rcopy_is_remote(str))
ret = ssi_rcopy_strnlen_user(str, ~0L >> 1);
else
ret = strlen_user_lcl(str);
return ret;
}
static inline long
strnlen_user(const char *str, long len)
{
unsigned long ret;
if (ssi_rcopy_is_remote(str))
ret = ssi_rcopy_strnlen_user(str, len);
else
ret = strnlen_user_lcl(str, len);
return ret;
}
static inline long
strncpy_from_user(char *to, const char *from, long count)
{
long ret;
if (ssi_rcopy_is_remote(from))
ret = ssi_rcopy_strncpy_from_user(to, from, count);
else
ret = strncpy_from_user_lcl(to, from, count);
return ret;
}
#else
#define __clear_user(to,n) \
__clear_user_lcl(to,n)
#define clear_user(to,n) \
clear_user_lcl(to,n)
#define __copy_to_user(to,from,n) \
copy_to_user_lcl(to,from,n)
#define copy_to_user(to,from,n) \
copy_to_user_lcl(to,from,n)
#define __copy_from_user(to,from,n) \
copy_from_user_lcl(to,from,n)
#define copy_from_user(to,from,n) \
copy_from_user_lcl(to,from,n)
#define __get_user(x,ptr) \
__get_user_lcl(x,ptr,size)
#define get_user(x,ptr) \
get_user_lcl(x,ptr)
#define __put_user(x,ptr) \
__put_user_lcl(x,ptr,size)
#define put_user(x,ptr) \
put_user_lcl(x,ptr)
#define strlen_user(str) \
strlen_user_lcl(str)
#define strnlen_user(str,n) \
strnlen_user_lcl(str,n)
#define strncpy_from_user(to,from,n) \
strncpy_from_user_lcl(to,from,n)
#endif /* CONFIG_SSI */
#endif /* _SSI_RCOPY_UACCESS_H */
Index: rcopy_types.h
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/include/cluster/ssi/rcopy_types.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- rcopy_types.h 20 Oct 2004 03:23:36 -0000 1.5
+++ rcopy_types.h 28 Oct 2004 02:25:42 -0000 1.6
@@ -47,6 +47,7 @@
mode_t sps_umask;
mm_segment_t sps_fs;
kernel_cap_t sps_cap_eff;
+ unsigned long sps_task_size;
} ssi_procstate_t;
#endif /* CONFIG_SSI */
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
|