Lines Matching defs:buffer
105 MODULE_PARM_DESC(buffer_kbs, "Default driver buffer size for fixed block mode (KB; 32)");
109 MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)");
158 /* The buffer size should fit into the 24 bits for length in the
370 cmdstatp = &STp->buffer->cmdstat;
374 scode = STp->buffer->cmdstat.sense_hdr.sense_key;
464 stp->buffer->syscall_result = -EINTR;
466 stp->buffer->syscall_result = -EBUSY;
490 - STp->buffer->cmdstat.residual,
492 if (STp->buffer->cmdstat.residual > 0)
504 - STp->buffer->cmdstat.residual,
506 if (STp->buffer->cmdstat.residual > 0)
527 STp->buffer->cmdstat.midlevel_result = SRpnt->result = scmd->result;
528 STp->buffer->cmdstat.residual = scmd->resid_len;
544 int data_direction, void *buffer, unsigned bufflen,
548 struct rq_map_data *mdata = &SRpnt->stp->buffer->map_data;
603 struct rq_map_data *mdata = &STp->buffer->map_data;
607 if (!do_wait && ((STp->buffer)->last_SRpnt)) {
611 (STp->buffer)->syscall_result = (-EINTR);
613 (STp->buffer)->syscall_result = (-EBUSY);
626 (STp->buffer)->last_SRpnt = SRpnt;
632 if (STp->buffer->do_dio) {
634 mdata->nr_entries = STp->buffer->sg_segs;
635 mdata->pages = STp->buffer->mapped_pages;
637 mdata->page_order = STp->buffer->reserved_page_order;
640 mdata->pages = STp->buffer->reserved_pages;
645 STp->buffer->cmdstat.have_sense = 0;
646 STp->buffer->syscall_result = 0;
651 /* could not allocate the buffer or request was too large */
652 (STp->buffer)->syscall_result = (-EBUSY);
653 (STp->buffer)->last_SRpnt = NULL;
657 (STp->buffer)->syscall_result = st_chk_result(STp, SRpnt);
676 STbuffer = STp->buffer;
692 (STp->buffer)->syscall_result = st_chk_result(STp, SRpnt);
753 return (STp->buffer)->syscall_result;
758 if ((STp->buffer)->cmdstat.midlevel_result != 0)
763 return (STp->buffer)->syscall_result;
767 /* Flush the write buffer (never need to write if variable blocksize). */
783 transfer = STp->buffer->buffer_bytes;
798 return (STp->buffer)->syscall_result;
801 if ((STp->buffer)->syscall_result != 0) {
802 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
811 (STp->buffer)->buffer_bytes = 0;
824 (STp->buffer)->buffer_bytes = 0;
833 /* Flush the tape buffer. The tape will be positioned correctly unless
856 backspace = ((STp->buffer)->buffer_bytes +
857 (STp->buffer)->read_pointer) / STp->block_size -
858 ((STp->buffer)->read_pointer + STp->block_size - 1) /
860 (STp->buffer)->buffer_bytes = 0;
861 (STp->buffer)->read_pointer = 0;
978 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
989 retval = (STp->buffer)->syscall_result;
1029 retval = (STp->buffer)->syscall_result;
1122 retval = (STp->buffer)->syscall_result;
1126 if (!SRpnt->result && !STp->buffer->cmdstat.have_sense) {
1127 STp->max_block = ((STp->buffer)->b_data[1] << 16) |
1128 ((STp->buffer)->b_data[2] << 8) | (STp->buffer)->b_data[3];
1129 STp->min_block = ((STp->buffer)->b_data[4] << 8) |
1130 (STp->buffer)->b_data[5];
1149 retval = (STp->buffer)->syscall_result;
1153 if ((STp->buffer)->syscall_result != 0) {
1156 (STp->buffer)->syscall_result = 0; /* Prevent error propagation */
1161 (STp->buffer)->b_data[0],
1162 (STp->buffer)->b_data[1],
1163 (STp->buffer)->b_data[2],
1164 (STp->buffer)->b_data[3]);
1166 if ((STp->buffer)->b_data[3] >= 8) {
1167 STp->drv_buffer = ((STp->buffer)->b_data[2] >> 4) & 7;
1168 STp->density = (STp->buffer)->b_data[4];
1169 STp->block_size = (STp->buffer)->b_data[9] * 65536 +
1170 (STp->buffer)->b_data[10] * 256 + (STp->buffer)->b_data[11];
1172 "drv buffer: %d\n",
1174 (STp->buffer)->b_data[5] * 65536 +
1175 (STp->buffer)->b_data[6] * 256 +
1176 (STp->buffer)->b_data[7],
1179 STp->drv_write_prot = ((STp->buffer)->b_data[2] & 0x80) != 0;
1192 (STp->buffer)->buffer_blocks =
1193 (STp->buffer)->buffer_size / STp->block_size;
1195 (STp->buffer)->buffer_blocks = 1;
1196 (STp->buffer)->buffer_bytes = (STp->buffer)->read_pointer = 0;
1198 DEBC_printk(STp, "Block size: %d, buffer size: %d (%d blocks).\n",
1199 STp->block_size, (STp->buffer)->buffer_size,
1200 (STp->buffer)->buffer_blocks);
1297 /* See that we have at least a one page buffer available */
1298 if (!enlarge_buffer(STp->buffer, PAGE_SIZE)) {
1300 "Can't allocate one page tape buffer.\n");
1305 (STp->buffer)->cleared = 0;
1306 (STp->buffer)->writing = 0;
1307 (STp->buffer)->syscall_result = 0;
1335 normalize_buffer(STp->buffer);
1348 /* Flush the tape buffer before close */
1382 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
1398 result = (STp->buffer)->syscall_result;
1402 if (STp->buffer->syscall_result == 0 ||
1472 normalize_buffer(STp->buffer);
1555 struct st_buffer *STbp = STp->buffer;
1598 "Can't allocate %d byte tape buffer.\n",
1617 STbp = STp->buffer;
1689 STbp = STp->buffer;
1708 /* Check the buffer readability in cases where copy_user might catch
1762 /* Don't write a buffer that is not full enough. */
1799 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
1836 move_buffer_data(STp->buffer, transfer - undone);
1846 STp->buffer->buffer_bytes);
1904 fatal error. Otherwise updates the buffer and the eof state.
1906 Does release user buffer mapping if it is set.
1926 STbp = STp->buffer;
1932 blks = (STp->buffer)->buffer_blocks;
1936 if (!STbp->do_dio && bytes > (STp->buffer)->buffer_size)
1937 bytes = (STp->buffer)->buffer_size;
1966 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
2089 STbp->buffer_bytes -= STp->buffer->cmdstat.residual;
2115 struct st_buffer *STbp = STp->buffer;
2164 /* Check the buffer writability before any tape movement. Don't alter
2165 buffer data. */
2178 /* Loop until enough data in buffer or a special condition found */
2181 /* Get new data if the buffer is empty */
2190 /* Move the data from driver buffer to user buffer */
2218 /* Change the eof state if no data from tape or buffer */
2259 "Mode %d options: buffer writes: %d, "
2426 "Drive buffer default disabled.\n");
2430 "Drive buffer default set to %x\n",
2485 /* Read a mode page into the tape buffer. The block descriptors are included
2503 return (STp->buffer)->syscall_result;
2507 return STp->buffer->syscall_result;
2511 /* Send the mode page in the tape buffer to the drive. Assumes that the mode data
2512 in the buffer is correctly formatted. The long timeout is used if slow is non-zero. */
2523 pgo = MODE_HEADER_LENGTH + (STp->buffer)->b_data[MH_OFF_BDESCS_LENGTH];
2524 cmd[4] = pgo + (STp->buffer)->b_data[pgo + MP_OFF_PAGE_LENGTH] + 2;
2527 (STp->buffer)->b_data[MH_OFF_DATA_LENGTH] = 0;
2528 (STp->buffer)->b_data[MH_OFF_MEDIUM_TYPE] = 0;
2529 (STp->buffer)->b_data[MH_OFF_DEV_SPECIFIC] &= ~MH_BIT_WP;
2530 (STp->buffer)->b_data[pgo + MP_OFF_PAGE_NBR] &= MP_MSK_PAGE_NBR;
2537 return (STp->buffer)->syscall_result;
2541 return STp->buffer->syscall_result;
2566 unsigned char *b_data = (STp->buffer)->b_data;
2658 return (STp->buffer)->syscall_result;
2660 retval = (STp->buffer)->syscall_result;
2721 WARN_ON(STp->buffer->do_dio != 0);
2910 if (STp->dirty || (STp->buffer)->buffer_bytes != 0)
2911 return (-EIO); /* Not allowed if data in buffer */
2926 memset((STp->buffer)->b_data, 0, 12);
2928 (STp->buffer)->b_data[2] = (arg & 7) << 4;
2930 (STp->buffer)->b_data[2] =
2932 (STp->buffer)->b_data[3] = 8; /* block descriptor length */
2934 (STp->buffer)->b_data[4] = arg;
2937 (STp->buffer)->b_data[4] = arg >> 24;
2939 (STp->buffer)->b_data[4] = STp->density;
2946 (STp->buffer)->b_data[9] = (ltmp >> 16);
2947 (STp->buffer)->b_data[10] = (ltmp >> 8);
2948 (STp->buffer)->b_data[11] = ltmp;
2954 (STp->buffer)->b_data[9] * 65536 +
2955 (STp->buffer)->b_data[10] * 256 +
2956 (STp->buffer)->b_data[11]);
2960 (STp->buffer)->b_data[4]);
2963 "Setting drive buffer code to %d.\n",
2964 ((STp->buffer)->b_data[2] >> 4) & 7);
2974 return (STp->buffer)->syscall_result;
2976 ioctl_result = (STp->buffer)->syscall_result;
2993 (STp->buffer)->buffer_blocks =
2994 (STp->buffer)->buffer_size / STp->block_size;
2996 (STp->buffer)->buffer_bytes = (STp->buffer)->read_pointer = 0;
3015 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
3139 return (STp->buffer)->syscall_result;
3141 if ((STp->buffer)->syscall_result != 0 ||
3143 ((STp->buffer)->b_data[0] & 4) != 0)) {
3150 *block = ((STp->buffer)->b_data[0] << 16)
3151 + ((STp->buffer)->b_data[1] << 8)
3152 + (STp->buffer)->b_data[2];
3155 *block = ((STp->buffer)->b_data[4] << 24)
3156 + ((STp->buffer)->b_data[5] << 16)
3157 + ((STp->buffer)->b_data[6] << 8)
3158 + (STp->buffer)->b_data[7];
3159 *partition = (STp->buffer)->b_data[1];
3160 if (((STp->buffer)->b_data[0] & 0x80) &&
3161 (STp->buffer)->b_data[1] == 0) /* BOP of partition 0 */
3243 return (STp->buffer)->syscall_result;
3247 if ((STp->buffer)->syscall_result != 0) {
3323 mode page into the tape buffer. */
3337 result = (STp->buffer)->b_data[MODE_HEADER_LENGTH +
3364 result = STp->buffer->syscall_result;
3410 /* The mode page is in the buffer. Let's modify it and write it. */
3411 bp = (STp->buffer)->b_data;
3776 (STp->buffer)->buffer_bytes / STp->block_size;
3779 ((STp->buffer)->buffer_bytes +
3884 /* Try to allocate a new tape buffer. Calling function must not hold
3892 printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n");
3910 /* Try to allocate enough space in the tape buffer */
3972 /* Make sure that no data from previous user is in the internal buffer */
3984 /* Release the extra buffer */
4000 /* Move data from the user buffer to the tape buffer. Returns zero (success) or
4032 /* Move data from the tape buffer to the user buffer. Returns zero (success) or
4065 /* Move data towards start of buffer */
4266 struct st_buffer *buffer;
4283 buffer = new_tape_buffer(i);
4284 if (buffer == NULL) {
4286 "st: Can't allocate new tape buffer. "
4305 tpnt->buffer = buffer;
4306 tpnt->buffer->last_SRpnt = NULL;
4406 kfree(buffer);
4445 if (tpnt->buffer) {
4446 normalize_buffer(tpnt->buffer);
4447 kfree(tpnt->buffer->reserved_pages);
4448 kfree(tpnt->buffer);
4667 * @buf: buffer to return formatted data in
4685 * @buf: buffer to return formatted data in
4701 * @buf: buffer to return formatted data in
4718 * @buf: buffer to return formatted data in
4735 * @buf: buffer to return formatted data in
4752 * @buf: buffer to return formatted data in
4770 * @buf: buffer to return formatted data in
4790 * @buf: buffer to return formatted data in
4809 * @buf: buffer to return formatted data in
4827 * @buf: buffer to return formatted data in