diff options
author | Michael Brown | 2011-06-24 15:14:41 +0200 |
---|---|---|
committer | Michael Brown | 2011-06-28 15:45:08 +0200 |
commit | e01ec74601b58f54a5e2ae7b9fd1196972034114 (patch) | |
tree | 54f2d2202274523e2365584502dee7db8deca43b /src/core/hw.c | |
parent | [xfer] Send xfer_window_changed() after xfer_vredirect() (diff) | |
download | ipxe-e01ec74601b58f54a5e2ae7b9fd1196972034114.tar.gz ipxe-e01ec74601b58f54a5e2ae7b9fd1196972034114.tar.xz ipxe-e01ec74601b58f54a5e2ae7b9fd1196972034114.zip |
[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/hw.c')
-rw-r--r-- | src/core/hw.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/core/hw.c b/src/core/hw.c index aca55809..e9c9ffc1 100644 --- a/src/core/hw.c +++ b/src/core/hw.c @@ -26,15 +26,7 @@ static void hw_finished ( struct hw *hw, int rc ) { process_del ( &hw->process ); } -static struct interface_operation hw_xfer_operations[] = { - INTF_OP ( intf_close, struct hw *, hw_finished ), -}; - -static struct interface_descriptor hw_xfer_desc = - INTF_DESC ( struct hw, xfer, hw_xfer_operations ); - -static void hw_step ( struct process *process ) { - struct hw *hw = container_of ( process, struct hw, process ); +static void hw_step ( struct hw *hw ) { int rc; if ( xfer_window ( &hw->xfer ) ) { @@ -43,6 +35,16 @@ static void hw_step ( struct process *process ) { } } +static struct interface_operation hw_xfer_operations[] = { + INTF_OP ( intf_close, struct hw *, hw_finished ), +}; + +static struct interface_descriptor hw_xfer_desc = + INTF_DESC ( struct hw, xfer, hw_xfer_operations ); + +static struct process_descriptor hw_process_desc = + PROC_DESC ( struct hw, process, hw_step ); + static int hw_open ( struct interface *xfer, struct uri *uri __unused ) { struct hw *hw; @@ -52,7 +54,7 @@ static int hw_open ( struct interface *xfer, struct uri *uri __unused ) { return -ENOMEM; ref_init ( &hw->refcnt, NULL ); intf_init ( &hw->xfer, &hw_xfer_desc, &hw->refcnt ); - process_init ( &hw->process, hw_step, &hw->refcnt ); + process_init ( &hw->process, &hw_process_desc, &hw->refcnt ); /* Attach parent interface, mortalise self, and return */ intf_plug_plug ( &hw->xfer, xfer ); |