summaryrefslogtreecommitdiffstats
path: root/src/usr/dhcpmgmt.c
diff options
context:
space:
mode:
authorMichael Brown2007-01-16 09:10:54 +0100
committerMichael Brown2007-01-16 09:10:54 +0100
commitff8528ea9a69ca2ef6cfbed0b7a1283e165aabe6 (patch)
treebae0e953c128a5d49bedd2f502325b938078635f /src/usr/dhcpmgmt.c
parentWhen a network device is specified to tcpip_tx() or it's children, treat (diff)
downloadipxe-ff8528ea9a69ca2ef6cfbed0b7a1283e165aabe6.tar.gz
ipxe-ff8528ea9a69ca2ef6cfbed0b7a1283e165aabe6.tar.xz
ipxe-ff8528ea9a69ca2ef6cfbed0b7a1283e165aabe6.zip
Create and use async_block() macro; it cuts down on the visual overhead
of blocking on asynchronous operations, when that isn't an important aspect of the code.
Diffstat (limited to 'src/usr/dhcpmgmt.c')
-rw-r--r--src/usr/dhcpmgmt.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/usr/dhcpmgmt.c b/src/usr/dhcpmgmt.c
index 90ed62bf..6f030274 100644
--- a/src/usr/dhcpmgmt.c
+++ b/src/usr/dhcpmgmt.c
@@ -20,6 +20,7 @@
#include <byteswap.h>
#include <vsprintf.h>
#include <gpxe/in.h>
+#include <gpxe/ip.h>
#include <gpxe/dhcp.h>
#include <gpxe/async.h>
#include <gpxe/netdevice.h>
@@ -65,13 +66,8 @@ int dhcp ( struct net_device *netdev ) {
printf ( "DHCP (%s %s)...", netdev->name, netdev_hwaddr ( netdev ) );
memset ( &dhcp, 0, sizeof ( dhcp ) );
dhcp.netdev = netdev;
- async_init_orphan ( &async );
- if ( ( rc = start_dhcp ( &dhcp, &async ) ) != 0 ) {
- printf ( "could not start (%s)\n", strerror ( rc ) );
- return rc;
- }
- async_wait ( &async, &rc, 1 );
- if ( rc != 0 ) {
+ if ( ( rc = async_block ( &async,
+ start_dhcp ( &dhcp, &async ) ) ) != 0 ) {
printf ( "failed (%s)\n", strerror ( rc ) );
return rc;
}