mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-02-06 03:41:52 +08:00
Use rtdm_safe_copy_{from,to}_user
This commit is contained in:
@@ -86,14 +86,16 @@ endif
|
||||
|
||||
ifeq (@ENABLE_XENOMAI@, 1)
|
||||
CFLAGS_rtdm.o := @XENOMAI_RTDM_CFLAGS@
|
||||
CFLAGS_rtdm-ioctl.o := @XENOMAI_RTDM_CFLAGS@
|
||||
endif
|
||||
|
||||
ifeq (@ENABLE_RTAI@, 1)
|
||||
CFLAGS_rtdm.o := -I@RTAI_DIR@/include
|
||||
CFLAGS_rtdm-ioctl.o := -I@RTAI_DIR@/include
|
||||
endif
|
||||
|
||||
ec_master-objs += rtdm-ioctl.o
|
||||
CFLAGS_rtdm-ioctl.o := -DEC_IOCTL_RTDM
|
||||
CFLAGS_rtdm-ioctl.o += -DEC_IOCTL_RTDM
|
||||
|
||||
endif # ENABLE_RTDM
|
||||
|
||||
|
||||
@@ -49,21 +49,25 @@
|
||||
#endif
|
||||
|
||||
#ifdef EC_IOCTL_RTDM
|
||||
# include "rtdm_details.h"
|
||||
/* RTDM does not support locking yet,
|
||||
* therefore no send/receive callbacks are set too. */
|
||||
# define ec_ioctl_lock(lock) do {} while(0)
|
||||
# define ec_ioctl_unlock(lock) do {} while(0)
|
||||
# define ec_ioctl_lock_interruptible(lock) (0)
|
||||
# define ec_copy_to_user(to, from, n, ctx) \
|
||||
rtdm_safe_copy_to_user(ec_ioctl_to_rtdm(ctx), to, from, n)
|
||||
# define ec_copy_from_user(to, from, n, ctx) \
|
||||
rtdm_safe_copy_from_user(ec_ioctl_to_rtdm(ctx), to, from, n)
|
||||
#else
|
||||
# define ec_ioctl_lock(lock) rt_mutex_lock(lock)
|
||||
# define ec_ioctl_unlock(lock) rt_mutex_unlock(lock)
|
||||
# define ec_ioctl_lock_interruptible(lock) \
|
||||
rt_mutex_lock_interruptible(lock)
|
||||
# define ec_copy_to_user(to, from, n, ctx) copy_to_user(to, from, n)
|
||||
# define ec_copy_from_user(to, from, n, ctx) copy_from_user(to, from, n)
|
||||
#endif // EC_IOCTL_RTDM
|
||||
|
||||
#define ec_copy_to_user(to, from, n, ctx) copy_to_user(to, from, n)
|
||||
#define ec_copy_from_user(to, from, n, ctx) copy_from_user(to, from, n)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/** Copies a string to an ioctl structure.
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#define __EC_RTDM_DETAILS_H__
|
||||
|
||||
#include "../config.h"
|
||||
#include "ioctl.h"
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
||||
@@ -41,7 +42,7 @@
|
||||
|
||||
#define EC_RTDM_USERFD_T rtdm_user_info_t
|
||||
|
||||
#endif
|
||||
#endif // EC_RTDM_XENOMAI_V3
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -54,4 +55,10 @@ typedef struct ec_rtdm_context {
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static inline EC_RTDM_USERFD_T *ec_ioctl_to_rtdm(ec_ioctl_context_t *ctx)
|
||||
{
|
||||
return container_of(ctx, ec_rtdm_context_t, ioctl_ctx)->user_fd;
|
||||
}
|
||||
|
||||
|
||||
#endif // __EC_RTDM_DETAILS_H__
|
||||
|
||||
Reference in New Issue
Block a user