lkml.org 
[lkml]   [2000]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Files in /proc

Sounds like a question for the kernel list.
I'm sending it there.

-Thomas

Mike Williams wrote:
>
> I am developing a driver for a PCI adapter with a sizeable amount of
> memory on it. I would like to use a couple of /proc files to read/write
> various memory location on the adapter interactively to aid in debugging
> the HW and SW. I have created two /proc files, /proc/my_adapter/cntrl
> and /proc/my_adapter/data to do what I want. Commands are written to
> cntrl that indicate what information should be returned when /.../data
> is read. As an example:
>
> echo "read 0x100 20" > .../cntrl
>
> This means that when "cat /proc/my_adapter/data" is executed 20 bytes
> are to be returned starting at offset 0x100 of the adapter address
> space. In the case of cat my proc_read function is given a page
> aligned buffer address with a count(length) of 0x200. I put the 20
> bytes in the buffer, set *eof to a 1 and return 20 to
> proc_file_read(). All is well until the amount of data to be returned
> is greater than the length of the buffer given. I have added smarts to
> my functions to fill the buffer, remember where I stopped and return the
> number of bytes I stuff in the buffer, without setting *eof. I expect
> the /proc subsystem to come back and request more data after giving the
> buffer to the user, in this case cat. It appears to come back with
> another page, with the offset set to 0x200 and a count(length of
> 0x200). I put the remaining bytes of the request in this new buffer,
> set *eof, and return the number of bytes in the buffer. This second
> buffer never appears in the output of cat.
>
> I am developing on RH6.2, running the standard 2.2.14 kernel.
>
> Does anyone know the proper procedure/algorithm for a /proc file
> function that produces output longer than 1 buffer? I have also tried
> "cp /.../data /tmp/xx" and it has the same problem but its beginning
> buffer is 0xc00 long with the secondary buffer being the balance of the
> page at 0x400. Other than that it behaves the same as cat. I have
> tried just returning all the data but at a couple of pages the system
> dies since I have stepped on something. Any pointers to documentation
> or help would be greatly appreciated. I have not had much luck gropping
> through the source to find how this condition is handled. Maybe, /proc
> files are limited to a max of 4K of data?
>
> Mike
>
> --
> Mike Williams Times N Systems
> mikew@timesn.com Braker Bldg. B, Suite P
> 1908 Kramer Lane
> Austin, TX 78758

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.024 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site