• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/s390/char/

Lines Matching defs:buffer

41  * Setup a sclp write buffer. Gets a page as input (4K) and returns
43 * end of the input page. This reduces the buffer space by a few
49 struct sclp_buffer *buffer;
57 buffer = ((struct sclp_buffer *) ((addr_t) sccb + PAGE_SIZE)) - 1;
58 buffer->sccb = sccb;
59 buffer->retry_count = 0;
60 buffer->mto_number = 0;
61 buffer->mto_char_sum = 0;
62 buffer->current_line = NULL;
63 buffer->current_length = 0;
64 buffer->columns = columns;
65 buffer->htab = htab;
79 return buffer;
84 * the buffer.
87 sclp_unmake_buffer(struct sclp_buffer *buffer)
89 return buffer->sccb;
93 * Initialize a new Message Text Object (MTO) at the end of the provided buffer
97 sclp_initialize_mto(struct sclp_buffer *buffer, int max_len)
106 /* check if current buffer sccb can contain the mto */
107 sccb = buffer->sccb;
124 buffer->current_line = (char *) (mto + 1);
125 buffer->current_length = 0;
132 * MTO, enclosing MDB, event buffer and SCCB.
135 sclp_finalize_mto(struct sclp_buffer *buffer)
141 str_len = buffer->current_length;
142 buffer->current_line = NULL;
143 buffer->current_length = 0;
149 sccb = buffer->sccb;
168 buffer->mto_number++;
169 buffer->mto_char_sum += str_len;
180 sclp_write(struct sclp_buffer *buffer, const unsigned char *msg, int count)
195 * next message. Besides we avoid a buffer overrun by writing its
212 if (buffer->current_line == NULL) {
213 rc = sclp_initialize_mto(buffer, 0);
217 sclp_finalize_mto(buffer);
221 buffer->sccb->msg_buf.mdb.go.general_msg_flags |=
226 if (buffer->current_line == NULL) {
227 rc = sclp_initialize_mto(buffer,
228 buffer->columns);
234 if (buffer->current_length >= buffer->columns)
237 *buffer->current_line++ = 0x40;
238 buffer->current_length++;
239 } while (buffer->current_length % buffer->htab);
245 if (buffer->current_line != NULL) {
246 spaces = buffer->current_length;
247 sclp_finalize_mto(buffer);
248 rc = sclp_initialize_mto(buffer,
249 buffer->columns);
252 memset(buffer->current_line, 0x40, spaces);
253 buffer->current_line += spaces;
254 buffer->current_length = spaces;
257 rc = sclp_initialize_mto(buffer,
258 buffer->columns);
261 sclp_finalize_mto(buffer);
268 if (buffer->current_line != NULL &&
269 buffer->current_length > 0) {
270 buffer->current_length--;
271 buffer->current_line--;
276 if (buffer->current_line != NULL)
277 sclp_finalize_mto(buffer);
286 if (buffer->current_line == NULL) {
287 rc = sclp_initialize_mto(buffer,
288 buffer->columns);
292 *buffer->current_line++ = sclp_ascebc(msg[i_msg]);
293 buffer->current_length++;
297 if (buffer->current_line != NULL &&
298 buffer->current_length >= buffer->columns)
299 sclp_finalize_mto(buffer);
310 sclp_buffer_space(struct sclp_buffer *buffer)
314 count = MAX_SCCB_ROOM - buffer->sccb->header.length;
315 if (buffer->current_line != NULL)
316 count -= sizeof(struct mto) + buffer->current_length;
321 * Return number of characters in buffer
324 sclp_chars_in_buffer(struct sclp_buffer *buffer)
328 count = buffer->mto_char_sum;
329 if (buffer->current_line != NULL)
330 count += buffer->current_length;
338 sclp_set_columns(struct sclp_buffer *buffer, unsigned short columns)
340 buffer->columns = columns;
341 if (buffer->current_line != NULL &&
342 buffer->current_length > buffer->columns)
343 sclp_finalize_mto(buffer);
347 sclp_set_htab(struct sclp_buffer *buffer, unsigned short htab)
349 buffer->htab = htab;
380 struct sclp_buffer *buffer;
383 buffer = (struct sclp_buffer *) data;
384 sccb = buffer->sccb;
387 if (buffer->callback != NULL)
388 buffer->callback(buffer, -EIO);
394 /* Normal completion, buffer processed, message(s) sent */
399 if (++buffer->retry_count > SCLP_BUFFER_MAX_RETRY) {
407 buffer->request.status = SCLP_REQ_FILLED;
417 if (++buffer->retry_count > SCLP_BUFFER_MAX_RETRY) {
423 buffer->request.status = SCLP_REQ_FILLED;
435 if (buffer->callback != NULL)
436 buffer->callback(buffer, rc);
445 sclp_emit_buffer(struct sclp_buffer *buffer,
451 if (buffer->current_line != NULL)
452 sclp_finalize_mto(buffer);
454 /* Are there messages in the output buffer ? */
455 if (buffer->mto_number == 0)
458 sccb = buffer->sccb;
467 buffer->request.command = SCLP_CMDW_WRITE_EVENT_DATA;
468 buffer->request.status = SCLP_REQ_FILLED;
469 buffer->request.callback = sclp_writedata_callback;
470 buffer->request.callback_data = buffer;
471 buffer->request.sccb = sccb;
472 buffer->callback = callback;
473 return sclp_add_request(&buffer->request);