iPXE
Functions | Variables
interface.c File Reference

Object interfaces. More...

#include <string.h>
#include <ipxe/interface.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static void null_intf_close (struct interface *intf __unused, int rc __unused)
 Close null interface. More...
 
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 interfaceintf_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 * intf_object (struct interface *intf)
 Get pointer to object containing object interface. More...
 
static struct interfaceintf_get_passthru (struct interface *intf)
 Get pass-through interface. More...
 
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,...)
 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,...)
 Shut down and restart multiple object interfaces. More...
 
void intf_poke (struct interface *intf, void(type)(struct interface *intf))
 Poke an object interface. More...
 

Variables

static struct interface_operation null_intf_op []
 Null interface operations. More...
 
struct interface_descriptor null_intf_desc
 Null interface descriptor. More...
 
struct interface null_intf = INTF_INIT ( null_intf_desc )
 The null interface. More...
 

Detailed Description

Object interfaces.

Definition in file interface.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ null_intf_close()

static void null_intf_close ( struct interface *intf  __unused,
int rc  __unused 
)
static

Close null interface.

Parameters
intfNull interface
rcReason for close

Definition at line 47 of file interface.c.

48  {
49 
50  /* Do nothing. In particular, do not call intf_restart(),
51  * since that would result in an infinite loop.
52  */
53 }

◆ intf_plug()

void intf_plug ( struct interface intf,
struct interface dest 
)

Plug an object interface into a new destination object interface.

Parameters
intfObject interface
destNew 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.

83  {
84  DBGC ( INTF_COL ( intf ),
85  "INTF " INTF_INTF_FMT " replug to " INTF_FMT "\n",
86  INTF_INTF_DBG ( intf, intf->dest ), INTF_DBG ( dest ) );
87  intf_get ( dest );
88  intf_put ( intf->dest );
89  intf->dest = dest;
90 }
struct interface * intf_get(struct interface *intf)
Increment reference count on an object interface.
Definition: interface.c:134
#define INTF_INTF_FMT
printf() format string for INTF_INTF_DBG()
Definition: interface.h:240
#define INTF_DBG(intf)
printf() arguments for representing an object interface
Definition: interface.h:237
#define INTF_INTF_DBG(intf, dest)
printf() arguments for representing an object interface pair
Definition: interface.h:249
#define INTF_COL(intf)
Find debugging colourisation for an object interface.
Definition: interface.h:226
#define DBGC(...)
Definition: compiler.h:505
struct interface * dest
Destination object interface.
Definition: interface.h:118
static void * dest
Definition: strings.h:176
void intf_put(struct interface *intf)
Decrement reference count on an object interface.
Definition: interface.c:144
#define INTF_FMT
printf() format string for INTF_DBG()
Definition: interface.h:229

References DBGC, interface::dest, dest, INTF_COL, INTF_DBG, INTF_FMT, intf_get(), INTF_INTF_DBG, INTF_INTF_FMT, and intf_put().

Referenced by intf_plug_plug(), and xfer_vredirect().

◆ intf_plug_plug()

void intf_plug_plug ( struct interface a,
struct interface b 
)

Plug two object interfaces together.

Parameters
aObject interface A
bObject 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 102 of file interface.c.

102  {
103  intf_plug ( a, b );
104  intf_plug ( b, a );
105 }
void intf_plug(struct interface *intf, struct interface *dest)
Plug an object interface into a new destination object interface.
Definition: interface.c:83

References intf_plug().

Referenced by add_tls(), aoedev_ata_command(), aoedev_cfg_command(), ata_open(), atadev_command(), block_translate(), 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(), 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(), and xfer_open_named_socket().

◆ intf_unplug()

void intf_unplug ( struct interface intf)

Unplug an object interface.

Parameters
intfObject interface

Definition at line 112 of file interface.c.

112  {
113  DBGC ( INTF_COL ( intf ), "INTF " INTF_INTF_FMT " unplug\n",
114  INTF_INTF_DBG ( intf, intf->dest ) );
115  intf_put ( intf->dest );
116  intf->dest = &null_intf;
117 }
#define INTF_INTF_FMT
printf() format string for INTF_INTF_DBG()
Definition: interface.h:240
struct interface null_intf
The null interface.
Definition: interface.c:65
#define INTF_INTF_DBG(intf, dest)
printf() arguments for representing an object interface pair
Definition: interface.h:249
#define INTF_COL(intf)
Find debugging colourisation for an object interface.
Definition: interface.h:226
#define DBGC(...)
Definition: compiler.h:505
struct interface * dest
Destination object interface.
Definition: interface.h:118
void intf_put(struct interface *intf)
Decrement reference count on an object interface.
Definition: interface.c:144

References DBGC, interface::dest, INTF_COL, INTF_INTF_DBG, INTF_INTF_FMT, intf_put(), and null_intf.

Referenced by intf_shutdown(), named_resolv_done(), and xfer_vredirect().

◆ intf_nullify()

void intf_nullify ( struct interface intf)

Ignore all further operations on an object interface.

Parameters
intfObject interface

Definition at line 124 of file interface.c.

124  {
125  intf->desc = &null_intf_desc;
126 }
struct interface_descriptor null_intf_desc
Null interface descriptor.
Definition: interface.c:61
struct interface_descriptor * desc
Interface descriptor.
Definition: interface.h:126

References interface::desc, and null_intf_desc.

Referenced by intf_shutdown(), intfs_vshutdown(), named_resolv_done(), and peermux_close().

◆ intf_get()

struct interface* intf_get ( struct interface intf)

Increment reference count on an object interface.

Parameters
intfObject interface
Return values
intfObject interface

Definition at line 134 of file interface.c.

134  {
135  ref_get ( intf->refcnt );
136  return intf;
137 }
#define ref_get(refcnt)
Get additional reference to object.
Definition: refcnt.h:92
struct refcnt * refcnt
Reference counter.
Definition: interface.h:124

References ref_get, and interface::refcnt.

Referenced by intf_get_dest_op_no_passthru_untyped(), and intf_plug().

◆ intf_put()

void intf_put ( struct interface intf)

Decrement reference count on an object interface.

Parameters
intfObject interface

Definition at line 144 of file interface.c.

144  {
145  ref_put ( intf->refcnt );
146 }
struct refcnt * refcnt
Reference counter.
Definition: interface.h:124
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106

References ref_put, and interface::refcnt.

Referenced by acpi_describe(), ata_command(), block_capacity(), block_read(), block_read_capacity(), block_write(), edd_describe(), identify_device(), intf_close(), intf_get_dest_op_untyped(), 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().

◆ intf_object()

void* intf_object ( struct interface intf)

Get pointer to object containing object interface.

Parameters
intfObject interface
Return values
objectContaining object

Definition at line 154 of file interface.c.

154  {
155  return ( ( ( void * ) intf ) - intf->desc->offset );
156 }

Referenced by acpi_describe(), ata_command(), block_capacity(), block_read(), block_read_capacity(), block_write(), edd_describe(), identify_device(), intf_close(), intf_poke(), job_progress(), peerdisc_stat(), resolv_done(), scsi_command(), scsi_response(), xfer_alloc_iob(), xfer_buffer(), xfer_deliver(), xfer_vredirect(), and xfer_window().

◆ intf_get_passthru()

static struct interface* intf_get_passthru ( struct interface intf)
static

Get pass-through interface.

Parameters
intfObject interface
Return values
passthruPass-through interface, or NULL

Definition at line 164 of file interface.c.

164  {
165  struct interface_descriptor *desc = intf->desc;
166 
167  if ( desc->passthru_offset ) {
168  return ( ( ( void * ) intf ) + desc->passthru_offset );
169  } else {
170  return NULL;
171  }
172 }
ssize_t passthru_offset
Offset to pass-through interface, if present.
Definition: interface.h:48
An object interface descriptor.
Definition: interface.h:40
struct interface_descriptor * desc
Interface descriptor.
Definition: interface.h:126
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References interface::desc, NULL, and interface_descriptor::passthru_offset.

Referenced by intf_get_dest_op_untyped().

◆ intf_get_dest_op_no_passthru_untyped()

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)

Parameters
intfObject interface
typeOperation type
Return values
destDestination interface
funcImplementing method, or NULL

Definition at line 182 of file interface.c.

184  {
185  struct interface_descriptor *desc;
186  struct interface_operation *op;
187  unsigned int i;
188 
189  *dest = intf_get ( intf->dest );
190  desc = (*dest)->desc;
191  for ( i = desc->num_op, op = desc->op ; i ; i--, op++ ) {
192  if ( op->type == type )
193  return op->func;
194  }
195 
196  return NULL;
197 }
struct interface * intf_get(struct interface *intf)
Increment reference count on an object interface.
Definition: interface.c:134
An object interface operation.
Definition: interface.h:17
uint8_t type
Type.
Definition: ena.h:16
unsigned int num_op
Number of interface operations.
Definition: interface.h:44
struct interface * dest
Destination object interface.
Definition: interface.h:118
struct interface_operation * op
Object interface operations.
Definition: interface.h:46
static void * dest
Definition: strings.h:176
An object interface descriptor.
Definition: interface.h:40
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References interface::dest, dest, intf_get(), NULL, interface_descriptor::num_op, interface_descriptor::op, op, and type.

Referenced by intf_get_dest_op_untyped().

◆ intf_get_dest_op_untyped()

void* intf_get_dest_op_untyped ( struct interface intf,
void *  type,
struct interface **  dest 
)

Get object interface destination and operation method.

Parameters
intfObject interface
typeOperation type
Return values
destDestination interface
funcImplementing method, or NULL

Definition at line 207 of file interface.c.

208  {
209  void *func;
210 
211  while ( 1 ) {
212 
213  /* Search for an implementing method provided by the
214  * current destination interface.
215  */
217  if ( func )
218  return func;
219 
220  /* Pass through to the underlying interface, if applicable */
221  if ( ! ( intf = intf_get_passthru ( *dest ) ) )
222  return NULL;
223  intf_put ( *dest );
224  }
225 }
static struct interface * intf_get_passthru(struct interface *intf)
Get pass-through interface.
Definition: interface.c:164
uint8_t type
Type.
Definition: ena.h:16
void * func
Implementing method.
Definition: interface.h:21
static void * dest
Definition: strings.h:176
void intf_put(struct interface *intf)
Decrement reference count on an object interface.
Definition: interface.c:144
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)
Definition: interface.c:182
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References dest, interface_operation::func, intf_get_dest_op_no_passthru_untyped(), intf_get_passthru(), intf_put(), NULL, and type.

Referenced by intf_poke().

◆ intf_close()

void intf_close ( struct interface intf,
int  rc 
)

Close an object interface.

Parameters
intfObject interface
rcReason 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 244 of file interface.c.

244  {
245  struct interface *dest;
246  intf_close_TYPE ( void * ) *op =
247  intf_get_dest_op ( intf, intf_close, &dest );
248  void *object = intf_object ( dest );
249 
250  DBGC ( INTF_COL ( intf ), "INTF " INTF_INTF_FMT " close (%s)\n",
251  INTF_INTF_DBG ( intf, dest ), strerror ( rc ) );
252 
253  if ( op ) {
254  op ( object, rc );
255  } else {
256  /* Default is to restart the interface */
257  intf_restart ( dest, rc );
258  }
259 
260  intf_put ( dest );
261 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:244
#define INTF_INTF_FMT
printf() format string for INTF_INTF_DBG()
Definition: interface.h:240
void intf_restart(struct interface *intf, int rc)
Shut down and restart an object interface.
Definition: interface.c:337
#define INTF_INTF_DBG(intf, dest)
printf() arguments for representing an object interface pair
Definition: interface.h:249
#define INTF_COL(intf)
Find debugging colourisation for an object interface.
Definition: interface.h:226
#define DBGC(...)
Definition: compiler.h:505
void * intf_object(struct interface *intf)
Get pointer to object containing object interface.
Definition: interface.c:154
An object interface.
Definition: interface.h:109
static void * dest
Definition: strings.h:176
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327
void intf_put(struct interface *intf)
Decrement reference count on an object interface.
Definition: interface.c:144
#define intf_get_dest_op(intf, type, dest)
Get object interface destination and operation method.
Definition: interface.h:214
#define intf_close_TYPE(object_type)
Definition: interface.h:148

References DBGC, dest, 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().

◆ intf_shutdown()

void intf_shutdown ( struct interface intf,
int  rc 
)

Shut down an object interface.

Parameters
intfObject interface
rcReason 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 273 of file interface.c.

273  {
274  struct interface tmp;
275 
276  DBGC ( INTF_COL ( intf ), "INTF " INTF_FMT " shutting down (%s)\n",
277  INTF_DBG ( intf ), strerror ( rc ) );
278 
279  /* Block further operations */
280  intf_nullify ( intf );
281 
282  /* Transfer destination to temporary interface */
283  tmp.dest = intf->dest;
284  intf->dest = &null_intf;
285 
286  /* Notify destination of close via temporary interface */
287  intf_close ( &tmp, rc );
288 
289  /* Unplug temporary interface */
290  intf_unplug ( &tmp );
291 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:244
struct interface null_intf
The null interface.
Definition: interface.c:65
#define INTF_DBG(intf)
printf() arguments for representing an object interface
Definition: interface.h:237
#define INTF_COL(intf)
Find debugging colourisation for an object interface.
Definition: interface.h:226
#define DBGC(...)
Definition: compiler.h:505
struct interface * dest
Destination object interface.
Definition: interface.h:118
An object interface.
Definition: interface.h:109
void intf_unplug(struct interface *intf)
Unplug an object interface.
Definition: interface.c:112
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
uint8_t * tmp
Definition: entropy.h:156
void intf_nullify(struct interface *intf)
Ignore all further operations on an object interface.
Definition: interface.c:124
#define INTF_FMT
printf() format string for INTF_DBG()
Definition: interface.h:229

References DBGC, interface::dest, intf_close(), INTF_COL, INTF_DBG, INTF_FMT, intf_nullify(), 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(), intf_restart(), intfs_vshutdown(), 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().

◆ intfs_vshutdown()

void intfs_vshutdown ( va_list  intfs,
int  rc 
)

Shut down multiple object interfaces.

Parameters
intfsObject interfaces
rcReason for close

Definition at line 299 of file interface.c.

299  {
300  struct interface *intf;
301  va_list tmp;
302 
303  /* Nullify all interfaces to avoid potential loops */
304  va_copy ( tmp, intfs );
305  while ( ( intf = va_arg ( tmp, struct interface * ) ) )
306  intf_nullify ( intf );
307  va_end ( tmp );
308 
309  /* Shut down all interfaces */
310  while ( ( intf = va_arg ( intfs, struct interface * ) ) )
311  intf_shutdown ( intf, rc );
312 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define va_end(ap)
Definition: stdarg.h:9
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:273
#define va_copy(dest, src)
Definition: stdarg.h:10
#define va_arg(ap, type)
Definition: stdarg.h:8
An object interface.
Definition: interface.h:109
uint8_t * tmp
Definition: entropy.h:156
void intf_nullify(struct interface *intf)
Ignore all further operations on an object interface.
Definition: interface.c:124
__builtin_va_list va_list
Definition: stdarg.h:6

References intf_nullify(), intf_shutdown(), rc, tmp, va_arg, va_copy, and va_end.

Referenced by intfs_shutdown(), and intfs_vrestart().

◆ intfs_shutdown()

void intfs_shutdown ( int  rc,
  ... 
)

Shut down multiple object interfaces.

Parameters
rcReason for close
...Object interfaces

Definition at line 320 of file interface.c.

320  {
321  va_list intfs;
322 
323  va_start ( intfs, rc );
324  intfs_vshutdown ( intfs, rc );
325  va_end ( intfs );
326 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define va_end(ap)
Definition: stdarg.h:9
__builtin_va_list va_list
Definition: stdarg.h:6
void intfs_vshutdown(va_list intfs, int rc)
Shut down multiple object interfaces.
Definition: interface.c:299
#define va_start(ap, last)
Definition: stdarg.h:7

References intfs_vshutdown(), rc, va_end, and va_start.

Referenced by http_close(), iscsi_close(), scsicmd_close(), and scsidev_close().

◆ intf_restart()

void intf_restart ( struct interface intf,
int  rc 
)

Shut down and restart an object interface.

Parameters
intfObject interface
rcReason for close

Shuts down the interface, then unblocks operations that were blocked during shutdown.

Definition at line 337 of file interface.c.

337  {
338 
339  /* Shut down the interface */
340  intf_shutdown ( intf, rc );
341 
342  DBGC ( INTF_COL ( intf ), "INTF " INTF_FMT " restarting\n",
343  INTF_DBG ( intf ) );
344 
345  /* Restore the interface descriptor. Must be done after
346  * shutdown (rather than inhibiting intf_shutdown() from
347  * nullifying the descriptor) in order to avoid a potential
348  * infinite loop as the intf_close() operations on each side
349  * of the link call each other recursively.
350  */
351  intf_reinit ( intf );
352 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:273
#define INTF_DBG(intf)
printf() arguments for representing an object interface
Definition: interface.h:237
#define INTF_COL(intf)
Find debugging colourisation for an object interface.
Definition: interface.h:226
#define DBGC(...)
Definition: compiler.h:505
#define INTF_FMT
printf() format string for INTF_DBG()
Definition: interface.h:229
static void intf_reinit(struct interface *intf)
Reinitialise an object interface.
Definition: interface.h:256

References DBGC, 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(), 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(), tftp_reopen(), tftp_reopen_mc(), tftp_timer_expired(), tls_validator_done(), validator_xfer_close(), xcm_close(), xcm_reopen(), and xfer_vreopen().

◆ intfs_vrestart()

void intfs_vrestart ( va_list  intfs,
int  rc 
)

Shut down and restart multiple object interfaces.

Parameters
intfsObject interfaces
rcReason for close

Definition at line 360 of file interface.c.

360  {
361  struct interface *intf;
362  va_list tmp;
363 
364  /* Shut down all interfaces */
365  va_copy ( tmp, intfs );
366  intfs_vshutdown ( tmp, rc );
367  va_end ( tmp );
368 
369  /* Reinitialise all interfaces */
370  while ( ( intf = va_arg ( intfs, struct interface * ) ) )
371  intf_reinit ( intf );
372 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define va_end(ap)
Definition: stdarg.h:9
#define va_copy(dest, src)
Definition: stdarg.h:10
#define va_arg(ap, type)
Definition: stdarg.h:8
An object interface.
Definition: interface.h:109
uint8_t * tmp
Definition: entropy.h:156
__builtin_va_list va_list
Definition: stdarg.h:6
void intfs_vshutdown(va_list intfs, int rc)
Shut down multiple object interfaces.
Definition: interface.c:299
static void intf_reinit(struct interface *intf)
Reinitialise an object interface.
Definition: interface.h:256

References intf_reinit(), intfs_vshutdown(), rc, tmp, va_arg, va_copy, and va_end.

Referenced by intfs_restart().

◆ intfs_restart()

void intfs_restart ( int  rc,
  ... 
)

Shut down and restart multiple object interfaces.

Parameters
rcReason for close
...Object interfaces

Definition at line 380 of file interface.c.

380  {
381  va_list intfs;
382 
383  va_start ( intfs, rc );
384  intfs_vrestart ( intfs, rc );
385  va_end ( intfs );
386 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define va_end(ap)
Definition: stdarg.h:9
__builtin_va_list va_list
Definition: stdarg.h:6
#define va_start(ap, last)
Definition: stdarg.h:7
void intfs_vrestart(va_list intfs, int rc)
Shut down and restart multiple object interfaces.
Definition: interface.c:360

References intfs_vrestart(), rc, va_end, and va_start.

Referenced by http_transfer_complete(), and sanpath_close().

◆ intf_poke()

void intf_poke ( struct interface intf,
void(type)(struct interface *intf)   
)

Poke an object interface.

Parameters
intfObject interface
typeOperation type

This is a helper function to implement methods which take no parameters and return nothing.

Definition at line 397 of file interface.c.

398  {
399  struct interface *dest;
400  intf_poke_TYPE ( void * ) *op =
401  intf_get_dest_op_untyped ( intf, type, &dest );
402  void *object = intf_object ( dest );
403 
404  if ( op ) {
405  op ( object );
406  } else {
407  /* Default is to do nothing */
408  }
409 
410  intf_put ( dest );
411 }
void * intf_get_dest_op_untyped(struct interface *intf, void *type, struct interface **dest)
Get object interface destination and operation method.
Definition: interface.c:207
uint8_t type
Type.
Definition: ena.h:16
void * intf_object(struct interface *intf)
Get pointer to object containing object interface.
Definition: interface.c:154
An object interface.
Definition: interface.h:109
static void * dest
Definition: strings.h:176
#define intf_poke_TYPE(object_type)
Definition: interface.h:160
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327
void intf_put(struct interface *intf)
Decrement reference count on an object interface.
Definition: interface.c:144

References dest, 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().

Variable Documentation

◆ null_intf_op

struct interface_operation null_intf_op[]
static
Initial value:
= {
}
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:244
static void null_intf_close(struct interface *intf __unused, int rc __unused)
Close null interface.
Definition: interface.c:47
An object interface.
Definition: interface.h:109
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32

Null interface operations.

Definition at line 56 of file interface.c.

◆ null_intf_desc

struct interface_descriptor null_intf_desc
Initial value:
=
#define INTF_DESC_PURE(operations)
Define an object interface descriptor for a pure-interface object.
Definition: interface.h:100
static struct interface_operation null_intf_op[]
Null interface operations.
Definition: interface.c:56

Null interface descriptor.

Definition at line 61 of file interface.c.

Referenced by intf_nullify(), numeric_resolv(), and xfer_vredirect().

◆ null_intf

struct interface null_intf = INTF_INIT ( null_intf_desc )

The null interface.

Definition at line 65 of file interface.c.

Referenced by block_translate(), intf_init(), intf_shutdown(), and intf_unplug().