aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/m68k/atari/stram.c28
-rw-r--r--fs/proc/proc_misc.c13
2 files changed, 22 insertions, 19 deletions
diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
index 04c69ffbea71..6ec3b7f33779 100644
--- a/arch/m68k/atari/stram.c
+++ b/arch/m68k/atari/stram.c
@@ -42,6 +42,7 @@
42/* abbrev for the && above... */ 42/* abbrev for the && above... */
43#define DO_PROC 43#define DO_PROC
44#include <linux/proc_fs.h> 44#include <linux/proc_fs.h>
45#include <linux/seq_file.h>
45#endif 46#endif
46 47
47/* 48/*
@@ -323,19 +324,16 @@ static int remove_region( BLOCK *block )
323 324
324#ifdef DO_PROC 325#ifdef DO_PROC
325 326
326#define PRINT_PROC(fmt,args...) len += sprintf( buf+len, fmt, ##args ) 327#define PRINT_PROC(fmt,args...) seq_printf( m, fmt, ##args )
327 328
328int get_stram_list( char *buf ) 329static int stram_proc_show(struct seq_file *m, void *v)
329{ 330{
330 int len = 0;
331 BLOCK *p; 331 BLOCK *p;
332 332
333 PRINT_PROC("Total ST-RAM: %8u kB\n", 333 PRINT_PROC("Total ST-RAM: %8u kB\n",
334 (stram_end - stram_start) >> 10); 334 (stram_end - stram_start) >> 10);
335 PRINT_PROC( "Allocated regions:\n" ); 335 PRINT_PROC( "Allocated regions:\n" );
336 for( p = alloc_list; p; p = p->next ) { 336 for( p = alloc_list; p; p = p->next ) {
337 if (len + 50 >= PAGE_SIZE)
338 break;
339 PRINT_PROC("0x%08lx-0x%08lx: %s (", 337 PRINT_PROC("0x%08lx-0x%08lx: %s (",
340 virt_to_phys(p->start), 338 virt_to_phys(p->start),
341 virt_to_phys(p->start+p->size-1), 339 virt_to_phys(p->start+p->size-1),
@@ -346,9 +344,27 @@ int get_stram_list( char *buf )
346 PRINT_PROC( "??)\n" ); 344 PRINT_PROC( "??)\n" );
347 } 345 }
348 346
349 return( len ); 347 return 0;
348}
349
350static int stram_proc_open(struct inode *inode, struct file *file)
351{
352 return single_open(file, stram_proc_show, NULL);
350} 353}
351 354
355static const struct file_operations stram_proc_fops = {
356 .open = stram_proc_open,
357 .read = seq_read,
358 .llseek = seq_lseek,
359 .release = single_release,
360};
361
362static int __init proc_stram_init(void)
363{
364 proc_create("stram", 0, NULL, &stram_proc_fops);
365 return 0;
366}
367module_init(proc_stram_init);
352#endif 368#endif
353 369
354 370
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 542527f6630f..ec37d3aeaf19 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -63,7 +63,6 @@
63 * have a way to deal with that gracefully. Right now I used straightforward 63 * have a way to deal with that gracefully. Right now I used straightforward
64 * wrappers, but this needs further analysis wrt potential overflows. 64 * wrappers, but this needs further analysis wrt potential overflows.
65 */ 65 */
66extern int get_stram_list(char *);
67extern int get_exec_domain_list(char *); 66extern int get_exec_domain_list(char *);
68 67
69static int proc_calc_metrics(char *page, char **start, off_t off, 68static int proc_calc_metrics(char *page, char **start, off_t off,
@@ -197,15 +196,6 @@ static const struct file_operations proc_vmstat_file_operations = {
197 .release = seq_release, 196 .release = seq_release,
198}; 197};
199 198
200#ifdef CONFIG_STRAM_PROC
201static int stram_read_proc(char *page, char **start, off_t off,
202 int count, int *eof, void *data)
203{
204 int len = get_stram_list(page);
205 return proc_calc_metrics(page, start, off, count, eof, len);
206}
207#endif
208
209#ifdef CONFIG_BLOCK 199#ifdef CONFIG_BLOCK
210static int partitions_open(struct inode *inode, struct file *file) 200static int partitions_open(struct inode *inode, struct file *file)
211{ 201{
@@ -658,9 +648,6 @@ void __init proc_misc_init(void)
658 char *name; 648 char *name;
659 int (*read_proc)(char*,char**,off_t,int,int*,void*); 649 int (*read_proc)(char*,char**,off_t,int,int*,void*);
660 } *p, simple_ones[] = { 650 } *p, simple_ones[] = {
661#ifdef CONFIG_STRAM_PROC
662 {"stram", stram_read_proc},
663#endif
664 {"filesystems", filesystems_read_proc}, 651 {"filesystems", filesystems_read_proc},
665 {"cmdline", cmdline_read_proc}, 652 {"cmdline", cmdline_read_proc},
666 {"execdomains", execdomains_read_proc}, 653 {"execdomains", execdomains_read_proc},