I use the hack myself, to implement a record-oriented file where the
file position is a record number. I could probably live with
PAGE_SIZE, but the current hack works fine with start bigger than
that, and it's possible that someone counts on it.
But if you're allocating your own buffer, you'd probably be better
off writing your own file ops, and not using the default
proc_file_read() at all. At the very least you'd save a redundant
__get_free_page/free_page pair.
>Cheers,
>Martin
>
>--
>Martin Wilck <Martin.Wilck@fujitsu-siemens.com>
>FSC EP PS DS1, Paderborn Tel. +49 5251 8 15113
>
>
>--- linux-2.4.5/fs/proc/generic.c Mon Jun 25 13:46:26 2001
>+++ 2.4.5mw/fs/proc/generic.c Tue Jun 26 20:42:22 2001
>@@ -104,14 +104,14 @@
> * return the bytes, and set `start' to the desired offset
> * as an unsigned int. - Paul.Russell@rustcorp.com.au
> */
>- n -= copy_to_user(buf, start < page ? page : start, n);
>+ n -= copy_to_user(buf, (unsigned long) start <
>PAGE_SIZE ? page : start, n);
> if (n == 0) {
> if (retval == 0)
> retval = -EFAULT;
> break;
> }
>
>- *ppos += start < page ? (long)start : n; /* Move down
>the file */
>+ *ppos += (unsigned long) start < PAGE_SIZE ?
>(unsigned long) start : n; /* Move down the file */
> nbytes -= n;
> buf += n;
> retval += n;
-- /Jonathan Lundell. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/