LWN.net Logo

Make sysctl pass the pos pointer around properly.

From:  Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
To:  bk-commits-head@vger.kernel.org
Subject:  Make sysctl pass the pos pointer around properly.
Date:  Sun, 08 Aug 2004 06:43:47 +0000

ChangeSet 1.1949, 2004/08/07 23:43:47-07:00, torvalds@ppc970.osdl.org

	Make sysctl pass the pos pointer around properly.
	
	Nobody ever fixed the big FIXME in sysctl - but we really need
	to pass around the proper "loff_t *" to all the sysctl functions
	if we want them to be well-behaved wrt the file pointer position.
	
	This is all preparation for making direct f_pos accesses go
	away.



 arch/ppc/kernel/ppc_htab.c          |    8 +-
 arch/s390/appldata/appldata_base.c  |   22 +++----
 arch/s390/mm/cmm.c                  |   12 ++--
 drivers/cdrom/cdrom.c               |   10 +--
 drivers/char/random.c               |    8 +-
 drivers/cpufreq/cpufreq_userspace.c |    6 +-
 drivers/net/wireless/arlan-proc.c   |   28 +++++-----
 drivers/parport/procfs.c            |   36 ++++++------
 fs/coda/sysctl.c                    |    8 +-
 fs/xfs/linux-2.6/xfs_sysctl.c       |    5 +
 include/linux/coda_proc.h           |    4 -
 include/linux/hugetlb.h             |    2 
 include/linux/mmzone.h              |    4 -
 include/linux/sysctl.h              |   18 +++---
 include/linux/writeback.h           |    2 
 include/net/ip.h                    |    2 
 include/net/ndisc.h                 |    3 -
 kernel/sysctl.c                     |  100 ++++++++++++++++++------------------
 mm/hugetlb.c                        |    4 -
 mm/page-writeback.c                 |    4 -
 mm/page_alloc.c                     |    8 +-
 net/bridge/br_netfilter.c           |    4 -
 net/decnet/dn_dev.c                 |    7 +-
 net/decnet/sysctl_net_decnet.c      |   18 +++---
 net/ipv4/devinet.c                  |    8 +-
 net/ipv4/ipvs/ip_vs_ctl.c           |    8 +-
 net/ipv4/route.c                    |    4 -
 net/ipv4/sysctl_net_ipv4.c          |    4 -
 net/ipv6/addrconf.c                 |    4 -
 net/ipv6/ndisc.c                    |    4 -
 net/ipv6/route.c                    |    4 -
 net/irda/irsysctl.c                 |    4 -
 net/sunrpc/sysctl.c                 |    6 +-
 33 files changed, 187 insertions(+), 182 deletions(-)


diff -Nru a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c
--- a/arch/ppc/kernel/ppc_htab.c	2004-08-08 01:05:06 -07:00
+++ b/arch/ppc/kernel/ppc_htab.c	2004-08-08 01:05:06 -07:00
@@ -35,7 +35,7 @@
 static ssize_t ppc_htab_write(struct file * file, const char __user * buffer,
 			      size_t count, loff_t *ppos);
 int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
-		  void __user *buffer, size_t *lenp);
+		  void __user *buffer, size_t *lenp, loff_t *ppos);
 
 extern PTE *Hash, *Hash_end;
 extern unsigned long Hash_size, Hash_mask;
@@ -320,7 +320,7 @@
 }
 
 int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
-		  void __user *buffer_arg, size_t *lenp)
+		  void __user *buffer_arg, size_t *lenp, loff_t *ppos)
 {
 	int vleft, first=1, len, left, val;
 	char __user *buffer = (char __user *) buffer_arg;
@@ -344,7 +344,7 @@
 	if (!(cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR))
 		return -EFAULT;
 
-	if ( /*!table->maxlen ||*/ (filp->f_pos && !write)) {
+	if ( /*!table->maxlen ||*/ (*ppos && !write)) {
 		*lenp = 0;
 		return 0;
 	}
@@ -435,6 +435,6 @@
 	if (write && first)
 		return -EINVAL;
 	*lenp -= left;
-	filp->f_pos += *lenp;
+	*ppos += *lenp;
 	return 0;
 }
diff -Nru a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
--- a/arch/s390/appldata/appldata_base.c	2004-08-08 01:05:06 -07:00
+++ b/arch/s390/appldata/appldata_base.c	2004-08-08 01:05:06 -07:00
@@ -88,11 +88,11 @@
  */
 static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata";
 static int appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
-				  void __user *buffer, size_t *lenp);
+				  void __user *buffer, size_t *lenp, loff_t *ppos);
 static int appldata_interval_handler(ctl_table *ctl, int write,
 					 struct file *filp,
 					 void __user *buffer,
-					 size_t *lenp);
+					 size_t *lenp, loff_t *ppos);
 
 static struct ctl_table_header *appldata_sysctl_header;
 static struct ctl_table appldata_table[] = {
@@ -315,12 +315,12 @@
  */
 static int
 appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
-			   void __user *buffer, size_t *lenp)
+			   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int len;
 	char buf[2];
 
-	if (!*lenp || filp->f_pos) {
+	if (!*lenp || *ppos) {
 		*lenp = 0;
 		return 0;
 	}
@@ -343,7 +343,7 @@
 	spin_unlock(&appldata_timer_lock);
 out:
 	*lenp = len;
-	filp->f_pos += len;
+	*ppos += len;
 	return 0;
 }
 
@@ -355,12 +355,12 @@
  */
 static int
 appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
-			   void __user *buffer, size_t *lenp)
+			   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int len, interval;
 	char buf[16];
 
-	if (!*lenp || filp->f_pos) {
+	if (!*lenp || *ppos) {
 		*lenp = 0;
 		return 0;
 	}
@@ -391,7 +391,7 @@
 		 interval);
 out:
 	*lenp = len;
-	filp->f_pos += len;
+	*ppos += len;
 	return 0;
 }
 
@@ -403,7 +403,7 @@
  */
 static int
 appldata_generic_handler(ctl_table *ctl, int write, struct file *filp,
-			   void __user *buffer, size_t *lenp)
+			   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	struct appldata_ops *ops = NULL, *tmp_ops;
 	int rc, len, found;
@@ -429,7 +429,7 @@
 	}
 	spin_unlock_bh(&appldata_ops_lock);
 
-	if (!*lenp || filp->f_pos) {
+	if (!*lenp || *ppos) {
 		*lenp = 0;
 		module_put(ops->owner);
 		return 0;
@@ -488,7 +488,7 @@
 	spin_unlock_bh(&appldata_ops_lock);
 out:
 	*lenp = len;
-	filp->f_pos += len;
+	*ppos += len;
 	module_put(ops->owner);
 	return 0;
 }
diff -Nru a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
--- a/arch/s390/mm/cmm.c	2004-08-08 01:05:06 -07:00
+++ b/arch/s390/mm/cmm.c	2004-08-08 01:05:06 -07:00
@@ -256,13 +256,13 @@
 
 static int
 cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
-		  void *buffer, size_t *lenp)
+		  void *buffer, size_t *lenp, loff_t *ppos)
 {
 	char buf[16], *p;
 	long pages;
 	int len;
 
-	if (!*lenp || (filp->f_pos && !write)) {
+	if (!*lenp || (*ppos && !write)) {
 		*lenp = 0;
 		return 0;
 	}
@@ -291,19 +291,19 @@
 			return -EFAULT;
 	}
 	*lenp = len;
-	filp->f_pos += len;
+	*ppos += len;
 	return 0;
 }
 
 static int
 cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp,
-		    void *buffer, size_t *lenp)
+		    void *buffer, size_t *lenp, loff_t *ppos)
 {
 	char buf[64], *p;
 	long pages, seconds;
 	int len;
 
-	if (!*lenp || (filp->f_pos && !write)) {
+	if (!*lenp || (*ppos && !write)) {
 		*lenp = 0;
 		return 0;
 	}
@@ -328,7 +328,7 @@
 			return -EFAULT;
 	}
 	*lenp = len;
-	filp->f_pos += len;
+	*ppos += len;
 	return 0;
 }
 
diff -Nru a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
--- a/drivers/cdrom/cdrom.c	2004-08-08 01:05:06 -07:00
+++ b/drivers/cdrom/cdrom.c	2004-08-08 01:05:06 -07:00
@@ -2933,13 +2933,13 @@
 } cdrom_sysctl_settings;
 
 int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
-                           void __user *buffer, size_t *lenp)
+                           void __user *buffer, size_t *lenp, loff_t *ppos)
 {
         int pos;
 	struct cdrom_device_info *cdi;
 	char *info = cdrom_sysctl_settings.info;
 	
-	if (!*lenp || (filp->f_pos && !write)) {
+	if (!*lenp || (*ppos && !write)) {
 		*lenp = 0;
 		return 0;
 	}
@@ -3028,7 +3028,7 @@
 
 	strcpy(info+pos,"\n\n");
 		
-        return proc_dostring(ctl, write, filp, buffer, lenp);
+        return proc_dostring(ctl, write, filp, buffer, lenp, ppos);
 }
 
 /* Unfortunately, per device settings are not implemented through
@@ -3060,13 +3060,13 @@
 }
 
 static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,
-				void __user *buffer, size_t *lenp)
+				void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int *valp = ctl->data;
 	int val = *valp;
 	int ret;
 	
-	ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+	ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
 	if (write && *valp != val) {
 	
diff -Nru a/drivers/char/random.c b/drivers/char/random.c
--- a/drivers/char/random.c	2004-08-08 01:05:06 -07:00
+++ b/drivers/char/random.c	2004-08-08 01:05:06 -07:00
@@ -1894,13 +1894,13 @@
 }
 
 static int proc_do_poolsize(ctl_table *table, int write, struct file *filp,
-			    void __user *buffer, size_t *lenp)
+			    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int	ret;
 
 	sysctl_poolsize = random_state->poolinfo.POOLBYTES;
 
-	ret = proc_dointvec(table, write, filp, buffer, lenp);
+	ret = proc_dointvec(table, write, filp, buffer, lenp, ppos);
 	if (ret || !write ||
 	    (sysctl_poolsize == random_state->poolinfo.POOLBYTES))
 		return ret;
@@ -1945,7 +1945,7 @@
  * sysctl system call, it is returned as 16 bytes of binary data.
  */
 static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
-			void __user *buffer, size_t *lenp)
+			void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	ctl_table	fake_table;
 	unsigned char	buf[64], tmp_uuid[16], *uuid;
@@ -1967,7 +1967,7 @@
 	fake_table.data = buf;
 	fake_table.maxlen = sizeof(buf);
 
-	return proc_dostring(&fake_table, write, filp, buffer, lenp);
+	return proc_dostring(&fake_table, write, filp, buffer, lenp, ppos);
 }
 
 static int uuid_strategy(ctl_table *table, int __user *name, int nlen,
diff -Nru a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
--- a/drivers/cpufreq/cpufreq_userspace.c	2004-08-08 01:05:06 -07:00
+++ b/drivers/cpufreq/cpufreq_userspace.c	2004-08-08 01:05:06 -07:00
@@ -151,13 +151,13 @@
 /*********************** cpufreq_sysctl interface ********************/
 static int
 cpufreq_procctl(ctl_table *ctl, int write, struct file *filp,
-		void __user *buffer, size_t *lenp)
+		void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	char buf[16], *p;
 	int cpu = (long) ctl->extra1;
 	unsigned int len, left = *lenp;
 
-	if (!left || (filp->f_pos && !write) || !cpu_online(cpu)) {
+	if (!left || (*ppos && !write) || !cpu_online(cpu)) {
 		*lenp = 0;
 		return 0;
 	}
@@ -183,7 +183,7 @@
 	}
 
 	*lenp = len;
-	filp->f_pos += len;
+	*ppos += len;
 	return 0;
 }
 
diff -Nru a/drivers/net/wireless/arlan-proc.c b/drivers/net/wireless/arlan-proc.c
--- a/drivers/net/wireless/arlan-proc.c	2004-08-08 01:05:06 -07:00
+++ b/drivers/net/wireless/arlan-proc.c	2004-08-08 01:05:06 -07:00
@@ -399,7 +399,7 @@
 static char arlan_drive_info[ARLAN_STR_SIZE] = "A655\n\0";
 
 static int arlan_sysctl_info(ctl_table * ctl, int write, struct file *filp,
-		      void __user *buffer, size_t * lenp)
+		      void __user *buffer, size_t * lenp, loff_t *ppos)
 {
 	int i;
 	int retv, pos, devnum;
@@ -625,7 +625,7 @@
 	*lenp = pos;
 
 	if (!write)
-		retv = proc_dostring(ctl, write, filp, buffer, lenp);
+		retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
 	else
 	{
 		*lenp = 0;
@@ -636,7 +636,7 @@
 
 
 static int arlan_sysctl_info161719(ctl_table * ctl, int write, struct file *filp,
-			    void __user *buffer, size_t * lenp)
+			    void __user *buffer, size_t * lenp, loff_t *ppos)
 {
 	int i;
 	int retv, pos, devnum;
@@ -665,12 +665,12 @@
 
 final:
 	*lenp = pos;
-	retv = proc_dostring(ctl, write, filp, buffer, lenp);
+	retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
 	return retv;
 }
 
 static int arlan_sysctl_infotxRing(ctl_table * ctl, int write, struct file *filp,
-			    void __user *buffer, size_t * lenp)
+			    void __user *buffer, size_t * lenp, loff_t *ppos)
 {
 	int i;
 	int retv, pos, devnum;
@@ -694,12 +694,12 @@
 	SARLBNpln(u_char, txBuffer, 0x800);
 final:
 	*lenp = pos;
-	retv = proc_dostring(ctl, write, filp, buffer, lenp);
+	retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
 	return retv;
 }
 
 static int arlan_sysctl_inforxRing(ctl_table * ctl, int write, struct file *filp,
-			    void __user *buffer, size_t * lenp)
+			    void __user *buffer, size_t * lenp, loff_t *ppos)
 {
 	int i;
 	int retv, pos, devnum;
@@ -722,12 +722,12 @@
 	SARLBNpln(u_char, rxBuffer, 0x800);
 final:
 	*lenp = pos;
-	retv = proc_dostring(ctl, write, filp, buffer, lenp);
+	retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
 	return retv;
 }
 
 static int arlan_sysctl_info18(ctl_table * ctl, int write, struct file *filp,
-			void __user *buffer, size_t * lenp)
+			void __user *buffer, size_t * lenp, loff_t *ppos)
 {
 	int i;
 	int retv, pos, devnum;
@@ -752,7 +752,7 @@
 
 final:
 	*lenp = pos;
-	retv = proc_dostring(ctl, write, filp, buffer, lenp);
+	retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
 	return retv;
 }
 
@@ -763,7 +763,7 @@
 static char conf_reset_result[200];
 
 static int arlan_configure(ctl_table * ctl, int write, struct file *filp,
-		    void __user *buffer, size_t * lenp)
+		    void __user *buffer, size_t * lenp, loff_t *ppos)
 {
 	int pos = 0;
 	int devnum = ctl->procname[6] - '0';
@@ -784,11 +784,11 @@
 		return -1;
 
 	*lenp = pos;
-	return proc_dostring(ctl, write, filp, buffer, lenp);
+	return proc_dostring(ctl, write, filp, buffer, lenp, ppos);
 }
 
 static int arlan_sysctl_reset(ctl_table * ctl, int write, struct file *filp,
-		       void __user *buffer, size_t * lenp)
+		       void __user *buffer, size_t * lenp, loff_t *ppos)
 {
 	int pos = 0;
 	int devnum = ctl->procname[5] - '0';
@@ -807,7 +807,7 @@
 	} else
 		return -1;
 	*lenp = pos + 3;
-	return proc_dostring(ctl, write, filp, buffer, lenp);
+	return proc_dostring(ctl, write, filp, buffer, lenp, ppos);
 }
 
 
diff -Nru a/drivers/parport/procfs.c b/drivers/parport/procfs.c
--- a/drivers/parport/procfs.c	2004-08-08 01:05:06 -07:00
+++ b/drivers/parport/procfs.c	2004-08-08 01:05:06 -07:00
@@ -33,7 +33,7 @@
 #define PARPORT_MAX_SPINTIME_VALUE 1000
 
 static int do_active_device(ctl_table *table, int write, struct file *filp,
-		      void __user *result, size_t *lenp)
+		      void __user *result, size_t *lenp, loff_t *ppos)
 {
 	struct parport *port = (struct parport *)table->extra1;
 	char buffer[256];
@@ -43,7 +43,7 @@
 	if (write)		/* can't happen anyway */
 		return -EACCES;
 
-	if (filp->f_pos) {
+	if (*ppos) {
 		*lenp = 0;
 		return 0;
 	}
@@ -63,14 +63,14 @@
 	else
 		*lenp = len;
 
-	filp->f_pos += len;
+	*ppos += len;
 
 	return copy_to_user(result, buffer, len) ? -EFAULT : 0;
 }
 
 #ifdef CONFIG_PARPORT_1284
 static int do_autoprobe(ctl_table *table, int write, struct file *filp,
-			void __user *result, size_t *lenp)
+			void __user *result, size_t *lenp, loff_t *ppos)
 {
 	struct parport_device_info *info = table->extra2;
 	const char *str;
@@ -80,7 +80,7 @@
 	if (write) /* permissions stop this */
 		return -EACCES;
 
-	if (filp->f_pos) {
+	if (*ppos) {
 		*lenp = 0;
 		return 0;
 	}
@@ -105,7 +105,7 @@
 	else
 		*lenp = len;
 
-	filp->f_pos += len;
+	*ppos += len;
 
 	return copy_to_user (result, buffer, len) ? -EFAULT : 0;
 }
@@ -113,13 +113,13 @@
 
 static int do_hardware_base_addr (ctl_table *table, int write,
 				  struct file *filp, void __user *result,
-				  size_t *lenp)
+				  size_t *lenp, loff_t *ppos)
 {
 	struct parport *port = (struct parport *)table->extra1;
 	char buffer[20];
 	int len = 0;
 
-	if (filp->f_pos) {
+	if (*ppos) {
 		*lenp = 0;
 		return 0;
 	}
@@ -134,20 +134,20 @@
 	else
 		*lenp = len;
 
-	filp->f_pos += len;
+	*ppos += len;
 
 	return copy_to_user(result, buffer, len) ? -EFAULT : 0;
 }
 
 static int do_hardware_irq (ctl_table *table, int write,
 			    struct file *filp, void __user *result,
-			    size_t *lenp)
+			    size_t *lenp, loff_t *ppos)
 {
 	struct parport *port = (struct parport *)table->extra1;
 	char buffer[20];
 	int len = 0;
 
-	if (filp->f_pos) {
+	if (*ppos) {
 		*lenp = 0;
 		return 0;
 	}
@@ -162,20 +162,20 @@
 	else
 		*lenp = len;
 
-	filp->f_pos += len;
+	*ppos += len;
 
 	return copy_to_user(result, buffer, len) ? -EFAULT : 0;
 }
 
 static int do_hardware_dma (ctl_table *table, int write,
 			    struct file *filp, void __user *result,
-			    size_t *lenp)
+			    size_t *lenp, loff_t *ppos)
 {
 	struct parport *port = (struct parport *)table->extra1;
 	char buffer[20];
 	int len = 0;
 
-	if (filp->f_pos) {
+	if (*ppos) {
 		*lenp = 0;
 		return 0;
 	}
@@ -190,20 +190,20 @@
 	else
 		*lenp = len;
 
-	filp->f_pos += len;
+	*ppos += len;
 
 	return copy_to_user(result, buffer, len) ? -EFAULT : 0;
 }
 
 static int do_hardware_modes (ctl_table *table, int write,
 			      struct file *filp, void __user *result,
-			      size_t *lenp)
+			      size_t *lenp, loff_t *ppos)
 {
 	struct parport *port = (struct parport *)table->extra1;
 	char buffer[40];
 	int len = 0;
 
-	if (filp->f_pos) {
+	if (*ppos) {
 		*lenp = 0;
 		return 0;
 	}
@@ -229,7 +229,7 @@
 	else
 		*lenp = len;
 
-	filp->f_pos += len;
+	*ppos += len;
 
 	return copy_to_user(result, buffer, len) ? -EFAULT : 0;
 }
diff -Nru a/fs/coda/sysctl.c b/fs/coda/sysctl.c
--- a/fs/coda/sysctl.c	2004-08-08 01:05:06 -07:00
+++ b/fs/coda/sysctl.c	2004-08-08 01:05:06 -07:00
@@ -69,12 +69,12 @@
 }
 
 int do_reset_coda_vfs_stats( ctl_table * table, int write, struct file * filp,
-			     void __user * buffer, size_t * lenp )
+			     void __user * buffer, size_t * lenp, loff_t * ppos )
 {
 	if ( write ) {
 		reset_coda_vfs_stats();
 
-		filp->f_pos += *lenp;
+		*ppos += *lenp;
 	} else {
 		*lenp = 0;
 	}
@@ -84,12 +84,12 @@
 
 int do_reset_coda_cache_inv_stats( ctl_table * table, int write, 
 				   struct file * filp, void __user * buffer, 
-				   size_t * lenp )
+				   size_t * lenp, loff_t * ppos )
 {
 	if ( write ) {
 		reset_coda_cache_inv_stats();
 
-		filp->f_pos += *lenp;
+		*ppos += *lenp;
 	} else {
 		*lenp = 0;
 	}
diff -Nru a/fs/xfs/linux-2.6/xfs_sysctl.c b/fs/xfs/linux-2.6/xfs_sysctl.c
--- a/fs/xfs/linux-2.6/xfs_sysctl.c	2004-08-08 01:05:06 -07:00
+++ b/fs/xfs/linux-2.6/xfs_sysctl.c	2004-08-08 01:05:06 -07:00
@@ -46,12 +46,13 @@
 	int		write,
 	struct file	*filp,
 	void		*buffer,
-	size_t		*lenp)
+	size_t		*lenp,
+	loff_t		*ppos)
 {
 	int		c, ret, *valp = ctl->data;
 	__uint32_t	vn_active;
 
-	ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp);
+	ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp, ppos);
 
 	if (!ret && write && *valp) {
 		printk("XFS Clearing xfsstats\n");
diff -Nru a/include/linux/coda_proc.h b/include/linux/coda_proc.h
--- a/include/linux/coda_proc.h	2004-08-08 01:05:06 -07:00
+++ b/include/linux/coda_proc.h	2004-08-08 01:05:06 -07:00
@@ -82,10 +82,10 @@
  * data structure for /proc/sys/... files 
  */
 int do_reset_coda_vfs_stats( ctl_table * table, int write, struct file * filp,
-			     void __user * buffer, size_t * lenp );
+			     void __user * buffer, size_t * lenp, loff_t * ppos );
 int do_reset_coda_cache_inv_stats( ctl_table * table, int write, 
 				   struct file * filp, void __user * buffer, 
-				   size_t * lenp );
+				   size_t * lenp, loff_t * ppos );
 
 /* these functions are called to form the content of /proc/fs/coda/... files */
 int coda_vfs_stats_get_info( char * buffer, char ** start, off_t offset,
diff -Nru a/include/linux/hugetlb.h b/include/linux/hugetlb.h
--- a/include/linux/hugetlb.h	2004-08-08 01:05:06 -07:00
+++ b/include/linux/hugetlb.h	2004-08-08 01:05:06 -07:00
@@ -12,7 +12,7 @@
 	return vma->vm_flags & VM_HUGETLB;
 }
 
-int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *);
+int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
 int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
 int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int);
 void zap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
diff -Nru a/include/linux/mmzone.h b/include/linux/mmzone.h
--- a/include/linux/mmzone.h	2004-08-08 01:05:06 -07:00
+++ b/include/linux/mmzone.h	2004-08-08 01:05:06 -07:00
@@ -374,9 +374,9 @@
 struct ctl_table;
 struct file;
 int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *, 
-					void __user *, size_t *);
+					void __user *, size_t *, loff_t *);
 int lower_zone_protection_sysctl_handler(struct ctl_table *, int, struct file *,
-					void __user *, size_t *);
+					void __user *, size_t *, loff_t *);
 
 #include <linux/topology.h>
 /* Returns the number of the current Node. */
diff -Nru a/include/linux/sysctl.h b/include/linux/sysctl.h
--- a/include/linux/sysctl.h	2004-08-08 01:05:06 -07:00
+++ b/include/linux/sysctl.h	2004-08-08 01:05:06 -07:00
@@ -762,24 +762,24 @@
 			 void **context);
 
 typedef int proc_handler (ctl_table *ctl, int write, struct file * filp,
-			  void __user *buffer, size_t *lenp);
+			  void __user *buffer, size_t *lenp, loff_t *ppos);
 
 extern int proc_dostring(ctl_table *, int, struct file *,
-			 void __user *, size_t *);
+			 void __user *, size_t *, loff_t *);
 extern int proc_dointvec(ctl_table *, int, struct file *,
-			 void __user *, size_t *);
+			 void __user *, size_t *, loff_t *);
 extern int proc_dointvec_bset(ctl_table *, int, struct file *,
-			      void __user *, size_t *);
+			      void __user *, size_t *, loff_t *);
 extern int proc_dointvec_minmax(ctl_table *, int, struct file *,
-				void __user *, size_t *);
+				void __user *, size_t *, loff_t *);
 extern int proc_dointvec_jiffies(ctl_table *, int, struct file *,
-				 void __user *, size_t *);
+				 void __user *, size_t *, loff_t *);
 extern int proc_dointvec_userhz_jiffies(ctl_table *, int, struct file *,
-					void __user *, size_t *);
+					void __user *, size_t *, loff_t *);
 extern int proc_doulongvec_minmax(ctl_table *, int, struct file *,
-				  void __user *, size_t *);
+				  void __user *, size_t *, loff_t *);
 extern int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int,
-				      struct file *, void __user *, size_t *);
+				      struct file *, void __user *, size_t *, loff_t *);
 
 extern int do_sysctl (int __user *name, int nlen,
 		      void __user *oldval, size_t __user *oldlenp,
diff -Nru a/include/linux/writeback.h b/include/linux/writeback.h
--- a/include/linux/writeback.h	2004-08-08 01:05:06 -07:00
+++ b/include/linux/writeback.h	2004-08-08 01:05:06 -07:00
@@ -86,7 +86,7 @@
 struct ctl_table;
 struct file;
 int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
-				      void __user *, size_t *);
+				      void __user *, size_t *, loff_t *);
 
 void page_writeback_init(void);
 void balance_dirty_pages_ratelimited(struct address_space *mapping);
diff -Nru a/include/net/ip.h b/include/net/ip.h
--- a/include/net/ip.h	2004-08-08 01:05:06 -07:00
+++ b/include/net/ip.h	2004-08-08 01:05:06 -07:00
@@ -301,7 +301,7 @@
  */
 int ipv4_doint_and_flush(ctl_table *ctl, int write,
 			 struct file* filp, void __user *buffer,
-			 size_t *lenp);
+			 size_t *lenp, loff_t *ppos);
 int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
 				  void __user *oldval, size_t __user *oldlenp,
 				  void __user *newval, size_t newlen, 
diff -Nru a/include/net/ndisc.h b/include/net/ndisc.h
--- a/include/net/ndisc.h	2004-08-08 01:05:06 -07:00
+++ b/include/net/ndisc.h	2004-08-08 01:05:06 -07:00
@@ -103,7 +103,8 @@
 							   int write,
 							   struct file * filp,
 							   void __user *buffer,
-							   size_t *lenp);
+							   size_t *lenp,
+							   loff_t *ppos);
 #endif
 
 extern void 			inet6_ifinfo_notify(int event,
diff -Nru a/kernel/sysctl.c b/kernel/sysctl.c
--- a/kernel/sysctl.c	2004-08-08 01:05:06 -07:00
+++ b/kernel/sysctl.c	2004-08-08 01:05:06 -07:00
@@ -123,7 +123,7 @@
 static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
 		       ctl_table *, void **);
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-		  void __user *buffer, size_t *lenp);
+		  void __user *buffer, size_t *lenp, loff_t *ppos);
 
 static ctl_table root_table[];
 static struct ctl_table_header root_table_header =
@@ -1287,11 +1287,7 @@
 	
 	res = count;
 
-	/*
-	 * FIXME: we need to pass on ppos to the handler.
-	 */
-
-	error = (*table->proc_handler) (table, write, file, buf, &res);
+	error = (*table->proc_handler) (table, write, file, buf, &res, ppos);
 	if (error)
 		return error;
 	return res;
@@ -1341,14 +1337,14 @@
  * Returns 0 on success.
  */
 int proc_dostring(ctl_table *table, int write, struct file *filp,
-		  void __user *buffer, size_t *lenp)
+		  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	size_t len;
 	char __user *p;
 	char c;
 	
 	if (!table->data || !table->maxlen || !*lenp ||
-	    (filp->f_pos && !write)) {
+	    (*ppos && !write)) {
 		*lenp = 0;
 		return 0;
 	}
@@ -1368,7 +1364,7 @@
 		if(copy_from_user(table->data, buffer, len))
 			return -EFAULT;
 		((char *) table->data)[len] = 0;
-		filp->f_pos += *lenp;
+		*ppos += *lenp;
 	} else {
 		len = strlen(table->data);
 		if (len > table->maxlen)
@@ -1384,7 +1380,7 @@
 			len++;
 		}
 		*lenp = len;
-		filp->f_pos += len;
+		*ppos += len;
 	}
 	return 0;
 }
@@ -1395,17 +1391,17 @@
  */
  
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-		  void __user *buffer, size_t *lenp)
+		  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int r;
 
 	if (!write) {
 		down_read(&uts_sem);
-		r=proc_dostring(table,0,filp,buffer,lenp);
+		r=proc_dostring(table,0,filp,buffer,lenp, ppos);
 		up_read(&uts_sem);
 	} else {
 		down_write(&uts_sem);
-		r=proc_dostring(table,1,filp,buffer,lenp);
+		r=proc_dostring(table,1,filp,buffer,lenp, ppos);
 		up_write(&uts_sem);
 	}
 	return r;
@@ -1431,7 +1427,7 @@
 }
 
 static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
-		  void __user *buffer, size_t *lenp, 
+		  void __user *buffer, size_t *lenp, loff_t *ppos,
 		  int (*conv)(int *negp, unsigned long *lvalp, int *valp,
 			      int write, void *data),
 		  void *data)
@@ -1445,7 +1441,7 @@
 	char __user *s = buffer;
 	
 	if (!table->data || !table->maxlen || !*lenp ||
-	    (filp->f_pos && !write)) {
+	    (*ppos && !write)) {
 		*lenp = 0;
 		return 0;
 	}
@@ -1534,7 +1530,7 @@
 	if (write && first)
 		return -EINVAL;
 	*lenp -= left;
-	filp->f_pos += *lenp;
+	*ppos += *lenp;
 	return 0;
 #undef TMPBUFLEN
 }
@@ -1553,9 +1549,9 @@
  * Returns 0 on success.
  */
 int proc_dointvec(ctl_table *table, int write, struct file *filp,
-		     void __user *buffer, size_t *lenp)
+		     void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-    return do_proc_dointvec(table,write,filp,buffer,lenp,
+    return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
 		    	    NULL,NULL);
 }
 
@@ -1601,7 +1597,7 @@
  */
  
 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
-			void __user *buffer, size_t *lenp)
+			void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int op;
 
@@ -1610,7 +1606,7 @@
 	}
 
 	op = (current->pid == 1) ? OP_SET : OP_AND;
-	return do_proc_dointvec(table,write,filp,buffer,lenp,
+	return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
 				do_proc_dointvec_bset_conv,&op);
 }
 
@@ -1660,19 +1656,20 @@
  * Returns 0 on success.
  */
 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
-		  void __user *buffer, size_t *lenp)
+		  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	struct do_proc_dointvec_minmax_conv_param param = {
 		.min = (int *) table->extra1,
 		.max = (int *) table->extra2,
 	};
-	return do_proc_dointvec(table, write, filp, buffer, lenp,
+	return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
 				do_proc_dointvec_minmax_conv, &param);
 }
 
 static int do_proc_doulongvec_minmax(ctl_table *table, int write,
 				     struct file *filp,
-				     void __user *buffer, size_t *lenp,
+				     void __user *buffer,
+				     size_t *lenp, loff_t *ppos,
 				     unsigned long convmul,
 				     unsigned long convdiv)
 {
@@ -1684,7 +1681,7 @@
 	char __user *s = buffer;
 	
 	if (!table->data || !table->maxlen || !*lenp ||
-	    (filp->f_pos && !write)) {
+	    (*ppos && !write)) {
 		*lenp = 0;
 		return 0;
 	}
@@ -1769,7 +1766,7 @@
 	if (write && first)
 		return -EINVAL;
 	*lenp -= left;
-	filp->f_pos += *lenp;
+	*ppos += *lenp;
 	return 0;
 #undef TMPBUFLEN
 }
@@ -1791,9 +1788,9 @@
  * Returns 0 on success.
  */
 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
-			   void __user *buffer, size_t *lenp)
+			   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-    return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, 1l, 1l);
+    return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
 }
 
 /**
@@ -1815,10 +1812,11 @@
  */
 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
 				      struct file *filp,
-				      void __user *buffer, size_t *lenp)
+				      void __user *buffer,
+				      size_t *lenp, loff_t *ppos)
 {
     return do_proc_doulongvec_minmax(table, write, filp, buffer,
-				     lenp, HZ, 1000l);
+				     lenp, ppos, HZ, 1000l);
 }
 
 
@@ -1880,9 +1878,9 @@
  * Returns 0 on success.
  */
 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
-			  void __user *buffer, size_t *lenp)
+			  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-    return do_proc_dointvec(table,write,filp,buffer,lenp,
+    return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
 		    	    do_proc_dointvec_jiffies_conv,NULL);
 }
 
@@ -1902,65 +1900,66 @@
  * Returns 0 on success.
  */
 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
-				 void __user *buffer, size_t *lenp)
+				 void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-    return do_proc_dointvec(table,write,filp,buffer,lenp,
+    return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
 		    	    do_proc_dointvec_userhz_jiffies_conv,NULL);
 }
 
 #else /* CONFIG_PROC_FS */
 
 int proc_dostring(ctl_table *table, int write, struct file *filp,
-		  void __user *buffer, size_t *lenp)
+		  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-			    void __user *buffer, size_t *lenp)
+			    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec(ctl_table *table, int write, struct file *filp,
-		  void __user *buffer, size_t *lenp)
+		  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
-			void __user *buffer, size_t *lenp)
+			void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
-		    void __user *buffer, size_t *lenp)
+		    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
-		    void __user *buffer, size_t *lenp)
+		    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
-		    void __user *buffer, size_t *lenp)
+		    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
-		    void __user *buffer, size_t *lenp)
+		    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
 				      struct file *filp,
-				      void __user *buffer, size_t *lenp)
+				      void __user *buffer,
+				      size_t *lenp, loff_t *ppos)
 {
     return -ENOSYS;
 }
@@ -2111,50 +2110,51 @@
 }
 
 int proc_dostring(ctl_table *table, int write, struct file *filp,
-		  void __user *buffer, size_t *lenp)
+		  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec(ctl_table *table, int write, struct file *filp,
-		  void __user *buffer, size_t *lenp)
+		  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
-			void __user *buffer, size_t *lenp)
+			void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
-		    void __user *buffer, size_t *lenp)
+		    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
-			  void __user *buffer, size_t *lenp)
+			  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
-			  void __user *buffer, size_t *lenp)
+			  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
-		    void __user *buffer, size_t *lenp)
+		    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	return -ENOSYS;
 }
 
 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
 				      struct file *filp,
-				      void __user *buffer, size_t *lenp)
+				      void __user *buffer,
+				      size_t *lenp, loff_t *ppos)
 {
     return -ENOSYS;
 }
diff -Nru a/mm/hugetlb.c b/mm/hugetlb.c
--- a/mm/hugetlb.c	2004-08-08 01:05:06 -07:00
+++ b/mm/hugetlb.c	2004-08-08 01:05:06 -07:00
@@ -191,9 +191,9 @@
 #ifdef CONFIG_SYSCTL
 int hugetlb_sysctl_handler(struct ctl_table *table, int write,
 			   struct file *file, void __user *buffer,
-			   size_t *length)
+			   size_t *length, loff_t *ppos)
 {
-	proc_doulongvec_minmax(table, write, file, buffer, length);
+	proc_doulongvec_minmax(table, write, file, buffer, length, ppos);
 	max_huge_pages = set_max_huge_pages(max_huge_pages);
 	return 0;
 }
diff -Nru a/mm/page-writeback.c b/mm/page-writeback.c
--- a/mm/page-writeback.c	2004-08-08 01:05:06 -07:00
+++ b/mm/page-writeback.c	2004-08-08 01:05:06 -07:00
@@ -399,9 +399,9 @@
  * sysctl handler for /proc/sys/vm/dirty_writeback_centisecs
  */
 int dirty_writeback_centisecs_handler(ctl_table *table, int write,
-		struct file *file, void __user *buffer, size_t *length)
+		struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
 {
-	proc_dointvec(table, write, file, buffer, length);
+	proc_dointvec(table, write, file, buffer, length, ppos);
 	if (dirty_writeback_centisecs) {
 		mod_timer(&wb_timer,
 			jiffies + (dirty_writeback_centisecs * HZ) / 100);
diff -Nru a/mm/page_alloc.c b/mm/page_alloc.c
--- a/mm/page_alloc.c	2004-08-08 01:05:06 -07:00
+++ b/mm/page_alloc.c	2004-08-08 01:05:06 -07:00
@@ -1955,9 +1955,9 @@
  *	changes.
  */
 int min_free_kbytes_sysctl_handler(ctl_table *table, int write, 
-		struct file *file, void __user *buffer, size_t *length)
+		struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
 {
-	proc_dointvec(table, write, file, buffer, length);
+	proc_dointvec(table, write, file, buffer, length, ppos);
 	setup_per_zone_pages_min();
 	setup_per_zone_protection();
 	return 0;
@@ -1969,9 +1969,9 @@
  *	whenever sysctl_lower_zone_protection changes.
  */
 int lower_zone_protection_sysctl_handler(ctl_table *table, int write,
-		 struct file *file, void __user *buffer, size_t *length)
+		 struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
 {
-	proc_dointvec_minmax(table, write, file, buffer, length);
+	proc_dointvec_minmax(table, write, file, buffer, length, ppos);
 	setup_per_zone_protection();
 	return 0;
 }
diff -Nru a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
--- a/net/bridge/br_netfilter.c	2004-08-08 01:05:06 -07:00
+++ b/net/bridge/br_netfilter.c	2004-08-08 01:05:06 -07:00
@@ -800,11 +800,11 @@
 #ifdef CONFIG_SYSCTL
 static
 int brnf_sysctl_call_tables(ctl_table *ctl, int write, struct file * filp,
-			void __user *buffer, size_t *lenp)
+			void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int ret;
 
-	ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+	ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
 	if (write && *(int *)(ctl->data))
 		*(int *)(ctl->data) = 1;
diff -Nru a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
--- a/net/decnet/dn_dev.c	2004-08-08 01:05:06 -07:00
+++ b/net/decnet/dn_dev.c	2004-08-08 01:05:06 -07:00
@@ -161,7 +161,7 @@
 static int max_priority[] = { 127 }; /* From DECnet spec */
 
 static int dn_forwarding_proc(ctl_table *, int, struct file *,
-			void __user *, size_t *);
+			void __user *, size_t *, loff_t *);
 static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen,
 			void __user *oldval, size_t __user *oldlenp,
 			void __user *newval, size_t newlen,
@@ -362,7 +362,8 @@
 
 static int dn_forwarding_proc(ctl_table *table, int write, 
 				struct file *filep,
-				void __user *buffer, size_t *lenp)
+				void __user *buffer,
+				size_t *lenp, loff_t *ppos)
 {
 #ifdef CONFIG_DECNET_ROUTER
 	struct net_device *dev = table->extra1;
@@ -376,7 +377,7 @@
 	dn_db = dev->dn_ptr;
 	old = dn_db->parms.forwarding;
 
-	err = proc_dointvec(table, write, filep, buffer, lenp);
+	err = proc_dointvec(table, write, filep, buffer, lenp, ppos);
 
 	if ((err >= 0) && write) {
 		if (dn_db->parms.forwarding < 0)
diff -Nru a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
--- a/net/decnet/sysctl_net_decnet.c	2004-08-08 01:05:06 -07:00
+++ b/net/decnet/sysctl_net_decnet.c	2004-08-08 01:05:06 -07:00
@@ -162,13 +162,14 @@
 
 static int dn_node_address_handler(ctl_table *table, int write, 
 				struct file *filp,
-				void __user *buffer, size_t *lenp)
+				void __user *buffer,
+				size_t *lenp, loff_t *ppos)
 {
 	char addr[DN_ASCBUF_LEN];
 	size_t len;
 	dn_address dnaddr;
 
-	if (!*lenp || (filp->f_pos && !write)) {
+	if (!*lenp || (*ppos && !write)) {
 		*lenp = 0;
 		return 0;
 	}
@@ -191,7 +192,7 @@
 
 		dn_dev_devices_on();
 
-		filp->f_pos += len;
+		*ppos += len;
 
 		return 0;
 	}
@@ -206,7 +207,7 @@
 		return -EFAULT;
 
 	*lenp = len;
-	filp->f_pos += len;
+	*ppos += len;
 
 	return 0;
 }
@@ -273,13 +274,14 @@
 
 static int dn_def_dev_handler(ctl_table *table, int write, 
 				struct file * filp,
-				void __user *buffer, size_t *lenp)
+				void __user *buffer,
+				size_t *lenp, loff_t *ppos)
 {
 	size_t len;
 	struct net_device *dev;
 	char devname[17];
 
-	if (!*lenp || (filp->f_pos && !write)) {
+	if (!*lenp || (*ppos && !write)) {
 		*lenp = 0;
 		return 0;
 	}
@@ -307,7 +309,7 @@
 			dev_put(dev);
 			return -ENODEV;
 		}
-		filp->f_pos += *lenp;
+		*ppos += *lenp;
 
 		return 0;
 	}
@@ -329,7 +331,7 @@
 		return -EFAULT;
 
 	*lenp = len;
-	filp->f_pos += len;
+	*ppos += len;
 
 	return 0;
 }
diff -Nru a/net/ipv4/devinet.c b/net/ipv4/devinet.c
--- a/net/ipv4/devinet.c	2004-08-08 01:05:06 -07:00
+++ b/net/ipv4/devinet.c	2004-08-08 01:05:06 -07:00
@@ -1151,11 +1151,11 @@
 
 static int devinet_sysctl_forward(ctl_table *ctl, int write,
 				  struct file* filp, void __user *buffer,
-				  size_t *lenp)
+				  size_t *lenp, loff_t *ppos)
 {
 	int *valp = ctl->data;
 	int val = *valp;
-	int ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+	int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
 	if (write && *valp != val) {
 		if (valp == &ipv4_devconf.forwarding)
@@ -1169,11 +1169,11 @@
 
 int ipv4_doint_and_flush(ctl_table *ctl, int write,
 			 struct file* filp, void __user *buffer,
-			 size_t *lenp)
+			 size_t *lenp, loff_t *ppos)
 {
 	int *valp = ctl->data;
 	int val = *valp;
-	int ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+	int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
 	if (write && *valp != val)
 		rt_cache_flush(0);
diff -Nru a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
--- a/net/ipv4/ipvs/ip_vs_ctl.c	2004-08-08 01:05:06 -07:00
+++ b/net/ipv4/ipvs/ip_vs_ctl.c	2004-08-08 01:05:06 -07:00
@@ -1347,13 +1347,13 @@
 
 static int
 proc_do_defense_mode(ctl_table *table, int write, struct file * filp,
-		     void __user *buffer, size_t *lenp)
+		     void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int *valp = table->data;
 	int val = *valp;
 	int rc;
 
-	rc = proc_dointvec(table, write, filp, buffer, lenp);
+	rc = proc_dointvec(table, write, filp, buffer, lenp, ppos);
 	if (write && (*valp != val)) {
 		if ((*valp < 0) || (*valp > 3)) {
 			/* Restore the correct value */
@@ -1370,7 +1370,7 @@
 
 static int
 proc_do_sync_threshold(ctl_table *table, int write, struct file *filp,
-		       void __user *buffer, size_t *lenp)
+		       void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int *valp = table->data;
 	int val[2];
@@ -1379,7 +1379,7 @@
 	/* backup the value first */
 	memcpy(val, valp, sizeof(val));
 
-	rc = proc_dointvec(table, write, filp, buffer, lenp);
+	rc = proc_dointvec(table, write, filp, buffer, lenp, ppos);
 	if (write && (valp[0] < 0 || valp[1] < 0 || valp[0] >= valp[1])) {
 		/* Restore the correct value */
 		memcpy(valp, val, sizeof(val));
diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c
--- a/net/ipv4/route.c	2004-08-08 01:05:06 -07:00
+++ b/net/ipv4/route.c	2004-08-08 01:05:06 -07:00
@@ -2498,10 +2498,10 @@
 
 static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write,
 					struct file *filp, void __user *buffer,
-					size_t *lenp)
+					size_t *lenp, loff_t *ppos)
 {
 	if (write) {
-		proc_dointvec(ctl, write, filp, buffer, lenp);
+		proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 		rt_cache_flush(flush_delay);
 		return 0;
 	} 
diff -Nru a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
--- a/net/ipv4/sysctl_net_ipv4.c	2004-08-08 01:05:06 -07:00
+++ b/net/ipv4/sysctl_net_ipv4.c	2004-08-08 01:05:06 -07:00
@@ -62,12 +62,12 @@
 
 static
 int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
-			void __user *buffer, size_t *lenp)
+			void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int val = ipv4_devconf.forwarding;
 	int ret;
 
-	ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+	ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
 	if (write && ipv4_devconf.forwarding != val)
 		inet_forward_change();
diff -Nru a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
--- a/net/ipv6/addrconf.c	2004-08-08 01:05:06 -07:00
+++ b/net/ipv6/addrconf.c	2004-08-08 01:05:06 -07:00
@@ -3003,13 +3003,13 @@
 
 static
 int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
-			   void __user *buffer, size_t *lenp)
+			   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int *valp = ctl->data;
 	int val = *valp;
 	int ret;
 
-	ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+	ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
 	if (write && *valp != val && valp != &ipv6_devconf_dflt.forwarding) {
 		struct inet6_dev *idev = NULL;
diff -Nru a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
--- a/net/ipv6/ndisc.c	2004-08-08 01:05:06 -07:00
+++ b/net/ipv6/ndisc.c	2004-08-08 01:05:06 -07:00
@@ -1423,7 +1423,7 @@
 };
 
 #ifdef CONFIG_SYSCTL
-int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * filp, void __user *buffer, size_t *lenp)
+int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * filp, void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	struct net_device *dev = ctl->extra1;
 	struct inet6_dev *idev;
@@ -1433,7 +1433,7 @@
 		inet6_ifinfo_notify(RTM_NEWLINK, idev);
 		in6_dev_put(idev);
 	}
-	return proc_dointvec(ctl, write, filp, buffer, lenp);
+	return proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 }
 #endif
 
diff -Nru a/net/ipv6/route.c b/net/ipv6/route.c
--- a/net/ipv6/route.c	2004-08-08 01:05:06 -07:00
+++ b/net/ipv6/route.c	2004-08-08 01:05:06 -07:00
@@ -1924,10 +1924,10 @@
 
 static
 int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp,
-			      void __user *buffer, size_t *lenp)
+			      void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	if (write) {
-		proc_dointvec(ctl, write, filp, buffer, lenp);
+		proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 		if (flush_delay < 0)
 			flush_delay = 0;
 		fib6_run_gc((unsigned long)flush_delay);
diff -Nru a/net/irda/irsysctl.c b/net/irda/irsysctl.c
--- a/net/irda/irsysctl.c	2004-08-08 01:05:06 -07:00
+++ b/net/irda/irsysctl.c	2004-08-08 01:05:06 -07:00
@@ -78,11 +78,11 @@
  * us on that - Jean II */
 
 static int do_devname(ctl_table *table, int write, struct file *filp,
-		      void __user *buffer, size_t *lenp)
+		      void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int ret;
 
-	ret = proc_dostring(table, write, filp, buffer, lenp);
+	ret = proc_dostring(table, write, filp, buffer, lenp, ppos);
 	if (ret == 0 && write) {
 		struct ias_value *val;
 
diff -Nru a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
--- a/net/sunrpc/sysctl.c	2004-08-08 01:05:06 -07:00
+++ b/net/sunrpc/sysctl.c	2004-08-08 01:05:06 -07:00
@@ -58,14 +58,14 @@
 
 static int
 proc_dodebug(ctl_table *table, int write, struct file *file,
-				void __user *buffer, size_t *lenp)
+				void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	char		tmpbuf[20], c, *s;
 	char __user *p;
 	unsigned int	value;
 	size_t		left, len;
 
-	if ((file->f_pos && !write) || !*lenp) {
+	if ((*ppos && !write) || !*lenp) {
 		*lenp = 0;
 		return 0;
 	}
@@ -115,7 +115,7 @@
 
 done:
 	*lenp -= left;
-	file->f_pos += *lenp;
+	*ppos += *lenp;
 	return 0;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Copyright © 2004, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds