uml: style fixes pass 2

Formatting changes in the files which have been changed in the course
of removing CHOOSE_MODE.  These include:
	copyright updates
	header file trimming
	style fixes
	adding severity to printks

These changes should be entirely non-functional.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Jeff Dike 2007-10-16 01:26:57 -07:00 committed by Linus Torvalds
parent 6aa802ce6a
commit ae2587e412
6 changed files with 146 additions and 153 deletions

View file

@ -1,43 +1,35 @@
/* /*
* Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
* Copyright (C) 2001 - 2003 Jeff Dike (jdike@addtoit.com) * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "linux/kernel.h" #include "linux/console.h"
#include "linux/slab.h"
#include "linux/init.h"
#include "linux/notifier.h"
#include "linux/reboot.h"
#include "linux/utsname.h"
#include "linux/ctype.h" #include "linux/ctype.h"
#include "linux/interrupt.h" #include "linux/interrupt.h"
#include "linux/sysrq.h"
#include "linux/workqueue.h"
#include "linux/module.h"
#include "linux/file.h"
#include "linux/fs.h"
#include "linux/namei.h"
#include "linux/proc_fs.h"
#include "linux/syscalls.h"
#include "linux/list.h" #include "linux/list.h"
#include "linux/mm.h" #include "linux/mm.h"
#include "linux/console.h" #include "linux/module.h"
#include "asm/irq.h" #include "linux/notifier.h"
#include "linux/reboot.h"
#include "linux/proc_fs.h"
#include "linux/slab.h"
#include "linux/syscalls.h"
#include "linux/utsname.h"
#include "linux/workqueue.h"
#include "asm/uaccess.h" #include "asm/uaccess.h"
#include "init.h"
#include "irq_kern.h"
#include "irq_user.h"
#include "kern_util.h" #include "kern_util.h"
#include "kern.h"
#include "mconsole.h" #include "mconsole.h"
#include "mconsole_kern.h" #include "mconsole_kern.h"
#include "irq_user.h"
#include "init.h"
#include "os.h" #include "os.h"
#include "irq_kern.h"
static int do_unlink_socket(struct notifier_block *notifier, static int do_unlink_socket(struct notifier_block *notifier,
unsigned long what, void *data) unsigned long what, void *data)
{ {
return(mconsole_unlink_socket()); return mconsole_unlink_socket();
} }
@ -60,8 +52,7 @@ static void mc_work_proc(struct work_struct *unused)
while (!list_empty(&mc_requests)) { while (!list_empty(&mc_requests)) {
local_irq_save(flags); local_irq_save(flags);
req = list_entry(mc_requests.next, struct mconsole_entry, req = list_entry(mc_requests.next, struct mconsole_entry, list);
list);
list_del(&req->list); list_del(&req->list);
local_irq_restore(flags); local_irq_restore(flags);
req->request.cmd->handler(&req->request); req->request.cmd->handler(&req->request);
@ -96,7 +87,7 @@ static irqreturn_t mconsole_interrupt(int irq, void *dev_id)
if (!list_empty(&mc_requests)) if (!list_empty(&mc_requests))
schedule_work(&mconsole_work); schedule_work(&mconsole_work);
reactivate_fd(fd, MCONSOLE_IRQ); reactivate_fd(fd, MCONSOLE_IRQ);
return(IRQ_HANDLED); return IRQ_HANDLED;
} }
void mconsole_version(struct mc_request *req) void mconsole_version(struct mc_request *req)
@ -104,8 +95,8 @@ void mconsole_version(struct mc_request *req)
char version[256]; char version[256];
sprintf(version, "%s %s %s %s %s", utsname()->sysname, sprintf(version, "%s %s %s %s %s", utsname()->sysname,
utsname()->nodename, utsname()->release, utsname()->nodename, utsname()->release, utsname()->version,
utsname()->version, utsname()->machine); utsname()->machine);
mconsole_reply(req, version, 0, 0); mconsole_reply(req, version, 0, 0);
} }
@ -117,7 +108,7 @@ void mconsole_log(struct mc_request *req)
ptr += strlen("log "); ptr += strlen("log ");
len = req->len - (ptr - req->request.data); len = req->len - (ptr - req->request.data);
printk("%.*s", len, ptr); printk(KERN_WARNING "%.*s", len, ptr);
mconsole_reply(req, "", 0, 0); mconsole_reply(req, "", 0, 0);
} }
@ -216,13 +207,14 @@ void mconsole_proc(struct mc_request *req)
char *ptr = req->request.data; char *ptr = req->request.data;
ptr += strlen("proc"); ptr += strlen("proc");
while(isspace(*ptr)) ptr++; while (isspace(*ptr))
ptr++;
snprintf(path, sizeof(path), "/proc/%s", ptr); snprintf(path, sizeof(path), "/proc/%s", ptr);
fd = sys_open(path, 0, 0); fd = sys_open(path, 0, 0);
if (fd < 0) { if (fd < 0) {
mconsole_reply(req, "Failed to open file", 1, 0); mconsole_reply(req, "Failed to open file", 1, 0);
printk("open %s: %d\n",path,fd); printk(KERN_ERR "open %s: %d\n",path,fd);
goto out; goto out;
} }
@ -353,9 +345,9 @@ static struct mc_device *mconsole_find_dev(char *name)
list_for_each(ele, &mconsole_devices) { list_for_each(ele, &mconsole_devices) {
dev = list_entry(ele, struct mc_device, list); dev = list_entry(ele, struct mc_device, list);
if (!strncmp(name, dev->name, strlen(dev->name))) if (!strncmp(name, dev->name, strlen(dev->name)))
return(dev); return dev;
} }
return(NULL); return NULL;
} }
#define UNPLUGGED_PER_PAGE \ #define UNPLUGGED_PER_PAGE \
@ -445,8 +437,8 @@ static int mem_config(char *str, char **error_out)
list); list);
err = os_drop_memory(addr, PAGE_SIZE); err = os_drop_memory(addr, PAGE_SIZE);
if (err) { if (err) {
printk("Failed to release memory - " printk(KERN_ERR "Failed to release "
"errno = %d\n", err); "memory - errno = %d\n", err);
*error_out = "Failed to release memory"; *error_out = "Failed to release memory";
goto out_unlock; goto out_unlock;
} }
@ -502,8 +494,8 @@ static int __init mem_mc_init(void)
{ {
if (can_drop_memory()) if (can_drop_memory())
mconsole_register_dev(&mem_mc); mconsole_register_dev(&mem_mc);
else printk("Can't release memory to the host - memory hotplug won't " else printk(KERN_ERR "Can't release memory to the host - memory "
"be supported\n"); "hotplug won't be supported\n");
return 0; return 0;
} }
@ -561,7 +553,8 @@ void mconsole_config(struct mc_request *req)
int err; int err;
ptr += strlen("config"); ptr += strlen("config");
while(isspace(*ptr)) ptr++; while (isspace(*ptr))
ptr++;
dev = mconsole_find_dev(ptr); dev = mconsole_find_dev(ptr);
if (dev == NULL) { if (dev == NULL) {
mconsole_reply(req, "Bad configuration option", 1, 0); mconsole_reply(req, "Bad configuration option", 1, 0);
@ -719,7 +712,8 @@ void mconsole_sysrq(struct mc_request *req)
ptr += strlen("sysrq"); ptr += strlen("sysrq");
while (isspace(*ptr)) ptr++; while (isspace(*ptr)) ptr++;
/* With 'b', the system will shut down without a chance to reply, /*
* With 'b', the system will shut down without a chance to reply,
* so in this case, we reply first. * so in this case, we reply first.
*/ */
if (*ptr == 'b') if (*ptr == 'b')
@ -742,7 +736,8 @@ static void stack_proc(void *arg)
switch_to(from, to, from); switch_to(from, to, from);
} }
/* Mconsole stack trace /*
* Mconsole stack trace
* Added by Allan Graves, Jeff Dike * Added by Allan Graves, Jeff Dike
* Dumps a stacks registers to the linux console. * Dumps a stacks registers to the linux console.
* Usage stack <pid>. * Usage stack <pid>.
@ -754,15 +749,19 @@ void mconsole_stack(struct mc_request *req)
struct task_struct *from = NULL; struct task_struct *from = NULL;
struct task_struct *to = NULL; struct task_struct *to = NULL;
/* Would be nice: /*
* Would be nice:
* 1) Send showregs output to mconsole. * 1) Send showregs output to mconsole.
* 2) Add a way to stack dump all pids. * 2) Add a way to stack dump all pids.
*/ */
ptr += strlen("stack"); ptr += strlen("stack");
while(isspace(*ptr)) ptr++; while (isspace(*ptr))
ptr++;
/* Should really check for multiple pids or reject bad args here */ /*
* Should really check for multiple pids or reject bad args here
*/
/* What do the arguments in mconsole_reply mean? */ /* What do the arguments in mconsole_reply mean? */
if (sscanf(ptr, "%d", &pid_requested) == 0) { if (sscanf(ptr, "%d", &pid_requested) == 0) {
mconsole_reply(req, "Please specify a pid", 1, 0); mconsole_reply(req, "Please specify a pid", 1, 0);
@ -779,7 +778,8 @@ void mconsole_stack(struct mc_request *req)
with_console(req, stack_proc, to); with_console(req, stack_proc, to);
} }
/* Changed by mconsole_setup, which is __setup, and called before SMP is /*
* Changed by mconsole_setup, which is __setup, and called before SMP is
* active. * active.
*/ */
static char *notify_socket = NULL; static char *notify_socket = NULL;
@ -791,13 +791,14 @@ static int __init mconsole_init(void)
int err; int err;
char file[256]; char file[256];
if(umid_file_name("mconsole", file, sizeof(file))) return(-1); if (umid_file_name("mconsole", file, sizeof(file)))
return -1;
snprintf(mconsole_socket_name, sizeof(file), "%s", file); snprintf(mconsole_socket_name, sizeof(file), "%s", file);
sock = os_create_unix_socket(file, sizeof(file), 1); sock = os_create_unix_socket(file, sizeof(file), 1);
if (sock < 0) { if (sock < 0) {
printk("Failed to initialize management console\n"); printk(KERN_ERR "Failed to initialize management console\n");
return(1); return 1;
} }
register_reboot_notifier(&reboot_notifier); register_reboot_notifier(&reboot_notifier);
@ -806,8 +807,8 @@ static int __init mconsole_init(void)
IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM, IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM,
"mconsole", (void *)sock); "mconsole", (void *)sock);
if (err) { if (err) {
printk("Failed to get IRQ for management console\n"); printk(KERN_ERR "Failed to get IRQ for management console\n");
return(1); return 1;
} }
if (notify_socket != NULL) { if (notify_socket != NULL) {
@ -820,9 +821,9 @@ static int __init mconsole_init(void)
"string\n"); "string\n");
} }
printk("mconsole (version %d) initialized on %s\n", printk(KERN_INFO "mconsole (version %d) initialized on %s\n",
MCONSOLE_VERSION, mconsole_socket_name); MCONSOLE_VERSION, mconsole_socket_name);
return(0); return 0;
} }
__initcall(mconsole_init); __initcall(mconsole_init);
@ -834,7 +835,7 @@ static int write_proc_mconsole(struct file *file, const char __user *buffer,
buf = kmalloc(count + 1, GFP_KERNEL); buf = kmalloc(count + 1, GFP_KERNEL);
if (buf == NULL) if (buf == NULL)
return(-ENOMEM); return -ENOMEM;
if (copy_from_user(buf, buffer, count)) { if (copy_from_user(buf, buffer, count)) {
count = -EFAULT; count = -EFAULT;
@ -846,24 +847,26 @@ static int write_proc_mconsole(struct file *file, const char __user *buffer,
mconsole_notify(notify_socket, MCONSOLE_USER_NOTIFY, buf, count); mconsole_notify(notify_socket, MCONSOLE_USER_NOTIFY, buf, count);
out: out:
kfree(buf); kfree(buf);
return(count); return count;
} }
static int create_proc_mconsole(void) static int create_proc_mconsole(void)
{ {
struct proc_dir_entry *ent; struct proc_dir_entry *ent;
if(notify_socket == NULL) return(0); if (notify_socket == NULL)
return 0;
ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL); ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL);
if (ent == NULL) { if (ent == NULL) {
printk(KERN_INFO "create_proc_mconsole : create_proc_entry failed\n"); printk(KERN_INFO "create_proc_mconsole : create_proc_entry "
return(0); "failed\n");
return 0;
} }
ent->read_proc = NULL; ent->read_proc = NULL;
ent->write_proc = write_proc_mconsole; ent->write_proc = write_proc_mconsole;
return(0); return 0;
} }
static DEFINE_SPINLOCK(notify_spinlock); static DEFINE_SPINLOCK(notify_spinlock);
@ -889,7 +892,7 @@ static int mconsole_setup(char *str)
notify_socket = str; notify_socket = str;
} }
else printk(KERN_ERR "mconsole_setup : Unknown option - '%s'\n", str); else printk(KERN_ERR "mconsole_setup : Unknown option - '%s'\n", str);
return(1); return 1;
} }
__setup("mconsole", mconsole_setup); __setup("mconsole", mconsole_setup);
@ -907,11 +910,12 @@ static int notify_panic(struct notifier_block *self, unsigned long unused1,
{ {
char *message = ptr; char *message = ptr;
if(notify_socket == NULL) return(0); if (notify_socket == NULL)
return 0;
mconsole_notify(notify_socket, MCONSOLE_PANIC, message, mconsole_notify(notify_socket, MCONSOLE_PANIC, message,
strlen(message) + 1); strlen(message) + 1);
return(0); return 0;
} }
static struct notifier_block panic_exit_notifier = { static struct notifier_block panic_exit_notifier = {
@ -924,14 +928,14 @@ static int add_notifier(void)
{ {
atomic_notifier_chain_register(&panic_notifier_list, atomic_notifier_chain_register(&panic_notifier_list,
&panic_exit_notifier); &panic_exit_notifier);
return(0); return 0;
} }
__initcall(add_notifier); __initcall(add_notifier);
char *mconsole_notify_socket(void) char *mconsole_notify_socket(void)
{ {
return(notify_socket); return notify_socket;
} }
EXPORT_SYMBOL(mconsole_notify_socket); EXPORT_SYMBOL(mconsole_notify_socket);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com) * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com) * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
@ -90,14 +90,3 @@ extern int clear_user(void __user *mem, int len);
extern int strnlen_user(const void __user *str, int len); extern int strnlen_user(const void __user *str, int len);
#endif #endif
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-file-style: "linux"
* End:
*/

View file

@ -1,22 +1,15 @@
/* /*
* Copyright (C) 2001 - 2004 Jeff Dike (jdike@addtoit.com) * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "linux/module.h" #include "linux/module.h"
#include "linux/string.h" #include "linux/syscalls.h"
#include "linux/smp_lock.h" #include "asm/a.out.h"
#include "linux/spinlock.h"
#include "linux/highmem.h"
#include "asm/current.h"
#include "asm/processor.h"
#include "asm/unistd.h"
#include "asm/pgalloc.h"
#include "asm/pgtable.h"
#include "asm/page.h"
#include "asm/tlbflush.h" #include "asm/tlbflush.h"
#include "kern_util.h" #include "asm/uaccess.h"
#include "as-layout.h" #include "as-layout.h"
#include "kern_util.h"
#include "mem_user.h" #include "mem_user.h"
#include "os.h" #include "os.h"

View file

@ -1,3 +1,8 @@
/*
* Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL
*/
#ifndef __UM_A_OUT_H #ifndef __UM_A_OUT_H
#define __UM_A_OUT_H #define __UM_A_OUT_H

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com) * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
@ -30,7 +30,9 @@ extern void flush_tlb_page_skas(struct vm_area_struct *vma,
static inline void flush_tlb_page(struct vm_area_struct *vma, static inline void flush_tlb_page(struct vm_area_struct *vma,
unsigned long address) unsigned long address)
{ {
flush_tlb_page_skas(vma, address & PAGE_MASK); address &= PAGE_MASK;
flush_tlb_page_skas(vma, address);
} }
extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);