aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/proc_sysctl.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-21 23:09:45 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-01-24 19:40:29 -0500
commit6980128fe1b834c92a85e556ca8198030f0d8d01 (patch)
tree2814b1771a8e70538215ea47e104e2ab89ba4048 /fs/proc/proc_sysctl.c
parent7ec66d06362da7684a4948c4c2bf1f8546425df4 (diff)
sysctl: Add sysctl_print_dir and use it in get_subdir
When there are errors it is very nice to know the full sysctl path. Add a simple function that computes the sysctl path and prints it out. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc/proc_sysctl.c')
-rw-r--r--fs/proc/proc_sysctl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 3c0767d5a55f..a78556514a87 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -53,6 +53,13 @@ static DEFINE_SPINLOCK(sysctl_lock);
53 53
54static void drop_sysctl_table(struct ctl_table_header *header); 54static void drop_sysctl_table(struct ctl_table_header *header);
55 55
56static void sysctl_print_dir(struct ctl_dir *dir)
57{
58 if (dir->header.parent)
59 sysctl_print_dir(dir->header.parent);
60 printk(KERN_CONT "%s/", dir->header.ctl_table[0].procname);
61}
62
56static int namecmp(const char *name1, int len1, const char *name2, int len2) 63static int namecmp(const char *name1, int len1, const char *name2, int len2)
57{ 64{
58 int minlen; 65 int minlen;
@@ -822,7 +829,9 @@ found:
822 subdir->header.nreg++; 829 subdir->header.nreg++;
823failed: 830failed:
824 if (unlikely(IS_ERR(subdir))) { 831 if (unlikely(IS_ERR(subdir))) {
825 printk(KERN_ERR "sysctl could not get directory: %*.*s %ld\n", 832 printk(KERN_ERR "sysctl could not get directory: ");
833 sysctl_print_dir(dir);
834 printk(KERN_CONT "/%*.*s %ld\n",
826 namelen, namelen, name, PTR_ERR(subdir)); 835 namelen, namelen, name, PTR_ERR(subdir));
827 } 836 }
828 drop_sysctl_table(&dir->header); 837 drop_sysctl_table(&dir->header);