]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
sysctl: Add sysctl_print_dir and use it in get_subdir
authorEric W. Biederman <ebiederm@xmission.com>
Sun, 22 Jan 2012 04:09:45 +0000 (20:09 -0800)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 25 Jan 2012 00:40:29 +0000 (16:40 -0800)
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>
fs/proc/proc_sysctl.c

index 3c0767d5a55faa85ef7be816adcc3cefb56a8ccd..a78556514a873118fbf17b85f19c73139bdcf380 100644 (file)
@@ -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);