Commit ddc00b98 authored by Guillaume Vercoutere's avatar Guillaume Vercoutere Committed by Greg Kroah-Hartman

staging: android: Correct coding style in logger.c

Correct intent and missing space
Signed-off-by: default avatarGuillaume Vercoutere <gvercoutere@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0541cdf5
...@@ -63,7 +63,6 @@ struct logger_log { ...@@ -63,7 +63,6 @@ struct logger_log {
static LIST_HEAD(log_list); static LIST_HEAD(log_list);
/** /**
* struct logger_reader - a logging device open for reading * struct logger_reader - a logging device open for reading
* @log: The associated log * @log: The associated log
...@@ -89,7 +88,6 @@ static size_t logger_offset(struct logger_log *log, size_t n) ...@@ -89,7 +88,6 @@ static size_t logger_offset(struct logger_log *log, size_t n)
return n & (log->size - 1); return n & (log->size - 1);
} }
/* /*
* file_get_log - Given a file structure, return the associated log * file_get_log - Given a file structure, return the associated log
* *
...@@ -122,14 +120,15 @@ static inline struct logger_log *file_get_log(struct file *file) ...@@ -122,14 +120,15 @@ static inline struct logger_log *file_get_log(struct file *file)
* the log entry spans the end and beginning of the circular buffer. * the log entry spans the end and beginning of the circular buffer.
*/ */
static struct logger_entry *get_entry_header(struct logger_log *log, static struct logger_entry *get_entry_header(struct logger_log *log,
size_t off, struct logger_entry *scratch) size_t off,
struct logger_entry *scratch)
{ {
size_t len = min(sizeof(struct logger_entry), log->size - off); size_t len = min(sizeof(struct logger_entry), log->size - off);
if (len != sizeof(struct logger_entry)) { if (len != sizeof(struct logger_entry)) {
memcpy(((void *) scratch), log->buffer + off, len); memcpy(((void *)scratch), log->buffer + off, len);
memcpy(((void *) scratch) + len, log->buffer, memcpy(((void *)scratch) + len, log->buffer,
sizeof(struct logger_entry) - len); sizeof(struct logger_entry) - len);
return scratch; return scratch;
} }
...@@ -163,7 +162,7 @@ static size_t get_user_hdr_len(int ver) ...@@ -163,7 +162,7 @@ static size_t get_user_hdr_len(int ver)
} }
static ssize_t copy_header_to_user(int ver, struct logger_entry *entry, static ssize_t copy_header_to_user(int ver, struct logger_entry *entry,
char __user *buf) char __user *buf)
{ {
void *hdr; void *hdr;
size_t hdr_len; size_t hdr_len;
...@@ -213,7 +212,7 @@ static ssize_t do_read_log_to_user(struct logger_log *log, ...@@ -213,7 +212,7 @@ static ssize_t do_read_log_to_user(struct logger_log *log,
count -= get_user_hdr_len(reader->r_ver); count -= get_user_hdr_len(reader->r_ver);
buf += get_user_hdr_len(reader->r_ver); buf += get_user_hdr_len(reader->r_ver);
msg_start = logger_offset(log, msg_start = logger_offset(log,
reader->r_off + sizeof(struct logger_entry)); reader->r_off + sizeof(struct logger_entry));
/* /*
* We read from the msg in two disjoint operations. First, we read from * We read from the msg in two disjoint operations. First, we read from
...@@ -243,7 +242,7 @@ static ssize_t do_read_log_to_user(struct logger_log *log, ...@@ -243,7 +242,7 @@ static ssize_t do_read_log_to_user(struct logger_log *log,
* 'log->buffer' which contains the first entry readable by 'euid' * 'log->buffer' which contains the first entry readable by 'euid'
*/ */
static size_t get_next_entry_by_uid(struct logger_log *log, static size_t get_next_entry_by_uid(struct logger_log *log,
size_t off, kuid_t euid) size_t off, kuid_t euid)
{ {
while (off != log->w_off) { while (off != log->w_off) {
struct logger_entry *entry; struct logger_entry *entry;
...@@ -530,8 +529,9 @@ static int logger_open(struct inode *inode, struct file *file) ...@@ -530,8 +529,9 @@ static int logger_open(struct inode *inode, struct file *file)
mutex_unlock(&log->mutex); mutex_unlock(&log->mutex);
file->private_data = reader; file->private_data = reader;
} else } else {
file->private_data = log; file->private_data = log;
}
return 0; return 0;
} }
...@@ -611,7 +611,7 @@ static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -611,7 +611,7 @@ static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
struct logger_log *log = file_get_log(file); struct logger_log *log = file_get_log(file);
struct logger_reader *reader; struct logger_reader *reader;
long ret = -EINVAL; long ret = -EINVAL;
void __user *argp = (void __user *) arg; void __user *argp = (void __user *)arg;
mutex_lock(&log->mutex); mutex_lock(&log->mutex);
...@@ -653,7 +653,7 @@ static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -653,7 +653,7 @@ static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
break; break;
} }
if (!(in_egroup_p(file_inode(file)->i_gid) || if (!(in_egroup_p(file_inode(file)->i_gid) ||
capable(CAP_SYSLOG))) { capable(CAP_SYSLOG))) {
ret = -EPERM; ret = -EPERM;
break; break;
} }
...@@ -741,12 +741,12 @@ static int __init create_log(char *log_name, int size) ...@@ -741,12 +741,12 @@ static int __init create_log(char *log_name, int size)
ret = misc_register(&log->misc); ret = misc_register(&log->misc);
if (unlikely(ret)) { if (unlikely(ret)) {
pr_err("failed to register misc device for log '%s'!\n", pr_err("failed to register misc device for log '%s'!\n",
log->misc.name); log->misc.name);
goto out_free_misc_name; goto out_free_misc_name;
} }
pr_info("created %luK log '%s'\n", pr_info("created %luK log '%s'\n",
(unsigned long) log->size >> 10, log->misc.name); (unsigned long)log->size >> 10, log->misc.name);
return 0; return 0;
...@@ -799,7 +799,6 @@ static void __exit logger_exit(void) ...@@ -799,7 +799,6 @@ static void __exit logger_exit(void)
} }
} }
device_initcall(logger_init); device_initcall(logger_init);
module_exit(logger_exit); module_exit(logger_exit);
......
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