From 802261e602517c8e4459929e98fd181f63847846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Wed, 17 Nov 2010 17:42:07 +0100 Subject: [PATCH] 2.6.36 removed file_operations.ioctl --- usr/src/nv/Makefile.kbuild | 1 + usr/src/nv/Makefile.nvidia | 1 + usr/src/nv/conftest.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++ usr/src/nv/nv-linux.h | 6 +++++ usr/src/nv/nv.c | 6 +++- 5 files changed, 66 insertions(+), 2 deletions(-) diff --git a/usr/src/nv/Makefile.kbuild b/usr/src/nv/Makefile.kbuild index c524697..2fb1617 100644 --- a/usr/src/nv/Makefile.kbuild +++ b/usr/src/nv/Makefile.kbuild @@ -180,6 +180,7 @@ ifneq ($(PATCHLEVEL), 4) pci_choose_state \ vm_insert_page \ acquire_console_sem \ + file_operations \ kmem_cache_create \ on_each_cpu \ smp_call_function \ diff --git a/usr/src/nv/Makefile.nvidia b/usr/src/nv/Makefile.nvidia index 220f197..b0d78ae 100644 --- a/usr/src/nv/Makefile.nvidia +++ b/usr/src/nv/Makefile.nvidia @@ -60,6 +60,7 @@ COMPILE_TESTS = \ change_page_attr \ i2c_adapter \ smp_call_function \ + file_operations \ proc_dir_entry \ scatterlist diff --git a/usr/src/nv/conftest.sh b/usr/src/nv/conftest.sh index 045f40f..1824f8a 100644 --- a/usr/src/nv/conftest.sh +++ b/usr/src/nv/conftest.sh @@ -1002,6 +1002,60 @@ compile_test() { fi ;; + file_operations) + # + # Determine if the 'file_operations' structure has + # 'ioctl', 'unlocked_ioctl' and 'compat_ioctl' fields. + # + echo "$CONFTEST_PREAMBLE + #include + int conftest_file_operations(void) { + return offsetof(struct file_operations, ioctl); + }" > conftest$$.c + + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1 + rm -f conftest$$.c + + if [ -f conftest$$.o ]; then + echo "#define NV_FILE_OPERATIONS_HAS_IOCTL" >> conftest.h + rm -f conftest$$.o + else + echo "#undef NV_FILE_OPERATIONS_HAS_IOCTL" >> conftest.h + fi + + echo "$CONFTEST_PREAMBLE + #include + int conftest_file_operations(void) { + return offsetof(struct file_operations, unlocked_ioctl); + }" > conftest$$.c + + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1 + rm -f conftest$$.c + + if [ -f conftest$$.o ]; then + echo "#define NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL" >> conftest.h + rm -f conftest$$.o + else + echo "#undef NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL" >> conftest.h + fi + + echo "$CONFTEST_PREAMBLE + #include + int conftest_file_operations(void) { + return offsetof(struct file_operations, compat_ioctl); + }" > conftest$$.c + + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1 + rm -f conftest$$.c + + if [ -f conftest$$.o ]; then + echo "#define NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL" >> conftest.h + rm -f conftest$$.o + else + echo "#undef NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL" >> conftest.h + fi + ;; + proc_dir_entry) # # Determine if the 'proc_dir_entry' structure has diff --git a/usr/src/nv/nv-linux.h b/usr/src/nv/nv-linux.h index d1ddb8d..0787816 100644 --- a/usr/src/nv/nv-linux.h +++ b/usr/src/nv/nv-linux.h @@ -105,6 +105,12 @@ #include /* sys_ioctl() (ioctl32) */ #endif +#if !defined(NV_FILE_OPERATIONS_HAS_IOCTL) && \ + !defined(NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL) +#error "struct file_operations compile test likely failed!" +#endif + + #if defined(CONFIG_VGA_ARB) #include #endif diff --git a/usr/src/nv/nv.c b/usr/src/nv/nv.c index a9d318d..339aeef 100644 --- a/usr/src/nv/nv.c +++ b/usr/src/nv/nv.c @@ -249,11 +249,13 @@ static struct pci_driver nv_pci_driver = { static struct file_operations nv_fops = { .owner = THIS_MODULE, .poll = nv_kern_poll, +#if defined(NV_FILE_OPERATIONS_HAS_IOCTL) .ioctl = nv_kern_ioctl, -#if defined(HAVE_UNLOCKED_IOCTL) +#endif +#if defined(NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL) .unlocked_ioctl = nv_kern_unlocked_ioctl, #endif -#if defined(NVCPU_X86_64) && defined(HAVE_COMPAT_IOCTL) +#if defined(NVCPU_X86_64) && defined(NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL) .compat_ioctl = nv_kern_compat_ioctl, #endif .mmap = nv_kern_mmap, -- 1.7.2.2