On 7 Feb 02 at 10:27, Patrick Mochel wrote:
> Concerning reading/writing from offsets, it's up to the drivers for them
> to either support it or not. In the files I've done so far, I return 0 if
> show() is called with an offset. Which will give different results if you
> read byte-by-byte or an entire chunk.
>
> It makes the callbacks simpler, but it is not technically correct.
What about extremelly nice stuff Al Viro made for us in
fs/seq_file.c ? It made putting stuff into procfs really easy...
Petr Vandrovec
[email protected]
On Thu, 7 Feb 2002, Petr Vandrovec wrote:
> On 7 Feb 02 at 10:27, Patrick Mochel wrote:
>
> > Concerning reading/writing from offsets, it's up to the drivers for them
> > to either support it or not. In the files I've done so far, I return 0 if
> > show() is called with an offset. Which will give different results if you
> > read byte-by-byte or an entire chunk.
> >
> > It makes the callbacks simpler, but it is not technically correct.
>
> What about extremelly nice stuff Al Viro made for us in
> fs/seq_file.c ? It made putting stuff into procfs really easy...
It is really nice, but it's too much for the common case. The goal is to
have each file export one and only one value. Setting up an iterator is
overkill for one value.
-pat
On Thu, 7 Feb 2002, Patrick Mochel wrote:
> It is really nice, but it's too much for the common case. The goal is to
> have each file export one and only one value. Setting up an iterator is
> overkill for one value.
You don't have to use the iterator side of that.
On Thu, 7 Feb 2002, Alexander Viro wrote:
>
>
> On Thu, 7 Feb 2002, Patrick Mochel wrote:
>
> > It is really nice, but it's too much for the common case. The goal is to
> > have each file export one and only one value. Setting up an iterator is
> > overkill for one value.
>
> You don't have to use the iterator side of that.
Well, I'll be...
I like the seq_ stuff, and the ->read() side of things take care of the
issues discussed in this thread. What's even nicer is that if I convert to
that, driver callbacks become something like either:
int driver_show(struct device * dev, struct seq_file * m)
or
int driver_show(struct device * dev, char * buf)
Have you considered doing write()?
-pat
On Thu, 7 Feb 2002, Patrick Mochel wrote:
> issues discussed in this thread. What's even nicer is that if I convert to
> that, driver callbacks become something like either:
>
> int driver_show(struct device * dev, struct seq_file * m)
>
> or
>
> int driver_show(struct device * dev, char * buf)
Preferably the former.
> Have you considered doing write()?
I had and that's going to be resurrected when remount() will be dealt
with (options-parsing both benefits a lot from and is a good testbed for
such helpers).