diff options
author | Richard Yao <[email protected]> | 2013-07-03 16:34:52 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-07-08 15:25:18 -0700 |
commit | f2a745c41df44c32149abb27b80e92cede772551 (patch) | |
tree | 59b7c99f5e1685c82aabf93e01b55ab76183b477 /module/spl/spl-proc.c | |
parent | 79a7ab25812d2701230aaff62904570ef7dbecef (diff) |
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 <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #257
Diffstat (limited to 'module/spl/spl-proc.c')
-rw-r--r-- | module/spl/spl-proc.c | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c index cd4fa1b47..b8379d0fe 100644 --- a/module/spl/spl-proc.c +++ b/module/spl/spl-proc.c @@ -1120,39 +1120,6 @@ static struct ctl_table spl_root[] = { { 0 } }; -static int -proc_dir_entry_match(int len, const char *name, struct proc_dir_entry *de) -{ - if (de->namelen != len) - return 0; - - return !memcmp(name, de->name, len); -} - -struct proc_dir_entry * -proc_dir_entry_find(struct proc_dir_entry *root, const char *str) -{ - struct proc_dir_entry *de; - - for (de = root->subdir; de; de = de->next) - if (proc_dir_entry_match(strlen(str), str, de)) - return de; - - return NULL; -} - -int -proc_dir_entries(struct proc_dir_entry *root) -{ - struct proc_dir_entry *de; - int i = 0; - - for (de = root->subdir; de; de = de->next) - i++; - - return i; -} - int spl_proc_init(void) { @@ -1174,11 +1141,11 @@ spl_proc_init(void) if (proc_spl_kmem == NULL) SGOTO(out, rc = -EUNATCH); - proc_spl_kmem_slab = create_proc_entry("slab", 0444, proc_spl_kmem); + proc_spl_kmem_slab = proc_create_data("slab", 0444, + proc_spl_kmem, &proc_slab_operations, NULL); if (proc_spl_kmem_slab == NULL) SGOTO(out, rc = -EUNATCH); - proc_spl_kmem_slab->proc_fops = &proc_slab_operations; #endif /* DEBUG_KMEM */ proc_spl_kstat = proc_mkdir("kstat", proc_spl); |