Re: getting more that 4K out of a proc file? [PATCH]

From: Peter T. Breuer (ptb@it.uc3m.es)
Date: Mon Feb 14 2000 - 01:58:52 EST


"A month of sundays ago Rusty Russell wrote:"
> In message <200002140516.GAA19264@oboe.it.uc3m.es> you write:
> > OK. I don't know from reading the code whether it will or will not mix
> > well with the >3K functionality (or even if the latter was planned).
> > All I can say is that the >3K is apparently working. now that
> > we have figured out how it was meant to be triggered.
>
> You can figure it yourself, fairly easily. If you happen to make
> start point at something less than the page pointer, it will assume
> that you wanted that value to be interpreted as a file offset to be
> added. So providing >3k by ignoring the page provided and pointing
> `start' to a large static area all of your own will ONLY work if that
> area happens to have an addr > page. That's a disaster waiting to
> happen.

This was where I had to make a couple of reverse engineering decisions
in the rewrite of the generic read_prco. I decided there were three and
maybe more modes of use:

    0) 1 page files (< 4k)
    1) more than single page files
    2) files where client controls ppos
    3) files where the client software supplies the buffer

0) is signalled in the old code by start=0. Maintained.
1) is signalled in the old code by start<page. Needs changing.
2) not entirely sure.
3) is signalled in the old code by start>=page. Yerrghhh.

> Yes, the start hack can now be removed: it was insufficient, and
> AFAIK, it was only used in the (removed-in-2.3) ip_fw.c code.

At least mode 1 needs preserving!

> > Storing the rule number in ppos seems strange. I think you should
> > have kept the natural ppos semantics and used a map ppos<->rule index.
>
> Which I keep uptodate as rules get inserted and deleted, how exactly?

You have access to the table of rules? Add and maintain an offset and
len (in terms of chars of printout) for each entry. You can do this
in a separate table, which has these two fields. You need to print the
rule into a buffer when it is first added in order to see how long it
prints out as.

> I don't think you understand the problem. The solution could have
> been to insist that all rules be formatted to uniform length (like the
> 2.0 ip_fw.c code tried to do, only they used %9u not %10u for the
> counters and so failed).

I don't see that. See above.

Peter

-
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/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:26 EST