diff options
author | Jeremie Koenig <jk@jk.fr.eu.org> | 2010-08-17 17:27:54 +0000 |
---|---|---|
committer | Jeremie Koenig <jk@jk.fr.eu.org> | 2010-08-30 14:14:48 +0200 |
commit | 09b121d42e9ba25e103b103bf1f53e1350e084a1 (patch) | |
tree | 6e70904de61182291249e7472591d7b739775543 /procfs_dir.h | |
parent | ef3adf6d159d566d83335cfe55a72206d492d838 (diff) |
More cleanup possibilities
* procfs.c, procfs.h: Extend the signature of the
cleanup_contents callback in the procfs_node_ops structure to include
the hook and contents_len. (cleanup_contents_with_free,
cleanup_contents_with_vm_deallocate): New functions, can be used as
a cleanup_contents callback for simple cases.
* procfs_dir.c, procfs_dir.h (procfs_dir_make_node):
Update, add a cleanup callback, make sure the cleanup callback is
invoked if there is an error.
* proclist.c (proclist_make_node), main.c (main): Update to match
the new interfaces.
Diffstat (limited to 'procfs_dir.h')
-rw-r--r-- | procfs_dir.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/procfs_dir.h b/procfs_dir.h index 1ba45ad0..4eb934e0 100644 --- a/procfs_dir.h +++ b/procfs_dir.h @@ -9,7 +9,12 @@ struct procfs_dir_entry }; /* A simple directory is built from a table of entries. The table is - terminated by a null NAME pointer. */ + 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); +procfs_dir_make_node (const struct procfs_dir_entry *entries, + void *dir_hook, void (*cleanup) (void *dir_hook)); |