lib: build list_sort() only if needed
[safe/jmp/linux-2.6] / fs / proc / vmcore.c
index 4c65ca4..0872afa 100644 (file)
@@ -32,7 +32,7 @@ static size_t elfcorebuf_sz;
 /* Total size of vmcore file. */
 static u64 vmcore_size;
 
-struct proc_dir_entry *proc_vmcore = NULL;
+static struct proc_dir_entry *proc_vmcore = NULL;
 
 /* Reads a page from the oldmem device from given offset. */
 static ssize_t read_from_oldmem(char *buf, size_t count,
@@ -47,8 +47,6 @@ static ssize_t read_from_oldmem(char *buf, size_t count,
 
        offset = (unsigned long)(*ppos % PAGE_SIZE);
        pfn = (unsigned long)(*ppos / PAGE_SIZE);
-       if (pfn > saved_max_pfn)
-               return -EINVAL;
 
        do {
                if (count > (PAGE_SIZE - offset))
@@ -162,18 +160,13 @@ static ssize_t read_vmcore(struct file *file, char __user *buffer,
        return acc;
 }
 
-const struct file_operations proc_vmcore_operations = {
+static const struct file_operations proc_vmcore_operations = {
        .read           = read_vmcore,
 };
 
 static struct vmcore* __init get_new_element(void)
 {
-       struct vmcore *p;
-
-       p = kmalloc(sizeof(*p), GFP_KERNEL);
-       if (p)
-               memset(p, 0, sizeof(*p));
-       return p;
+       return kzalloc(sizeof(struct vmcore), GFP_KERNEL);
 }
 
 static u64 __init get_vmcore_size_elf64(char *elfptr)
@@ -644,7 +637,7 @@ static int __init vmcore_init(void)
        int rc = 0;
 
        /* If elfcorehdr= has been passed in cmdline, then capture the dump.*/
-       if (!(elfcorehdr_addr < ELFCORE_ADDR_MAX))
+       if (!(is_vmcore_usable()))
                return rc;
        rc = parse_crash_elf_headers();
        if (rc) {
@@ -652,7 +645,7 @@ static int __init vmcore_init(void)
                return rc;
        }
 
-       /* Initialize /proc/vmcore size if proc is already up. */
+       proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations);
        if (proc_vmcore)
                proc_vmcore->size = vmcore_size;
        return 0;