]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Cleanly split Linux proc.h (fs) from conflicting Solaris proc.h (process)
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 11 Jun 2010 21:37:46 +0000 (14:37 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 11 Jun 2010 22:57:25 +0000 (15:57 -0700)
Under linux the proc.h header is for the /proc filesystem, and under
Solaris the proc/h header if for processes.  This patch correctly
moves the Linux proc functionality in a linux/proc_compat.h header
and leaves the sys/proc.h for use by Solaris.  Minor updates were
required to all the call sites where it was included of course.

12 files changed:
include/linux/proc_compat.h [new file with mode: 0644]
include/sys/kstat.h
include/sys/proc.h
include/sys/sysmacros.h
include/sys/taskq.h
include/sys/thread.h
include/sys/types.h
module/spl/spl-debug.c
module/spl/spl-generic.c
module/spl/spl-kstat.c
module/spl/spl-proc.c
module/spl/spl-thread.c

diff --git a/include/linux/proc_compat.h b/include/linux/proc_compat.h
new file mode 100644 (file)
index 0000000..c30f9db
--- /dev/null
@@ -0,0 +1,47 @@
+/*****************************************************************************\
+ *  Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
+ *  Copyright (C) 2007 The Regents of the University of California.
+ *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+ *  Written by Brian Behlendorf <behlendorf1@llnl.gov>.
+ *  UCRL-CODE-235197
+ *
+ *  This file is part of the SPL, Solaris Porting Layer.
+ *  For details, see <http://github.com/behlendorf/spl/>.
+ *
+ *  The SPL is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; either version 2 of the License, or (at your
+ *  option) any later version.
+ *
+ *  The SPL is distributed in the hope that it will be useful, but WITHOUT
+ *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ *  for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with the SPL.  If not, see <http://www.gnu.org/licenses/>.
+\*****************************************************************************/
+
+#ifndef _SPL_PROC_H
+#define _SPL_PROC_H
+
+#include <linux/proc_fs.h>
+
+#ifdef CONFIG_SYSCTL
+#ifdef HAVE_2ARGS_REGISTER_SYSCTL
+#define spl_register_sysctl_table(t, a)        register_sysctl_table(t, a)
+#else
+#define spl_register_sysctl_table(t, a)        register_sysctl_table(t)
+#endif /* HAVE_2ARGS_REGISTER_SYSCTL */
+#define spl_unregister_sysctl_table(t) unregister_sysctl_table(t)
+#endif /* CONFIG_SYSCTL */
+
+extern struct proc_dir_entry *proc_spl_kstat;
+struct proc_dir_entry *proc_dir_entry_find(struct proc_dir_entry *root,
+                                          const char *str);
+int proc_dir_entries(struct proc_dir_entry *root);
+
+int proc_init(void);
+void proc_fini(void);
+
+#endif /* SPL_PROC_H */
index 6595f0a8bf32123f5de54b70579d6c8168d6b5be..42458bee590cd823df618f18fde1757ca1ee69c4 100644 (file)
 #define _SPL_KSTAT_H
 
 #include <linux/module.h>
+#include <linux/proc_compat.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/kmem.h>
-#include <sys/proc.h>
 
 #define KSTAT_STRLEN            31
 
index 64b26bb3fc70b352c2c04817c3850b39c47ee91a..1c02c676ef4af95ff89ddd09abcf0808a0a9748c 100644 (file)
 #ifndef _SPL_PROC_H
 #define _SPL_PROC_H
 
-#include <linux/proc_fs.h>
-#include <linux/kmod.h>
-#include <linux/ctype.h>
-#include <linux/sysctl.h>
-#include <linux/seq_file.h>
-#include <sys/sysmacros.h>
-#include <sys/systeminfo.h>
-#include <sys/kmem.h>
-#include <sys/mutex.h>
-#include <sys/kstat.h>
-#include <sys/debug.h>
-
-#ifdef CONFIG_SYSCTL
-#ifdef HAVE_2ARGS_REGISTER_SYSCTL
-#define spl_register_sysctl_table(t, a)        register_sysctl_table(t, a)
-#else
-#define spl_register_sysctl_table(t, a)        register_sysctl_table(t)
-#endif /* HAVE_2ARGS_REGISTER_SYSCTL */
-#define spl_unregister_sysctl_table(t) unregister_sysctl_table(t)
-#endif /* CONFIG_SYSCTL */
-
-extern struct proc_dir_entry *proc_spl_kstat;
-struct proc_dir_entry *proc_dir_entry_find(struct proc_dir_entry *root,
-                                          const char *str);
-int proc_dir_entries(struct proc_dir_entry *root);
-
-int proc_init(void);
-void proc_fini(void);
-
 #endif /* SPL_PROC_H */
index f76c6dd7fae635c5f4aaadad3c4d598cd0fd37b3..4475431e711375479dd1125dfe229cff7558a763 100644 (file)
 #define DEV_BSIZE                      512
 #define DEV_BSHIFT                     9 /* log2(DEV_BSIZE) */
 
-#define curproc                                current
 #define proc_pageout                   NULL
-#define max_ncpus                       64
+#define curproc                                get_current()
+#define max_ncpus                      64
 #define CPU_SEQID                      smp_processor_id() /* I think... */
 #define _NOTE(x)
+#define is_system_labeled()            0
 
 
 #define RLIM64_INFINITY                        RLIM_INFINITY
 extern char spl_version[16];
 extern long spl_hostid;
 extern char hw_serial[11];
-extern int p0;
 
 /* Missing misc functions */
 extern int highbit(unsigned long i);
index d8578499beea39069b1457c63ba88e299b903a0b..baa96eaa0ab0a1b5c044c73c098161c4dcb145ad 100644 (file)
@@ -94,6 +94,10 @@ void spl_taskq_fini(void);
 #define taskq_wait(tq)                     __taskq_wait(tq)
 #define taskq_dispatch(tq, f, p, fl)       __taskq_dispatch(tq, f, p, fl)
 #define taskq_create(n, th, p, mi, ma, fl) __taskq_create(n, th, p, mi, ma, fl)
+#define taskq_create_proc(n, th, p, mi, ma, pr, fl)    \
+       __taskq_create(n, th, p, mi, ma, fl)
+#define taskq_create_sysdc(n, th, mi, ma, pr, dc, fl)  \
+       __taskq_create(n, th, maxclsyspri, mi, ma, fl)
 #define taskq_destroy(tq)                  __taskq_destroy(tq)
 
 #endif  /* _SPL_TASKQ_H */
index 4cad648df35604585a618d106f6af1247f9bdc26..e29715d830dd8d38f1558ebde975addd0909d526 100644 (file)
 #define TS_RUN                         TASK_RUNNING
 #define TS_ZOMB                                EXIT_ZOMBIE
 #define TS_STOPPED                     TASK_STOPPED
-#if 0
-#define TS_FREE                                0x00    /* No clean linux mapping */
-#define TS_ONPROC                      0x04    /* No clean linux mapping */
-#define TS_WAIT                                0x20    /* No clean linux mapping */
-#endif
 
 typedef void (*thread_func_t)(void *);
 
@@ -53,13 +48,13 @@ typedef void (*thread_func_t)(void *);
        __thread_create(stk, stksize, (thread_func_t)func,               \
                        #func, arg, len, pp, state, pri)
 #define thread_exit()                  __thread_exit()
+#define thread_join(t)                 SBUG()
 #define curthread                      get_current()
 
 extern kthread_t *__thread_create(caddr_t stk, size_t  stksize,
                                   thread_func_t func, const char *name,
-                                  void *args, size_t len, int *pp,
+                                  void *args, size_t len, proc_t *pp,
                                   int state, pri_t pri);
 extern void __thread_exit(void);
 
 #endif  /* _SPL_THREAD_H */
-
index 498abdff450c11a8673d80e1e8361e25a636051e..1bdd00c4837e4b4e5f75946b4d1eecdb58bd4fc3 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/mutex_compat.h>
 #include <linux/module_compat.h>
 #include <linux/sysctl_compat.h>
+#include <linux/proc_compat.h>
 
 #ifndef HAVE_UINTPTR_T
 typedef unsigned long                  uintptr_t;
@@ -63,6 +64,7 @@ typedef unsigned long long            rlim64_t;
 typedef long long                      longlong_t;
 typedef long long                      offset_t;
 typedef struct task_struct             kthread_t;
+typedef struct task_struct             proc_t;
 typedef struct vmem { }                        vmem_t;
 typedef short                          pri_t;
 typedef struct timespec                        timestruc_t; /* definition per SVr4 */
@@ -79,4 +81,6 @@ typedef ulong_t                               pgcnt_t;
 typedef long                           spgcnt_t;
 typedef short                          index_t;
 
+extern proc_t p0;
+
 #endif /* _SPL_TYPES_H */
index 8ee6c5dfb8ea611132c361c44c6b58d11e5ab11e..6a108624127b10ef9780bd7669db23f47861a2e2 100644 (file)
@@ -34,8 +34,8 @@
 #include <linux/hardirq.h>
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
+#include <linux/proc_compat.h>
 #include <sys/sysmacros.h>
-#include <sys/proc.h>
 #include <sys/debug.h>
 #include <spl-ctl.h>
 
index 9916051de0fc28c31446d063c5e7a04ee2fa86cc..d5c1523e1a2d45d7cbb47e502bc1dd21e3e044b6 100644 (file)
@@ -38,6 +38,7 @@
 #include <sys/utsname.h>
 #include <sys/file.h>
 #include <linux/kmod.h>
+#include <linux/proc_compat.h>
 
 #ifdef DEBUG_SUBSYSTEM
 #undef DEBUG_SUBSYSTEM
@@ -53,7 +54,7 @@ EXPORT_SYMBOL(spl_hostid);
 char hw_serial[HW_HOSTID_LEN] = "<none>";
 EXPORT_SYMBOL(hw_serial);
 
-int p0 = 0;
+proc_t p0 = { 0 };
 EXPORT_SYMBOL(p0);
 
 #ifndef HAVE_KALLSYMS_LOOKUP_NAME
index 2b45549d6f6c229586983d63857718da6aa01bd2..433f3e5b016110a1fe9099f5304e9dbd8c3ceca1 100644 (file)
@@ -25,6 +25,7 @@
 \*****************************************************************************/
 
 #include <sys/kstat.h>
+#include <linux/seq_file.h>
 
 static spinlock_t kstat_lock;
 static struct list_head kstat_list;
index 3bc8b40cf5761833d5af0ecdb3fd8e9362d40435..277a92a7af1f08da2d2687daf5b29acc89adce44 100644 (file)
  *  Solaris Porting Layer (SPL) Proc Implementation.
 \*****************************************************************************/
 
-#include <sys/proc.h>
+#include <sys/systeminfo.h>
+#include <sys/kstat.h>
+#include <linux/kmod.h>
+#include <linux/seq_file.h>
+#include <linux/proc_compat.h>
 
 #ifdef DEBUG_SUBSYSTEM
 #undef DEBUG_SUBSYSTEM
index de959119e72e4874b522e957ac79bd145a22fd5d..1345890ed828626521595d394217fc06885b80c1 100644 (file)
@@ -83,7 +83,7 @@ EXPORT_SYMBOL(__thread_exit);
  * style callers likely never check for... since it can't fail. */
 kthread_t *
 __thread_create(caddr_t stk, size_t  stksize, thread_func_t func,
-               const char *name, void *args, size_t len, int *pp,
+               const char *name, void *args, size_t len, proc_t *pp,
                int state, pri_t pri)
 {
        thread_priv_t *tp;