diff options
author | Michael Brown | 2010-06-16 02:31:29 +0200 |
---|---|---|
committer | Michael Brown | 2010-06-22 16:50:31 +0200 |
commit | 4327d5d39f101f1df0ace6c03f3b3ada5f6a6213 (patch) | |
tree | ccf92bdfd23046b6c7f64f87b57350f02f63ad6f /src/core/hw.c | |
parent | [interface] Convert all name-resolution interfaces to generic interfaces (diff) | |
download | ipxe-4327d5d39f101f1df0ace6c03f3b3ada5f6a6213.tar.gz ipxe-4327d5d39f101f1df0ace6c03f3b3ada5f6a6213.tar.xz ipxe-4327d5d39f101f1df0ace6c03f3b3ada5f6a6213.zip |
[interface] Convert all data-xfer interfaces to generic interfaces
Remove data-xfer as an interface type, and replace data-xfer
interfaces with generic interfaces supporting the data-xfer methods.
Filter interfaces (as used by the TLS layer) are handled using the
generic pass-through interface capability. A side-effect of this is
that deliver_raw() no longer exists as a data-xfer method. (In
practice this doesn't lose any efficiency, since there are no
instances within the current codebase where xfer_deliver_raw() is used
to pass data to an interface supporting the deliver_raw() method.)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/hw.c')
-rw-r--r-- | src/core/hw.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/core/hw.c b/src/core/hw.c index b4a19027..aca55809 100644 --- a/src/core/hw.c +++ b/src/core/hw.c @@ -15,33 +15,24 @@ struct hw { struct refcnt refcnt; - struct xfer_interface xfer; + struct interface xfer; struct process process; }; static const char hw_msg[] = "Hello world!\n"; static void hw_finished ( struct hw *hw, int rc ) { - xfer_nullify ( &hw->xfer ); - xfer_close ( &hw->xfer, rc ); + intf_shutdown ( &hw->xfer, rc ); process_del ( &hw->process ); } -static void hw_xfer_close ( struct xfer_interface *xfer, int rc ) { - struct hw *hw = container_of ( xfer, struct hw, xfer ); - - hw_finished ( hw, rc ); -} - -static struct xfer_interface_operations hw_xfer_operations = { - .close = hw_xfer_close, - .vredirect = ignore_xfer_vredirect, - .window = unlimited_xfer_window, - .alloc_iob = default_xfer_alloc_iob, - .deliver_iob = xfer_deliver_as_raw, - .deliver_raw = ignore_xfer_deliver_raw, +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 ); int rc; @@ -52,7 +43,7 @@ static void hw_step ( struct process *process ) { } } -static int hw_open ( struct xfer_interface *xfer, struct uri *uri __unused ) { +static int hw_open ( struct interface *xfer, struct uri *uri __unused ) { struct hw *hw; /* Allocate and initialise structure */ @@ -60,11 +51,11 @@ static int hw_open ( struct xfer_interface *xfer, struct uri *uri __unused ) { if ( ! hw ) return -ENOMEM; ref_init ( &hw->refcnt, NULL ); - xfer_init ( &hw->xfer, &hw_xfer_operations, &hw->refcnt ); + intf_init ( &hw->xfer, &hw_xfer_desc, &hw->refcnt ); process_init ( &hw->process, hw_step, &hw->refcnt ); /* Attach parent interface, mortalise self, and return */ - xfer_plug_plug ( &hw->xfer, xfer ); + intf_plug_plug ( &hw->xfer, xfer ); ref_put ( &hw->refcnt ); return 0; } |