Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 370108
b: refs/heads/master
c: 526c597
h: refs/heads/master
v: v3
  • Loading branch information
David Howells authored and Al Viro committed Apr 29, 2013
1 parent 51c6c48 commit 554e631
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f9368c18e9a99d86c509ac113363e9d295e0bf74
refs/heads/master: 526c59784c09fb794a5f0181429525bc473453c9
42 changes: 19 additions & 23 deletions trunk/arch/arm/kernel/swp_emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/sched.h>
#include <linux/syscalls.h>
#include <linux/perf_event.h>
Expand Down Expand Up @@ -79,27 +80,27 @@ static unsigned long abtcounter;
static pid_t previous_pid;

#ifdef CONFIG_PROC_FS
static int proc_read_status(char *page, char **start, off_t off, int count,
int *eof, void *data)
static int proc_status_show(struct seq_file *m, void *v)
{
char *p = page;
int len;

p += sprintf(p, "Emulated SWP:\t\t%lu\n", swpcounter);
p += sprintf(p, "Emulated SWPB:\t\t%lu\n", swpbcounter);
p += sprintf(p, "Aborted SWP{B}:\t\t%lu\n", abtcounter);
seq_printf(m, "Emulated SWP:\t\t%lu\n", swpcounter);
seq_printf(m, "Emulated SWPB:\t\t%lu\n", swpbcounter);
seq_printf(m, "Aborted SWP{B}:\t\t%lu\n", abtcounter);
if (previous_pid != 0)
p += sprintf(p, "Last process:\t\t%d\n", previous_pid);

len = (p - page) - off;
if (len < 0)
len = 0;

*eof = (len <= count) ? 1 : 0;
*start = page + off;
seq_printf(m, "Last process:\t\t%d\n", previous_pid);
return 0;
}

return len;
static int proc_status_open(struct inode *inode, struct file *file)
{
return single_open(file, proc_status_show, PDE_DATA(inode));
}

static const struct file_operations proc_status_fops = {
.open = proc_status_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#endif

/*
Expand Down Expand Up @@ -266,12 +267,7 @@ static struct undef_hook swp_hook = {
static int __init swp_emulation_init(void)
{
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *res;

res = create_proc_read_entry("cpu/swp_emulation", S_IRUGO, NULL,
proc_read_status, NULL);

if (!res)
if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops))
return -ENOMEM;
#endif /* CONFIG_PROC_FS */

Expand Down

0 comments on commit 554e631

Please sign in to comment.