Linux 3.10 compat: Do not rely on struct proc_dir_entry definition

Linux kernel commit torvalds/linux#59d8053f moved the definition of
struct proc_dir_entry from include/linux/proc_fs.h to the private
header fs/proc/internal.h. The SPL relied on that to map Solaris'
kstat to entries in /proc/spl/kstat.

Since the proc_dir_entry structure is now private the only safe
thing to do is wrap the opaque proc handle with our own structure.
This actually ends up simplify the code and is good because it
moves us away from depending on implementation details of /proc.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257
This commit is contained in:
Richard Yao
2013-07-03 16:34:52 -04:00
committed by Brian Behlendorf
parent 79a7ab2581
commit f2a745c41d
4 changed files with 95 additions and 88 deletions
+8
View File
@@ -83,6 +83,13 @@ struct kstat_s;
typedef int kid_t; /* unique kstat id */
typedef int kstat_update_t(struct kstat_s *, int); /* dynamic update cb */
typedef struct kstat_module {
char ksm_name[KSTAT_STRLEN+1]; /* module name */
struct list_head ksm_module_list; /* module linkage */
struct list_head ksm_kstat_list; /* list of kstat entries */
struct proc_dir_entry *ksm_proc; /* proc entry */
} kstat_module_t;
typedef struct kstat_s {
int ks_magic; /* magic value */
kid_t ks_kid; /* unique kstat ID */
@@ -102,6 +109,7 @@ typedef struct kstat_s {
void *ks_private; /* private data */
kmutex_t ks_lock; /* kstat data lock */
struct list_head ks_list; /* kstat linkage */
kstat_module_t *ks_owner; /* kstat module linkage */
} kstat_t;
typedef struct kstat_named_s {