summaryrefslogtreecommitdiff
path: root/procfs_dir.h
blob: 4eb934e0012ac53a8942ea27595d043c190335fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

/* Each entry associates a name with a callback function for creating new
   nodes corresponding to that entry.  */
struct procfs_dir_entry
{
  const char *name;
  struct node *(*make_node)(void *dir_hook, void *entry_hook);
  void *hook;
};

/* A simple directory is built from a table of entries.  The table is
   terminated by a null NAME pointer.  The DIR_HOOK is passed the
   MAKE_NODE callback function of looked up procfs_dir_entries, and to
   the provided CLEANUP function when the directory is destroyed.
   Returns the new directory node.  If not enough memory can be
   allocated, CLEANUP is invoked immediately and NULL is returned.  */
struct node *
procfs_dir_make_node (const struct procfs_dir_entry *entries,
		      void *dir_hook, void (*cleanup) (void *dir_hook));