diff options
author | Michael Brown <mcb30@ipxe.org> | 2011-06-24 14:14:41 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2011-06-28 14:45:08 +0100 |
commit | e01ec74601b58f54a5e2ae7b9fd1196972034114 (patch) | |
tree | 54f2d2202274523e2365584502dee7db8deca43b /src/core/resolv.c | |
parent | ba3633782bd36831ca5471d792e626b7e8344e0c (diff) | |
download | ipxe-e01ec74601b58f54a5e2ae7b9fd1196972034114.tar.gz |
[process] Pass containing object pointer to process step() methods
Give the step() method a pointer to the containing object, rather than
a pointer to the process. This is consistent with the operation of
interface methods, and allows a single function to serve as both an
interface method and a process step() method.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/resolv.c')
-rw-r--r-- | src/core/resolv.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/resolv.c b/src/core/resolv.c index 91f0c15c..9edfcead 100644 --- a/src/core/resolv.c +++ b/src/core/resolv.c @@ -86,16 +86,17 @@ struct numeric_resolv { int rc; }; -static void numeric_step ( struct process *process ) { - struct numeric_resolv *numeric = - container_of ( process, struct numeric_resolv, process ); +static void numeric_step ( struct numeric_resolv *numeric ) { - process_del ( process ); + process_del ( &numeric->process ); if ( numeric->rc == 0 ) resolv_done ( &numeric->resolv, &numeric->sa ); intf_shutdown ( &numeric->resolv, numeric->rc ); } +static struct process_descriptor numeric_process_desc = + PROC_DESC ( struct numeric_resolv, process, numeric_step ); + static int numeric_resolv ( struct interface *resolv, const char *name, struct sockaddr *sa ) { struct numeric_resolv *numeric; @@ -107,7 +108,8 @@ static int numeric_resolv ( struct interface *resolv, return -ENOMEM; ref_init ( &numeric->refcnt, NULL ); intf_init ( &numeric->resolv, &null_intf_desc, &numeric->refcnt ); - process_init ( &numeric->process, numeric_step, &numeric->refcnt ); + process_init ( &numeric->process, &numeric_process_desc, + &numeric->refcnt ); memcpy ( &numeric->sa, sa, sizeof ( numeric->sa ) ); DBGC ( numeric, "NUMERIC %p attempting to resolve \"%s\"\n", |