static LIST_HEAD(log_list);
-
/**
* struct logger_reader - a logging device open for reading
* @log: The associated log
return n & (log->size - 1);
}
-
/*
* file_get_log - Given a file structure, return the associated log
*
* the log entry spans the end and beginning of the circular buffer.
*/
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);
if (len != sizeof(struct logger_entry)) {
- memcpy(((void *) scratch), log->buffer + off, len);
- memcpy(((void *) scratch) + len, log->buffer,
- sizeof(struct logger_entry) - len);
+ memcpy(((void *)scratch), log->buffer + off, len);
+ memcpy(((void *)scratch) + len, log->buffer,
+ sizeof(struct logger_entry) - len);
return scratch;
}
}
static ssize_t copy_header_to_user(int ver, struct logger_entry *entry,
- char __user *buf)
+ char __user *buf)
{
void *hdr;
size_t hdr_len;
count -= get_user_hdr_len(reader->r_ver);
buf += get_user_hdr_len(reader->r_ver);
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
* 'log->buffer' which contains the first entry readable by 'euid'
*/
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) {
struct logger_entry *entry;
mutex_unlock(&log->mutex);
file->private_data = reader;
- } else
+ } else {
file->private_data = log;
+ }
return 0;
}
struct logger_log *log = file_get_log(file);
struct logger_reader *reader;
long ret = -EINVAL;
- void __user *argp = (void __user *) arg;
+ void __user *argp = (void __user *)arg;
mutex_lock(&log->mutex);
break;
}
if (!(in_egroup_p(file_inode(file)->i_gid) ||
- capable(CAP_SYSLOG))) {
+ capable(CAP_SYSLOG))) {
ret = -EPERM;
break;
}
ret = misc_register(&log->misc);
if (unlikely(ret)) {
pr_err("failed to register misc device for log '%s'!\n",
- log->misc.name);
+ log->misc.name);
goto out_free_misc_name;
}
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;
}
}
-
device_initcall(logger_init);
module_exit(logger_exit);