Commit 6980128f authored by Eric W. Biederman's avatar Eric W. Biederman

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: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 7ec66d06
...@@ -53,6 +53,13 @@ static DEFINE_SPINLOCK(sysctl_lock); ...@@ -53,6 +53,13 @@ static DEFINE_SPINLOCK(sysctl_lock);
static void drop_sysctl_table(struct ctl_table_header *header); 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) static int namecmp(const char *name1, int len1, const char *name2, int len2)
{ {
int minlen; int minlen;
...@@ -822,7 +829,9 @@ static struct ctl_dir *get_subdir(struct ctl_table_set *set, ...@@ -822,7 +829,9 @@ static struct ctl_dir *get_subdir(struct ctl_table_set *set,
subdir->header.nreg++; subdir->header.nreg++;
failed: failed:
if (unlikely(IS_ERR(subdir))) { 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)); namelen, namelen, name, PTR_ERR(subdir));
} }
drop_sysctl_table(&dir->header); drop_sysctl_table(&dir->header);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment