diff options
author | Michael Brown | 2015-07-08 17:24:11 +0200 |
---|---|---|
committer | Michael Brown | 2015-07-22 22:17:47 +0200 |
commit | 81c80c8ba9e7ba053f2571a1945581b70f310b4d (patch) | |
tree | efbdeec11680bf9c13aa5665fe7d298c63254fb5 /src/core | |
parent | [profile] Add profile_custom() for profiling with arbitrary time units (diff) | |
download | ipxe-81c80c8ba9e7ba053f2571a1945581b70f310b4d.tar.gz ipxe-81c80c8ba9e7ba053f2571a1945581b70f310b4d.tar.xz ipxe-81c80c8ba9e7ba053f2571a1945581b70f310b4d.zip |
[interface] Add intf_poke() helper
Reduce the cost of implementing object methods which convey no
information beyond the fact that the method has been called.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/interface.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/interface.c b/src/core/interface.c index 400fac14..ba148c13 100644 --- a/src/core/interface.c +++ b/src/core/interface.c @@ -311,3 +311,28 @@ void intf_restart ( struct interface *intf, int rc ) { */ intf->desc = desc; } + +/** + * Poke an object interface + * + * @v intf Object interface + * @v type Operation type + * + * This is a helper function to implement methods which take no + * parameters and return nothing. + */ +void intf_poke ( struct interface *intf, + void ( type ) ( struct interface *intf ) ) { + struct interface *dest; + intf_poke_TYPE ( void * ) *op = + intf_get_dest_op_untyped ( intf, type, &dest ); + void *object = intf_object ( dest ); + + if ( op ) { + op ( object ); + } else { + /* Default is to do nothing */ + } + + intf_put ( dest ); +} |