oprofile: fixing whitespaces in drivers/oprofile/*

Signed-off-by: Robert Richter <robert.richter@amd.com>
This commit is contained in:
Robert Richter 2008-10-16 15:01:40 +02:00
parent 5a289395bf
commit 6a18037d41
12 changed files with 60 additions and 60 deletions

View File

@ -9,13 +9,13 @@
#ifndef OPROFILE_BUFFER_SYNC_H
#define OPROFILE_BUFFER_SYNC_H
/* add the necessary profiling hooks */
int sync_start(void);
/* remove the hooks */
void sync_stop(void);
/* sync the given CPU's buffer */
void sync_buffer(int cpu);

View File

@ -22,7 +22,7 @@
#include <linux/oprofile.h>
#include <linux/vmalloc.h>
#include <linux/errno.h>
#include "event_buffer.h"
#include "cpu_buffer.h"
#include "buffer_sync.h"
@ -38,7 +38,7 @@ static int work_enabled;
void free_cpu_buffers(void)
{
int i;
for_each_online_cpu(i) {
vfree(per_cpu(cpu_buffer, i).buffer);
per_cpu(cpu_buffer, i).buffer = NULL;
@ -48,17 +48,17 @@ void free_cpu_buffers(void)
int alloc_cpu_buffers(void)
{
int i;
unsigned long buffer_size = fs_cpu_buffer_size;
for_each_online_cpu(i) {
struct oprofile_cpu_buffer *b = &per_cpu(cpu_buffer, i);
b->buffer = vmalloc_node(sizeof(struct op_sample) * buffer_size,
cpu_to_node(i));
if (!b->buffer)
goto fail;
b->last_task = NULL;
b->last_is_kernel = -1;
b->tracing = 0;
@ -150,7 +150,7 @@ static void increment_head(struct oprofile_cpu_buffer *b)
static inline void
add_sample(struct oprofile_cpu_buffer *cpu_buf,
unsigned long pc, unsigned long event)
unsigned long pc, unsigned long event)
{
struct op_sample *entry = &cpu_buf->buffer[cpu_buf->head_pos];
entry->eip = pc;
@ -205,7 +205,7 @@ static int log_sample(struct oprofile_cpu_buffer *cpu_buf, unsigned long pc,
cpu_buf->last_task = task;
add_code(cpu_buf, (unsigned long)task);
}
add_sample(cpu_buf, pc, event);
return 1;
}

View File

@ -15,9 +15,9 @@
#include <linux/workqueue.h>
#include <linux/cache.h>
#include <linux/sched.h>
struct task_struct;
int alloc_cpu_buffers(void);
void free_cpu_buffers(void);
@ -31,7 +31,7 @@ struct op_sample {
unsigned long eip;
unsigned long event;
};
struct oprofile_cpu_buffer {
volatile unsigned long head_pos;
volatile unsigned long tail_pos;

View File

@ -19,13 +19,13 @@
#include <linux/dcookies.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include "oprof.h"
#include "event_buffer.h"
#include "oprofile_stats.h"
DEFINE_MUTEX(buffer_mutex);
static unsigned long buffer_opened;
static DECLARE_WAIT_QUEUE_HEAD(buffer_wait);
static unsigned long *event_buffer;
@ -66,7 +66,7 @@ void wake_up_buffer_waiter(void)
mutex_unlock(&buffer_mutex);
}
int alloc_event_buffer(void)
{
int err = -ENOMEM;
@ -76,13 +76,13 @@ int alloc_event_buffer(void)
buffer_size = fs_buffer_size;
buffer_watershed = fs_buffer_watershed;
spin_unlock_irqrestore(&oprofilefs_lock, flags);
if (buffer_watershed >= buffer_size)
return -EINVAL;
event_buffer = vmalloc(sizeof(unsigned long) * buffer_size);
if (!event_buffer)
goto out;
goto out;
err = 0;
out:
@ -97,7 +97,7 @@ void free_event_buffer(void)
event_buffer = NULL;
}
static int event_buffer_open(struct inode *inode, struct file *file)
{
int err = -EPERM;
@ -116,14 +116,14 @@ static int event_buffer_open(struct inode *inode, struct file *file)
file->private_data = dcookie_register();
if (!file->private_data)
goto out;
if ((err = oprofile_setup()))
goto fail;
/* NB: the actual start happens from userspace
* echo 1 >/dev/oprofile/enable
*/
return 0;
fail:
@ -172,18 +172,18 @@ static ssize_t event_buffer_read(struct file *file, char __user *buf,
retval = -EFAULT;
count = buffer_pos * sizeof(unsigned long);
if (copy_to_user(buf, event_buffer, count))
goto out;
retval = count;
buffer_pos = 0;
out:
mutex_unlock(&buffer_mutex);
return retval;
}
const struct file_operations event_buffer_fops = {
.open = event_buffer_open,
.release = event_buffer_release,

View File

@ -10,13 +10,13 @@
#ifndef EVENT_BUFFER_H
#define EVENT_BUFFER_H
#include <linux/types.h>
#include <linux/types.h>
#include <asm/mutex.h>
int alloc_event_buffer(void);
void free_event_buffer(void);
/* wake up the process sleeping on the event file */
void wake_up_buffer_waiter(void);
@ -24,10 +24,10 @@ void wake_up_buffer_waiter(void);
#define NO_COOKIE 0UL
extern const struct file_operations event_buffer_fops;
/* mutex between sync_cpu_buffers() and the
* file reading code.
*/
extern struct mutex buffer_mutex;
#endif /* EVENT_BUFFER_H */

View File

@ -94,7 +94,7 @@ int oprofile_start(void)
int err = -EINVAL;
mutex_lock(&start_mutex);
if (!is_setup)
goto out;

View File

@ -11,7 +11,7 @@
#define OPROF_H
int oprofile_setup(void);
void oprofile_shutdown(void);
void oprofile_shutdown(void);
int oprofilefs_register(void);
void oprofilefs_unregister(void);
@ -20,14 +20,14 @@ int oprofile_start(void);
void oprofile_stop(void);
struct oprofile_operations;
extern unsigned long fs_buffer_size;
extern unsigned long fs_cpu_buffer_size;
extern unsigned long fs_buffer_watershed;
extern struct oprofile_operations oprofile_ops;
extern unsigned long oprofile_started;
extern unsigned long backtrace_depth;
struct super_block;
struct dentry;
@ -35,5 +35,5 @@ void oprofile_create_files(struct super_block *sb, struct dentry *root);
void oprofile_timer_init(struct oprofile_operations *ops);
int oprofile_set_backtrace(unsigned long depth);
#endif /* OPROF_H */

View File

@ -13,7 +13,7 @@
#include "event_buffer.h"
#include "oprofile_stats.h"
#include "oprof.h"
unsigned long fs_buffer_size = 131072;
unsigned long fs_cpu_buffer_size = 8192;
unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */
@ -49,7 +49,7 @@ static const struct file_operations depth_fops = {
.write = depth_write
};
static ssize_t pointer_size_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{
return oprofilefs_ulong_to_user(sizeof(void *), buf, count, offset);
@ -65,13 +65,13 @@ static ssize_t cpu_type_read(struct file *file, char __user *buf, size_t count,
{
return oprofilefs_str_to_user(oprofile_ops.cpu_type, buf, count, offset);
}
static const struct file_operations cpu_type_fops = {
.read = cpu_type_read,
};
static ssize_t enable_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{
return oprofilefs_ulong_to_user(oprofile_started, buf, count, offset);
@ -89,7 +89,7 @@ static ssize_t enable_write(struct file *file, char const __user *buf, size_t co
retval = oprofilefs_ulong_from_user(&val, buf, count);
if (retval)
return retval;
if (val)
retval = oprofile_start();
else
@ -100,7 +100,7 @@ static ssize_t enable_write(struct file *file, char const __user *buf, size_t co
return count;
}
static const struct file_operations enable_fops = {
.read = enable_read,
.write = enable_write,
@ -117,7 +117,7 @@ static ssize_t dump_write(struct file *file, char const __user *buf, size_t coun
static const struct file_operations dump_fops = {
.write = dump_write,
};
void oprofile_create_files(struct super_block *sb, struct dentry *root)
{
oprofilefs_create_file(sb, root, "enable", &enable_fops);
@ -126,7 +126,7 @@ void oprofile_create_files(struct super_block *sb, struct dentry *root)
oprofilefs_create_ulong(sb, root, "buffer_size", &fs_buffer_size);
oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
oprofilefs_create_ulong(sb, root, "cpu_buffer_size", &fs_cpu_buffer_size);
oprofilefs_create_file(sb, root, "cpu_type", &cpu_type_fops);
oprofilefs_create_file(sb, root, "cpu_type", &cpu_type_fops);
oprofilefs_create_file(sb, root, "backtrace_depth", &depth_fops);
oprofilefs_create_file(sb, root, "pointer_size", &pointer_size_fops);
oprofile_create_stats_files(sb, root);

View File

@ -11,17 +11,17 @@
#include <linux/smp.h>
#include <linux/cpumask.h>
#include <linux/threads.h>
#include "oprofile_stats.h"
#include "cpu_buffer.h"
struct oprofile_stat_struct oprofile_stats;
void oprofile_reset_stats(void)
{
struct oprofile_cpu_buffer *cpu_buf;
int i;
for_each_possible_cpu(i) {
cpu_buf = &per_cpu(cpu_buffer, i);
cpu_buf->sample_received = 0;
@ -29,7 +29,7 @@ void oprofile_reset_stats(void)
cpu_buf->backtrace_aborted = 0;
cpu_buf->sample_invalid_eip = 0;
}
atomic_set(&oprofile_stats.sample_lost_no_mm, 0);
atomic_set(&oprofile_stats.sample_lost_no_mapping, 0);
atomic_set(&oprofile_stats.event_lost_overflow, 0);
@ -52,7 +52,7 @@ void oprofile_create_stats_files(struct super_block *sb, struct dentry *root)
cpu_buf = &per_cpu(cpu_buffer, i);
snprintf(buf, 10, "cpu%d", i);
cpudir = oprofilefs_mkdir(sb, dir, buf);
/* Strictly speaking access to these ulongs is racy,
* but we can't simply lock them, and they are
* informational only.
@ -66,7 +66,7 @@ void oprofile_create_stats_files(struct super_block *sb, struct dentry *root)
oprofilefs_create_ro_ulong(sb, cpudir, "sample_invalid_eip",
&cpu_buf->sample_invalid_eip);
}
oprofilefs_create_ro_atomic(sb, dir, "sample_lost_no_mm",
&oprofile_stats.sample_lost_no_mm);
oprofilefs_create_ro_atomic(sb, dir, "sample_lost_no_mapping",

View File

@ -11,7 +11,7 @@
#define OPROFILE_STATS_H
#include <asm/atomic.h>
struct oprofile_stat_struct {
atomic_t sample_lost_no_mm;
atomic_t sample_lost_no_mapping;
@ -20,13 +20,13 @@ struct oprofile_stat_struct {
};
extern struct oprofile_stat_struct oprofile_stats;
/* reset all stats to zero */
void oprofile_reset_stats(void);
struct super_block;
struct dentry;
/* create the stats/ dir */
void oprofile_create_stats_files(struct super_block *sb, struct dentry *root);

View File

@ -181,13 +181,13 @@ static ssize_t atomic_read_file(struct file *file, char __user *buf, size_t coun
atomic_t *val = file->private_data;
return oprofilefs_ulong_to_user(atomic_read(val), buf, count, offset);
}
static const struct file_operations atomic_ro_fops = {
.read = atomic_read_file,
.open = default_open,
};
int oprofilefs_create_ro_atomic(struct super_block *sb, struct dentry *root,
char const *name, atomic_t *val)
@ -201,7 +201,7 @@ int oprofilefs_create_ro_atomic(struct super_block *sb, struct dentry *root,
return 0;
}
int oprofilefs_create_file(struct super_block *sb, struct dentry *root,
char const *name, const struct file_operations *fops)
{

View File

@ -19,7 +19,7 @@
static int timer_notify(struct pt_regs *regs)
{
oprofile_add_sample(regs, 0);
oprofile_add_sample(regs, 0);
return 0;
}