[lkml]   [2003]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: seq_file and exporting dynamically allocated data
On Sat, Nov 15, 2003 at 08:36:07PM +0000, wrote:

> > 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().
> If arguments of ->open() were not enough to find your data, how the hell would
> current code manage to find it?
> You've got inode; you've got (if that's on procfs) proc_dir_entry - from
> inode; you've got dentry (from struct file *). If that's not enough to
> find your data, what is?

thanks, I've now found a way to deal with the problem. after calling
create_proc_entry(), I put a pointer to my hash table in
proc_dir_entry->data. The proc_dir_entry->proc_fops->open() function
then calls seq_open() and sets seq_file->private to PDE(inode). This
way the seq_operations->start/next/show functions can find out the

> Which files do you have in mind?

It's not part of the stock kernel, but something I've been working on
the last couple of days. An iptables match module called 'dstlimit'.

This match creates a new hash table (yes a table, not just an entry) for
every rule in which you use that match. Mainly for testing/debugging
purpose, I want to be able to read the contents of each hash table via a
/proc file (/proc/net/ipt_dstlimit/*).

The implementation is now done in the way I described above, and it
seems to be working quite fine.

Thanks to everybody helping me with this issue.

- Harald Welte <>
"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
[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2005-03-22 13:58    [W:0.058 / U:29.480 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site