]> 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)
committerDerrick Brashear <shadow@your-file-system.com>
Tue, 28 May 2013 14:15:06 +0000 (07:15 -0700)
Add an afs_proc_create() compat function that uses the
appropriate kernel function based on a configure test.

Change-Id: I4f3929849af032f2a483bc06bc5769f64085f1c4
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>
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 d84bce56c532cf34c651def9d7eb262d08ab929d..6ffb6862d97f3d1fd5596e27d5faa691225b22f3 100644 (file)
@@ -936,6 +936,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 dc2c26ac3f085ca800e74d452e8032ee9d487ed8..ce9178e50f5e32400dd4d15ead861ea57c77be50 100644 (file)
@@ -595,4 +595,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 b5219fa9c123053323b86915cb736fe4c54e8a94..71983dc16d73c5a5839837f4ebe2c08bfd41422b 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
@@ -379,21 +380,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 e8d072ce3c3ad6af68ee66099d6dc4135f0b03d5..34501b5585f7eea00d64520ec79e9223cc491774 100644 (file)
@@ -154,6 +154,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>