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,6 +96,9 @@ static int downloader_ensure_size ( struct downloader *downloader,
96 96
 	if ( len <= downloader->image->len )
97 97
 		return 0;
98 98
 
99
+	DBGC ( downloader, "Downloader %p extending to %zd bytes\n",
100
+	       downloader, len );
101
+
99 102
 	/* Extend buffer */
100 103
 	new_buffer = urealloc ( downloader->image->data, len );
101 104
 	if ( ! new_buffer ) {
@@ -141,68 +144,44 @@ static struct job_interface_operations downloader_job_operations = {
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 148
  * Handle deliver_raw() event received via data transfer interface
181 149
  *
182 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 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 158
 	struct downloader *downloader =
190 159
 		container_of ( xfer, struct downloader, xfer );
160
+	size_t len;
191 161
 	size_t max;
192 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 169
 	/* Ensure that we have enough buffer space for this data */
170
+	len = iob_len ( iobuf );
195 171
 	max = ( downloader->pos + len );
196 172
 	if ( ( rc = downloader_ensure_size ( downloader, max ) ) != 0 )
197
-		return rc;
173
+		goto done;
198 174
 
199 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 179
 	/* Update current buffer position */
203 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,10 +206,10 @@ static void downloader_xfer_close ( struct xfer_interface *xfer, int rc ) {
227 206
 static struct xfer_interface_operations downloader_xfer_operations = {
228 207
 	.close		= downloader_xfer_close,
229 208
 	.vredirect	= xfer_vopen,
230
-	.seek		= downloader_xfer_seek,
231 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,12 +44,6 @@ int filter_vredirect ( struct xfer_interface *xfer, int type,
44 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 47
 size_t filter_window ( struct xfer_interface *xfer ) {
54 48
 	struct xfer_interface *other = filter_other_half ( xfer );
55 49
 

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

@@ -36,8 +36,8 @@ static void hw_xfer_close ( struct xfer_interface *xfer, int rc ) {
36 36
 static struct xfer_interface_operations hw_xfer_operations = {
37 37
 	.close		= hw_xfer_close,
38 38
 	.vredirect	= ignore_xfer_vredirect,
39
-	.seek		= ignore_xfer_seek,
40 39
 	.window		= unlimited_xfer_window,
40
+	.alloc_iob	= default_xfer_alloc_iob,
41 41
 	.deliver_iob	= xfer_deliver_as_raw,
42 42
 	.deliver_raw	= ignore_xfer_deliver_raw,
43 43
 };

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

@@ -103,39 +103,12 @@ static void posix_file_xfer_close ( struct xfer_interface *xfer, int rc ) {
103 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 107
  * Handle deliver_iob() event
135 108
  *
136 109
  * @v xfer		POSIX file data transfer interface
137 110
  * @v iobuf		I/O buffer
138
- * @v meta		Data transfer metadata, or NULL
111
+ * @v meta		Data transfer metadata
139 112
  * @ret rc		Return status code
140 113
  */
141 114
 static int
@@ -145,6 +118,13 @@ posix_file_xfer_deliver_iob ( struct xfer_interface *xfer,
145 118
 	struct posix_file *file =
146 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 128
 	list_add_tail ( &iobuf->list, &file->data );
149 129
 	return 0;
150 130
 }
@@ -153,7 +133,6 @@ posix_file_xfer_deliver_iob ( struct xfer_interface *xfer,
153 133
 static struct xfer_interface_operations posix_file_xfer_operations = {
154 134
 	.close		= posix_file_xfer_close,
155 135
 	.vredirect	= xfer_vopen,
156
-	.seek		= posix_file_xfer_seek,
157 136
 	.window		= unlimited_xfer_window,
158 137
 	.alloc_iob	= default_xfer_alloc_iob,
159 138
 	.deliver_iob	= posix_file_xfer_deliver_iob,

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

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

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

@@ -85,31 +85,6 @@ int xfer_redirect ( struct xfer_interface *xfer, int type, ... ) {
85 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 89
  * Check flow control window
115 90
  *
@@ -153,7 +128,7 @@ struct io_buffer * xfer_alloc_iob ( struct xfer_interface *xfer, size_t len ) {
153 128
  *
154 129
  * @v xfer		Data transfer interface
155 130
  * @v iobuf		Datagram I/O buffer
156
- * @v meta		Data transfer metadata, or NULL
131
+ * @v meta		Data transfer metadata
157 132
  * @ret rc		Return status code
158 133
  */
159 134
 int xfer_deliver_iob_meta ( struct xfer_interface *xfer,
@@ -184,7 +159,8 @@ int xfer_deliver_iob_meta ( struct xfer_interface *xfer,
184 159
  */
185 160
 int xfer_deliver_iob ( struct xfer_interface *xfer,
186 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,6 +229,31 @@ int xfer_printf ( struct xfer_interface *xfer, const char *format, ... ) {
253 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 259
  * Helper methods
@@ -286,19 +287,6 @@ int ignore_xfer_vredirect ( struct xfer_interface *xfer __unused,
286 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 291
  * Unlimited flow control window
304 292
  *
@@ -401,7 +389,6 @@ int ignore_xfer_deliver_raw ( struct xfer_interface *xfer,
401 389
 struct xfer_interface_operations null_xfer_ops = {
402 390
 	.close		= ignore_xfer_close,
403 391
 	.vredirect	= ignore_xfer_vredirect,
404
-	.seek		= ignore_xfer_seek,
405 392
 	.window		= unlimited_xfer_window,
406 393
 	.alloc_iob	= default_xfer_alloc_iob,
407 394
 	.deliver_iob	= xfer_deliver_as_raw,

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

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

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

@@ -32,17 +32,6 @@ struct xfer_interface_operations {
32 32
 	 */
33 33
 	int ( * vredirect ) ( struct xfer_interface *xfer, int type,
34 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 35
 	/** Check flow control window
47 36
 	 *
48 37
 	 * @v xfer		Data transfer interface
@@ -71,7 +60,7 @@ struct xfer_interface_operations {
71 60
 	 *
72 61
 	 * @v xfer		Data transfer interface
73 62
 	 * @v iobuf		Datagram I/O buffer
74
-	 * @v meta		Data transfer metadata, or NULL
63
+	 * @v meta		Data transfer metadata
75 64
 	 * @ret rc		Return status code
76 65
 	 *
77 66
 	 * A data transfer interface that wishes to support only raw
@@ -104,8 +93,21 @@ struct xfer_interface {
104 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 102
 /** Data transfer metadata */
108 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 111
 	/** Source socket address, or NULL */
110 112
 	struct sockaddr *src;
111 113
 	/** Destination socket address, or NULL */
@@ -114,12 +116,6 @@ struct xfer_metadata {
114 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 120
  * Describe seek basis
125 121
  *
@@ -128,8 +124,8 @@ enum seek_whence {
128 124
 static inline __attribute__ (( always_inline )) const char *
129 125
 whence_text ( int whence ) {
130 126
 	switch ( whence ) {
131
-	case SEEK_SET:	return "SET";
132 127
 	case SEEK_CUR:	return "CUR";
128
+	case SEEK_SET:	return "SET";
133 129
 	default:	return "INVALID";
134 130
 	}
135 131
 }
@@ -141,7 +137,6 @@ extern void xfer_close ( struct xfer_interface *xfer, int rc );
141 137
 extern int xfer_vredirect ( struct xfer_interface *xfer, int type,
142 138
 			    va_list args );
143 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 140
 extern size_t xfer_window ( struct xfer_interface *xfer );
146 141
 extern struct io_buffer * xfer_alloc_iob ( struct xfer_interface *xfer,
147 142
 					   size_t len );
@@ -156,12 +151,11 @@ extern int xfer_vprintf ( struct xfer_interface *xfer,
156 151
 			  const char *format, va_list args );
157 152
 extern int xfer_printf ( struct xfer_interface *xfer,
158 153
 			 const char *format, ... );
154
+extern int xfer_seek ( struct xfer_interface *xfer, off_t offset, int whence );
159 155
 
160 156
 extern void ignore_xfer_close ( struct xfer_interface *xfer, int rc );
161 157
 extern int ignore_xfer_vredirect ( struct xfer_interface *xfer,
162 158
 				   int type, va_list args );
163
-extern int ignore_xfer_seek ( struct xfer_interface *xfer, off_t offset,
164
-			      int whence );
165 159
 extern size_t unlimited_xfer_window ( struct xfer_interface *xfer );
166 160
 extern size_t no_xfer_window ( struct xfer_interface *xfer );
167 161
 extern struct io_buffer * default_xfer_alloc_iob ( struct xfer_interface *xfer,

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

@@ -103,7 +103,6 @@ static int pxe_udp_deliver_iob ( struct xfer_interface *xfer,
103 103
 static struct xfer_interface_operations pxe_udp_xfer_operations = {
104 104
 	.close		= ignore_xfer_close,
105 105
 	.vredirect	= ignore_xfer_vredirect,
106
-	.seek		= ignore_xfer_seek,
107 106
 	.window		= unlimited_xfer_window,
108 107
 	.alloc_iob	= default_xfer_alloc_iob,
109 108
 	.deliver_iob	= pxe_udp_deliver_iob,

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

@@ -1022,7 +1022,6 @@ static int tcp_xfer_deliver_iob ( struct xfer_interface *xfer,
1022 1022
 static struct xfer_interface_operations tcp_xfer_operations = {
1023 1023
 	.close		= tcp_xfer_close,
1024 1024
 	.vredirect	= ignore_xfer_vredirect,
1025
-	.seek		= ignore_xfer_seek,
1026 1025
 	.window		= tcp_xfer_window,
1027 1026
 	.alloc_iob	= default_xfer_alloc_iob,
1028 1027
 	.deliver_iob	= tcp_xfer_deliver_iob,

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

@@ -299,7 +299,6 @@ static int ftp_control_deliver_raw ( struct xfer_interface *control,
299 299
 static struct xfer_interface_operations ftp_control_operations = {
300 300
 	.close		= ftp_control_close,
301 301
 	.vredirect	= xfer_vopen,
302
-	.seek		= ignore_xfer_seek,
303 302
 	.window		= unlimited_xfer_window,
304 303
 	.alloc_iob	= default_xfer_alloc_iob,
305 304
 	.deliver_iob	= xfer_deliver_as_raw,
@@ -364,7 +363,6 @@ static int ftp_data_deliver_iob ( struct xfer_interface *data,
364 363
 static struct xfer_interface_operations ftp_data_operations = {
365 364
 	.close		= ftp_data_closed,
366 365
 	.vredirect	= xfer_vopen,
367
-	.seek		= ignore_xfer_seek,
368 366
 	.window		= unlimited_xfer_window,
369 367
 	.alloc_iob	= default_xfer_alloc_iob,
370 368
 	.deliver_iob	= ftp_data_deliver_iob,
@@ -397,7 +395,6 @@ static void ftp_xfer_closed ( struct xfer_interface *xfer, int rc ) {
397 395
 static struct xfer_interface_operations ftp_xfer_operations = {
398 396
 	.close		= ftp_xfer_closed,
399 397
 	.vredirect	= ignore_xfer_vredirect,
400
-	.seek		= ignore_xfer_seek,
401 398
 	.window		= unlimited_xfer_window,
402 399
 	.alloc_iob	= default_xfer_alloc_iob,
403 400
 	.deliver_iob	= xfer_deliver_as_raw,

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

@@ -426,7 +426,6 @@ static void http_socket_close ( struct xfer_interface *socket, int rc ) {
426 426
 static struct xfer_interface_operations http_socket_operations = {
427 427
 	.close		= http_socket_close,
428 428
 	.vredirect	= xfer_vopen,
429
-	.seek		= ignore_xfer_seek,
430 429
 	.window		= unlimited_xfer_window,
431 430
 	.alloc_iob	= default_xfer_alloc_iob,
432 431
 	.deliver_iob	= http_socket_deliver_iob,
@@ -453,7 +452,6 @@ static void http_xfer_close ( struct xfer_interface *xfer, int rc ) {
453 452
 static struct xfer_interface_operations http_xfer_operations = {
454 453
 	.close		= http_xfer_close,
455 454
 	.vredirect	= ignore_xfer_vredirect,
456
-	.seek		= ignore_xfer_seek,
457 455
 	.window		= unlimited_xfer_window,
458 456
 	.alloc_iob	= default_xfer_alloc_iob,
459 457
 	.deliver_iob	= xfer_deliver_as_raw,

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

@@ -1322,7 +1322,6 @@ static int iscsi_vredirect ( struct xfer_interface *socket, int type,
1322 1322
 static struct xfer_interface_operations iscsi_socket_operations = {
1323 1323
 	.close		= iscsi_socket_close,
1324 1324
 	.vredirect	= iscsi_vredirect,
1325
-	.seek		= ignore_xfer_seek,
1326 1325
 	.window		= unlimited_xfer_window,
1327 1326
 	.alloc_iob	= default_xfer_alloc_iob,
1328 1327
 	.deliver_iob	= xfer_deliver_as_raw,

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

@@ -1460,7 +1460,6 @@ static int tls_plainstream_deliver_raw ( struct xfer_interface *xfer,
1460 1460
 static struct xfer_interface_operations tls_plainstream_operations = {
1461 1461
 	.close		= tls_plainstream_close,
1462 1462
 	.vredirect	= ignore_xfer_vredirect,
1463
-	.seek		= filter_seek,
1464 1463
 	.window		= tls_plainstream_window,
1465 1464
 	.alloc_iob	= default_xfer_alloc_iob,
1466 1465
 	.deliver_iob	= xfer_deliver_as_raw,
@@ -1600,7 +1599,6 @@ static int tls_cipherstream_deliver_raw ( struct xfer_interface *xfer,
1600 1599
 static struct xfer_interface_operations tls_cipherstream_operations = {
1601 1600
 	.close		= tls_cipherstream_close,
1602 1601
 	.vredirect	= xfer_vopen,
1603
-	.seek		= filter_seek,
1604 1602
 	.window		= filter_window,
1605 1603
 	.alloc_iob	= default_xfer_alloc_iob,
1606 1604
 	.deliver_iob	= xfer_deliver_as_raw,

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

@@ -415,7 +415,6 @@ static int udp_xfer_deliver_iob ( struct xfer_interface *xfer,
415 415
 static struct xfer_interface_operations udp_xfer_operations = {
416 416
 	.close		= udp_xfer_close,
417 417
 	.vredirect	= ignore_xfer_vredirect,
418
-	.seek		= ignore_xfer_seek,
419 418
 	.window		= unlimited_xfer_window,
420 419
 	.alloc_iob	= udp_alloc_iob,
421 420
 	.deliver_iob	= udp_xfer_deliver_iob,

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

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

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

@@ -435,7 +435,6 @@ static void dns_xfer_close ( struct xfer_interface *socket, int rc ) {
435 435
 static struct xfer_interface_operations dns_socket_operations = {
436 436
 	.close		= dns_xfer_close,
437 437
 	.vredirect	= xfer_vopen,
438
-	.seek		= ignore_xfer_seek,
439 438
 	.window		= unlimited_xfer_window,
440 439
 	.alloc_iob	= default_xfer_alloc_iob,
441 440
 	.deliver_iob	= xfer_deliver_as_raw,

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

@@ -554,6 +554,7 @@ static int tftp_rx_oack ( struct tftp_request *tftp, void *buf, size_t len ) {
554 554
 static int tftp_rx_data ( struct tftp_request *tftp,
555 555
 			  struct io_buffer *iobuf ) {
556 556
 	struct tftp_data *data = iobuf->data;
557
+	struct xfer_metadata meta;
557 558
 	int block;
558 559
 	off_t offset;
559 560
 	size_t data_len;
@@ -580,8 +581,10 @@ static int tftp_rx_data ( struct tftp_request *tftp,
580 581
 	}
581 582
 
582 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 588
 	iobuf = NULL;
586 589
 	if ( rc != 0 ) {
587 590
 		DBGC ( tftp, "TFTP %p could not deliver data: %s\n",
@@ -763,7 +766,6 @@ static void tftp_socket_close ( struct xfer_interface *socket, int rc ) {
763 766
 static struct xfer_interface_operations tftp_socket_operations = {
764 767
 	.close		= tftp_socket_close,
765 768
 	.vredirect	= xfer_vopen,
766
-	.seek		= ignore_xfer_seek,
767 769
 	.window		= unlimited_xfer_window,
768 770
 	.alloc_iob	= default_xfer_alloc_iob,
769 771
 	.deliver_iob	= tftp_socket_deliver_iob,
@@ -811,7 +813,6 @@ static void tftp_mc_socket_close ( struct xfer_interface *mc_socket,
811 813
 static struct xfer_interface_operations tftp_mc_socket_operations = {
812 814
 	.close		= tftp_mc_socket_close,
813 815
 	.vredirect	= xfer_vopen,
814
-	.seek		= ignore_xfer_seek,
815 816
 	.window		= unlimited_xfer_window,
816 817
 	.alloc_iob	= default_xfer_alloc_iob,
817 818
 	.deliver_iob	= tftp_mc_socket_deliver_iob,
@@ -838,7 +839,6 @@ static void tftp_xfer_close ( struct xfer_interface *xfer, int rc ) {
838 839
 static struct xfer_interface_operations tftp_xfer_operations = {
839 840
 	.close		= tftp_xfer_close,
840 841
 	.vredirect	= ignore_xfer_vredirect,
841
-	.seek		= ignore_xfer_seek,
842 842
 	.window		= unlimited_xfer_window,
843 843
 	.alloc_iob	= default_xfer_alloc_iob,
844 844
 	.deliver_iob	= xfer_deliver_as_raw,

Loading…
Cancel
Save