From: Brian Behlendorf Date: Fri, 10 Jul 2009 17:56:32 +0000 (-0700) Subject: Add ddi_copyin/ddi_copyout support for fake kernel originated ioctls. X-Git-Tag: spl-0.4.5~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3126abe75a6502d55bfa2339b48d4fa263e1b02;p=spl Add ddi_copyin/ddi_copyout support for fake kernel originated ioctls. --- diff --git a/include/sys/sunddi.h b/include/sys/sunddi.h index 404b14b..c1773f5 100644 --- a/include/sys/sunddi.h +++ b/include/sys/sunddi.h @@ -213,6 +213,9 @@ extern int ddi_strtol(const char *, char **, int, long *); extern int ddi_strtoull(const char *, char **, int, unsigned long long *); extern int ddi_strtoll(const char *, char **, int, long long *); +extern int ddi_copyin(const void *from, void *to, size_t len, int flags); +extern int ddi_copyout(const void *from, void *to, size_t len, int flags); + static __inline__ void ddi_report_dev(dev_info_t *d) { } static __inline__ void ddi_prop_remove_all(dev_info_t *dip) { } diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index 568d406..b81dabc 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #ifdef DEBUG_SUBSYSTEM @@ -226,6 +227,32 @@ EXPORT_SYMBOL(ddi_strtol); EXPORT_SYMBOL(ddi_strtoll); EXPORT_SYMBOL(ddi_strtoull); +int +ddi_copyin(const void *from, void *to, size_t len, int flags) +{ + /* Fake ioctl() issued by kernel, 'from' is a kernel address */ + if (flags & FKIOCTL) { + memcpy(to, from, len); + return 0; + } + + return copyin(from, to, len); +} +EXPORT_SYMBOL(ddi_copyin); + +int +ddi_copyout(const void *from, void *to, size_t len, int flags) +{ + /* Fake ioctl() issued by kernel, 'from' is a kernel address */ + if (flags & FKIOCTL) { + memcpy(to, from, len); + return 0; + } + + return copyout(from, to, len); +} +EXPORT_SYMBOL(ddi_copyout); + struct new_utsname *__utsname(void) { #ifdef HAVE_INIT_UTSNAME