A patch for /proc

From: H . J . Lu (hjl@valinux.com)
Date: Mon Apr 17 2000 - 11:18:33 EST


Hi,

This is a patch for /proc. I guess it was a combination of typo and
cut/paste. Without my patch, I got

# cat /proc/tty/driver
pty_slave /dev/pts 136 0-255 pty:slave
pty_master /dev/ptm 128 0-255 pty:master
pty_slave /dev/ttyp 3 0-255 pty:slave
pty_master /dev/pty 2 0-255 pty:master
serial /dev/cua 5 64-95 serial:callout
serial /dev/ttyS 4 64-95 serial
/dev/tty0 /dev/tty0 4 0 system:vtmaster
/dev/ptmx /dev/ptmx 5 2 system
/dev/console /dev/console 5 1 sy/dev/console
/dev/console 5 1 system:console
/dev/tty /dev/tty 5 0 system:/dev/tty
unknowcat: /proc/tty/drivers: Bad address
# cat /proc/tty/driver/serial
.....
21: uart:unknown port:128 irq:12
22: uart:unknown port:130 irq:12
23: uart:unknown port:138 irq:12
24: uart:unknown port:140 irq:12
25: uart:unknown port:148 irq:12
26: uart:unknown port:150 irq:12
27: uart:unknown port:158 irq:12
28: uart:unknown port:160 irq:12
29: uart:unknown port:1cat: /proc/tty/driver/serial: Bad address

-- 
H.J. Lu (hjl@gnu.org)
---
--- linux-2.2.15-pre16/fs/proc/proc_tty.c.proc	Wed Apr 12 21:32:15 2000
+++ linux-2.2.15-pre16/fs/proc/proc_tty.c	Wed Apr 12 21:32:21 2000
@@ -93,7 +93,7 @@ static int tty_drivers_read_proc(char *p
 		*eof = 1;
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
@@ -123,7 +123,7 @@ static int tty_ldiscs_read_proc(char *pa
 		*eof = 1;
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
--- linux-2.2.15-pre16/net/irda/ircomm/irvtd_driver.c.proc	Wed Apr 12 21:23:38 2000
+++ linux-2.2.15-pre16/net/irda/ircomm/irvtd_driver.c	Wed Apr 12 21:24:10 2000
@@ -1960,7 +1960,7 @@ static int irvtd_read_proc(char *buf, ch
 done:
 	if (offset >= count+begin)
 		return 0;
-	*start = buf + (begin-offset);
+	*start = buf + (offset-begin);
 	return ((len < begin+count-offset) ? len : begin+count-offset);
 }
 
--- linux-2.2.15-pre16/drivers/char/serial.c.proc	Wed Apr 12 21:32:15 2000
+++ linux-2.2.15-pre16/drivers/char/serial.c	Wed Apr 12 21:32:21 2000
@@ -2801,7 +2801,7 @@ int rs_read_proc(char *page, char **star
 done:
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
--- linux-2.2.15-pre16/drivers/char/synclink.c.proc	Wed Apr 12 21:32:15 2000
+++ linux-2.2.15-pre16/drivers/char/synclink.c	Wed Apr 12 21:32:21 2000
@@ -3900,7 +3900,7 @@ int mgsl_read_proc(char *page, char **st
 done:
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 	
 }	/* end of mgsl_read_proc() */
--- linux-2.2.15-pre16/drivers/char/ip2main.c.proc	Wed Apr 12 21:32:15 2000
+++ linux-2.2.15-pre16/drivers/char/ip2main.c	Wed Apr 12 21:32:22 2000
@@ -3174,7 +3174,7 @@ int ip2_read_proc(char *page, char **sta
 	if (off >= len+begin)
 		return 0;
 
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
  }
  
--- linux-2.2.15-pre16/drivers/isdn/avmb1/capi.c.proc	Wed Apr 12 21:32:15 2000
+++ linux-2.2.15-pre16/drivers/isdn/avmb1/capi.c	Wed Apr 12 21:32:22 2000
@@ -564,7 +564,7 @@ endloop:
 		*eof = 1;
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
--- linux-2.2.15-pre16/drivers/isdn/avmb1/kcapi.c.proc	Wed Apr 12 21:32:15 2000
+++ linux-2.2.15-pre16/drivers/isdn/avmb1/kcapi.c	Wed Apr 12 21:32:22 2000
@@ -250,7 +250,7 @@ endloop:
 		*eof = 1;
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
@@ -289,7 +289,7 @@ endloop:
 		*eof = 1;
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
@@ -321,7 +321,7 @@ endloop:
 		*eof = 1;
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
@@ -350,7 +350,7 @@ endloop:
 		*eof = 1;
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
@@ -387,7 +387,7 @@ endloop:
 		*eof = 1;
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
@@ -424,7 +424,7 @@ endloop:
 		*eof = 1;
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
@@ -461,7 +461,7 @@ endloop:
 		*eof = 1;
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
--- linux-2.2.15-pre16/drivers/sbus/char/sab82532.c.proc	Wed Apr 12 21:32:15 2000
+++ linux-2.2.15-pre16/drivers/sbus/char/sab82532.c	Wed Apr 12 21:32:22 2000
@@ -2063,7 +2063,7 @@ int sab82532_read_proc(char *page, char 
 done:
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
--- linux-2.2.15-pre16/drivers/sbus/char/su.c.proc	Wed Apr 12 21:32:15 2000
+++ linux-2.2.15-pre16/drivers/sbus/char/su.c	Wed Apr 12 21:32:22 2000
@@ -2205,7 +2205,7 @@ int su_read_proc(char *page, char **star
 done:
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
--- linux-2.2.15-pre16/arch/mips/baget/vacserial.c.proc	Wed Apr 12 21:32:15 2000
+++ linux-2.2.15-pre16/arch/mips/baget/vacserial.c	Wed Apr 12 21:32:22 2000
@@ -2162,7 +2162,7 @@ int rs_read_proc(char *page, char **star
 done:
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 
--- linux-2.2.15-pre16/arch/ppc/8xx_io/uart.c.proc	Wed Apr 12 21:32:15 2000
+++ linux-2.2.15-pre16/arch/ppc/8xx_io/uart.c	Wed Apr 12 21:32:22 2000
@@ -2050,7 +2050,7 @@ int rs_8xx_read_proc(char *page, char **
 done:
 	if (off >= len+begin)
 		return 0;
-	*start = page + (begin-off);
+	*start = page + (off-begin);
 	return ((count < begin+len-off) ? count : begin+len-off);
 }
 

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:11 EST