|
@@ -35,6 +35,8 @@
|
35
|
35
|
void xfer_close ( struct xfer_interface *xfer, int rc ) {
|
36
|
36
|
struct xfer_interface *dest = xfer_get_dest ( xfer );
|
37
|
37
|
|
|
38
|
+ DBGC ( xfer, "XFER %p->%p close\n", xfer, dest );
|
|
39
|
+
|
38
|
40
|
dest->op->close ( dest, rc );
|
39
|
41
|
xfer_unplug ( xfer );
|
40
|
42
|
xfer_put ( dest );
|
|
@@ -52,7 +54,14 @@ int xfer_vredirect ( struct xfer_interface *xfer, int type, va_list args ) {
|
52
|
54
|
struct xfer_interface *dest = xfer_get_dest ( xfer );
|
53
|
55
|
int rc;
|
54
|
56
|
|
|
57
|
+ DBGC ( xfer, "XFER %p->%p redirect\n", xfer, dest );
|
|
58
|
+
|
55
|
59
|
rc = dest->op->vredirect ( dest, type, args );
|
|
60
|
+
|
|
61
|
+ if ( rc != 0 ) {
|
|
62
|
+ DBGC ( xfer, "XFER %p<-%p redirect: %s\n", xfer, dest,
|
|
63
|
+ strerror ( rc ) );
|
|
64
|
+ }
|
56
|
65
|
xfer_put ( dest );
|
57
|
66
|
return rc;
|
58
|
67
|
}
|
|
@@ -89,21 +98,19 @@ int xfer_request ( struct xfer_interface *xfer, off_t offset, int whence,
|
89
|
98
|
struct xfer_interface *dest = xfer_get_dest ( xfer );
|
90
|
99
|
int rc;
|
91
|
100
|
|
|
101
|
+ DBGC ( xfer, "XFER %p->%p request %s+%ld %zd\n", xfer, dest,
|
|
102
|
+ whence_text ( whence ), offset, len );
|
|
103
|
+
|
92
|
104
|
rc = dest->op->request ( dest, offset, whence, len );
|
|
105
|
+
|
|
106
|
+ if ( rc != 0 ) {
|
|
107
|
+ DBGC ( xfer, "XFER %p<-%p request: %s\n", xfer, dest,
|
|
108
|
+ strerror ( rc ) );
|
|
109
|
+ }
|
93
|
110
|
xfer_put ( dest );
|
94
|
111
|
return rc;
|
95
|
112
|
}
|
96
|
113
|
|
97
|
|
-/**
|
98
|
|
- * Request all data
|
99
|
|
- *
|
100
|
|
- * @v xfer Data transfer interface
|
101
|
|
- * @ret rc Return status code
|
102
|
|
- */
|
103
|
|
-int xfer_request_all ( struct xfer_interface *xfer ) {
|
104
|
|
- return xfer_request ( xfer, 0, SEEK_SET, ~( ( size_t ) 0 ) );
|
105
|
|
-}
|
106
|
|
-
|
107
|
114
|
/**
|
108
|
115
|
* Seek to position
|
109
|
116
|
*
|
|
@@ -116,11 +123,33 @@ int xfer_seek ( struct xfer_interface *xfer, off_t offset, int whence ) {
|
116
|
123
|
struct xfer_interface *dest = xfer_get_dest ( xfer );
|
117
|
124
|
int rc;
|
118
|
125
|
|
|
126
|
+ DBGC ( xfer, "XFER %p->%p seek %s+%ld\n", xfer, dest,
|
|
127
|
+ whence_text ( whence ), offset );
|
|
128
|
+
|
119
|
129
|
rc = dest->op->seek ( dest, offset, whence );
|
|
130
|
+
|
|
131
|
+ if ( rc != 0 ) {
|
|
132
|
+ DBGC ( xfer, "XFER %p<-%p seek: %s\n", xfer, dest,
|
|
133
|
+ strerror ( rc ) );
|
|
134
|
+ }
|
120
|
135
|
xfer_put ( dest );
|
121
|
136
|
return rc;
|
122
|
137
|
}
|
123
|
138
|
|
|
139
|
+/**
|
|
140
|
+ * Test to see if interface is ready to accept data
|
|
141
|
+ *
|
|
142
|
+ * @v xfer Data transfer interface
|
|
143
|
+ * @ret rc Return status code
|
|
144
|
+ *
|
|
145
|
+ * This test is optional; the data transfer interface may wish that it
|
|
146
|
+ * does not yet wish to accept data, but cannot prevent attempts to
|
|
147
|
+ * deliver data to it.
|
|
148
|
+ */
|
|
149
|
+int xfer_ready ( struct xfer_interface *xfer ) {
|
|
150
|
+ return xfer_seek ( xfer, 0, SEEK_CUR );
|
|
151
|
+}
|
|
152
|
+
|
124
|
153
|
/**
|
125
|
154
|
* Allocate I/O buffer
|
126
|
155
|
*
|
|
@@ -132,7 +161,13 @@ struct io_buffer * xfer_alloc_iob ( struct xfer_interface *xfer, size_t len ) {
|
132
|
161
|
struct xfer_interface *dest = xfer_get_dest ( xfer );
|
133
|
162
|
struct io_buffer *iobuf;
|
134
|
163
|
|
|
164
|
+ DBGC ( xfer, "XFER %p->%p alloc_iob %zd\n", xfer, dest, len );
|
|
165
|
+
|
135
|
166
|
iobuf = dest->op->alloc_iob ( dest, len );
|
|
167
|
+
|
|
168
|
+ if ( ! iobuf ) {
|
|
169
|
+ DBGC ( xfer, "XFER %p<-%p alloc_iob failed\n", xfer, dest );
|
|
170
|
+ }
|
136
|
171
|
xfer_put ( dest );
|
137
|
172
|
return iobuf;
|
138
|
173
|
}
|
|
@@ -148,7 +183,15 @@ int xfer_deliver_iob ( struct xfer_interface *xfer, struct io_buffer *iobuf ) {
|
148
|
183
|
struct xfer_interface *dest = xfer_get_dest ( xfer );
|
149
|
184
|
int rc;
|
150
|
185
|
|
|
186
|
+ DBGC ( xfer, "XFER %p->%p deliver_iob %zd\n", xfer, dest,
|
|
187
|
+ iob_len ( iobuf ) );
|
|
188
|
+
|
151
|
189
|
rc = dest->op->deliver_iob ( dest, iobuf );
|
|
190
|
+
|
|
191
|
+ if ( rc != 0 ) {
|
|
192
|
+ DBGC ( xfer, "XFER %p<-%p deliver_iob: %s\n", xfer, dest,
|
|
193
|
+ strerror ( rc ) );
|
|
194
|
+ }
|
152
|
195
|
xfer_put ( dest );
|
153
|
196
|
return rc;
|
154
|
197
|
}
|
|
@@ -165,7 +208,15 @@ int xfer_deliver_raw ( struct xfer_interface *xfer,
|
165
|
208
|
struct xfer_interface *dest = xfer_get_dest ( xfer );
|
166
|
209
|
int rc;
|
167
|
210
|
|
|
211
|
+ DBGC ( xfer, "XFER %p->%p deliver_raw %p+%zd\n", xfer, dest,
|
|
212
|
+ data, len );
|
|
213
|
+
|
168
|
214
|
rc = dest->op->deliver_raw ( dest, data, len );
|
|
215
|
+
|
|
216
|
+ if ( rc != 0 ) {
|
|
217
|
+ DBGC ( xfer, "XFER %p<-%p deliver_raw: %s\n", xfer, dest,
|
|
218
|
+ strerror ( rc ) );
|
|
219
|
+ }
|
169
|
220
|
xfer_put ( dest );
|
170
|
221
|
return rc;
|
171
|
222
|
}
|