Browse Source

Make seek information part of the xfer metadata, rather than an entirely

separate xfer method.

Add missing .alloc_iob entries to several xfer_interface_operations
structures.
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
f6a8158eed

+ 24
- 45
src/core/downloader.c View File

96
 	if ( len <= downloader->image->len )
96
 	if ( len <= downloader->image->len )
97
 		return 0;
97
 		return 0;
98
 
98
 
99
+	DBGC ( downloader, "Downloader %p extending to %zd bytes\n",
100
+	       downloader, len );
101
+
99
 	/* Extend buffer */
102
 	/* Extend buffer */
100
 	new_buffer = urealloc ( downloader->image->data, len );
103
 	new_buffer = urealloc ( downloader->image->data, len );
101
 	if ( ! new_buffer ) {
104
 	if ( ! new_buffer ) {
141
  *
144
  *
142
  */
145
  */
143
 
146
 
144
-/**
145
- * Handle seek() event received via data transfer interface
146
- *
147
- * @v xfer		Downloader data transfer interface
148
- * @v pos		New position
149
- * @ret rc		Return status code
150
- */
151
-static int downloader_xfer_seek ( struct xfer_interface *xfer, off_t offset,
152
-				  int whence ) {
153
-	struct downloader *downloader =
154
-		container_of ( xfer, struct downloader, xfer );
155
-	off_t new_pos;
156
-	int rc;
157
-
158
-	/* Calculate new buffer position */
159
-	switch ( whence ) {
160
-	case SEEK_SET:
161
-		new_pos = offset;
162
-		break;
163
-	case SEEK_CUR:
164
-		new_pos = ( downloader->pos + offset );
165
-		break;
166
-	default:
167
-		assert ( 0 );
168
-		return -EINVAL;
169
-	}
170
-
171
-	/* Ensure that we have enough buffer space for this buffer position */
172
-	if ( ( rc = downloader_ensure_size ( downloader, new_pos ) ) != 0 )
173
-		return rc;
174
-	downloader->pos = new_pos;
175
-
176
-	return 0;
177
-}
178
-
179
 /**
147
 /**
180
  * Handle deliver_raw() event received via data transfer interface
148
  * Handle deliver_raw() event received via data transfer interface
181
  *
149
  *
182
  * @v xfer		Downloader data transfer interface
150
  * @v xfer		Downloader data transfer interface
183
- * @v data		Data buffer
184
- * @v len		Length of data buffer
151
+ * @v iobuf		Datagram I/O buffer
152
+ * @v meta		Data transfer metadata
185
  * @ret rc		Return status code
153
  * @ret rc		Return status code
186
  */
154
  */
187
-static int downloader_xfer_deliver_raw ( struct xfer_interface *xfer,
188
-					 const void *data, size_t len ) {
155
+static int downloader_xfer_deliver_iob ( struct xfer_interface *xfer,
156
+					 struct io_buffer *iobuf,
157
+					 struct xfer_metadata *meta ) {
189
 	struct downloader *downloader =
158
 	struct downloader *downloader =
190
 		container_of ( xfer, struct downloader, xfer );
159
 		container_of ( xfer, struct downloader, xfer );
160
+	size_t len;
191
 	size_t max;
161
 	size_t max;
192
 	int rc;
162
 	int rc;
193
 
163
 
164
+	/* Calculate new buffer position */
165
+	if ( meta->whence != SEEK_CUR )
166
+		downloader->pos = 0;
167
+	downloader->pos += meta->offset;
168
+
194
 	/* Ensure that we have enough buffer space for this data */
169
 	/* Ensure that we have enough buffer space for this data */
170
+	len = iob_len ( iobuf );
195
 	max = ( downloader->pos + len );
171
 	max = ( downloader->pos + len );
196
 	if ( ( rc = downloader_ensure_size ( downloader, max ) ) != 0 )
172
 	if ( ( rc = downloader_ensure_size ( downloader, max ) ) != 0 )
197
-		return rc;
173
+		goto done;
198
 
174
 
199
 	/* Copy data to buffer */
175
 	/* Copy data to buffer */
200
-	copy_to_user ( downloader->image->data, downloader->pos, data, len );
176
+	copy_to_user ( downloader->image->data, downloader->pos,
177
+		       iobuf->data, len );
201
 
178
 
202
 	/* Update current buffer position */
179
 	/* Update current buffer position */
203
 	downloader->pos += len;
180
 	downloader->pos += len;
204
 
181
 
205
-	return 0;
182
+ done:
183
+	free_iob ( iobuf );
184
+	return rc;
206
 }
185
 }
207
 
186
 
208
 /**
187
 /**
227
 static struct xfer_interface_operations downloader_xfer_operations = {
206
 static struct xfer_interface_operations downloader_xfer_operations = {
228
 	.close		= downloader_xfer_close,
207
 	.close		= downloader_xfer_close,
229
 	.vredirect	= xfer_vopen,
208
 	.vredirect	= xfer_vopen,
230
-	.seek		= downloader_xfer_seek,
231
 	.window		= unlimited_xfer_window,
209
 	.window		= unlimited_xfer_window,
232
-	.deliver_iob	= xfer_deliver_as_raw,
233
-	.deliver_raw	= downloader_xfer_deliver_raw,
210
+	.alloc_iob	= default_xfer_alloc_iob,
211
+	.deliver_iob	= downloader_xfer_deliver_iob,
212
+	.deliver_raw	= xfer_deliver_as_iob,
234
 };
213
 };
235
 
214
 
236
 /****************************************************************************
215
 /****************************************************************************

+ 0
- 6
src/core/filter.c View File

44
 	return xfer_vredirect ( other, type, args );
44
 	return xfer_vredirect ( other, type, args );
45
 }
45
 }
46
 
46
 
47
-int filter_seek ( struct xfer_interface *xfer, off_t offset, int whence ) {
48
-	struct xfer_interface *other = filter_other_half ( xfer );
49
-
50
-	return xfer_seek ( other, offset, whence );
51
-}
52
-
53
 size_t filter_window ( struct xfer_interface *xfer ) {
47
 size_t filter_window ( struct xfer_interface *xfer ) {
54
 	struct xfer_interface *other = filter_other_half ( xfer );
48
 	struct xfer_interface *other = filter_other_half ( xfer );
55
 
49
 

+ 1
- 1
src/core/hw.c View File

36
 static struct xfer_interface_operations hw_xfer_operations = {
36
 static struct xfer_interface_operations hw_xfer_operations = {
37
 	.close		= hw_xfer_close,
37
 	.close		= hw_xfer_close,
38
 	.vredirect	= ignore_xfer_vredirect,
38
 	.vredirect	= ignore_xfer_vredirect,
39
-	.seek		= ignore_xfer_seek,
40
 	.window		= unlimited_xfer_window,
39
 	.window		= unlimited_xfer_window,
40
+	.alloc_iob	= default_xfer_alloc_iob,
41
 	.deliver_iob	= xfer_deliver_as_raw,
41
 	.deliver_iob	= xfer_deliver_as_raw,
42
 	.deliver_raw	= ignore_xfer_deliver_raw,
42
 	.deliver_raw	= ignore_xfer_deliver_raw,
43
 };
43
 };

+ 8
- 29
src/core/posix_io.c View File

103
 	posix_file_finished ( file, rc );
103
 	posix_file_finished ( file, rc );
104
 }
104
 }
105
 
105
 
106
-/**
107
- * Handle seek() event
108
- *
109
- * @v xfer		POSIX file data transfer interface
110
- * @v pos		New position
111
- * @ret rc		Return status code
112
- */
113
-static int posix_file_xfer_seek ( struct xfer_interface *xfer, off_t offset,
114
-				  int whence ) {
115
-	struct posix_file *file =
116
-		container_of ( xfer, struct posix_file, xfer );
117
-
118
-	switch ( whence ) {
119
-	case SEEK_SET:
120
-		file->pos = offset;
121
-		break;
122
-	case SEEK_CUR:
123
-		file->pos += offset;
124
-		break;
125
-	}
126
-
127
-	if ( file->filesize < file->pos )
128
-		file->filesize = file->pos;
129
-
130
-	return 0;
131
-}
132
-
133
 /**
106
 /**
134
  * Handle deliver_iob() event
107
  * Handle deliver_iob() event
135
  *
108
  *
136
  * @v xfer		POSIX file data transfer interface
109
  * @v xfer		POSIX file data transfer interface
137
  * @v iobuf		I/O buffer
110
  * @v iobuf		I/O buffer
138
- * @v meta		Data transfer metadata, or NULL
111
+ * @v meta		Data transfer metadata
139
  * @ret rc		Return status code
112
  * @ret rc		Return status code
140
  */
113
  */
141
 static int
114
 static int
145
 	struct posix_file *file =
118
 	struct posix_file *file =
146
 		container_of ( xfer, struct posix_file, xfer );
119
 		container_of ( xfer, struct posix_file, xfer );
147
 
120
 
121
+	/* Keep track of file position solely for the filesize */
122
+	if ( meta->whence != SEEK_CUR )
123
+		file->pos = 0;
124
+	file->pos += meta->offset;
125
+	if ( file->filesize < file->pos )
126
+		file->filesize = file->pos;
127
+
148
 	list_add_tail ( &iobuf->list, &file->data );
128
 	list_add_tail ( &iobuf->list, &file->data );
149
 	return 0;
129
 	return 0;
150
 }
130
 }
153
 static struct xfer_interface_operations posix_file_xfer_operations = {
133
 static struct xfer_interface_operations posix_file_xfer_operations = {
154
 	.close		= posix_file_xfer_close,
134
 	.close		= posix_file_xfer_close,
155
 	.vredirect	= xfer_vopen,
135
 	.vredirect	= xfer_vopen,
156
-	.seek		= posix_file_xfer_seek,
157
 	.window		= unlimited_xfer_window,
136
 	.window		= unlimited_xfer_window,
158
 	.alloc_iob	= default_xfer_alloc_iob,
137
 	.alloc_iob	= default_xfer_alloc_iob,
159
 	.deliver_iob	= posix_file_xfer_deliver_iob,
138
 	.deliver_iob	= posix_file_xfer_deliver_iob,

+ 0
- 1
src/core/resolv.c View File

312
 static struct xfer_interface_operations named_xfer_ops = {
312
 static struct xfer_interface_operations named_xfer_ops = {
313
 	.close		= ignore_xfer_close,
313
 	.close		= ignore_xfer_close,
314
 	.vredirect	= ignore_xfer_vredirect,
314
 	.vredirect	= ignore_xfer_vredirect,
315
-	.seek		= ignore_xfer_seek,
316
 	.window		= no_xfer_window,
315
 	.window		= no_xfer_window,
317
 	.alloc_iob	= default_xfer_alloc_iob,
316
 	.alloc_iob	= default_xfer_alloc_iob,
318
 	.deliver_iob	= xfer_deliver_as_raw,
317
 	.deliver_iob	= xfer_deliver_as_raw,

+ 28
- 41
src/core/xfer.c View File

85
 	return rc;
85
 	return rc;
86
 }
86
 }
87
 
87
 
88
-/**
89
- * Seek to position
90
- *
91
- * @v xfer		Data transfer interface
92
- * @v offset		Offset to new position
93
- * @v whence		Basis for new position
94
- * @ret rc		Return status code
95
- */
96
-int xfer_seek ( struct xfer_interface *xfer, off_t offset, int whence ) {
97
-	struct xfer_interface *dest = xfer_get_dest ( xfer );
98
-	int rc;
99
-
100
-	DBGC ( xfer, "XFER %p->%p seek %s+%ld\n", xfer, dest,
101
-	       whence_text ( whence ), offset );
102
-
103
-	rc = dest->op->seek ( dest, offset, whence );
104
-
105
-	if ( rc != 0 ) {
106
-		DBGC ( xfer, "XFER %p<-%p seek: %s\n", xfer, dest,
107
-		       strerror ( rc ) );
108
-	}
109
-	xfer_put ( dest );
110
-	return rc;
111
-}
112
-
113
 /**
88
 /**
114
  * Check flow control window
89
  * Check flow control window
115
  *
90
  *
153
  *
128
  *
154
  * @v xfer		Data transfer interface
129
  * @v xfer		Data transfer interface
155
  * @v iobuf		Datagram I/O buffer
130
  * @v iobuf		Datagram I/O buffer
156
- * @v meta		Data transfer metadata, or NULL
131
+ * @v meta		Data transfer metadata
157
  * @ret rc		Return status code
132
  * @ret rc		Return status code
158
  */
133
  */
159
 int xfer_deliver_iob_meta ( struct xfer_interface *xfer,
134
 int xfer_deliver_iob_meta ( struct xfer_interface *xfer,
184
  */
159
  */
185
 int xfer_deliver_iob ( struct xfer_interface *xfer,
160
 int xfer_deliver_iob ( struct xfer_interface *xfer,
186
 		       struct io_buffer *iobuf ) {
161
 		       struct io_buffer *iobuf ) {
187
-	return xfer_deliver_iob_meta ( xfer, iobuf, NULL );
162
+	static struct xfer_metadata dummy_metadata;
163
+	return xfer_deliver_iob_meta ( xfer, iobuf, &dummy_metadata );
188
 }
164
 }
189
 
165
 
190
 /**
166
 /**
253
 	return rc;
229
 	return rc;
254
 }
230
 }
255
 
231
 
232
+/**
233
+ * Seek to position
234
+ *
235
+ * @v xfer		Data transfer interface
236
+ * @v offset		Offset to new position
237
+ * @v whence		Basis for new position
238
+ * @ret rc		Return status code
239
+ */
240
+int xfer_seek ( struct xfer_interface *xfer, off_t offset, int whence ) {
241
+	struct io_buffer *iobuf;
242
+	struct xfer_metadata meta = {
243
+		.offset = offset,
244
+		.whence = whence,
245
+	};
246
+
247
+	DBGC ( xfer, "XFER %p seek %s+%ld\n", xfer,
248
+	       whence_text ( whence ), offset );
249
+
250
+	/* Allocate and send a zero-length data buffer */
251
+	iobuf = xfer_alloc_iob ( xfer, 0 );
252
+	if ( ! iobuf )
253
+		return -ENOMEM;
254
+	return xfer_deliver_iob_meta ( xfer, iobuf, &meta );
255
+}
256
+
256
 /****************************************************************************
257
 /****************************************************************************
257
  *
258
  *
258
  * Helper methods
259
  * Helper methods
286
 	return 0;
287
 	return 0;
287
 }
288
 }
288
 
289
 
289
-/**
290
- * Ignore seek() event
291
- *
292
- * @v xfer		Data transfer interface
293
- * @v offset		Offset to new position
294
- * @v whence		Basis for new position
295
- * @ret rc		Return status code
296
- */
297
-int ignore_xfer_seek ( struct xfer_interface *xfer __unused,
298
-		       off_t offset __unused, int whence __unused ) {
299
-	return 0;
300
-}
301
-
302
 /**
290
 /**
303
  * Unlimited flow control window
291
  * Unlimited flow control window
304
  *
292
  *
401
 struct xfer_interface_operations null_xfer_ops = {
389
 struct xfer_interface_operations null_xfer_ops = {
402
 	.close		= ignore_xfer_close,
390
 	.close		= ignore_xfer_close,
403
 	.vredirect	= ignore_xfer_vredirect,
391
 	.vredirect	= ignore_xfer_vredirect,
404
-	.seek		= ignore_xfer_seek,
405
 	.window		= unlimited_xfer_window,
392
 	.window		= unlimited_xfer_window,
406
 	.alloc_iob	= default_xfer_alloc_iob,
393
 	.alloc_iob	= default_xfer_alloc_iob,
407
 	.deliver_iob	= xfer_deliver_as_raw,
394
 	.deliver_iob	= xfer_deliver_as_raw,

+ 0
- 2
src/include/gpxe/filter.h View File

41
 extern void filter_close ( struct xfer_interface *xfer, int rc );
41
 extern void filter_close ( struct xfer_interface *xfer, int rc );
42
 extern int filter_vredirect ( struct xfer_interface *xfer, int type,
42
 extern int filter_vredirect ( struct xfer_interface *xfer, int type,
43
 			      va_list args );
43
 			      va_list args );
44
-extern int filter_seek ( struct xfer_interface *xfer, off_t offset,
45
-			 int whence );
46
 extern size_t filter_window ( struct xfer_interface *xfer );
44
 extern size_t filter_window ( struct xfer_interface *xfer );
47
 extern struct io_buffer * filter_alloc_iob ( struct xfer_interface *xfer,
45
 extern struct io_buffer * filter_alloc_iob ( struct xfer_interface *xfer,
48
 					     size_t len );
46
 					     size_t len );

+ 16
- 22
src/include/gpxe/xfer.h View File

32
 	 */
32
 	 */
33
 	int ( * vredirect ) ( struct xfer_interface *xfer, int type,
33
 	int ( * vredirect ) ( struct xfer_interface *xfer, int type,
34
 			      va_list args );
34
 			      va_list args );
35
-	/** Seek to position
36
-	 *
37
-	 * @v xfer		Data transfer interface
38
-	 * @v offset		Offset to new position
39
-	 * @v whence		Basis for new position
40
-	 * @ret rc		Return status code
41
-	 *
42
-	 * @c whence must be one of @c SEEK_SET or @c SEEK_CUR.
43
-	 */
44
-	int ( * seek ) ( struct xfer_interface *xfer, off_t offset,
45
-			 int whence );
46
 	/** Check flow control window
35
 	/** Check flow control window
47
 	 *
36
 	 *
48
 	 * @v xfer		Data transfer interface
37
 	 * @v xfer		Data transfer interface
71
 	 *
60
 	 *
72
 	 * @v xfer		Data transfer interface
61
 	 * @v xfer		Data transfer interface
73
 	 * @v iobuf		Datagram I/O buffer
62
 	 * @v iobuf		Datagram I/O buffer
74
-	 * @v meta		Data transfer metadata, or NULL
63
+	 * @v meta		Data transfer metadata
75
 	 * @ret rc		Return status code
64
 	 * @ret rc		Return status code
76
 	 *
65
 	 *
77
 	 * A data transfer interface that wishes to support only raw
66
 	 * A data transfer interface that wishes to support only raw
104
 	struct xfer_interface_operations *op;
93
 	struct xfer_interface_operations *op;
105
 };
94
 };
106
 
95
 
96
+/** Basis positions for seek() events */
97
+enum seek_whence {
98
+	SEEK_CUR = 0,
99
+	SEEK_SET,
100
+};
101
+
107
 /** Data transfer metadata */
102
 /** Data transfer metadata */
108
 struct xfer_metadata {
103
 struct xfer_metadata {
104
+	/** Position of data within stream */
105
+	off_t offset;
106
+	/** Basis for data position
107
+	 *
108
+	 * Must be one of @c SEEK_CUR or @c SEEK_SET.
109
+	 */
110
+	int whence;
109
 	/** Source socket address, or NULL */
111
 	/** Source socket address, or NULL */
110
 	struct sockaddr *src;
112
 	struct sockaddr *src;
111
 	/** Destination socket address, or NULL */
113
 	/** Destination socket address, or NULL */
114
 	struct net_device *netdev;
116
 	struct net_device *netdev;
115
 };
117
 };
116
 
118
 
117
-/** Basis positions for seek() events */
118
-enum seek_whence {
119
-	SEEK_SET = 0,
120
-	SEEK_CUR,
121
-};
122
-
123
 /**
119
 /**
124
  * Describe seek basis
120
  * Describe seek basis
125
  *
121
  *
128
 static inline __attribute__ (( always_inline )) const char *
124
 static inline __attribute__ (( always_inline )) const char *
129
 whence_text ( int whence ) {
125
 whence_text ( int whence ) {
130
 	switch ( whence ) {
126
 	switch ( whence ) {
131
-	case SEEK_SET:	return "SET";
132
 	case SEEK_CUR:	return "CUR";
127
 	case SEEK_CUR:	return "CUR";
128
+	case SEEK_SET:	return "SET";
133
 	default:	return "INVALID";
129
 	default:	return "INVALID";
134
 	}
130
 	}
135
 }
131
 }
141
 extern int xfer_vredirect ( struct xfer_interface *xfer, int type,
137
 extern int xfer_vredirect ( struct xfer_interface *xfer, int type,
142
 			    va_list args );
138
 			    va_list args );
143
 extern int xfer_redirect ( struct xfer_interface *xfer, int type, ... );
139
 extern int xfer_redirect ( struct xfer_interface *xfer, int type, ... );
144
-extern int xfer_seek ( struct xfer_interface *xfer, off_t offset, int whence );
145
 extern size_t xfer_window ( struct xfer_interface *xfer );
140
 extern size_t xfer_window ( struct xfer_interface *xfer );
146
 extern struct io_buffer * xfer_alloc_iob ( struct xfer_interface *xfer,
141
 extern struct io_buffer * xfer_alloc_iob ( struct xfer_interface *xfer,
147
 					   size_t len );
142
 					   size_t len );
156
 			  const char *format, va_list args );
151
 			  const char *format, va_list args );
157
 extern int xfer_printf ( struct xfer_interface *xfer,
152
 extern int xfer_printf ( struct xfer_interface *xfer,
158
 			 const char *format, ... );
153
 			 const char *format, ... );
154
+extern int xfer_seek ( struct xfer_interface *xfer, off_t offset, int whence );
159
 
155
 
160
 extern void ignore_xfer_close ( struct xfer_interface *xfer, int rc );
156
 extern void ignore_xfer_close ( struct xfer_interface *xfer, int rc );
161
 extern int ignore_xfer_vredirect ( struct xfer_interface *xfer,
157
 extern int ignore_xfer_vredirect ( struct xfer_interface *xfer,
162
 				   int type, va_list args );
158
 				   int type, va_list args );
163
-extern int ignore_xfer_seek ( struct xfer_interface *xfer, off_t offset,
164
-			      int whence );
165
 extern size_t unlimited_xfer_window ( struct xfer_interface *xfer );
159
 extern size_t unlimited_xfer_window ( struct xfer_interface *xfer );
166
 extern size_t no_xfer_window ( struct xfer_interface *xfer );
160
 extern size_t no_xfer_window ( struct xfer_interface *xfer );
167
 extern struct io_buffer * default_xfer_alloc_iob ( struct xfer_interface *xfer,
161
 extern struct io_buffer * default_xfer_alloc_iob ( struct xfer_interface *xfer,

+ 0
- 1
src/interface/pxe/pxe_udp.c View File

103
 static struct xfer_interface_operations pxe_udp_xfer_operations = {
103
 static struct xfer_interface_operations pxe_udp_xfer_operations = {
104
 	.close		= ignore_xfer_close,
104
 	.close		= ignore_xfer_close,
105
 	.vredirect	= ignore_xfer_vredirect,
105
 	.vredirect	= ignore_xfer_vredirect,
106
-	.seek		= ignore_xfer_seek,
107
 	.window		= unlimited_xfer_window,
106
 	.window		= unlimited_xfer_window,
108
 	.alloc_iob	= default_xfer_alloc_iob,
107
 	.alloc_iob	= default_xfer_alloc_iob,
109
 	.deliver_iob	= pxe_udp_deliver_iob,
108
 	.deliver_iob	= pxe_udp_deliver_iob,

+ 0
- 1
src/net/tcp.c View File

1022
 static struct xfer_interface_operations tcp_xfer_operations = {
1022
 static struct xfer_interface_operations tcp_xfer_operations = {
1023
 	.close		= tcp_xfer_close,
1023
 	.close		= tcp_xfer_close,
1024
 	.vredirect	= ignore_xfer_vredirect,
1024
 	.vredirect	= ignore_xfer_vredirect,
1025
-	.seek		= ignore_xfer_seek,
1026
 	.window		= tcp_xfer_window,
1025
 	.window		= tcp_xfer_window,
1027
 	.alloc_iob	= default_xfer_alloc_iob,
1026
 	.alloc_iob	= default_xfer_alloc_iob,
1028
 	.deliver_iob	= tcp_xfer_deliver_iob,
1027
 	.deliver_iob	= tcp_xfer_deliver_iob,

+ 0
- 3
src/net/tcp/ftp.c View File

299
 static struct xfer_interface_operations ftp_control_operations = {
299
 static struct xfer_interface_operations ftp_control_operations = {
300
 	.close		= ftp_control_close,
300
 	.close		= ftp_control_close,
301
 	.vredirect	= xfer_vopen,
301
 	.vredirect	= xfer_vopen,
302
-	.seek		= ignore_xfer_seek,
303
 	.window		= unlimited_xfer_window,
302
 	.window		= unlimited_xfer_window,
304
 	.alloc_iob	= default_xfer_alloc_iob,
303
 	.alloc_iob	= default_xfer_alloc_iob,
305
 	.deliver_iob	= xfer_deliver_as_raw,
304
 	.deliver_iob	= xfer_deliver_as_raw,
364
 static struct xfer_interface_operations ftp_data_operations = {
363
 static struct xfer_interface_operations ftp_data_operations = {
365
 	.close		= ftp_data_closed,
364
 	.close		= ftp_data_closed,
366
 	.vredirect	= xfer_vopen,
365
 	.vredirect	= xfer_vopen,
367
-	.seek		= ignore_xfer_seek,
368
 	.window		= unlimited_xfer_window,
366
 	.window		= unlimited_xfer_window,
369
 	.alloc_iob	= default_xfer_alloc_iob,
367
 	.alloc_iob	= default_xfer_alloc_iob,
370
 	.deliver_iob	= ftp_data_deliver_iob,
368
 	.deliver_iob	= ftp_data_deliver_iob,
397
 static struct xfer_interface_operations ftp_xfer_operations = {
395
 static struct xfer_interface_operations ftp_xfer_operations = {
398
 	.close		= ftp_xfer_closed,
396
 	.close		= ftp_xfer_closed,
399
 	.vredirect	= ignore_xfer_vredirect,
397
 	.vredirect	= ignore_xfer_vredirect,
400
-	.seek		= ignore_xfer_seek,
401
 	.window		= unlimited_xfer_window,
398
 	.window		= unlimited_xfer_window,
402
 	.alloc_iob	= default_xfer_alloc_iob,
399
 	.alloc_iob	= default_xfer_alloc_iob,
403
 	.deliver_iob	= xfer_deliver_as_raw,
400
 	.deliver_iob	= xfer_deliver_as_raw,

+ 0
- 2
src/net/tcp/http.c View File

426
 static struct xfer_interface_operations http_socket_operations = {
426
 static struct xfer_interface_operations http_socket_operations = {
427
 	.close		= http_socket_close,
427
 	.close		= http_socket_close,
428
 	.vredirect	= xfer_vopen,
428
 	.vredirect	= xfer_vopen,
429
-	.seek		= ignore_xfer_seek,
430
 	.window		= unlimited_xfer_window,
429
 	.window		= unlimited_xfer_window,
431
 	.alloc_iob	= default_xfer_alloc_iob,
430
 	.alloc_iob	= default_xfer_alloc_iob,
432
 	.deliver_iob	= http_socket_deliver_iob,
431
 	.deliver_iob	= http_socket_deliver_iob,
453
 static struct xfer_interface_operations http_xfer_operations = {
452
 static struct xfer_interface_operations http_xfer_operations = {
454
 	.close		= http_xfer_close,
453
 	.close		= http_xfer_close,
455
 	.vredirect	= ignore_xfer_vredirect,
454
 	.vredirect	= ignore_xfer_vredirect,
456
-	.seek		= ignore_xfer_seek,
457
 	.window		= unlimited_xfer_window,
455
 	.window		= unlimited_xfer_window,
458
 	.alloc_iob	= default_xfer_alloc_iob,
456
 	.alloc_iob	= default_xfer_alloc_iob,
459
 	.deliver_iob	= xfer_deliver_as_raw,
457
 	.deliver_iob	= xfer_deliver_as_raw,

+ 0
- 1
src/net/tcp/iscsi.c View File

1322
 static struct xfer_interface_operations iscsi_socket_operations = {
1322
 static struct xfer_interface_operations iscsi_socket_operations = {
1323
 	.close		= iscsi_socket_close,
1323
 	.close		= iscsi_socket_close,
1324
 	.vredirect	= iscsi_vredirect,
1324
 	.vredirect	= iscsi_vredirect,
1325
-	.seek		= ignore_xfer_seek,
1326
 	.window		= unlimited_xfer_window,
1325
 	.window		= unlimited_xfer_window,
1327
 	.alloc_iob	= default_xfer_alloc_iob,
1326
 	.alloc_iob	= default_xfer_alloc_iob,
1328
 	.deliver_iob	= xfer_deliver_as_raw,
1327
 	.deliver_iob	= xfer_deliver_as_raw,

+ 0
- 2
src/net/tls.c View File

1460
 static struct xfer_interface_operations tls_plainstream_operations = {
1460
 static struct xfer_interface_operations tls_plainstream_operations = {
1461
 	.close		= tls_plainstream_close,
1461
 	.close		= tls_plainstream_close,
1462
 	.vredirect	= ignore_xfer_vredirect,
1462
 	.vredirect	= ignore_xfer_vredirect,
1463
-	.seek		= filter_seek,
1464
 	.window		= tls_plainstream_window,
1463
 	.window		= tls_plainstream_window,
1465
 	.alloc_iob	= default_xfer_alloc_iob,
1464
 	.alloc_iob	= default_xfer_alloc_iob,
1466
 	.deliver_iob	= xfer_deliver_as_raw,
1465
 	.deliver_iob	= xfer_deliver_as_raw,
1600
 static struct xfer_interface_operations tls_cipherstream_operations = {
1599
 static struct xfer_interface_operations tls_cipherstream_operations = {
1601
 	.close		= tls_cipherstream_close,
1600
 	.close		= tls_cipherstream_close,
1602
 	.vredirect	= xfer_vopen,
1601
 	.vredirect	= xfer_vopen,
1603
-	.seek		= filter_seek,
1604
 	.window		= filter_window,
1602
 	.window		= filter_window,
1605
 	.alloc_iob	= default_xfer_alloc_iob,
1603
 	.alloc_iob	= default_xfer_alloc_iob,
1606
 	.deliver_iob	= xfer_deliver_as_raw,
1604
 	.deliver_iob	= xfer_deliver_as_raw,

+ 0
- 1
src/net/udp.c View File

415
 static struct xfer_interface_operations udp_xfer_operations = {
415
 static struct xfer_interface_operations udp_xfer_operations = {
416
 	.close		= udp_xfer_close,
416
 	.close		= udp_xfer_close,
417
 	.vredirect	= ignore_xfer_vredirect,
417
 	.vredirect	= ignore_xfer_vredirect,
418
-	.seek		= ignore_xfer_seek,
419
 	.window		= unlimited_xfer_window,
418
 	.window		= unlimited_xfer_window,
420
 	.alloc_iob	= udp_alloc_iob,
419
 	.alloc_iob	= udp_alloc_iob,
421
 	.deliver_iob	= udp_xfer_deliver_iob,
420
 	.deliver_iob	= udp_xfer_deliver_iob,

+ 1
- 1
src/net/udp/dhcp.c View File

927
 static struct xfer_interface_operations dhcp_xfer_operations = {
927
 static struct xfer_interface_operations dhcp_xfer_operations = {
928
 	.close		= ignore_xfer_close,
928
 	.close		= ignore_xfer_close,
929
 	.vredirect	= xfer_vopen,
929
 	.vredirect	= xfer_vopen,
930
-	.seek		= ignore_xfer_seek,
931
 	.window		= unlimited_xfer_window,
930
 	.window		= unlimited_xfer_window,
931
+	.alloc_iob	= default_xfer_alloc_iob,
932
 	.deliver_iob	= xfer_deliver_as_raw,
932
 	.deliver_iob	= xfer_deliver_as_raw,
933
 	.deliver_raw	= dhcp_deliver_raw,
933
 	.deliver_raw	= dhcp_deliver_raw,
934
 };
934
 };

+ 0
- 1
src/net/udp/dns.c View File

435
 static struct xfer_interface_operations dns_socket_operations = {
435
 static struct xfer_interface_operations dns_socket_operations = {
436
 	.close		= dns_xfer_close,
436
 	.close		= dns_xfer_close,
437
 	.vredirect	= xfer_vopen,
437
 	.vredirect	= xfer_vopen,
438
-	.seek		= ignore_xfer_seek,
439
 	.window		= unlimited_xfer_window,
438
 	.window		= unlimited_xfer_window,
440
 	.alloc_iob	= default_xfer_alloc_iob,
439
 	.alloc_iob	= default_xfer_alloc_iob,
441
 	.deliver_iob	= xfer_deliver_as_raw,
440
 	.deliver_iob	= xfer_deliver_as_raw,

+ 5
- 5
src/net/udp/tftp.c View File

554
 static int tftp_rx_data ( struct tftp_request *tftp,
554
 static int tftp_rx_data ( struct tftp_request *tftp,
555
 			  struct io_buffer *iobuf ) {
555
 			  struct io_buffer *iobuf ) {
556
 	struct tftp_data *data = iobuf->data;
556
 	struct tftp_data *data = iobuf->data;
557
+	struct xfer_metadata meta;
557
 	int block;
558
 	int block;
558
 	off_t offset;
559
 	off_t offset;
559
 	size_t data_len;
560
 	size_t data_len;
580
 	}
581
 	}
581
 
582
 
582
 	/* Deliver data */
583
 	/* Deliver data */
583
-	xfer_seek ( &tftp->xfer, offset, SEEK_SET );
584
-	rc = xfer_deliver_iob ( &tftp->xfer, iobuf );
584
+	memset ( &meta, 0, sizeof ( meta ) );
585
+	meta.whence = SEEK_SET;
586
+	meta.offset = offset;
587
+	rc = xfer_deliver_iob_meta ( &tftp->xfer, iobuf, &meta );
585
 	iobuf = NULL;
588
 	iobuf = NULL;
586
 	if ( rc != 0 ) {
589
 	if ( rc != 0 ) {
587
 		DBGC ( tftp, "TFTP %p could not deliver data: %s\n",
590
 		DBGC ( tftp, "TFTP %p could not deliver data: %s\n",
763
 static struct xfer_interface_operations tftp_socket_operations = {
766
 static struct xfer_interface_operations tftp_socket_operations = {
764
 	.close		= tftp_socket_close,
767
 	.close		= tftp_socket_close,
765
 	.vredirect	= xfer_vopen,
768
 	.vredirect	= xfer_vopen,
766
-	.seek		= ignore_xfer_seek,
767
 	.window		= unlimited_xfer_window,
769
 	.window		= unlimited_xfer_window,
768
 	.alloc_iob	= default_xfer_alloc_iob,
770
 	.alloc_iob	= default_xfer_alloc_iob,
769
 	.deliver_iob	= tftp_socket_deliver_iob,
771
 	.deliver_iob	= tftp_socket_deliver_iob,
811
 static struct xfer_interface_operations tftp_mc_socket_operations = {
813
 static struct xfer_interface_operations tftp_mc_socket_operations = {
812
 	.close		= tftp_mc_socket_close,
814
 	.close		= tftp_mc_socket_close,
813
 	.vredirect	= xfer_vopen,
815
 	.vredirect	= xfer_vopen,
814
-	.seek		= ignore_xfer_seek,
815
 	.window		= unlimited_xfer_window,
816
 	.window		= unlimited_xfer_window,
816
 	.alloc_iob	= default_xfer_alloc_iob,
817
 	.alloc_iob	= default_xfer_alloc_iob,
817
 	.deliver_iob	= tftp_mc_socket_deliver_iob,
818
 	.deliver_iob	= tftp_mc_socket_deliver_iob,
838
 static struct xfer_interface_operations tftp_xfer_operations = {
839
 static struct xfer_interface_operations tftp_xfer_operations = {
839
 	.close		= tftp_xfer_close,
840
 	.close		= tftp_xfer_close,
840
 	.vredirect	= ignore_xfer_vredirect,
841
 	.vredirect	= ignore_xfer_vredirect,
841
-	.seek		= ignore_xfer_seek,
842
 	.window		= unlimited_xfer_window,
842
 	.window		= unlimited_xfer_window,
843
 	.alloc_iob	= default_xfer_alloc_iob,
843
 	.alloc_iob	= default_xfer_alloc_iob,
844
 	.deliver_iob	= xfer_deliver_as_raw,
844
 	.deliver_iob	= xfer_deliver_as_raw,

Loading…
Cancel
Save