read() from driverfs files can read more bytes
Quoted 6 lines · Patrick Mochel
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]
Quoted 11 lines · Petr Vandrovec
Quoted 6 lines · Patrick Mochel
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
Quoted 3 lines · Patrick Mochel
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.
Quoted 9 lines · Alexander Viro
Quoted 3 lines · Patrick Mochel
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
Quoted 8 lines · Patrick Mochel
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.
Quoted 1 line
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).