summaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-22 05:09:45 +0100
committerEric W. Biederman <ebiederm@xmission.com>2012-01-25 01:40:29 +0100
commit6980128fe1b834c92a85e556ca8198030f0d8d01 (patch)
tree2814b1771a8e70538215ea47e104e2ab89ba4048 /fs/proc
parentsysctl: Stop requiring explicit management of sysctl directories (diff)
downloadlinux-6980128fe1b834c92a85e556ca8198030f0d8d01.tar.xz
linux-6980128fe1b834c92a85e556ca8198030f0d8d01.zip
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')
-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);
static void drop_sysctl_table(struct ctl_table_header *header);
+static void sysctl_print_dir(struct ctl_dir *dir)
+{
+ if (dir->header.parent)
+ sysctl_print_dir(dir->header.parent);
+ printk(KERN_CONT "%s/", dir->header.ctl_table[0].procname);
+}
+
static int namecmp(const char *name1, int len1, const char *name2, int len2)
{
int minlen;
@@ -822,7 +829,9 @@ found:
subdir->header.nreg++;
failed:
if (unlikely(IS_ERR(subdir))) {
- printk(KERN_ERR "sysctl could not get directory: %*.*s %ld\n",
+ printk(KERN_ERR "sysctl could not get directory: ");
+ sysctl_print_dir(dir);
+ printk(KERN_CONT "/%*.*s %ld\n",
namelen, namelen, name, PTR_ERR(subdir));
}
drop_sysctl_table(&dir->header);