Lines Matching defs:buffer

104 MODULE_PARM_DESC(buffer_kbs, "Default driver buffer size for fixed block mode (KB; 32)");
108 MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)");
157 /* The buffer size should fit into the 24 bits for length in the
374 cmdstatp = &STp->buffer->cmdstat;
378 scode = STp->buffer->cmdstat.sense_hdr.sense_key;
466 stp->buffer->syscall_result = -EINTR;
468 stp->buffer->syscall_result = -EBUSY;
491 - STp->buffer->cmdstat.residual,
493 if (STp->buffer->cmdstat.residual > 0)
505 - STp->buffer->cmdstat.residual,
507 if (STp->buffer->cmdstat.residual > 0)
527 STp->buffer->cmdstat.midlevel_result = SRpnt->result = rq->result;
528 STp->buffer->cmdstat.residual = rq->resid_len;
543 int data_direction, void *buffer, unsigned bufflen,
548 struct rq_map_data *mdata = &SRpnt->stp->buffer->map_data;
602 struct rq_map_data *mdata = &STp->buffer->map_data;
606 if (!do_wait && ((STp->buffer)->last_SRpnt)) {
610 (STp->buffer)->syscall_result = (-EINTR);
612 (STp->buffer)->syscall_result = (-EBUSY);
625 (STp->buffer)->last_SRpnt = SRpnt;
631 if (STp->buffer->do_dio) {
633 mdata->nr_entries = STp->buffer->sg_segs;
634 mdata->pages = STp->buffer->mapped_pages;
636 mdata->page_order = STp->buffer->reserved_page_order;
639 mdata->pages = STp->buffer->reserved_pages;
644 STp->buffer->cmdstat.have_sense = 0;
645 STp->buffer->syscall_result = 0;
650 /* could not allocate the buffer or request was too large */
651 (STp->buffer)->syscall_result = (-EBUSY);
652 (STp->buffer)->last_SRpnt = NULL;
656 (STp->buffer)->syscall_result = st_chk_result(STp, SRpnt);
675 STbuffer = STp->buffer;
691 (STp->buffer)->syscall_result = st_chk_result(STp, SRpnt);
752 return (STp->buffer)->syscall_result;
757 if ((STp->buffer)->cmdstat.midlevel_result != 0)
762 return (STp->buffer)->syscall_result;
766 /* Flush the write buffer (never need to write if variable blocksize). */
782 transfer = STp->buffer->buffer_bytes;
797 return (STp->buffer)->syscall_result;
800 if ((STp->buffer)->syscall_result != 0) {
801 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
810 (STp->buffer)->buffer_bytes = 0;
823 (STp->buffer)->buffer_bytes = 0;
832 /* Flush the tape buffer. The tape will be positioned correctly unless
855 backspace = ((STp->buffer)->buffer_bytes +
856 (STp->buffer)->read_pointer) / STp->block_size -
857 ((STp->buffer)->read_pointer + STp->block_size - 1) /
859 (STp->buffer)->buffer_bytes = 0;
860 (STp->buffer)->read_pointer = 0;
977 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
988 retval = (STp->buffer)->syscall_result;
1028 retval = (STp->buffer)->syscall_result;
1121 retval = (STp->buffer)->syscall_result;
1125 if (!SRpnt->result && !STp->buffer->cmdstat.have_sense) {
1126 STp->max_block = ((STp->buffer)->b_data[1] << 16) |
1127 ((STp->buffer)->b_data[2] << 8) | (STp->buffer)->b_data[3];
1128 STp->min_block = ((STp->buffer)->b_data[4] << 8) |
1129 (STp->buffer)->b_data[5];
1148 retval = (STp->buffer)->syscall_result;
1152 if ((STp->buffer)->syscall_result != 0) {
1155 (STp->buffer)->syscall_result = 0; /* Prevent error propagation */
1160 (STp->buffer)->b_data[0],
1161 (STp->buffer)->b_data[1],
1162 (STp->buffer)->b_data[2],
1163 (STp->buffer)->b_data[3]);
1165 if ((STp->buffer)->b_data[3] >= 8) {
1166 STp->drv_buffer = ((STp->buffer)->b_data[2] >> 4) & 7;
1167 STp->density = (STp->buffer)->b_data[4];
1168 STp->block_size = (STp->buffer)->b_data[9] * 65536 +
1169 (STp->buffer)->b_data[10] * 256 + (STp->buffer)->b_data[11];
1171 "drv buffer: %d\n",
1173 (STp->buffer)->b_data[5] * 65536 +
1174 (STp->buffer)->b_data[6] * 256 +
1175 (STp->buffer)->b_data[7],
1178 STp->drv_write_prot = ((STp->buffer)->b_data[2] & 0x80) != 0;
1191 (STp->buffer)->buffer_blocks =
1192 (STp->buffer)->buffer_size / STp->block_size;
1194 (STp->buffer)->buffer_blocks = 1;
1195 (STp->buffer)->buffer_bytes = (STp->buffer)->read_pointer = 0;
1197 DEBC_printk(STp, "Block size: %d, buffer size: %d (%d blocks).\n",
1198 STp->block_size, (STp->buffer)->buffer_size,
1199 (STp->buffer)->buffer_blocks);
1296 /* See that we have at least a one page buffer available */
1297 if (!enlarge_buffer(STp->buffer, PAGE_SIZE, STp->restr_dma)) {
1299 "Can't allocate one page tape buffer.\n");
1304 (STp->buffer)->cleared = 0;
1305 (STp->buffer)->writing = 0;
1306 (STp->buffer)->syscall_result = 0;
1334 normalize_buffer(STp->buffer);
1347 /* Flush the tape buffer before close */
1381 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
1397 result = (STp->buffer)->syscall_result;
1401 if (STp->buffer->syscall_result == 0 ||
1471 normalize_buffer(STp->buffer);
1554 struct st_buffer *STbp = STp->buffer;
1597 "Can't allocate %d byte tape buffer.\n",
1616 STbp = STp->buffer;
1688 STbp = STp->buffer;
1707 /* Check the buffer readability in cases where copy_user might catch
1761 /* Don't write a buffer that is not full enough. */
1798 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
1835 move_buffer_data(STp->buffer, transfer - undone);
1845 STp->buffer->buffer_bytes);
1903 fatal error. Otherwise updates the buffer and the eof state.
1905 Does release user buffer mapping if it is set.
1925 STbp = STp->buffer;
1931 blks = (STp->buffer)->buffer_blocks;
1935 if (!STbp->do_dio && bytes > (STp->buffer)->buffer_size)
1936 bytes = (STp->buffer)->buffer_size;
1965 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
2088 STbp->buffer_bytes -= STp->buffer->cmdstat.residual;
2114 struct st_buffer *STbp = STp->buffer;
2163 /* Check the buffer writability before any tape movement. Don't alter
2164 buffer data. */
2177 /* Loop until enough data in buffer or a special condition found */
2180 /* Get new data if the buffer is empty */
2189 /* Move the data from driver buffer to user buffer */
2217 /* Change the eof state if no data from tape or buffer */
2258 "Mode %d options: buffer writes: %d, "
2425 "Drive buffer default disabled.\n");
2429 "Drive buffer default set to %x\n",
2484 /* Read a mode page into the tape buffer. The block descriptors are included
2502 return (STp->buffer)->syscall_result;
2506 return STp->buffer->syscall_result;
2510 /* Send the mode page in the tape buffer to the drive. Assumes that the mode data
2511 in the buffer is correctly formatted. The long timeout is used if slow is non-zero. */
2522 pgo = MODE_HEADER_LENGTH + (STp->buffer)->b_data[MH_OFF_BDESCS_LENGTH];
2523 cmd[4] = pgo + (STp->buffer)->b_data[pgo + MP_OFF_PAGE_LENGTH] + 2;
2526 (STp->buffer)->b_data[MH_OFF_DATA_LENGTH] = 0;
2527 (STp->buffer)->b_data[MH_OFF_MEDIUM_TYPE] = 0;
2528 (STp->buffer)->b_data[MH_OFF_DEV_SPECIFIC] &= ~MH_BIT_WP;
2529 (STp->buffer)->b_data[pgo + MP_OFF_PAGE_NBR] &= MP_MSK_PAGE_NBR;
2536 return (STp->buffer)->syscall_result;
2540 return STp->buffer->syscall_result;
2565 unsigned char *b_data = (STp->buffer)->b_data;
2657 return (STp->buffer)->syscall_result;
2659 retval = (STp->buffer)->syscall_result;
2720 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;
3775 (STp->buffer)->buffer_bytes / STp->block_size;
3778 ((STp->buffer)->buffer_bytes +
3911 /* Try to allocate a new tape buffer. Calling function must not hold
3919 printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n");
3938 /* Try to allocate enough space in the tape buffer */
4002 /* Make sure that no data from previous user is in the internal buffer */
4014 /* Release the extra buffer */
4030 /* Move data from the user buffer to the tape buffer. Returns zero (success) or
4062 /* Move data from the tape buffer to the user buffer. Returns zero (success) or
4095 /* Move data towards start of buffer */
4297 struct st_buffer *buffer;
4315 buffer = new_tape_buffer((SDp->host)->unchecked_isa_dma, i);
4316 if (buffer == NULL) {
4318 "st: Can't allocate new tape buffer. "
4352 tpnt->buffer = buffer;
4353 tpnt->buffer->last_SRpnt = NULL;
4457 kfree(buffer);
4497 if (tpnt->buffer) {
4498 normalize_buffer(tpnt->buffer);
4499 kfree(tpnt->buffer->reserved_pages);
4500 kfree(tpnt->buffer);
4721 * @buf: buffer to return formatted data in
4739 * @buf: buffer to return formatted data in
4755 * @buf: buffer to return formatted data in
4772 * @buf: buffer to return formatted data in
4789 * @buf: buffer to return formatted data in
4806 * @buf: buffer to return formatted data in
4824 * @buf: buffer to return formatted data in
4844 * @buf: buffer to return formatted data in
4863 * @buf: buffer to return formatted data in
4881 * @buf: buffer to return formatted data in