]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Linux 3.10: Replace create_proc_entry() with proc_create()
authorMarc Dionne <marc.dionne@your-file-system.com>
Tue, 7 May 2013 00:20:07 +0000 (20:20 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Thu, 30 May 2013 14:44:56 +0000 (07:44 -0700)
Add an afs_proc_create() compat function that uses the
appropriate kernel function based on a configure test.

Reviewed-on: http://gerrit.openafs.org/9854
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 9b24013426e03a501fcaa6334ba5a9b48a8da3d1)

Change-Id: I976ef345b1638434026e852e577e1f4474171e3d
Reviewed-on: http://gerrit.openafs.org/9948
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
acinclude.m4
src/afs/LINUX/osi_compat.h
src/afs/LINUX/osi_ioctl.c
src/afs/LINUX/osi_proc.c
src/afs/sysincludes.h

index 8334d084bd6e3f17349b8bf9134d2a38586a7d30..b548b9258b7c78b9724f5aa1a926746a08d8cbaa 100644 (file)
@@ -920,6 +920,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                                     [#include <linux/fs.h>
                                      #include <linux/namei.h>],
                                     [path_lookup(NULL, 0, NULL);])
+                AC_CHECK_LINUX_FUNC([proc_create],
+                                    [#include <linux/proc_fs.h>],
+                                    [proc_create(NULL, 0, NULL, NULL);])
                 AC_CHECK_LINUX_FUNC([rcu_read_lock],
                                     [#include <linux/rcupdate.h>],
                                     [rcu_read_lock();])
index d726c6ae27fd187ec57b1ffc101ea44dc8e15e9b..b933560baba28eae06dc58e52b42a36501448f2f 100644 (file)
@@ -552,4 +552,17 @@ afs_truncate(struct inode *inode, int len)
     return code;
 }
 
+static inline struct proc_dir_entry *
+afs_proc_create(char *name, umode_t mode, struct proc_dir_entry *parent, struct file_operations *fops) {
+#if defined(HAVE_LINUX_PROC_CREATE)
+    return proc_create(name, mode, parent, fops);
+#else
+    struct proc_dir_entry *entry;
+    entry = create_proc_entry(name, mode, parent);
+    if (entry)
+       entry->proc_fops = fops;
+    return entry;
+#endif
+}
+
 #endif /* AFS_LINUX_OSI_COMPAT_H */
index 45e0fcdfceca5c00c7751edd1a34f385b47f9b08..82e907bf68ff88e7b120c0c91e0c696657182d5a 100644 (file)
 #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;
@@ -107,10 +108,10 @@ 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 = afs_proc_create(PROC_SYSCALL_NAME, 0666, openafs_procfs, &afs_syscall_fops);
 #if defined(STRUCT_PROC_DIR_ENTRY_HAS_OWNER)
-    entry->owner = THIS_MODULE;
+    if (entry)
+       entry->owner = THIS_MODULE;
 #endif
 
 #if defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
index 974c0a7713975174f07eeb9233509077a4e5fb8a..5e3ac5301dc5b1dadce9a908ab6d33db0da95984 100644 (file)
 # include <asm/ia32_unistd.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"
+
 struct proc_dir_entry *openafs_procfs;
 
 #ifdef HAVE_LINUX_SEQ_FILE_H
@@ -367,21 +368,18 @@ osi_proc_init(void)
     openafs_procfs = proc_mkdir(path, NULL);
 #endif
 #ifdef HAVE_LINUX_SEQ_FILE_H
-    entry = create_proc_entry("unixusers", 0, openafs_procfs);
-    if (entry) {
-       entry->proc_fops = &afs_unixuser_fops;
+    entry = afs_proc_create("unixusers", 0, openafs_procfs, &afs_unixuser_fops);
 # if defined(STRUCT_PROC_DIR_ENTRY_HAS_OWNER)
+    if (entry)
        entry->owner = THIS_MODULE;
 # endif
-    }
-    entry = create_proc_entry(PROC_CELLSERVDB_NAME, 0, openafs_procfs);
-    if (entry)
-       entry->proc_fops = &afs_csdb_operations;
+    entry = afs_proc_create(PROC_CELLSERVDB_NAME, 0, openafs_procfs, &afs_csdb_operations);
 #else
     entry = create_proc_info_entry(PROC_CELLSERVDB_NAME, (S_IFREG|S_IRUGO), openafs_procfs, csdbproc_info);
 #endif
 #if defined(STRUCT_PROC_DIR_ENTRY_HAS_OWNER)
-    entry->owner = THIS_MODULE;
+    if (entry)
+       entry->owner = THIS_MODULE;
 #endif
 }
 
index f7abc2e46f2c2f69b2eb7c192dbb0b167e67929a..5840227130266e8102c67dff1f22c0f8a882403f 100644 (file)
@@ -160,6 +160,7 @@ struct xfs_inode_info {
 # include <linux/sched.h>
 # include <linux/mm.h>
 # include <linux/slab.h>
+# include <linux/proc_fs.h>
 # include <linux/string.h>
 # if defined(HAVE_LINUX_SEMAPHORE_H)
 #  include <linux/semaphore.h>