All of lore.kernel.org
 help / color / mirror / Atom feed
* seq_file and exporting dynamically allocated data
@ 2003-11-14 20:42 Harald Welte
  2003-11-14 21:01 ` Tigran Aivazian
  0 siblings, 1 reply; 28+ messages in thread
From: Harald Welte @ 2003-11-14 20:42 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1747 bytes --]

Hi!

After having hacked up a patch to convert /proc/net/ip_conntrack
to seq_file (which was quite ah experience, I will comment on that in a
different mail), I am facing a different issue.

I haven't found a way to use seq_file for information that is not
exported as a global variable. 

Let's say I have some hash tables that are allocated during runtime of
the system, on users demand.  I have no way of knowing how many there
will be and how the user will want to call them.

For every of those hashtables I want to create a file in /proc and
export the data using seq_file().  Since the data objects are all the
same, I'd like to use the same seq_operations.{start,next,show,stop}
functions.  The whole struct seq_operations would be part of a larger
structure that already exists for every hash table.

However, how do I know which hashtable is to be read, when the
seq_operations.start() function is called?  I would somehow need a
pointer back to the hashtable from the file itself.  And please don't
tell me to call d_path() and find the correct hash table by the
filename.

The problem is, that seq_file is already using the file.private_data
member...

Any ideas?

Thanks for enlightening a networking hacker about the magic of the
virtual filesystem ;)

Please Cc' me in replies, that makes the job easier for my mail filters.

-- 
- Harald Welte <laforge@netfilter.org>             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 #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2003-11-17 10:35 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-14 20:42 seq_file and exporting dynamically allocated data Harald Welte
2003-11-14 21:01 ` Tigran Aivazian
2003-11-15  9:38   ` Harald Welte
2003-11-15 17:18     ` viro
2003-11-15 17:33       ` Harald Welte
2003-11-15 19:49         ` Tigran Aivazian
2003-11-15 20:14           ` viro
2003-11-15 20:41             ` Tigran Aivazian
2003-11-15 21:30               ` viro
2003-11-15 20:50             ` Tigran Aivazian
2003-11-15 21:33               ` viro
2003-11-15 21:54                 ` Tigran Aivazian
2003-11-16  7:27                   ` Tigran Aivazian
2003-11-17  5:48                     ` viro
2003-11-17  8:21                       ` Tigran Aivazian
2003-11-17  8:30                         ` William Lee Irwin III
2003-11-17  8:38                           ` Tigran Aivazian
2003-11-17  8:48                             ` William Lee Irwin III
2003-11-17  9:03                               ` William Lee Irwin III
2003-11-17  9:42                                 ` Tigran Aivazian
2003-11-17  9:50                                   ` William Lee Irwin III
2003-11-17  9:55                                   ` viro
2003-11-17 10:08                                     ` Tigran Aivazian
2003-11-17 10:35                                       ` viro
2003-11-17  9:48                                 ` viro
2003-11-16 20:45               ` Harald Welte
2003-11-15 20:36         ` viro
2003-11-16 20:42           ` Harald Welte

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.