Commit f7a4bc7e authored by Linus Torvalds's avatar Linus Torvalds

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.
parent 24e25979
......@@ -35,7 +35,7 @@ static int ppc_htab_show(struct seq_file *m, void *v);
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 @@ static ssize_t ppc_htab_write(struct file * file, const char __user * ubuffer,
}
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 @@ int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
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 @@ int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
if (write && first)
return -EINVAL;
*lenp -= left;
filp->f_pos += *lenp;
*ppos += *lenp;
return 0;
}
......@@ -88,11 +88,11 @@ struct appldata_parameter_list {
*/
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 @@ __appldata_vtimer_setup(int cmd)
*/
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 @@ appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
spin_unlock(&appldata_timer_lock);
out:
*lenp = len;
filp->f_pos += len;
*ppos += len;
return 0;
}
......@@ -355,12 +355,12 @@ appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
*/
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 @@ appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
interval);
out:
*lenp = len;
filp->f_pos += len;
*ppos += len;
return 0;
}
......@@ -403,7 +403,7 @@ appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
*/
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 @@ appldata_generic_handler(ctl_table *ctl, int write, struct file *filp,
}
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 @@ appldata_generic_handler(ctl_table *ctl, int write, struct file *filp,
spin_unlock_bh(&appldata_ops_lock);
out:
*lenp = len;
filp->f_pos += len;
*ppos += len;
module_put(ops->owner);
return 0;
}
......
......@@ -256,13 +256,13 @@ static struct ctl_table cmm_table[];
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 @@ cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
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 @@ cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp,
return -EFAULT;
}
*lenp = len;
filp->f_pos += len;
*ppos += len;
return 0;
}
......
......@@ -2933,13 +2933,13 @@ struct cdrom_sysctl_settings {
} 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 @@ int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
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 @@ void cdrom_update_settings(void)
}
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) {
......
......@@ -1894,13 +1894,13 @@ static int change_poolsize(int poolsize)
}
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 @@ static int poolsize_strategy(ctl_table *table, int __user *name, int nlen,
* 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 @@ static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
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,
......
......@@ -151,13 +151,13 @@ EXPORT_SYMBOL_GPL(cpufreq_setmax);
/*********************** 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 @@ cpufreq_procctl(ctl_table *ctl, int write, struct file *filp,
}
*lenp = len;
filp->f_pos += len;
*ppos += len;
return 0;
}
......
......@@ -399,7 +399,7 @@ static int arlan_setup_card_by_book(struct net_device *dev)
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 @@ static int arlan_sysctl_info(ctl_table * ctl, int write, struct file *filp,
*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_info(ctl_table * ctl, int write, struct file *filp,
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 @@ static int arlan_sysctl_info161719(ctl_table * ctl, int write, struct file *filp
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 @@ static int arlan_sysctl_infotxRing(ctl_table * ctl, int write, struct file *filp
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 @@ static int arlan_sysctl_inforxRing(ctl_table * ctl, int write, struct file *filp
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 @@ static int arlan_sysctl_info18(ctl_table * ctl, int write, struct file *filp,
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 int arlan_sysctl_info18(ctl_table * ctl, int write, struct file *filp,
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 @@ static int arlan_configure(ctl_table * ctl, int write, struct file *filp,
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 @@ static int arlan_sysctl_reset(ctl_table * ctl, int write, struct file *filp,
} else
return -1;
*lenp = pos + 3;
return proc_dostring(ctl, write, filp, buffer, lenp);
return proc_dostring(ctl, write, filp, buffer, lenp, ppos);
}
......
......@@ -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 @@ static int do_active_device(ctl_table *table, int write, struct file *filp,
if (write) /* can't happen anyway */
return -EACCES;
if (filp->f_pos) {
if (*ppos) {
*lenp = 0;
return 0;
}
......@@ -63,14 +63,14 @@ static int do_active_device(ctl_table *table, int write, struct file *filp,
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 @@ static int do_autoprobe(ctl_table *table, int write, struct file *filp,
if (write) /* permissions stop this */
return -EACCES;
if (filp->f_pos) {
if (*ppos) {
*lenp = 0;
return 0;
}
......@@ -105,7 +105,7 @@ static int do_autoprobe(ctl_table *table, int write, struct file *filp,
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_autoprobe(ctl_table *table, int write, struct file *filp,
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 @@ static int do_hardware_base_addr (ctl_table *table, int write,
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 @@ static int do_hardware_irq (ctl_table *table, int write,
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 @@ static int do_hardware_dma (ctl_table *table, int write,
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 @@ static int do_hardware_modes (ctl_table *table, int write,
else
*lenp = len;
filp->f_pos += len;
*ppos += len;
return copy_to_user(result, buffer, len) ? -EFAULT : 0;
}
......
......@@ -69,12 +69,12 @@ void reset_coda_cache_inv_stats( void )
}
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_vfs_stats( ctl_table * table, int write, struct file * filp,
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;
}
......
......@@ -46,12 +46,13 @@ xfs_stats_clear_proc_handler(
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");
......
......@@ -82,10 +82,10 @@ void reset_coda_cache_inv_stats( void );
* 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,
......
......@@ -12,7 +12,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
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);
......
......@@ -374,9 +374,9 @@ static inline int is_normal(struct zone *zone)
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. */
......
......@@ -762,24 +762,24 @@ typedef int ctl_handler (ctl_table *table, int __user *name, int nlen,
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,
......
......@@ -86,7 +86,7 @@ extern int laptop_mode;
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);
......
......@@ -301,7 +301,7 @@ extern int ipv4_proc_init(void);
*/
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,
......
......@@ -103,7 +103,8 @@ extern int ndisc_ifinfo_sysctl_change(ctl_table *ctl,
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,
......
This diff is collapsed.
......@@ -191,9 +191,9 @@ static unsigned long set_max_huge_pages(unsigned long count)
#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;
}
......
......@@ -399,9 +399,9 @@ static void wb_kupdate(unsigned long arg)
* 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);
......
......@@ -1955,9 +1955,9 @@ module_init(init_per_zone_pages_min)
* 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 @@ int min_free_kbytes_sysctl_handler(ctl_table *table, int write,
* 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;
}
......
......@@ -800,11 +800,11 @@ static struct nf_hook_ops br_nf_ops[] = {
#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;
......
......@@ -161,7 +161,7 @@ static int min_priority[1];
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 void dn_dev_check_default(struct net_device *dev)
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 @@ static int dn_forwarding_proc(ctl_table *table, int write,
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)
......
......@@ -162,13 +162,14 @@ static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen
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 @@ static int dn_node_address_handler(ctl_table *table, int write,
dn_dev_devices_on();
filp->f_pos += len;
*ppos += len;
return 0;
}
......@@ -206,7 +207,7 @@ static int dn_node_address_handler(ctl_table *table, int write,
return -EFAULT;
*lenp = len;
filp->f_pos += len;
*ppos += len;
return 0;
}
......@@ -273,13 +274,14 @@ static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen,
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 @@ static int dn_def_dev_handler(ctl_table *table, int write,
dev_put(dev);
return -ENODEV;
}
filp->f_pos += *lenp;
*ppos += *lenp;
return 0;
}
......@@ -329,7 +331,7 @@ static int dn_def_dev_handler(ctl_table *table, int write,
return -EFAULT;
*lenp = len;
filp->f_pos += len;
*ppos += len;
return 0;
}
......
......@@ -1151,11 +1151,11 @@ void inet_forward_change(void)
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 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
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);
......
......@@ -1347,13 +1347,13 @@ static int ip_vs_zero_all(void)
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 @@ proc_do_defense_mode(ctl_table *table, int write, struct file * filp,
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 @@ proc_do_sync_threshold(ctl_table *table, int write, struct file *filp,
/* 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));
......
......@@ -2498,10 +2498,10 @@ static int flush_delay;
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;
}
......
......@@ -62,12 +62,12 @@ extern ctl_table ipv4_route_table[];
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();
......
......@@ -3003,13 +3003,13 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
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;
......
......@@ -1423,7 +1423,7 @@ static struct notifier_block ndisc_netdev_notifier = {
};
#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 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f
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
......
......@@ -1924,10 +1924,10 @@ static int flush_delay;
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);
......
......@@ -78,11 +78,11 @@ static int min_lap_keepalive_time = 100; /* 100us */
* 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;
......
......@@ -58,14 +58,14 @@ rpc_unregister_sysctl(void)
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 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
done:
*lenp -= left;
file->f_pos += *lenp;
*ppos += *lenp;
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment