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 #ifndef OPROFILE_BUFFER_SYNC_H
#define OPROFILE_BUFFER_SYNC_H #define OPROFILE_BUFFER_SYNC_H
/* add the necessary profiling hooks */ /* add the necessary profiling hooks */
int sync_start(void); int sync_start(void);
/* remove the hooks */ /* remove the hooks */
void sync_stop(void); void sync_stop(void);
/* sync the given CPU's buffer */ /* sync the given CPU's buffer */
void sync_buffer(int cpu); void sync_buffer(int cpu);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,7 +11,7 @@
#define OPROF_H #define OPROF_H
int oprofile_setup(void); int oprofile_setup(void);
void oprofile_shutdown(void); void oprofile_shutdown(void);
int oprofilefs_register(void); int oprofilefs_register(void);
void oprofilefs_unregister(void); void oprofilefs_unregister(void);
@ -20,14 +20,14 @@ int oprofile_start(void);
void oprofile_stop(void); void oprofile_stop(void);
struct oprofile_operations; struct oprofile_operations;
extern unsigned long fs_buffer_size; extern unsigned long fs_buffer_size;
extern unsigned long fs_cpu_buffer_size; extern unsigned long fs_cpu_buffer_size;
extern unsigned long fs_buffer_watershed; extern unsigned long fs_buffer_watershed;
extern struct oprofile_operations oprofile_ops; extern struct oprofile_operations oprofile_ops;
extern unsigned long oprofile_started; extern unsigned long oprofile_started;
extern unsigned long backtrace_depth; extern unsigned long backtrace_depth;
struct super_block; struct super_block;
struct dentry; 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); void oprofile_timer_init(struct oprofile_operations *ops);
int oprofile_set_backtrace(unsigned long depth); int oprofile_set_backtrace(unsigned long depth);
#endif /* OPROF_H */ #endif /* OPROF_H */

View File

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

View File

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

View File

@ -11,7 +11,7 @@
#define OPROFILE_STATS_H #define OPROFILE_STATS_H
#include <asm/atomic.h> #include <asm/atomic.h>
struct oprofile_stat_struct { struct oprofile_stat_struct {
atomic_t sample_lost_no_mm; atomic_t sample_lost_no_mm;
atomic_t sample_lost_no_mapping; atomic_t sample_lost_no_mapping;
@ -20,13 +20,13 @@ struct oprofile_stat_struct {
}; };
extern struct oprofile_stat_struct oprofile_stats; extern struct oprofile_stat_struct oprofile_stats;
/* reset all stats to zero */ /* reset all stats to zero */
void oprofile_reset_stats(void); void oprofile_reset_stats(void);
struct super_block; struct super_block;
struct dentry; struct dentry;
/* create the stats/ dir */ /* create the stats/ dir */
void oprofile_create_stats_files(struct super_block *sb, struct dentry *root); 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; atomic_t *val = file->private_data;
return oprofilefs_ulong_to_user(atomic_read(val), buf, count, offset); return oprofilefs_ulong_to_user(atomic_read(val), buf, count, offset);
} }
static const struct file_operations atomic_ro_fops = { static const struct file_operations atomic_ro_fops = {
.read = atomic_read_file, .read = atomic_read_file,
.open = default_open, .open = default_open,
}; };
int oprofilefs_create_ro_atomic(struct super_block *sb, struct dentry *root, int oprofilefs_create_ro_atomic(struct super_block *sb, struct dentry *root,
char const *name, atomic_t *val) char const *name, atomic_t *val)
@ -201,7 +201,7 @@ int oprofilefs_create_ro_atomic(struct super_block *sb, struct dentry *root,
return 0; return 0;
} }
int oprofilefs_create_file(struct super_block *sb, struct dentry *root, int oprofilefs_create_file(struct super_block *sb, struct dentry *root,
char const *name, const struct file_operations *fops) char const *name, const struct file_operations *fops)
{ {

View File

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