#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <gpxe/refcnt.h>
#include <gpxe/process.h>
#include <gpxe/xfer.h>
#include <gpxe/open.h>
Go to the source code of this file.
Data Structures | |
| struct | hw |
Functions | |
| static void | hw_finished (struct hw *hw, int rc) |
| static void | hw_xfer_close (struct xfer_interface *xfer, int rc) |
| static void | hw_step (struct process *process) |
| static int | hw_open (struct xfer_interface *xfer, struct uri *uri __unused) |
Variables | |
| static const char | hw_msg [] = "Hello world!\n" |
| static struct xfer_interface_operations | hw_xfer_operations |
| struct uri_opener hw_uri_opener | __uri_opener |
Definition in file hw.c.
| static void hw_finished | ( | struct hw * | hw, | |
| int | rc | |||
| ) | [static] |
Definition at line 24 of file hw.c.
References hw::process, process_del(), hw::xfer, and xfer_close().
Referenced by hw_step(), and hw_xfer_close().
00024 { 00025 xfer_nullify ( &hw->xfer ); 00026 xfer_close ( &hw->xfer, rc ); 00027 process_del ( &hw->process ); 00028 }
| static void hw_xfer_close | ( | struct xfer_interface * | xfer, | |
| int | rc | |||
| ) | [static] |
Definition at line 30 of file hw.c.
References container_of, and hw_finished().
00030 { 00031 struct hw *hw = container_of ( xfer, struct hw, xfer ); 00032 00033 hw_finished ( hw, rc ); 00034 }
| static void hw_step | ( | struct process * | process | ) | [static] |
Definition at line 45 of file hw.c.
References container_of, hw_finished(), hw_msg, hw::xfer, xfer_deliver_raw(), and xfer_window().
Referenced by hw_open().
00045 { 00046 struct hw *hw = container_of ( process, struct hw, process ); 00047 int rc; 00048 00049 if ( xfer_window ( &hw->xfer ) ) { 00050 rc = xfer_deliver_raw ( &hw->xfer, hw_msg, sizeof ( hw_msg ) ); 00051 hw_finished ( hw, rc ); 00052 } 00053 }
| static int hw_open | ( | struct xfer_interface * | xfer, | |
| struct uri *uri | __unused | |||
| ) | [static] |
Definition at line 55 of file hw.c.
References ENOMEM, hw_step(), hw::process, process_init(), ref_put(), hw::refcnt, hw::xfer, xfer_init(), and zalloc().
00055 { 00056 struct hw *hw; 00057 00058 /* Allocate and initialise structure */ 00059 hw = zalloc ( sizeof ( *hw ) ); 00060 if ( ! hw ) 00061 return -ENOMEM; 00062 xfer_init ( &hw->xfer, &hw_xfer_operations, &hw->refcnt ); 00063 process_init ( &hw->process, hw_step, &hw->refcnt ); 00064 00065 /* Attach parent interface, mortalise self, and return */ 00066 xfer_plug_plug ( &hw->xfer, xfer ); 00067 ref_put ( &hw->refcnt ); 00068 return 0; 00069 }
const char hw_msg[] = "Hello world!\n" [static] |
struct xfer_interface_operations hw_xfer_operations [static] |
Initial value:
{
.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,
}
| struct uri_opener hw_uri_opener __uri_opener |
1.5.7.1