patch-2.0.21-2.1.0 linux/fs/proc/array.c

Next file: linux/fs/proc/kmsg.c
Previous file: linux/fs/pipe.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file lx2.0/v2.0.21/linux/fs/proc/array.c linux/fs/proc/array.c
@@ -59,7 +59,8 @@
 #endif
 
 
-static int read_core(struct inode * inode, struct file * file,char * buf, int count)
+static long read_core(struct inode * inode, struct file * file,
+	char * buf, unsigned long count)
 {
 	unsigned long p = file->f_pos, memsize;
 	int read;
@@ -74,14 +75,12 @@
 
 	memset(&dump, 0, sizeof(struct user));
 	dump.magic = CMAGIC;
-	dump.u_dsize = MAP_NR(high_memory);
+	dump.u_dsize = max_mapnr;
 #ifdef __alpha__
 	dump.start_data = PAGE_OFFSET;
 #endif
 
-	if (count < 0)
-		return -EINVAL;
-	memsize = MAP_NR(high_memory + PAGE_SIZE) << PAGE_SHIFT;
+	memsize = (max_mapnr + 1) << PAGE_SHIFT;
 	if (p >= memsize)
 		return 0;
 	if (count > memsize - p)
@@ -129,15 +128,14 @@
  * buffer. Use of the program readprofile is recommended in order to
  * get meaningful info out of these data.
  */
-static int read_profile(struct inode *inode, struct file *file, char *buf, int count)
+static long read_profile(struct inode *inode, struct file *file,
+	char *buf, unsigned long count)
 {
 	unsigned long p = file->f_pos;
 	int read;
 	char * pnt;
 	unsigned int sample_step = 1 << prof_shift;
 
-	if (count < 0)
-		return -EINVAL;
 	if (p >= (prof_len+1)*sizeof(unsigned int))
 		return 0;
 	if (count > (prof_len+1)*sizeof(unsigned int) - p)
@@ -156,7 +154,8 @@
 }
 
 /* Writing to /proc/profile resets the counters */
-static int write_profile(struct inode * inode, struct file * file, const char * buf, int count)
+static long write_profile(struct inode * inode, struct file * file,
+	const char * buf, unsigned long count)
 {
     int i=prof_len;
 
@@ -762,7 +761,7 @@
 		++*pages;
 		if (pte_dirty(page))
 			++*dirty;
-		if (pte_page(page) >= high_memory)
+		if (MAP_NR(pte_page(page)) >= max_mapnr)
 			continue;
 		if (mem_map[MAP_NR(pte_page(page))].count > 1)
 			++*shared;
@@ -871,7 +870,8 @@
 #define MAPS_LINE_MAX	MAPS_LINE_MAX8
 
 
-static int read_maps (int pid, struct file * file, char * buf, int count)
+static long read_maps (int pid, struct file * file,
+	char * buf, unsigned long count)
 {
 	struct task_struct ** p = get_task(pid);
 	char * destptr;
@@ -980,7 +980,8 @@
 extern int get_smp_prof_list(char *);
 #endif
 
-static int get_root_array(char * page, int type, char **start, off_t offset, int length)
+static long get_root_array(char * page, int type, char **start,
+	off_t offset, unsigned long length)
 {
 	switch (type) {
 		case PROC_LOADAVG:
@@ -1083,7 +1084,8 @@
 
 #define PROC_BLOCK_SIZE	(3*1024)		/* 4K page size but our output routines use some slack for overruns */
 
-static int array_read(struct inode * inode, struct file * file,char * buf, int count)
+static long array_read(struct inode * inode, struct file * file,
+	char * buf, unsigned long count)
 {
 	unsigned long page;
 	char *start;
@@ -1092,8 +1094,6 @@
 	unsigned int type, pid;
 	struct proc_dir_entry *dp;
 
-	if (count < 0)
-		return -EINVAL;
 	if (count > PROC_BLOCK_SIZE)
 		count = PROC_BLOCK_SIZE;
 	if (!(page = __get_free_page(GFP_KERNEL)))
@@ -1167,13 +1167,11 @@
 	NULL			/* permission */
 };
 
-static int arraylong_read (struct inode * inode, struct file * file, char * buf, int count)
+static long arraylong_read(struct inode * inode, struct file * file,
+	char * buf, unsigned long count)
 {
 	unsigned int pid = inode->i_ino >> 16;
 	unsigned int type = inode->i_ino & 0x0000ffff;
-
-	if (count < 0)
-		return -EINVAL;
 
 	switch (type) {
 		case PROC_PID_MAPS:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov