|  | @@ -32,22 +32,29 @@ struct xfer_interface_operations {
 | 
		
	
		
			
			| 32 | 32 |  
 | 
		
	
		
			
			| 33 | 33 |  	/** Close interface
 | 
		
	
		
			
			| 34 | 34 |  	 *
 | 
		
	
		
			
			| 35 |  | -	 * @v xfer		Data-transfer interface
 | 
		
	
		
			
			|  | 35 | +	 * @v xfer		Data transfer interface
 | 
		
	
		
			
			| 36 | 36 |  	 * @v rc		Reason for close
 | 
		
	
		
			
			| 37 | 37 |  	 */
 | 
		
	
		
			
			| 38 | 38 |  	void ( * close ) ( struct xfer_interface *xfer, int rc );
 | 
		
	
		
			
			| 39 | 39 |  	/** Redirect to new location
 | 
		
	
		
			
			| 40 | 40 |  	 *
 | 
		
	
		
			
			| 41 |  | -	 * @v xfer		Data-transfer interface
 | 
		
	
		
			
			|  | 41 | +	 * @v xfer		Data transfer interface
 | 
		
	
		
			
			| 42 | 42 |  	 * @v type		New location type
 | 
		
	
		
			
			| 43 | 43 |  	 * @v args		Remaining arguments depend upon location type
 | 
		
	
		
			
			| 44 | 44 |  	 * @ret rc		Return status code
 | 
		
	
		
			
			| 45 | 45 |  	 */
 | 
		
	
		
			
			| 46 | 46 |  	int ( * vredirect ) ( struct xfer_interface *xfer, int type,
 | 
		
	
		
			
			| 47 | 47 |  			      va_list args );
 | 
		
	
		
			
			|  | 48 | +	/** Seek to position
 | 
		
	
		
			
			|  | 49 | +	 *
 | 
		
	
		
			
			|  | 50 | +	 * @v xfer		Data transfer interface
 | 
		
	
		
			
			|  | 51 | +	 * @v pos		New position
 | 
		
	
		
			
			|  | 52 | +	 * @ret rc		Return status code
 | 
		
	
		
			
			|  | 53 | +	 */
 | 
		
	
		
			
			|  | 54 | +	int ( * seek ) ( struct xfer_interface *xfer, size_t pos );
 | 
		
	
		
			
			| 48 | 55 |  	/** Deliver datagram
 | 
		
	
		
			
			| 49 | 56 |  	 *
 | 
		
	
		
			
			| 50 |  | -	 * @v xfer		Data-transfer interface
 | 
		
	
		
			
			|  | 57 | +	 * @v xfer		Data transfer interface
 | 
		
	
		
			
			| 51 | 58 |  	 * @v iobuf		Datagram I/O buffer
 | 
		
	
		
			
			| 52 | 59 |  	 * @ret rc		Return status code
 | 
		
	
		
			
			| 53 | 60 |  	 *
 | 
		
	
	
		
			
			|  | @@ -59,7 +66,7 @@ struct xfer_interface_operations {
 | 
		
	
		
			
			| 59 | 66 |  			    struct io_buffer *iobuf );
 | 
		
	
		
			
			| 60 | 67 |  	/** Deliver datagram as raw data
 | 
		
	
		
			
			| 61 | 68 |  	 *
 | 
		
	
		
			
			| 62 |  | -	 * @v xfer		Data-transfer interface
 | 
		
	
		
			
			|  | 69 | +	 * @v xfer		Data transfer interface
 | 
		
	
		
			
			| 63 | 70 |  	 * @v data		Data buffer
 | 
		
	
		
			
			| 64 | 71 |  	 * @v len		Length of data buffer
 | 
		
	
		
			
			| 65 | 72 |  	 * @ret rc		Return status code
 | 
		
	
	
		
			
			|  | @@ -83,32 +90,67 @@ struct xfer_interface {
 | 
		
	
		
			
			| 83 | 90 |  extern struct xfer_interface null_xfer;
 | 
		
	
		
			
			| 84 | 91 |  extern struct xfer_interface_operations null_xfer_ops;
 | 
		
	
		
			
			| 85 | 92 |  
 | 
		
	
		
			
			|  | 93 | +extern void close ( struct xfer_interface *xfer, int rc );
 | 
		
	
		
			
			|  | 94 | +extern int seek ( struct xfer_interface *xfer, size_t pos );
 | 
		
	
		
			
			| 86 | 95 |  extern int vredirect ( struct xfer_interface *xfer, int type, va_list args );
 | 
		
	
		
			
			| 87 | 96 |  extern int redirect ( struct xfer_interface *xfer, int type, ... );
 | 
		
	
		
			
			| 88 | 97 |  extern int deliver ( struct xfer_interface *xfer, struct io_buffer *iobuf );
 | 
		
	
		
			
			| 89 | 98 |  extern int deliver_raw ( struct xfer_interface *xfer,
 | 
		
	
		
			
			| 90 | 99 |  			 const void *data, size_t len );
 | 
		
	
		
			
			| 91 | 100 |  
 | 
		
	
		
			
			|  | 101 | +extern void ignore_close ( struct xfer_interface *xfer, int rc );
 | 
		
	
		
			
			|  | 102 | +extern int ignore_vredirect ( struct xfer_interface *xfer,
 | 
		
	
		
			
			|  | 103 | +			      int type, va_list args );
 | 
		
	
		
			
			|  | 104 | +extern int ignore_seek ( struct xfer_interface *xfer, size_t pos );
 | 
		
	
		
			
			| 92 | 105 |  extern int deliver_as_raw ( struct xfer_interface *xfer,
 | 
		
	
		
			
			| 93 | 106 |  			    struct io_buffer *iobuf );
 | 
		
	
		
			
			| 94 | 107 |  extern int deliver_as_iobuf ( struct xfer_interface *xfer,
 | 
		
	
		
			
			| 95 | 108 |  			      const void *data, size_t len );
 | 
		
	
		
			
			|  | 109 | +extern int ignore_deliver_raw ( struct xfer_interface *xfer,
 | 
		
	
		
			
			|  | 110 | +				const void *data __unused, size_t len );
 | 
		
	
		
			
			|  | 111 | +
 | 
		
	
		
			
			|  | 112 | +/**
 | 
		
	
		
			
			|  | 113 | + * Initialise a data transfer interface
 | 
		
	
		
			
			|  | 114 | + *
 | 
		
	
		
			
			|  | 115 | + * @v xfer		Data transfer interface
 | 
		
	
		
			
			|  | 116 | + * @v op		Data transfer interface operations
 | 
		
	
		
			
			|  | 117 | + * @v refcnt		Data transfer interface reference counting method
 | 
		
	
		
			
			|  | 118 | + */
 | 
		
	
		
			
			|  | 119 | +static inline void xfer_init ( struct xfer_interface *xfer,
 | 
		
	
		
			
			|  | 120 | +			       struct xfer_interface_operations *op,
 | 
		
	
		
			
			|  | 121 | +			       void ( * refcnt ) ( struct interface *intf,
 | 
		
	
		
			
			|  | 122 | +						   int delta ) ) {
 | 
		
	
		
			
			|  | 123 | +	xfer->intf.dest = &null_xfer.intf;
 | 
		
	
		
			
			|  | 124 | +	xfer->intf.refcnt = refcnt;
 | 
		
	
		
			
			|  | 125 | +	xfer->op = op;
 | 
		
	
		
			
			|  | 126 | +}
 | 
		
	
		
			
			|  | 127 | +
 | 
		
	
		
			
			|  | 128 | +/**
 | 
		
	
		
			
			|  | 129 | + * Get data transfer interface from generic object communication interface
 | 
		
	
		
			
			|  | 130 | + *
 | 
		
	
		
			
			|  | 131 | + * @v intf		Generic object communication interface
 | 
		
	
		
			
			|  | 132 | + * @ret xfer		Data transfer interface
 | 
		
	
		
			
			|  | 133 | + */
 | 
		
	
		
			
			|  | 134 | +static inline struct xfer_interface *
 | 
		
	
		
			
			|  | 135 | +intf_to_xfer ( struct interface *intf ) {
 | 
		
	
		
			
			|  | 136 | +	return container_of ( intf, struct xfer_interface, intf );
 | 
		
	
		
			
			|  | 137 | +}
 | 
		
	
		
			
			| 96 | 138 |  
 | 
		
	
		
			
			| 97 | 139 |  /**
 | 
		
	
		
			
			| 98 |  | - * Get destination data-transfer interface
 | 
		
	
		
			
			|  | 140 | + * Get destination data transfer interface
 | 
		
	
		
			
			| 99 | 141 |   *
 | 
		
	
		
			
			| 100 |  | - * @v xfer		Data-transfer interface
 | 
		
	
		
			
			|  | 142 | + * @v xfer		Data transfer interface
 | 
		
	
		
			
			| 101 | 143 |   * @ret dest		Destination interface
 | 
		
	
		
			
			| 102 | 144 |   */
 | 
		
	
		
			
			| 103 | 145 |  static inline struct xfer_interface *
 | 
		
	
		
			
			| 104 | 146 |  xfer_dest ( struct xfer_interface *xfer ) {
 | 
		
	
		
			
			| 105 |  | -	return container_of ( xfer->intf.dest, struct xfer_interface, intf );
 | 
		
	
		
			
			|  | 147 | +	return intf_to_xfer ( xfer->intf.dest );
 | 
		
	
		
			
			| 106 | 148 |  }
 | 
		
	
		
			
			| 107 | 149 |  
 | 
		
	
		
			
			| 108 | 150 |  /**
 | 
		
	
		
			
			| 109 |  | - * Plug a data-transfer interface into a new destination interface
 | 
		
	
		
			
			|  | 151 | + * Plug a data transfer interface into a new destination interface
 | 
		
	
		
			
			| 110 | 152 |   *
 | 
		
	
		
			
			| 111 |  | - * @v xfer		Data-transfer interface
 | 
		
	
		
			
			|  | 153 | + * @v xfer		Data transfer interface
 | 
		
	
		
			
			| 112 | 154 |   * @v dest		New destination interface
 | 
		
	
		
			
			| 113 | 155 |   */
 | 
		
	
		
			
			| 114 | 156 |  static inline void xfer_plug ( struct xfer_interface *xfer,
 | 
		
	
	
		
			
			|  | @@ -117,23 +159,23 @@ static inline void xfer_plug ( struct xfer_interface *xfer,
 | 
		
	
		
			
			| 117 | 159 |  }
 | 
		
	
		
			
			| 118 | 160 |  
 | 
		
	
		
			
			| 119 | 161 |  /**
 | 
		
	
		
			
			| 120 |  | - * Unplug a data-transfer interface
 | 
		
	
		
			
			|  | 162 | + * Unplug a data transfer interface
 | 
		
	
		
			
			| 121 | 163 |   *
 | 
		
	
		
			
			| 122 |  | - * @v xfer		Data-transfer interface
 | 
		
	
		
			
			|  | 164 | + * @v xfer		Data transfer interface
 | 
		
	
		
			
			| 123 | 165 |   */
 | 
		
	
		
			
			| 124 | 166 |  static inline void xfer_unplug ( struct xfer_interface *xfer ) {
 | 
		
	
		
			
			| 125 | 167 |  	plug ( &xfer->intf, &null_xfer.intf );
 | 
		
	
		
			
			| 126 | 168 |  }
 | 
		
	
		
			
			| 127 | 169 |  
 | 
		
	
		
			
			| 128 | 170 |  /**
 | 
		
	
		
			
			| 129 |  | - * Terminate a data-transfer interface
 | 
		
	
		
			
			|  | 171 | + * Stop using a data transfer interface
 | 
		
	
		
			
			| 130 | 172 |   *
 | 
		
	
		
			
			| 131 |  | - * @v xfer		Data-transfer interface
 | 
		
	
		
			
			|  | 173 | + * @v xfer		Data transfer interface
 | 
		
	
		
			
			| 132 | 174 |   *
 | 
		
	
		
			
			| 133 | 175 |   * After calling this method, no further messages will be received via
 | 
		
	
		
			
			| 134 | 176 |   * the interface.
 | 
		
	
		
			
			| 135 | 177 |   */
 | 
		
	
		
			
			| 136 |  | -static inline void xfer_terminate ( struct xfer_interface *xfer ) {
 | 
		
	
		
			
			|  | 178 | +static inline void xfer_nullify ( struct xfer_interface *xfer ) {
 | 
		
	
		
			
			| 137 | 179 |  	xfer->op = &null_xfer_ops;
 | 
		
	
		
			
			| 138 | 180 |  };
 | 
		
	
		
			
			| 139 | 181 |  
 |