Linux 3.10: Replace create_proc_entry() with proc_create()

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>
This commit is contained in:
Marc Dionne 2013-05-06 20:20:07 -04:00 committed by Derrick Brashear
parent caa90b2d7a
commit 9b24013426
5 changed files with 29 additions and 13 deletions

View 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();])

View 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 */

View File

@ -29,12 +29,13 @@
#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)

View File

@ -29,12 +29,13 @@
# 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
}

View 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>