diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-28 16:46:59 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 16:46:59 +0100 |
commit | 2011a067281565494494aee194ca5081e52d6c3f (patch) | |
tree | e0b21ad43e6eeb0c67945026be71d1278c93c695 /arch/m68k/atari/stram.c | |
parent | 63fb70859f987f2b3b8028fa467fd63336315e9c (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into x86/doc
Diffstat (limited to 'arch/m68k/atari/stram.c')
-rw-r--r-- | arch/m68k/atari/stram.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c index 04c69ffbea7..6ec3b7f3377 100644 --- a/arch/m68k/atari/stram.c +++ b/arch/m68k/atari/stram.c @@ -42,6 +42,7 @@ /* abbrev for the && above... */ #define DO_PROC #include <linux/proc_fs.h> +#include <linux/seq_file.h> #endif /* @@ -323,19 +324,16 @@ static int remove_region( BLOCK *block ) #ifdef DO_PROC -#define PRINT_PROC(fmt,args...) len += sprintf( buf+len, fmt, ##args ) +#define PRINT_PROC(fmt,args...) seq_printf( m, fmt, ##args ) -int get_stram_list( char *buf ) +static int stram_proc_show(struct seq_file *m, void *v) { - int len = 0; BLOCK *p; PRINT_PROC("Total ST-RAM: %8u kB\n", (stram_end - stram_start) >> 10); PRINT_PROC( "Allocated regions:\n" ); for( p = alloc_list; p; p = p->next ) { - if (len + 50 >= PAGE_SIZE) - break; PRINT_PROC("0x%08lx-0x%08lx: %s (", virt_to_phys(p->start), virt_to_phys(p->start+p->size-1), @@ -346,9 +344,27 @@ int get_stram_list( char *buf ) PRINT_PROC( "??)\n" ); } - return( len ); + return 0; +} + +static int stram_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, stram_proc_show, NULL); } +static const struct file_operations stram_proc_fops = { + .open = stram_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int __init proc_stram_init(void) +{ + proc_create("stram", 0, NULL, &stram_proc_fops); + return 0; +} +module_init(proc_stram_init); #endif |