iPXE
|
Object interfaces. More...
Go to the source code of this file.
Data Structures | |
struct | interface_operation |
An object interface operation. More... | |
struct | interface_descriptor |
An object interface descriptor. More... | |
struct | interface |
An object interface. More... | |
Macros | |
#define | INTF_OP(op_type, object_type, op_func) |
Define an object interface operation. More... | |
#define | UNUSED_INTF_OP(op_type, object_type, op_func) |
Define an unused object interface operation. More... | |
#define | intf_offset(object_type, intf) |
#define | INTF_DESC(object_type, intf, operations) |
Define an object interface descriptor. More... | |
#define | INTF_DESC_PASSTHRU(object_type, intf, operations, passthru) |
Define an object interface descriptor with pass-through interface. More... | |
#define | INTF_DESC_PURE(operations) |
Define an object interface descriptor for a pure-interface object. More... | |
#define | intf_close_TYPE(object_type) typeof ( void ( object_type, int rc ) ) |
#define | intf_poke_TYPE(object_type) typeof ( void ( object_type ) ) |
#define | INTF_INIT(descriptor) |
Initialise a static object interface. More... | |
#define | intf_get_dest_op_no_passthru(intf, type, dest) |
Get object interface destination and operation method (without pass-through) More... | |
#define | intf_get_dest_op(intf, type, dest) |
Get object interface destination and operation method. More... | |
#define | INTF_COL(intf) intf_object ( intf_origin ( intf ) ) |
Find debugging colourisation for an object interface. More... | |
#define | INTF_FMT "%p+%zx" |
printf() format string for INTF_DBG() More... | |
#define | INTF_DBG(intf) |
printf() arguments for representing an object interface More... | |
#define | INTF_INTF_FMT INTF_FMT "->" INTF_FMT |
printf() format string for INTF_INTF_DBG() More... | |
#define | INTF_INTF_DBG(intf, dest) INTF_DBG ( intf ), INTF_DBG ( dest ) |
printf() arguments for representing an object interface pair More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
void | intf_plug (struct interface *intf, struct interface *dest) |
Plug an object interface into a new destination object interface. More... | |
void | intf_plug_plug (struct interface *a, struct interface *b) |
Plug two object interfaces together. More... | |
void | intf_unplug (struct interface *intf) |
Unplug an object interface. More... | |
void | intf_nullify (struct interface *intf) |
Ignore all further operations on an object interface. More... | |
struct interface * | intf_get (struct interface *intf) |
Increment reference count on an object interface. More... | |
void | intf_put (struct interface *intf) |
Decrement reference count on an object interface. More... | |
void * | __attribute__ ((pure)) intf_object(struct interface *intf) |
void * | intf_get_dest_op_no_passthru_untyped (struct interface *intf, void *type, struct interface **dest) |
Get object interface destination and operation method (without pass-through) More... | |
void * | intf_get_dest_op_untyped (struct interface *intf, void *type, struct interface **dest) |
Get object interface destination and operation method. More... | |
void | intf_close (struct interface *intf, int rc) |
Close an object interface. More... | |
void | intf_shutdown (struct interface *intf, int rc) |
Shut down an object interface. More... | |
void | intfs_vshutdown (va_list intfs, int rc) |
Shut down multiple object interfaces. More... | |
void | intfs_shutdown (int rc,...) __attribute__((sentinel)) |
Shut down multiple object interfaces. More... | |
void | intf_restart (struct interface *intf, int rc) |
Shut down and restart an object interface. More... | |
void | intfs_vrestart (va_list intfs, int rc) |
Shut down and restart multiple object interfaces. More... | |
void | intfs_restart (int rc,...) __attribute__((sentinel)) |
Shut down and restart multiple object interfaces. More... | |
void | intf_insert (struct interface *intf, struct interface *upper, struct interface *lower) |
Insert a filter interface. More... | |
void | intf_poke (struct interface *intf, void(type)(struct interface *intf)) |
Poke an object interface. More... | |
static void | intf_init (struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt) |
Initialise an object interface. More... | |
static void | intf_temp_init (struct interface *intf, struct interface *original) |
Initialise a temporary outbound-only object interface. More... | |
static struct interface * | intf_origin (struct interface *intf) |
Get original interface. More... | |
static void | intf_reinit (struct interface *intf) |
Reinitialise an object interface. More... | |
Variables | |
struct interface_descriptor | null_intf_desc |
Null interface descriptor. More... | |
struct interface | null_intf |
The null interface. More... | |
Object interfaces.
Definition in file interface.h.
#define INTF_OP | ( | op_type, | |
object_type, | |||
op_func | |||
) |
Define an object interface operation.
op_type | Operation type |
object_type | Implementing method's expected object type |
op_func | Implementing method |
op | Object interface operation |
Definition at line 32 of file interface.h.
#define UNUSED_INTF_OP | ( | op_type, | |
object_type, | |||
op_func | |||
) |
Define an unused object interface operation.
op_type | Operation type |
object_type | Implementing method's expected object type |
op_func | Implementing method |
op | Object interface operation |
Definition at line 47 of file interface.h.
#define intf_offset | ( | object_type, | |
intf | |||
) |
Definition at line 66 of file interface.h.
#define INTF_DESC | ( | object_type, | |
intf, | |||
operations | |||
) |
Define an object interface descriptor.
object_type | Containing object data type |
intf | Interface name (i.e. field within object data type) |
operations | Object interface operations array |
desc | Object interface descriptor |
Definition at line 80 of file interface.h.
#define INTF_DESC_PASSTHRU | ( | object_type, | |
intf, | |||
operations, | |||
passthru | |||
) |
Define an object interface descriptor with pass-through interface.
object_type | Containing object data type |
intf | Interface name (i.e. field within object data type) |
operations | Object interface operations array |
passthru | Pass-through interface name |
desc | Object interface descriptor |
Definition at line 97 of file interface.h.
#define INTF_DESC_PURE | ( | operations | ) |
Define an object interface descriptor for a pure-interface object.
operations | Object interface operations array |
desc | Object interface descriptor |
A pure-interface object is an object that consists solely of a single interface.
Definition at line 115 of file interface.h.
Definition at line 176 of file interface.h.
#define intf_poke_TYPE | ( | object_type | ) | typeof ( void ( object_type ) ) |
Definition at line 190 of file interface.h.
#define INTF_INIT | ( | descriptor | ) |
Initialise a static object interface.
descriptor | Object interface descriptor |
Definition at line 217 of file interface.h.
Get object interface destination and operation method (without pass-through)
intf | Object interface |
type | Operation type |
dest | Destination interface |
func | Implementing method, or NULL |
Definition at line 257 of file interface.h.
Get object interface destination and operation method.
intf | Object interface |
type | Operation type |
dest | Destination interface |
func | Implementing method, or NULL |
Definition at line 269 of file interface.h.
#define INTF_COL | ( | intf | ) | intf_object ( intf_origin ( intf ) ) |
Find debugging colourisation for an object interface.
intf | Object interface |
col | Debugging colourisation |
Use as the first argument to DBGC() or equivalent macro.
Definition at line 281 of file interface.h.
#define INTF_FMT "%p+%zx" |
printf() format string for INTF_DBG()
Definition at line 284 of file interface.h.
#define INTF_DBG | ( | intf | ) |
printf() arguments for representing an object interface
intf | Object interface |
args | printf() argument list corresponding to INTF_FMT |
Definition at line 292 of file interface.h.
printf() format string for INTF_INTF_DBG()
Definition at line 297 of file interface.h.
printf() arguments for representing an object interface pair
intf | Object interface |
dest | Destination object interface |
args | printf() argument list corresponding to INTF_INTF_FMT |
Definition at line 306 of file interface.h.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
Plug an object interface into a new destination object interface.
intf | Object interface |
dest | New destination object interface |
The reference to the existing destination interface is dropped, a reference to the new destination interface is obtained, and the interface is updated to point to the new destination interface.
Definition at line 83 of file interface.c.
References DBGC, interface::dest, dest, interface::intf, INTF_COL, INTF_DBG, INTF_FMT, intf_get(), INTF_INTF_DBG, INTF_INTF_FMT, intf_put(), and null_intf.
Referenced by intf_plug_plug(), and xfer_vredirect().
Plug two object interfaces together.
a | Object interface A |
b | Object interface B |
Plugs interface A into interface B, and interface B into interface A. (The basic plug() function is unidirectional; this function is merely a shorthand for two calls to plug(), hence the name.)
Definition at line 107 of file interface.c.
References intf_plug().
Referenced by aoedev_ata_command(), aoedev_cfg_command(), ata_open(), atadev_command(), create_downloader(), create_pinger(), create_validator(), dns_resolv(), efi_local_open(), fc_els_request(), fc_els_respond(), fc_port_open(), fc_xchg_originate(), fcpdev_scsi_command(), ftp_open(), http_connect(), http_open(), http_transfer_complete(), hw_open(), ib_cmrc_open(), ifpoller_wait(), intf_insert(), ipair_create(), iscsi_scsi_command(), nfs_open(), numeric_resolv(), peerblk_open(), peermux_filter(), ping_open(), resolv(), resolv_setting(), scsi_open(), scsidev_command(), slam_open(), srp_open(), srpdev_scsi_command(), start_dhcp(), start_dhcpv6(), start_ipv6conf(), start_ntp(), start_pxebs(), sync(), tcp_open(), tftp_core_open(), udp_open_common(), usbblk_scsi_command(), and xfer_open_named_socket().
void intf_unplug | ( | struct interface * | intf | ) |
Unplug an object interface.
intf | Object interface |
Definition at line 117 of file interface.c.
References DBGC, interface::dest, interface::intf, INTF_COL, INTF_INTF_DBG, INTF_INTF_FMT, intf_put(), and null_intf.
Referenced by intf_shutdown(), named_resolv_done(), and xfer_vredirect().
void intf_nullify | ( | struct interface * | intf | ) |
Ignore all further operations on an object interface.
intf | Object interface |
Definition at line 129 of file interface.c.
References interface::desc, interface::intf, and null_intf_desc.
Referenced by intf_shutdown(), intfs_vshutdown(), named_resolv_done(), and peermux_close().
Increment reference count on an object interface.
intf | Object interface |
intf | Object interface |
Definition at line 139 of file interface.c.
References interface::intf, ref_get, and interface::refcnt.
Referenced by intf_get_dest_op_no_passthru_untyped(), intf_insert(), and intf_plug().
void intf_put | ( | struct interface * | intf | ) |
Decrement reference count on an object interface.
intf | Object interface |
Definition at line 149 of file interface.c.
References interface::intf, ref_put, and interface::refcnt.
Referenced by acpi_describe(), ata_command(), block_capacity(), block_read(), block_read_capacity(), block_write(), edd_describe(), efi_describe(), identify_device(), intf_close(), intf_get_dest_op_untyped(), intf_insert(), intf_plug(), intf_poke(), intf_unplug(), job_progress(), peerdisc_stat(), resolv_done(), scsi_command(), scsi_response(), xfer_alloc_iob(), xfer_buffer(), xfer_deliver(), xfer_vredirect(), and xfer_window().
void* __attribute__ | ( | (pure) | ) |
void* intf_get_dest_op_no_passthru_untyped | ( | struct interface * | intf, |
void * | type, | ||
struct interface ** | dest | ||
) |
Get object interface destination and operation method (without pass-through)
intf | Object interface |
type | Operation type |
dest | Destination interface |
func | Implementing method, or NULL |
Definition at line 187 of file interface.c.
References desc, interface::dest, dest, intf_get(), NULL, op, and type.
Referenced by intf_get_dest_op_untyped().
Get object interface destination and operation method.
intf | Object interface |
type | Operation type |
dest | Destination interface |
func | Implementing method, or NULL |
Definition at line 212 of file interface.c.
References dest, interface_operation::func, intf_get_dest_op_no_passthru_untyped(), intf_get_passthru(), intf_put(), NULL, and type.
Referenced by intf_poke().
void intf_close | ( | struct interface * | intf, |
int | rc | ||
) |
Close an object interface.
intf | Object interface |
rc | Reason for close |
Note that this function merely informs the destination object that the interface is about to be closed; it doesn't actually disconnect the interface. In most cases, you probably want to use intf_shutdown() or intf_restart() instead.
Definition at line 249 of file interface.c.
References DBGC, dest, interface::intf, intf_close(), intf_close_TYPE, INTF_COL, intf_get_dest_op, INTF_INTF_DBG, INTF_INTF_FMT, intf_object(), intf_put(), intf_restart(), op, rc, and strerror().
Referenced by ifconf_progress(), iflinkwait_progress(), intf_close(), intf_shutdown(), netdev_close(), sync_progress(), and xfer_vredirect().
void intf_shutdown | ( | struct interface * | intf, |
int | rc | ||
) |
Shut down an object interface.
intf | Object interface |
rc | Reason for close |
Blocks further operations from being received via the interface, executes a close operation on the destination interface, and unplugs the interface.
Definition at line 278 of file interface.c.
References DBGC, interface::dest, interface::intf, intf_close(), INTF_COL, INTF_DBG, INTF_FMT, intf_nullify(), intf_temp_init(), intf_unplug(), null_intf, rc, strerror(), and tmp.
Referenced by aoecmd_close(), aoedev_close(), aoedev_config_done(), atacmd_close(), atadev_close(), blktrans_close(), comboot_resolv_close(), dhcp_finished(), dhcpv6_finished(), dns_done(), downloader_finished(), efi_download_close(), efi_local_close(), fc_els_close(), fc_ns_query_close(), fc_peer_close(), fc_port_close(), fc_ulp_close(), fc_xchg_close(), fcoe_close(), fcpcmd_close(), fcpdev_close(), ftp_done(), http_conn_close(), http_transfer_complete(), hw_finished(), ib_cmrc_close(), ib_srp_close(), imux_shutdown(), intf_restart(), intfs_vshutdown(), ipair_close(), ipv6conf_done(), named_close(), nfs_deliver(), nfs_done(), nfs_pm_deliver(), nslookup_close(), ntp_close(), numeric_step(), peerblk_close(), peermux_close(), peermux_info_close(), ping_close(), pinger_close(), posix_file_finished(), pxe_tftp_close(), resmux_close(), slam_finished(), srpcmd_close(), srpdev_close(), tcp_close(), tftp_done(), tls_close(), udp_close(), validator_finished(), and xcm_destroy().
void intfs_vshutdown | ( | va_list | intfs, |
int | rc | ||
) |
Shut down multiple object interfaces.
intfs | Object interfaces |
rc | Reason for close |
Definition at line 305 of file interface.c.
References interface::intf, intf_nullify(), intf_shutdown(), rc, tmp, va_arg, va_copy, and va_end.
Referenced by intfs_shutdown(), and intfs_vrestart().
void intfs_shutdown | ( | int | rc, |
... | |||
) |
Shut down multiple object interfaces.
rc | Reason for close |
... | Object interfaces |
Definition at line 326 of file interface.c.
References intfs_vshutdown(), rc, va_end, and va_start.
Referenced by http_close(), iscsi_close(), scsicmd_close(), scsidev_close(), and usbblk_remove().
void intf_restart | ( | struct interface * | intf, |
int | rc | ||
) |
Shut down and restart an object interface.
intf | Object interface |
rc | Reason for close |
Shuts down the interface, then unblocks operations that were blocked during shutdown.
Definition at line 343 of file interface.c.
References DBGC, interface::intf, INTF_COL, INTF_DBG, INTF_FMT, intf_reinit(), intf_shutdown(), and rc.
Referenced by apply_syslog_settings(), apply_syslogs_settings(), efi_pxe_tftp_close(), efi_pxe_udp_close(), fc_peer_plogi(), fc_peer_plogi_done(), fc_port_examine(), fc_port_flogi_done(), fc_port_login(), fc_port_ns_plogi_done(), fc_ulp_examine(), fc_ulp_prli_done(), fcoe_reset(), http_block_read(), http_block_read_capacity(), http_conn_close(), http_conn_xfer_close(), http_reopen(), http_transfer_complete(), imux_close(), imux_start_pair(), intf_close(), iscsi_close_connection(), iscsi_command_close(), iscsi_scsi_done(), monojob_close(), netdev_config_close(), netdev_configure(), peerblk_raw_close(), peerblk_raw_open(), peerblk_raw_rx(), peerblk_reset(), peerblk_retrieval_close(), peerblk_retrieval_open(), peerblk_retrieval_rx(), peerdisc_socket_close(), peerdisc_socket_open(), peermux_block_close(), pxenv_udp_close(), pxenv_udp_open(), resmux_child_close(), sandev_command_close(), sanpath_close(), scsicmd_done(), scsidev_ready(), syslogs_close(), tftp_reopen(), tftp_reopen_mc(), tftp_timer_expired(), tls_validator_done(), usbblk_stop(), validator_start_download(), validator_start_ocsp(), validator_xfer_close(), xcm_close(), xcm_reopen(), and xfer_vreopen().
void intfs_vrestart | ( | va_list | intfs, |
int | rc | ||
) |
Shut down and restart multiple object interfaces.
intfs | Object interfaces |
rc | Reason for close |
Definition at line 366 of file interface.c.
References interface::intf, intf_reinit(), intfs_vshutdown(), rc, tmp, va_arg, va_copy, and va_end.
Referenced by intfs_restart().
void intfs_restart | ( | int | rc, |
... | |||
) |
Shut down and restart multiple object interfaces.
rc | Reason for close |
... | Object interfaces |
Definition at line 386 of file interface.c.
References intfs_vrestart(), rc, va_end, and va_start.
Referenced by http_transfer_complete(), sanpath_close(), and usbblk_scsi_close().
Insert a filter interface.
intf | Object interface |
upper | Upper end of filter |
lower | Lower end of filter |
Definition at line 401 of file interface.c.
References interface::dest, dest, interface::intf, intf_get(), intf_plug_plug(), and intf_put().
Referenced by add_tls(), and block_translate().
Poke an object interface.
intf | Object interface |
type | Operation type |
This is a helper function to implement methods which take no parameters and return nothing.
Definition at line 420 of file interface.c.
References dest, interface::intf, intf_get_dest_op_untyped(), intf_object(), intf_poke_TYPE, intf_put(), op, and type.
Referenced by pool_recycle(), pool_reopen(), and xfer_window_changed().
|
inlinestatic |
Initialise an object interface.
intf | Object interface |
desc | Object interface descriptor |
refcnt | Containing object reference counter, or NULL |
Definition at line 203 of file interface.h.
References desc, interface::desc, interface::dest, interface::intf, null_intf, interface::original, refcnt, and interface::refcnt.
Referenced by add_tls(), alloc_netdev(), alloc_sandev(), aoecmd_create(), aoedev_open(), ata_open(), atadev_command(), block_translate(), create_downloader(), create_pinger(), create_validator(), dns_resolv(), efi_download_start(), efi_local_open(), efi_pxe_install(), fc_els_create(), fc_ns_query(), fc_peer_create(), fc_port_open(), fc_ulp_create(), fc_xchg_create(), fcoe_probe(), fcpdev_open(), fcpdev_scsi_command(), ftp_open(), http_connect(), http_open(), hw_open(), ib_cmrc_open(), ib_srp_open(), imux_probe(), ipair_create(), iscsi_open(), nfs_open(), numeric_resolv(), open(), peerblk_open(), peermux_filter(), ping_open(), pxe_tftp_open(), resolv(), resolv_setting(), scsi_open(), scsidev_command(), slam_open(), srp_open(), srpdev_scsi_command(), start_dhcp(), start_dhcpv6(), start_ipv6conf(), start_ntp(), start_pxebs(), tcp_open(), tftp_core_open(), udp_open_common(), usbblk_probe(), xcm_create(), and xfer_open_named_socket().
Initialise a temporary outbound-only object interface.
intf | Temporary outbound-only object interface |
original | Original object interface |
Definition at line 232 of file interface.h.
References interface::desc, interface::dest, interface::intf, NULL, null_intf, and interface::original.
Referenced by intf_shutdown(), and xfer_vredirect().
Get original interface.
intf | Object interface (possibly a temporary interface) |
intf | Original object interface |
Definition at line 245 of file interface.h.
References interface::desc, interface::intf, and interface::original.
|
inlinestatic |
Reinitialise an object interface.
intf | Object interface |
Definition at line 313 of file interface.h.
References interface::desc, interface::intf, and interface::original.
Referenced by intf_restart(), and intfs_vrestart().
struct interface_descriptor null_intf_desc |
Null interface descriptor.
Definition at line 61 of file interface.c.
Referenced by intf_nullify(), and numeric_resolv().
struct interface null_intf |
The null interface.
Definition at line 65 of file interface.c.
Referenced by intf_init(), intf_plug(), intf_shutdown(), intf_temp_init(), and intf_unplug().