]> git.karo-electronics.de Git - karo-tx-linux.git/commit
[PATCH] Simplify proc/devices and fix early termination regression
authorAndrew Morton <akpm@osdl.org>
Fri, 21 Apr 2006 08:51:36 +0000 (01:51 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 1 May 2006 19:03:43 +0000 (12:03 -0700)
commit692c0509fd0719406f8f781d9a9f2e19aa6b7c0a
tree947a3bfc5610fd194785f9e081ec6439c3972deb
parentebea8457d4b94864a818ae3e6a95655602244935
[PATCH] Simplify proc/devices and fix early termination regression

Repair /proc/devices early-termination regression.

2.6.16 broke /proc/devices.  An application often gets an
EOF before the end of data is reached, if that application
uses a series of short read(2)s to access the data.  I have
used read buffers of varying sizes with varying degrees
of unsuccess (larger sizes get further into the data than
smaller sizes, following a simple pattern).  It appears
that the only safe way to get the data is to use a single
read buffer larger than all the data in /proc/devices.

The following example demonstates the problem:

    # dd if=/proc/devices bs=1
    Character devices:
      1 mem
    27+0 records in
    27+0 records out

This patch is a backport of the fix recently accepted to
Linus's tree:

    commit 68eef3b4791572ecb70249c7fb145bb3742dd899
    [PATCH] Simplify proc/devices and fix early termination regression

It replaces the complex, state-machine algorithm introduced
in 2.6.16 with a simple algorithm, modeled on the implementation
of /proc/interrupts.

[akpm@osdl.org: cleanups, simplifications]

Signed-off-by: Joe Korty <joe.korty@ccur.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
block/genhd.c
fs/char_dev.c
fs/proc/proc_misc.c
include/linux/fs.h