mirror of
https://github.com/ipxe/ipxe
synced 2025-12-21 20:40:25 +03:00
[process] Pass containing object pointer to process step() methods
Give the step() method a pointer to the containing object, rather than a pointer to the process. This is consistent with the operation of interface methods, and allows a single function to serve as both an interface method and a process step() method. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -86,16 +86,17 @@ struct numeric_resolv {
|
||||
int rc;
|
||||
};
|
||||
|
||||
static void numeric_step ( struct process *process ) {
|
||||
struct numeric_resolv *numeric =
|
||||
container_of ( process, struct numeric_resolv, process );
|
||||
static void numeric_step ( struct numeric_resolv *numeric ) {
|
||||
|
||||
process_del ( process );
|
||||
process_del ( &numeric->process );
|
||||
if ( numeric->rc == 0 )
|
||||
resolv_done ( &numeric->resolv, &numeric->sa );
|
||||
intf_shutdown ( &numeric->resolv, numeric->rc );
|
||||
}
|
||||
|
||||
static struct process_descriptor numeric_process_desc =
|
||||
PROC_DESC ( struct numeric_resolv, process, numeric_step );
|
||||
|
||||
static int numeric_resolv ( struct interface *resolv,
|
||||
const char *name, struct sockaddr *sa ) {
|
||||
struct numeric_resolv *numeric;
|
||||
@@ -107,7 +108,8 @@ static int numeric_resolv ( struct interface *resolv,
|
||||
return -ENOMEM;
|
||||
ref_init ( &numeric->refcnt, NULL );
|
||||
intf_init ( &numeric->resolv, &null_intf_desc, &numeric->refcnt );
|
||||
process_init ( &numeric->process, numeric_step, &numeric->refcnt );
|
||||
process_init ( &numeric->process, &numeric_process_desc,
|
||||
&numeric->refcnt );
|
||||
memcpy ( &numeric->sa, sa, sizeof ( numeric->sa ) );
|
||||
|
||||
DBGC ( numeric, "NUMERIC %p attempting to resolve \"%s\"\n",
|
||||
|
||||
Reference in New Issue
Block a user