Skip to content

Commit

Permalink
oprofile: fixing whitespaces in drivers/oprofile/*
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Richter <[email protected]>
  • Loading branch information
Robert Richter committed Oct 16, 2008
1 parent 5a28939 commit 6a18037
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 60 deletions.
4 changes: 2 additions & 2 deletions drivers/oprofile/buffer_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
16 changes: 8 additions & 8 deletions drivers/oprofile/cpu_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/oprofile/cpu_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down
24 changes: 12 additions & 12 deletions drivers/oprofile/event_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -66,7 +66,7 @@ void wake_up_buffer_waiter(void)
mutex_unlock(&buffer_mutex);
}


int alloc_event_buffer(void)
{
int err = -ENOMEM;
Expand All @@ -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:
Expand All @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions drivers/oprofile/event_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
#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);

#define INVALID_COOKIE ~0UL
#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 */
2 changes: 1 addition & 1 deletion drivers/oprofile/oprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int oprofile_start(void)
int err = -EINVAL;

mutex_lock(&start_mutex);

if (!is_setup)
goto out;

Expand Down
8 changes: 4 additions & 4 deletions drivers/oprofile/oprof.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -20,20 +20,20 @@ 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;

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 */
20 changes: 10 additions & 10 deletions drivers/oprofile/oprofile_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -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);
Expand All @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions drivers/oprofile/oprofile_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@
#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;
cpu_buf->sample_lost_overflow = 0;
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);
Expand All @@ -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.
Expand All @@ -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",
Expand Down
Loading

0 comments on commit 6a18037

Please sign in to comment.