From e1564ac345ad5204c20df381196a8db44e8e3b86 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 2 Aug 2004 05:20:37 -0700 Subject: [NET]: Add skb_iter functions. There's no convenient function to walk the data of an skbuff; provide one. Netfilter extensions in particular can use this to examine packet contents without needing an entire copy. I originally wrote an 'skb_walk(skb, fn, data)' function, but open iterators are easier to use for complex cases. Signed-off-by: Rusty Russell Signed-off-by: David S. Miller --- include/linux/skbuff.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/linux') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 11f514844817..724d6841d0ae 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1108,6 +1108,22 @@ extern void skb_split(struct sk_buff *skb, extern void skb_init(void); extern void skb_add_mtu(int mtu); +struct skb_iter { + /* Iteration functions set these */ + unsigned char *data; + unsigned int len; + + /* Private to iteration */ + unsigned int nextfrag; + struct sk_buff *fraglist; +}; + +/* Keep iterating until skb_iter_next returns false. */ +extern void skb_iter_first(const struct sk_buff *skb, struct skb_iter *i); +extern int skb_iter_next(const struct sk_buff *skb, struct skb_iter *i); +/* Call this if aborting loop before !skb_iter_next */ +extern void skb_iter_abort(const struct sk_buff *skb, struct skb_iter *i); + #ifdef CONFIG_NETFILTER static inline void nf_conntrack_put(struct nf_ct_info *nfct) { -- cgit v1.2.3 From 251f4c317c0d60922313476cabf37d755c88244d Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 3 Aug 2004 23:30:46 -0700 Subject: [PKT_SCHED]: Use double-linked list for dev->qdisc_list Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netdevice.h | 2 +- include/net/pkt_sched.h | 2 +- net/sched/sch_api.c | 27 ++++++++++++++++----------- net/sched/sch_generic.c | 24 +++++------------------- 4 files changed, 23 insertions(+), 32 deletions(-) (limited to 'include/linux') diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 53c73157ed74..5edb93f163c1 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -362,8 +362,8 @@ struct net_device struct Qdisc *qdisc; struct Qdisc *qdisc_sleeping; - struct Qdisc *qdisc_list; struct Qdisc *qdisc_ingress; + struct list_head qdisc_list; unsigned long tx_queue_len; /* Max frames per queue allowed */ /* ingress path synchronizer */ diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 159f8ebf4bb5..f2e29fd92c19 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -78,11 +78,11 @@ struct Qdisc #define TCQ_F_THROTTLED 2 #define TCQ_F_INGRES 4 struct Qdisc_ops *ops; - struct Qdisc *next; u32 handle; atomic_t refcnt; struct sk_buff_head q; struct net_device *dev; + struct list_head list; struct tc_stats stats; spinlock_t *stats_lock; diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 80cd0adfbdf9..a69089d442d4 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -195,7 +196,7 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle) { struct Qdisc *q; - for (q = dev->qdisc_list; q; q = q->next) { + list_for_each_entry(q, &dev->qdisc_list, list) { if (q->handle == handle) return q; } @@ -421,6 +422,7 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) memset(sch, 0, size); + INIT_LIST_HEAD(&sch->list); skb_queue_head_init(&sch->q); if (handle == TC_H_INGRESS) @@ -454,8 +456,7 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) smp_wmb(); if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) { qdisc_lock_tree(dev); - sch->next = dev->qdisc_list; - dev->qdisc_list = sch; + list_add_tail(&sch->list, &dev->qdisc_list); qdisc_unlock_tree(dev); #ifdef CONFIG_NET_ESTIMATOR @@ -814,9 +815,9 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) if (idx > s_idx) s_q_idx = 0; read_lock_bh(&qdisc_tree_lock); - for (q = dev->qdisc_list, q_idx = 0; q; - q = q->next, q_idx++) { - if (q_idx < s_q_idx) + q_idx = 0; + list_for_each_entry(q, &dev->qdisc_list, list) { + if (q_idx++ < s_q_idx) continue; if (tc_fill_qdisc(skb, q, 0, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) { @@ -831,7 +832,7 @@ done: read_unlock(&dev_base_lock); cb->args[0] = idx; - cb->args[1] = q_idx; + cb->args[1] = q_idx - 1; return skb->len; } @@ -1033,13 +1034,16 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) return 0; s_t = cb->args[0]; + t = 0; read_lock_bh(&qdisc_tree_lock); - for (q=dev->qdisc_list, t=0; q; q = q->next, t++) { - if (t < s_t) continue; - if (!q->ops->cl_ops) continue; - if (tcm->tcm_parent && TC_H_MAJ(tcm->tcm_parent) != q->handle) + list_for_each_entry(q, &dev->qdisc_list, list) { + if (t < s_t || !q->ops->cl_ops || + (tcm->tcm_parent && + TC_H_MAJ(tcm->tcm_parent) != q->handle)) { + t++; continue; + } if (t > s_t) memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(cb->args[0])); arg.w.fn = qdisc_class_dump; @@ -1052,6 +1056,7 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) cb->args[1] = arg.w.count; if (arg.w.stop) break; + t++; } read_unlock_bh(&qdisc_tree_lock); diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index d9e6a0860667..addece5b15c6 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -394,6 +395,7 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops) return NULL; memset(sch, 0, size); + INIT_LIST_HEAD(&sch->list); skb_queue_head_init(&sch->q); sch->ops = ops; sch->enqueue = ops->enqueue; @@ -450,20 +452,9 @@ static void __qdisc_destroy(struct rcu_head *head) void qdisc_destroy(struct Qdisc *qdisc) { - struct net_device *dev = qdisc->dev; - if (!atomic_dec_and_test(&qdisc->refcnt)) return; - - if (dev) { - struct Qdisc *q, **qp; - for (qp = &qdisc->dev->qdisc_list; (q=*qp) != NULL; qp = &q->next) { - if (q == qdisc) { - *qp = q->next; - break; - } - } - } + list_del(&qdisc->list); call_rcu(&qdisc->q_rcu, __qdisc_destroy); } @@ -483,12 +474,9 @@ void dev_activate(struct net_device *dev) printk(KERN_INFO "%s: activation failed\n", dev->name); return; } - write_lock_bh(&qdisc_tree_lock); - qdisc->next = dev->qdisc_list; - dev->qdisc_list = qdisc; + list_add_tail(&qdisc->list, &dev->qdisc_list); write_unlock_bh(&qdisc_tree_lock); - } else { qdisc = &noqueue_qdisc; } @@ -530,7 +518,7 @@ void dev_init_scheduler(struct net_device *dev) qdisc_lock_tree(dev); dev->qdisc = &noop_qdisc; dev->qdisc_sleeping = &noop_qdisc; - dev->qdisc_list = NULL; + INIT_LIST_HEAD(&dev->qdisc_list); qdisc_unlock_tree(dev); dev_watchdog_init(dev); @@ -551,9 +539,7 @@ void dev_shutdown(struct net_device *dev) qdisc_destroy(qdisc); } #endif - BUG_TRAP(dev->qdisc_list == NULL); BUG_TRAP(!timer_pending(&dev->watchdog_timer)); - dev->qdisc_list = NULL; qdisc_unlock_tree(dev); } -- cgit v1.2.3 From 4a47ae69a72d3d8e92cfaa58e8d5a977ded1543d Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 6 Aug 2004 22:12:52 -0700 Subject: Add infrastructure for the VFS layer to mark files seekable. We use a FMODE_LSEEK flag to match the existing read/write bits. This allows us to check for seekability on a VFS level for lseek/pread/pwrite, and cleans things up. Update some sites that used the numeric constants to use the symbolic values instead. --- fs/fifo.c | 1 + fs/file_table.c | 2 +- fs/nfsd/nfs4state.c | 4 ++-- fs/open.c | 2 +- fs/pipe.c | 4 ++-- fs/read_write.c | 17 ++++++++++++----- include/linux/fs.h | 1 + net/socket.c | 2 +- 8 files changed, 21 insertions(+), 12 deletions(-) (limited to 'include/linux') diff --git a/fs/fifo.c b/fs/fifo.c index 7a6a018303d7..fcdc9952c712 100644 --- a/fs/fifo.c +++ b/fs/fifo.c @@ -44,6 +44,7 @@ static int fifo_open(struct inode *inode, struct file *filp) goto err_nocleanup; } filp->f_version = 0; + filp->f_mode &= ~FMODE_LSEEK; switch (filp->f_mode) { case 1: diff --git a/fs/file_table.c b/fs/file_table.c index 5d56ec5db141..8a4bd0398e34 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -117,7 +117,7 @@ int open_private_file(struct file *filp, struct dentry *dentry, int flags) memset(filp, 0, sizeof(*filp)); eventpoll_init_file(filp); filp->f_flags = flags; - filp->f_mode = (flags+1) & O_ACCMODE; + filp->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK; atomic_set(&filp->f_count, 1); filp->f_dentry = dentry; filp->f_mapping = dentry->d_inode->i_mapping; diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 4df0dedef709..342003bd23d4 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1141,7 +1141,7 @@ int status; if (share_access & NFS4_SHARE_ACCESS_WRITE) { status = get_write_access(filp->f_dentry->d_inode); if (!status) - filp->f_mode = FMODE_WRITE; + filp->f_mode = FMODE_WRITE | FMODE_LSEEK; else return nfserrno(status); } @@ -1153,7 +1153,7 @@ nfs4_file_downgrade(struct file *filp, unsigned int share_access) { if (share_access & NFS4_SHARE_ACCESS_WRITE) { put_write_access(filp->f_dentry->d_inode); - filp->f_mode = FMODE_READ; + filp->f_mode = FMODE_READ | FMODE_LSEEK; } } diff --git a/fs/open.c b/fs/open.c index 854c5de744db..098ac8d30db2 100644 --- a/fs/open.c +++ b/fs/open.c @@ -781,7 +781,7 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags) if (!f) goto cleanup_dentry; f->f_flags = flags; - f->f_mode = (flags+1) & O_ACCMODE; + f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK; inode = dentry->d_inode; if (f->f_mode & FMODE_WRITE) { error = get_write_access(inode); diff --git a/fs/pipe.c b/fs/pipe.c index 737271c0c9b9..f0e16609595a 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -656,13 +656,13 @@ int do_pipe(int *fd) f1->f_pos = f2->f_pos = 0; f1->f_flags = O_RDONLY; f1->f_op = &read_pipe_fops; - f1->f_mode = 1; + f1->f_mode = FMODE_READ; f1->f_version = 0; /* write file */ f2->f_flags = O_WRONLY; f2->f_op = &write_pipe_fops; - f2->f_mode = 2; + f2->f_mode = FMODE_WRITE; f2->f_version = 0; fd_install(i, f1); diff --git a/fs/read_write.c b/fs/read_write.c index 481332642515..6b226d11b606 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -113,9 +113,12 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin) { loff_t (*fn)(struct file *, loff_t, int); - fn = default_llseek; - if (file->f_op && file->f_op->llseek) - fn = file->f_op->llseek; + fn = no_llseek; + if (file->f_mode & FMODE_LSEEK) { + fn = default_llseek; + if (file->f_op && file->f_op->llseek) + fn = file->f_op->llseek; + } return fn(file, offset, origin); } EXPORT_SYMBOL(vfs_llseek); @@ -310,7 +313,9 @@ asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, file = fget_light(fd, &fput_needed); if (file) { - ret = vfs_read(file, buf, count, &pos); + ret = -ESPIPE; + if (file->f_mode & FMODE_LSEEK) + ret = vfs_read(file, buf, count, &pos); fput_light(file, fput_needed); } @@ -329,7 +334,9 @@ asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, file = fget_light(fd, &fput_needed); if (file) { - ret = vfs_write(file, buf, count, &pos); + ret = -ESPIPE; + if (file->f_mode & FMODE_LSEEK) + ret = vfs_write(file, buf, count, &pos); fput_light(file, fput_needed); } diff --git a/include/linux/fs.h b/include/linux/fs.h index 22dd6acdf9f1..44dbcaea3ebd 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -74,6 +74,7 @@ extern int leases_enable, dir_notify_enable, lease_break_time; #define FMODE_READ 1 #define FMODE_WRITE 2 +#define FMODE_LSEEK 4 /* Internal kernel extension */ #define RW_MASK 1 #define RWA_MASK 2 diff --git a/net/socket.c b/net/socket.c index 5bb81ec300e2..58398204d92c 100644 --- a/net/socket.c +++ b/net/socket.c @@ -401,7 +401,7 @@ int sock_map_fd(struct socket *sock) sock->file = file; file->f_op = SOCK_INODE(sock)->i_fop = &socket_file_ops; - file->f_mode = 3; + file->f_mode = FMODE_READ | FMODE_WRITE; file->f_flags = O_RDWR; file->f_pos = 0; fd_install(fd, file); -- cgit v1.2.3 From 915a29ec1c5e34283a6231af1036114e4d612cb0 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 7 Aug 2004 02:08:23 -0700 Subject: Add pread/pwrite support bits to match the lseek bit. This also removes the ESPIPE logic from pipes and seq_files, since the VFS layer now supports it. --- arch/mips/kernel/linux32.c | 7 +++++++ fs/fifo.c | 4 +++- fs/file_table.c | 2 +- fs/nfsd/nfs4state.c | 7 +++---- fs/open.c | 2 +- fs/pipe.c | 8 -------- fs/read_write.c | 4 ++-- fs/seq_file.c | 6 +++--- include/linux/fs.h | 6 +++++- 9 files changed, 25 insertions(+), 21 deletions(-) (limited to 'include/linux') diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index bcb3e0c5a3ec..afd36307070a 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c @@ -477,6 +477,9 @@ asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf, goto out; if (pos < 0) goto out; + ret = -ESPIPE; + if (!(file->f_mode & FMODE_PREAD)) + goto out; ret = read(file, buf, count, &pos); if (ret > 0) dnotify_parent(file->f_dentry, DN_ACCESS); @@ -511,6 +514,10 @@ asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf, if (pos < 0) goto out; + ret = -ESPIPE; + if (!(file->f_mode & FMODE_PWRITE)) + goto out; + ret = write(file, buf, count, &pos); if (ret > 0) dnotify_parent(file->f_dentry, DN_MODIFY); diff --git a/fs/fifo.c b/fs/fifo.c index fcdc9952c712..a045fa71630c 100644 --- a/fs/fifo.c +++ b/fs/fifo.c @@ -44,7 +44,9 @@ static int fifo_open(struct inode *inode, struct file *filp) goto err_nocleanup; } filp->f_version = 0; - filp->f_mode &= ~FMODE_LSEEK; + + /* We can only do regular read/write on fifos */ + filp->f_mode &= (FMODE_READ | FMODE_WRITE); switch (filp->f_mode) { case 1: diff --git a/fs/file_table.c b/fs/file_table.c index 8a4bd0398e34..6e97427ff0d8 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -117,7 +117,7 @@ int open_private_file(struct file *filp, struct dentry *dentry, int flags) memset(filp, 0, sizeof(*filp)); eventpoll_init_file(filp); filp->f_flags = flags; - filp->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK; + filp->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE; atomic_set(&filp->f_count, 1); filp->f_dentry = dentry; filp->f_mapping = dentry->d_inode->i_mapping; diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 342003bd23d4..0ff4425cae9a 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1140,10 +1140,9 @@ int status; if (share_access & NFS4_SHARE_ACCESS_WRITE) { status = get_write_access(filp->f_dentry->d_inode); - if (!status) - filp->f_mode = FMODE_WRITE | FMODE_LSEEK; - else + if (status) return nfserrno(status); + filp->f_mode = (filp->f_mode | FMODE_WRITE) & ~FMODE_READ; } return nfs_ok; } @@ -1153,7 +1152,7 @@ nfs4_file_downgrade(struct file *filp, unsigned int share_access) { if (share_access & NFS4_SHARE_ACCESS_WRITE) { put_write_access(filp->f_dentry->d_inode); - filp->f_mode = FMODE_READ | FMODE_LSEEK; + filp->f_mode = (filp->f_mode | FMODE_READ) & ~FMODE_WRITE; } } diff --git a/fs/open.c b/fs/open.c index 098ac8d30db2..22d42e94fc18 100644 --- a/fs/open.c +++ b/fs/open.c @@ -781,7 +781,7 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags) if (!f) goto cleanup_dentry; f->f_flags = flags; - f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK; + f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE; inode = dentry->d_inode; if (f->f_mode & FMODE_WRITE) { error = get_write_access(inode); diff --git a/fs/pipe.c b/fs/pipe.c index f0e16609595a..2b42a25a414e 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -94,10 +94,6 @@ pipe_readv(struct file *filp, const struct iovec *_iov, struct iovec *iov = (struct iovec *)_iov; size_t total_len; - /* pread is not allowed on pipes. */ - if (unlikely(ppos != &filp->f_pos)) - return -ESPIPE; - total_len = iov_length(iov, nr_segs); /* Null read succeeds. */ if (unlikely(total_len == 0)) @@ -187,10 +183,6 @@ pipe_writev(struct file *filp, const struct iovec *_iov, struct iovec *iov = (struct iovec *)_iov; size_t total_len; - /* pwrite is not allowed on pipes. */ - if (unlikely(ppos != &filp->f_pos)) - return -ESPIPE; - total_len = iov_length(iov, nr_segs); /* Null write succeeds. */ if (unlikely(total_len == 0)) diff --git a/fs/read_write.c b/fs/read_write.c index 6b226d11b606..33ce2284c9d0 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -314,7 +314,7 @@ asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, file = fget_light(fd, &fput_needed); if (file) { ret = -ESPIPE; - if (file->f_mode & FMODE_LSEEK) + if (file->f_mode & FMODE_PREAD) ret = vfs_read(file, buf, count, &pos); fput_light(file, fput_needed); } @@ -335,7 +335,7 @@ asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, file = fget_light(fd, &fput_needed); if (file) { ret = -ESPIPE; - if (file->f_mode & FMODE_LSEEK) + if (file->f_mode & FMODE_PWRITE) ret = vfs_write(file, buf, count, &pos); fput_light(file, fput_needed); } diff --git a/fs/seq_file.c b/fs/seq_file.c index 8bd7097f3cfb..5a73e085fb4e 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -35,6 +35,9 @@ int seq_open(struct file *file, struct seq_operations *op) sema_init(&p->sem, 1); p->op = op; file->private_data = p; + + /* SEQ files support lseek, but not pread/pwrite */ + file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE); return 0; } EXPORT_SYMBOL(seq_open); @@ -54,9 +57,6 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) void *p; int err = 0; - if (ppos != &file->f_pos) - return -EPIPE; - down(&m->sem); /* grab buffer if we didn't have one */ if (!m->buf) { diff --git a/include/linux/fs.h b/include/linux/fs.h index 44dbcaea3ebd..d352f8678258 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -74,7 +74,11 @@ extern int leases_enable, dir_notify_enable, lease_break_time; #define FMODE_READ 1 #define FMODE_WRITE 2 -#define FMODE_LSEEK 4 /* Internal kernel extension */ + +/* Internal kernel extensions */ +#define FMODE_LSEEK 4 +#define FMODE_PREAD 8 +#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ #define RW_MASK 1 #define RWA_MASK 2 -- cgit v1.2.3 From ae61518fec12b954a5f56c6ad2aad1370e6f9174 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 7 Aug 2004 04:54:18 -0700 Subject: Add "nonseekable_open()" helper functions for nonseekable file descriptors. --- fs/open.c | 12 ++++++++++++ include/linux/fs.h | 1 + 2 files changed, 13 insertions(+) (limited to 'include/linux') diff --git a/fs/open.c b/fs/open.c index 22d42e94fc18..8e539937ceca 100644 --- a/fs/open.c +++ b/fs/open.c @@ -1070,3 +1070,15 @@ int generic_file_open(struct inode * inode, struct file * filp) } EXPORT_SYMBOL(generic_file_open); + +/* + * This is used by subsystems that don't want seekable + * file descriptors + */ +int nonseekable_open(struct inode *inode, struct file *filp) +{ + filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE); + return 0; +} + +EXPORT_SYMBOL(nonseekable_open); diff --git a/include/linux/fs.h b/include/linux/fs.h index d352f8678258..e6f97b00fe34 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1435,6 +1435,7 @@ extern loff_t no_llseek(struct file *file, loff_t offset, int origin); extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); extern loff_t remote_llseek(struct file *file, loff_t offset, int origin); extern int generic_file_open(struct inode * inode, struct file * filp); +extern int nonseekable_open(struct inode * inode, struct file * filp); static inline void do_generic_file_read(struct file * filp, loff_t *ppos, read_descriptor_t * desc, -- cgit v1.2.3 From f7a4bc7ee10c8e39e80b3e84f227a5752b0092d9 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 7 Aug 2004 09:43:47 -0700 Subject: 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(-) (limited to 'include/linux') diff --git a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c index 29ff57bbab54..91592c03ea8b 100644 --- a/arch/ppc/kernel/ppc_htab.c +++ b/arch/ppc/kernel/ppc_htab.c @@ -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; } diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c index 1395840ba98f..3589f48ded47 100644 --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c @@ -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 @@ out: */ 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 @@ out: */ 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; } diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c index 170da71fa2ff..cb2950301061 100644 --- a/arch/s390/mm/cmm.c +++ b/arch/s390/mm/cmm.c @@ -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; } diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index bfdc4d24a2c7..360d4b64a42e 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -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) { diff --git a/drivers/char/random.c b/drivers/char/random.c index f51b541120e2..a86545f32d63 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -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, diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c index 510214470955..161e8a27c6c5 100644 --- a/drivers/cpufreq/cpufreq_userspace.c +++ b/drivers/cpufreq/cpufreq_userspace.c @@ -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; } diff --git a/drivers/net/wireless/arlan-proc.c b/drivers/net/wireless/arlan-proc.c index b2e01523cb2b..86da31cac5ee 100644 --- a/drivers/net/wireless/arlan-proc.c +++ b/drivers/net/wireless/arlan-proc.c @@ -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 @@ final: *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 @@ final: 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 @@ final: 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); } diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c index afa6ac45a5da..061097fd8117 100644 --- a/drivers/parport/procfs.c +++ b/drivers/parport/procfs.c @@ -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; } diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c index 60fc6f9ce240..fd98626ba280 100644 --- a/fs/coda/sysctl.c +++ b/fs/coda/sysctl.c @@ -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; } diff --git a/fs/xfs/linux-2.6/xfs_sysctl.c b/fs/xfs/linux-2.6/xfs_sysctl.c index 570d1a942507..4a173d3d8916 100644 --- a/fs/xfs/linux-2.6/xfs_sysctl.c +++ b/fs/xfs/linux-2.6/xfs_sysctl.c @@ -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"); diff --git a/include/linux/coda_proc.h b/include/linux/coda_proc.h index 5bf752163790..c061a22ed86d 100644 --- a/include/linux/coda_proc.h +++ b/include/linux/coda_proc.h @@ -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, diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 5e578c036157..954af9d82768 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -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); diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 8958b0e6af06..8a23709fe18a 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -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 /* Returns the number of the current Node. */ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 38acd5d4b691..70ac59e6a41f 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -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, diff --git a/include/linux/writeback.h b/include/linux/writeback.h index f557b55e8b0a..e4450070ac78 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -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); diff --git a/include/net/ip.h b/include/net/ip.h index 70bb6f887988..bacccde1c078 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -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, diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 95684d3363c1..61d7033bca7f 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -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, diff --git a/kernel/sysctl.c b/kernel/sysctl.c index e7435ba0f35b..2a643c00e9ad 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -123,7 +123,7 @@ extern int acct_parm[]; 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 @@ static ssize_t do_rw_proc(int write, struct file * file, char __user * buf, 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 @@ static ssize_t proc_writesys(struct file * file, const char __user * buf, * 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 @@ int proc_dostring(ctl_table *table, int write, struct file *filp, 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 @@ int proc_dostring(ctl_table *table, int write, struct file *filp, len++; } *lenp = len; - filp->f_pos += len; + *ppos += len; } return 0; } @@ -1395,17 +1391,17 @@ int proc_dostring(ctl_table *table, int write, struct file *filp, */ 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_conv(int *negp, unsigned long *lvalp, } 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 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp, char __user *s = buffer; if (!table->data || !table->maxlen || !*lenp || - (filp->f_pos && !write)) { + (*ppos && !write)) { *lenp = 0; return 0; } @@ -1534,7 +1530,7 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp, if (write && first) return -EINVAL; *lenp -= left; - filp->f_pos += *lenp; + *ppos += *lenp; return 0; #undef TMPBUFLEN } @@ -1553,9 +1549,9 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp, * 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 @@ static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp, */ 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 @@ int proc_dointvec_bset(ctl_table *table, int write, struct file *filp, } 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 @@ static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp, * 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, ¶m); } 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 @@ static int do_proc_doulongvec_minmax(ctl_table *table, int write, char __user *s = buffer; if (!table->data || !table->maxlen || !*lenp || - (filp->f_pos && !write)) { + (*ppos && !write)) { *lenp = 0; return 0; } @@ -1769,7 +1766,7 @@ static int do_proc_doulongvec_minmax(ctl_table *table, int write, if (write && first) return -EINVAL; *lenp -= left; - filp->f_pos += *lenp; + *ppos += *lenp; return 0; #undef TMPBUFLEN } @@ -1791,9 +1788,9 @@ static int do_proc_doulongvec_minmax(ctl_table *table, int write, * 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_minmax(ctl_table *table, int write, struct file *filp, */ 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 @@ static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp, * 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 @@ int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp, * 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 sysctl_jiffies(ctl_table *table, int __user *name, int nlen, } 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 --git a/mm/hugetlb.c b/mm/hugetlb.c index 1c1cf7daceac..6c522e127033 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -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; } diff --git a/mm/page-writeback.c b/mm/page-writeback.c index a2aa511adf9a..343998d46bb0 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -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); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 60522982ad3f..6708f4f80b43 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -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; } diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 7313d06c9328..404dda32b2f9 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c @@ -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; diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 6b6e49a9eb23..11b0f0c6d45c 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c @@ -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) diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c index 65ce3bb9563b..02bca49cb508 100644 --- a/net/decnet/sysctl_net_decnet.c +++ b/net/decnet/sysctl_net_decnet.c @@ -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; } diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 2dc4e7a8ade8..4781dea42dfe 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -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); diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 5df55ca9eef0..d90a7935623f 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c @@ -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)); diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 37c9d31c3880..15d9eca5384e 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -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; } diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 6b0b74430e28..55cc269224db 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -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(); diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 1305cf851707..40ad73c5cbb7 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -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; diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 3e8767628a95..b278e5a04ca8 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -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 diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 143543f262a6..2017c69dc9f3 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -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); diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c index 995f4e15cce5..cdcb320b56d1 100644 --- a/net/irda/irsysctl.c +++ b/net/irda/irsysctl.c @@ -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; diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index e69a7fbb489c..1b9616a12e24 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c @@ -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; } -- cgit v1.2.3 From dcff0e756ca34d301e760ae751eaf285c81a5a51 Mon Sep 17 00:00:00 2001 From: Johannes Stezenbach Date: Mon, 9 Aug 2004 02:46:38 -0700 Subject: [PATCH] dvb: missing includes Although the current DVB stuff compiles fine, for correctness the following patch adds the necessary include for __user annotations. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/dvb/osd.h | 2 ++ include/linux/dvb/video.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'include/linux') diff --git a/include/linux/dvb/osd.h b/include/linux/dvb/osd.h index 5ccf27457e1b..cdaff25eccc3 100644 --- a/include/linux/dvb/osd.h +++ b/include/linux/dvb/osd.h @@ -24,6 +24,8 @@ #ifndef _DVBOSD_H_ #define _DVBOSD_H_ +#include + typedef enum { // All functions return -2 on "not open" OSD_Close=1, // () diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h index 8fb2eb336336..2ed5d7bc4cbc 100644 --- a/include/linux/dvb/video.h +++ b/include/linux/dvb/video.h @@ -24,6 +24,8 @@ #ifndef _DVBVIDEO_H_ #define _DVBVIDEO_H_ +#include + #ifdef __KERNEL__ #include #else -- cgit v1.2.3