#include <afsconfig.h>
#include "afs/param.h"
-RCSID
- ("$Header$");
#include <linux/module.h> /* early to avoid printf->printk mapping */
#include "afs/sysincludes.h"
#include "afsincludes.h"
-#include "h/unistd.h" /* For syscall numbers. */
-#include "h/mm.h"
+#include <linux/unistd.h> /* For syscall numbers. */
+#include <linux/mm.h>
#ifdef AFS_AMD64_LINUX20_ENV
#include <asm/ia32_unistd.h>
#endif
-#ifdef AFS_SPARC64_LINUX20_ENV
+
+#if defined(AFS_SPARC64_LINUX26_ENV) && defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
#include <linux/ioctl32.h>
#endif
-#include <linux/proc_fs.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/kernel.h>
+#include "osi_compat.h"
+
extern struct proc_dir_entry *openafs_procfs;
#if defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
static int ioctl32_done;
if (cmd != VIOC_SYSCALL && cmd != VIOC_SYSCALL32) return -EINVAL;
#ifdef NEED_IOCTL32
-#ifdef AFS_LINUX26_ENV
-#ifdef AFS_S390X_LINUX26_ENV
+# if defined(AFS_S390X_LINUX26_ENV)
if (test_thread_flag(TIF_31BIT))
-#elif AFS_AMD64_LINUX20_ENV
+# elif defined(AFS_AMD64_LINUX20_ENV)
if (test_thread_flag(TIF_IA32))
-#else
+# else
if (test_thread_flag(TIF_32BIT))
-#endif /* AFS_S390X_LINUX26_ENV */
-#else
-#ifdef AFS_SPARC64_LINUX24_ENV
- if (current->thread.flags & SPARC_FLAG_32BIT)
-#elif defined(AFS_SPARC64_LINUX20_ENV)
- if (current->tss.flags & SPARC_FLAG_32BIT)
-#elif defined(AFS_AMD64_LINUX20_ENV)
- if (current->thread.flags & THREAD_IA32)
-#elif defined(AFS_PPC64_LINUX20_ENV)
- if (current->thread.flags & PPC_FLAG_32BIT)
-#elif defined(AFS_S390X_LINUX20_ENV)
- if (current->thread.flags & S390_FLAG_31BIT)
-#else
-#error Not done for this linux type
-#endif /* AFS_LINUX26_ENV */
-#endif /* NEED_IOCTL32 */
+# endif /* AFS_S390X_LINUX26_ENV */
{
if (copy_from_user(&sysargs32, (void *)arg,
sizeof(struct afsprocdata32)))
(unsigned long)sysargs32.param3,
(unsigned long)sysargs32.param4);
} else
-#endif
+#endif /* NEED_IOCTL32 */
{
if (copy_from_user(&sysargs, (void *)arg, sizeof(struct afsprocdata)))
return -EFAULT;
return afs_ioctl(FILE_INODE(file), file, cmd, arg);
}
#endif
-
-static struct file_operations afs_syscall_fops = {
-#ifdef HAVE_UNLOCKED_IOCTL
- .unlocked_ioctl = afs_unlocked_ioctl,
+#if defined(HAVE_LINUX_STRUCT_PROC_OPS)
+static struct proc_ops afs_syscall_ops = {
+ .proc_ioctl = afs_unlocked_ioctl,
+# ifdef STRUCT_PROC_OPS_HAS_PROC_COMPAT_IOCTL
+ .proc_compat_ioctl = afs_unlocked_ioctl,
+# endif
+};
#else
+static struct file_operations afs_syscall_ops = {
+# ifdef HAVE_UNLOCKED_IOCTL
+ .unlocked_ioctl = afs_unlocked_ioctl,
+# else
.ioctl = afs_ioctl,
-#endif
-#ifdef HAVE_COMPAT_IOCTL
+# endif
+# ifdef HAVE_COMPAT_IOCTL
.compat_ioctl = afs_unlocked_ioctl,
-#endif
+# endif
};
-
+#endif /* HAVE_LINUX_STRUCT_PROC_OPS */
void
osi_ioctl_init(void)
{
struct proc_dir_entry *entry;
- entry = create_proc_entry(PROC_SYSCALL_NAME, 0666, openafs_procfs);
- entry->proc_fops = &afs_syscall_fops;
- entry->owner = THIS_MODULE;
+ entry = afs_proc_create(PROC_SYSCALL_NAME, 0666, openafs_procfs, &afs_syscall_ops);
+#if defined(STRUCT_PROC_DIR_ENTRY_HAS_OWNER)
+ if (entry)
+ entry->owner = THIS_MODULE;
+#endif
#if defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
if (register_ioctl32_conversion(VIOC_SYSCALL32, NULL) == 0)