mirror of
https://github.com/ipxe/ipxe
synced 2026-01-02 09:52:49 +03:00
[comboot] Add COMBOOT and COM32 support
This commit is contained in:
committed by
Michael Brown
parent
aa28544373
commit
e8b22f203f
58
src/arch/i386/interface/syslinux/comboot_resolv.c
Normal file
58
src/arch/i386/interface/syslinux/comboot_resolv.c
Normal file
@@ -0,0 +1,58 @@
|
||||
#include <errno.h>
|
||||
#include <comboot.h>
|
||||
#include <gpxe/in.h>
|
||||
#include <gpxe/list.h>
|
||||
#include <gpxe/process.h>
|
||||
#include <gpxe/resolv.h>
|
||||
|
||||
static int comboot_resolv_rc;
|
||||
static struct in_addr comboot_resolv_addr;
|
||||
|
||||
static void comboot_resolv_done ( struct resolv_interface *resolv,
|
||||
struct sockaddr *sa, int rc ) {
|
||||
struct sockaddr_in *sin;
|
||||
|
||||
resolv_unplug ( resolv );
|
||||
|
||||
if ( rc != 0 ) {
|
||||
comboot_resolv_rc = rc;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sa->sa_family != AF_INET ) {
|
||||
comboot_resolv_rc = -EAFNOSUPPORT;
|
||||
return;
|
||||
}
|
||||
|
||||
sin = ( ( struct sockaddr_in * ) sa );
|
||||
comboot_resolv_addr = sin->sin_addr;
|
||||
|
||||
comboot_resolv_rc = 0;
|
||||
}
|
||||
|
||||
static struct resolv_interface_operations comboot_resolv_ops = {
|
||||
.done = comboot_resolv_done,
|
||||
};
|
||||
|
||||
static struct resolv_interface comboot_resolver = {
|
||||
.intf = {
|
||||
.dest = &null_resolv.intf,
|
||||
.refcnt = NULL,
|
||||
},
|
||||
.op = &comboot_resolv_ops,
|
||||
};
|
||||
|
||||
int comboot_resolv ( const char *name, struct in_addr *address ) {
|
||||
int rc;
|
||||
|
||||
comboot_resolv_rc = -EINPROGRESS;
|
||||
|
||||
if ( ( rc = resolv ( &comboot_resolver, name, NULL ) ) != 0 )
|
||||
return rc;
|
||||
|
||||
while ( comboot_resolv_rc == -EINPROGRESS )
|
||||
step();
|
||||
|
||||
*address = comboot_resolv_addr;
|
||||
return comboot_resolv_rc;
|
||||
}
|
||||
Reference in New Issue
Block a user