diff options
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 b4a190271..aca558099 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; } |
