summaryrefslogtreecommitdiffstats
path: root/src/net/udp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/udp')
-rw-r--r--src/net/udp/dhcp.c17
-rw-r--r--src/net/udp/tftp.c6
2 files changed, 11 insertions, 12 deletions
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index 8f8297018..a2d3db6bb 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -517,7 +517,7 @@ static void dhcp_done ( struct dhcp_session *dhcp, int rc ) {
ref_del ( &dhcp->netdev_ref );
/* Mark async operation as complete */
- async_done ( &dhcp->aop, rc );
+ async_done ( &dhcp->async, rc );
}
/** Address for transmitting DHCP requests */
@@ -713,14 +713,15 @@ static void dhcp_forget_netdev ( struct reference *ref ) {
* Initiate DHCP on a network interface
*
* @v dhcp DHCP session
- * @ret aop Asynchronous operation
+ * @v parent Parent asynchronous operation
+ * @ret rc Return status code
*
* If the DHCP operation completes successfully, the
* dhcp_session::options field will be filled in with the resulting
* options block. The caller takes responsibility for eventually
* calling free_dhcp_options().
*/
-struct async_operation * start_dhcp ( struct dhcp_session *dhcp ) {
+int start_dhcp ( struct dhcp_session *dhcp, struct async *parent ) {
int rc;
/* Initialise DHCP session */
@@ -729,10 +730,8 @@ struct async_operation * start_dhcp ( struct dhcp_session *dhcp ) {
dhcp->state = DHCPDISCOVER;
/* Bind to local port */
- if ( ( rc = udp_open ( &dhcp->udp, htons ( BOOTPC_PORT ) ) ) != 0 ) {
- async_done ( &dhcp->aop, rc );
- goto out;
- }
+ if ( ( rc = udp_open ( &dhcp->udp, htons ( BOOTPC_PORT ) ) ) != 0 )
+ return rc;
/* Add persistent reference to net device */
dhcp->netdev_ref.forget = dhcp_forget_netdev;
@@ -741,6 +740,6 @@ struct async_operation * start_dhcp ( struct dhcp_session *dhcp ) {
/* Proof of concept: just send a single DHCPDISCOVER */
dhcp_send_request ( dhcp );
- out:
- return &dhcp->aop;
+ async_init ( &dhcp->async, &default_async_operations, parent );
+ return 0;
}
diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c
index 6753e8380..69650ab0f 100644
--- a/src/net/udp/tftp.c
+++ b/src/net/udp/tftp.c
@@ -142,7 +142,7 @@ static void tftp_done ( struct tftp_session *tftp, int rc ) {
udp_close ( &tftp->udp );
/* Mark async operation as complete */
- async_done ( &tftp->aop, rc );
+ async_done ( &tftp->async, rc );
}
/**
@@ -477,7 +477,7 @@ struct async_operation * tftp_get ( struct tftp_session *tftp ) {
/* Open UDP connection */
if ( ( rc = udp_open ( &tftp->udp, 0 ) ) != 0 ) {
- async_done ( &tftp->aop, rc );
+ async_done ( &tftp->async, rc );
goto out;
}
@@ -485,5 +485,5 @@ struct async_operation * tftp_get ( struct tftp_session *tftp ) {
tftp_send_packet ( tftp );
out:
- return &tftp->aop;
+ return &tftp->async;
}