[lc-checkins] CVS: linux/fs/proc proc_misc.c,1.1,1.2
Status: Beta
Brought to you by:
nitin_sf
|
From: Rodrigo S. de C. <rc...@us...> - 2001-12-12 20:45:49
|
Update of /cvsroot/linuxcompressed/linux/fs/proc
In directory usw-pr-cvs1:/tmp/cvs-serv17791/fs/proc
Modified Files:
proc_misc.c
Log Message:
- 0.20pre2 version updated from 2.4.10 to 2.4.16.
- Code was rewritten in swapfile.c to work with the new swap file functions
(swap_free, swap_duplicate, swap_info_get, swap_info_put, etc).
Index: proc_misc.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/fs/proc/proc_misc.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** proc_misc.c 2001/10/01 22:43:59 1.1
--- proc_misc.c 2001/12/12 20:45:46 1.2
***************
*** 36,39 ****
--- 36,40 ----
#include <linux/init.h>
#include <linux/smp_lock.h>
+ #include <linux/seq_file.h>
#ifdef CONFIG_COMP_CACHE
#include <linux/comp_cache.h>
***************
*** 53,70 ****
* wrappers, but this needs further analysis wrt potential overflows.
*/
- extern int get_cpuinfo(char *);
- extern int get_hardware_list(char *);
- extern int get_stram_list(char *);
- #ifdef CONFIG_DEBUG_MALLOC
- extern int get_malloc(char * buffer);
- #endif
#ifdef CONFIG_MODULES
extern int get_module_list(char *);
- extern int get_ksyms_list(char *, char **, off_t, int);
#endif
extern int get_device_list(char *);
extern int get_partition_list(char *, char **, off_t, int);
extern int get_filesystem_list(char *);
- extern int get_filesystem_info(char *);
extern int get_exec_domain_list(char *);
extern int get_irq_list(char *);
--- 54,63 ----
***************
*** 144,147 ****
--- 137,141 ----
struct sysinfo i;
int len;
+ int pg_size ;
/*
***************
*** 152,155 ****
--- 146,151 ----
si_meminfo(&i);
si_swapinfo(&i);
+ pg_size = atomic_read(&page_cache_size) - i.bufferram ;
+
len = sprintf(page, " total: used: free: shared: buffers: cached:\n"
"Mem: %8Lu %8Lu %8Lu %8Lu %8Lu %8Lu\n"
***************
*** 157,161 ****
B(i.totalram), B(i.totalram-i.freeram), B(i.freeram),
B(i.sharedram), B(i.bufferram),
! B(atomic_read(&page_cache_size)), B(i.totalswap),
B(i.totalswap-i.freeswap), B(i.freeswap));
/*
--- 153,157 ----
B(i.totalram), B(i.totalram-i.freeram), B(i.freeram),
B(i.sharedram), B(i.bufferram),
! B(pg_size), B(i.totalswap),
B(i.totalswap-i.freeswap), B(i.freeswap));
/*
***************
*** 183,187 ****
K(i.sharedram),
K(i.bufferram),
! K(atomic_read(&page_cache_size) - swapper_space.nrpages),
K(swapper_space.nrpages),
K(nr_active_pages),
--- 179,183 ----
K(i.sharedram),
K(i.bufferram),
! K(pg_size - swapper_space.nrpages),
K(swapper_space.nrpages),
K(nr_active_pages),
***************
*** 209,246 ****
return proc_calc_metrics(page, start, off, count, eof, len);
}
-
- static int cpuinfo_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
- {
- int len = get_cpuinfo(page);
- return proc_calc_metrics(page, start, off, count, eof, len);
- }
! #ifdef CONFIG_PROC_HARDWARE
! static int hardware_read_proc(char *page, char **start, off_t off,
! int count, int *eof, void *data)
{
! int len = get_hardware_list(page);
! return proc_calc_metrics(page, start, off, count, eof, len);
}
! #endif
!
! #ifdef CONFIG_STRAM_PROC
! static int stram_read_proc(char *page, char **start, off_t off,
! int count, int *eof, void *data)
! {
! int len = get_stram_list(page);
! return proc_calc_metrics(page, start, off, count, eof, len);
! }
! #endif
!
! #ifdef CONFIG_DEBUG_MALLOC
! static int malloc_read_proc(char *page, char **start, off_t off,
! int count, int *eof, void *data)
! {
! int len = get_malloc(page);
! return proc_calc_metrics(page, start, off, count, eof, len);
! }
! #endif
#ifdef CONFIG_MODULES
--- 205,220 ----
return proc_calc_metrics(page, start, off, count, eof, len);
}
! extern struct seq_operations cpuinfo_op;
! static int cpuinfo_open(struct inode *inode, struct file *file)
{
! return seq_open(file, &cpuinfo_op);
}
! static struct file_operations proc_cpuinfo_operations = {
! open: cpuinfo_open,
! read: seq_read,
! llseek: seq_lseek,
! release: seq_release,
! };
#ifdef CONFIG_MODULES
***************
*** 252,262 ****
}
! static int ksyms_read_proc(char *page, char **start, off_t off,
! int count, int *eof, void *data)
{
! int len = get_ksyms_list(page, start, off, count);
! if (len < count) *eof = 1;
! return len;
}
#endif
--- 226,240 ----
}
! extern struct seq_operations ksyms_op;
! static int ksyms_open(struct inode *inode, struct file *file)
{
! return seq_open(file, &ksyms_op);
}
+ static struct file_operations proc_ksyms_operations = {
+ open: ksyms_open,
+ read: seq_read,
+ llseek: seq_lseek,
+ release: seq_release,
+ };
#endif
***************
*** 492,502 ****
}
- static int mounts_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
- {
- int len = get_filesystem_info(page);
- return proc_calc_metrics(page, start, off, count, eof, len);
- }
-
static int execdomains_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
--- 470,473 ----
***************
*** 583,588 ****
--- 554,579 ----
};
+ extern struct seq_operations mounts_op;
+ static int mounts_open(struct inode *inode, struct file *file)
+ {
+ return seq_open(file, &mounts_op);
+ }
+ static struct file_operations proc_mounts_operations = {
+ open: mounts_open,
+ read: seq_read,
+ llseek: seq_lseek,
+ release: seq_release,
+ };
+
struct proc_dir_entry *proc_root_kcore;
+ static void create_seq_entry(char *name, mode_t mode, struct file_operations *f)
+ {
+ struct proc_dir_entry *entry;
+ entry = create_proc_entry(name, mode, NULL);
+ if (entry)
+ entry->proc_fops = f;
+ }
+
void __init proc_misc_init(void)
{
***************
*** 596,612 ****
{"meminfo", meminfo_read_proc},
{"version", version_read_proc},
- {"cpuinfo", cpuinfo_read_proc},
- #ifdef CONFIG_PROC_HARDWARE
- {"hardware", hardware_read_proc},
- #endif
- #ifdef CONFIG_STRAM_PROC
- {"stram", stram_read_proc},
- #endif
- #ifdef CONFIG_DEBUG_MALLOC
- {"malloc", malloc_read_proc},
- #endif
#ifdef CONFIG_MODULES
{"modules", modules_read_proc},
- {"ksyms", ksyms_read_proc},
#endif
{"stat", kstat_read_proc},
--- 587,592 ----
***************
*** 627,631 ****
#endif
{"locks", locks_read_proc},
- {"mounts", mounts_read_proc},
{"swaps", swaps_read_proc},
{"iomem", memory_read_proc},
--- 607,610 ----
***************
*** 640,643 ****
--- 619,627 ----
if (entry)
entry->proc_fops = &proc_kmsg_operations;
+ create_seq_entry("mounts", 0, &proc_mounts_operations);
+ create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
+ #ifdef CONFIG_MODULES
+ create_seq_entry("ksyms", 0, &proc_ksyms_operations);
+ #endif
proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL);
if (proc_root_kcore) {
|