Re: seq_file and exporting dynamically allocated data

From: Harald Welte
Date: Sat Nov 15 2003 - 14:22:59 EST


On Sat, Nov 15, 2003 at 05:18:44PM +0000, viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
> On Sat, Nov 15, 2003 at 10:38:33AM +0100, Harald Welte wrote:
> > that doesn't help. As I am aware, the seq_file structure is only
> > allocated in the seq_open() call. How does seq_open() know which
> > private data (i.e. hash table) to associate with struct file?
>
> Why should seq_open() know that? Its caller does and it can set the damn
> thing to whatever it wants.

So who is the caller? it's the ->open() member of struct
file_operations. and struct file_operations doesn't have some private
member where I could hide my pointer before saving it to
seq_file.private in seq_open().

> Wrong.

Hm, maybe somebody could enlighten me then. Maybe this is a stupid
qestion, but I wasn't able to figure that out after reading all the
structures, etc.

--
- Harald Welte <laforge@xxxxxxxxxxxxx> http://www.netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie

Attachment: pgp00001.pgp
Description: PGP signature