Lines Matching defs:rep
405 void sg_in_operation(Rq_coll * clp, Rq_elem * rep);
406 void sg_out_operation(Rq_coll * clp, Rq_elem * rep);
407 int normal_in_operation(Rq_coll * clp, Rq_elem * rep, int blocks);
408 void normal_out_operation(Rq_coll * clp, Rq_elem * rep, int blocks);
409 int sg_start_io(Rq_elem * rep);
410 int sg_finish_io(int wr, Rq_elem * rep, pthread_mutex_t * a_mutp);
6802 Rq_elem *rep = &rel;
6809 memset(rep, 0, sizeof(Rq_elem));
6811 if (NULL == (rep->alloc_bp = malloc(sz + psz)))
6813 rep->buffp =
6814 (unsigned char *)(((unsigned long)rep->alloc_bp + psz - 1) &
6817 rep->bs = clp->bs;
6818 rep->fua_mode = clp->fua_mode;
6819 rep->dio = clp->dio;
6820 rep->infd = clp->infd;
6821 rep->outfd = clp->outfd;
6822 rep->debug = clp->debug;
6823 rep->in_scsi_type = clp->in_scsi_type;
6824 rep->out_scsi_type = clp->out_scsi_type;
6825 rep->cdbsz = clp->cdbsz;
6839 rep->wr = 0;
6840 rep->blk = clp->in_blk;
6841 rep->num_blks = blocks;
6847 sg_in_operation(clp, rep); /* lets go of in_mutex mid operation */
6850 normal_in_operation(clp, rep, blocks);
6862 ((rep->blk + seek_skip) != clp->out_blk)) {
6884 rep->wr = 1;
6885 rep->blk = clp->out_blk;
6886 /* rep->num_blks = blocks; */
6892 sg_out_operation(clp, rep); /* releases out_mutex mid operation */
6900 normal_out_operation(clp, rep, blocks);
6911 if (rep->alloc_bp)
6912 free(rep->alloc_bp);
6925 int normal_in_operation(Rq_coll * clp, Rq_elem * rep, int blocks)
6931 while (((res = read(clp->infd, rep->buffp,
6935 memset(rep->buffp, 0, rep->num_blks * rep->bs);
6938 "%d bytes, %s\n", rep->blk,
6939 rep->num_blks * rep->bs, strerror(errno));
6940 res = rep->num_blks * clp->bs;
6960 rep->num_blks = blocks;
6968 void normal_out_operation(Rq_coll * clp, Rq_elem * rep, int blocks)
6973 while (((res = write(clp->outfd, rep->buffp,
6974 rep->num_blks * clp->bs)) < 0)
6979 "%d bytes, %s\n", rep->blk,
6980 rep->num_blks * rep->bs, strerror(errno));
6981 res = rep->num_blks * clp->bs;
6996 rep->num_blks = blocks;
7001 void sg_in_operation(Rq_coll * clp, Rq_elem * rep)
7008 res = sg_start_io(rep);
7013 rep->blk);
7025 res = sg_finish_io(rep->wr, rep, &clp->aux_mutex);
7028 memset(rep->buffp, 0, rep->num_blks * rep->bs);
7031 "%d bytes\n", rep->blk,
7032 rep->num_blks * rep->bs);
7041 if (rep->dio_incomplete || rep->resid) {
7045 clp->dio_incomplete += rep->dio_incomplete;
7046 clp->sum_of_resids += rep->resid;
7054 clp->in_done_count -= rep->num_blks;
7069 void sg_out_operation(Rq_coll * clp, Rq_elem * rep)
7076 res = sg_start_io(rep);
7082 rep->blk);
7094 res = sg_finish_io(rep->wr, rep, &clp->aux_mutex);
7099 "%d bytes\n", rep->blk,
7100 rep->num_blks * rep->bs);
7109 if (rep->dio_incomplete || rep->resid) {
7113 clp->dio_incomplete += rep->dio_incomplete;
7114 clp->sum_of_resids += rep->resid;
7122 clp->out_done_count -= rep->num_blks;
7137 int sg_start_io(Rq_elem * rep)
7139 sg_io_hdr_t *hp = &rep->io_hdr;
7140 int fua = rep->wr ? (rep->fua_mode & 1) : (rep->fua_mode & 2);
7143 if (sg_build_scsi_cdb(rep->cmd, rep->cdbsz, rep->num_blks, rep->blk,
7144 rep->wr, fua, 0)) {
7146 rep->blk, rep->num_blks);
7151 hp->cmd_len = rep->cdbsz;
7152 hp->cmdp = rep->cmd;
7153 hp->dxfer_direction = rep->wr ? SG_DXFER_TO_DEV : SG_DXFER_FROM_DEV;
7154 hp->dxfer_len = rep->bs * rep->num_blks;
7155 hp->dxferp = rep->buffp;
7156 hp->mx_sb_len = sizeof(rep->sb);
7157 hp->sbp = rep->sb;
7159 hp->usr_ptr = rep;
7160 hp->pack_id = rep->blk;
7161 if (rep->dio)
7163 if (rep->debug > 8) {
7165 rep->wr ? "WRITE" : "READ", rep->blk, rep->num_blks);
7172 while (((res = write(rep->wr ? rep->outfd : rep->infd, hp,
7184 int sg_finish_io(int wr, Rq_elem * rep, pthread_mutex_t * a_mutp)
7196 io_hdr.dxfer_direction = rep->wr ? SG_DXFER_TO_DEV : SG_DXFER_FROM_DEV;
7197 io_hdr.pack_id = rep->blk;
7199 while (((res = read(wr ? rep->outfd : rep->infd, &io_hdr,
7205 if (rep != (Rq_elem *) io_hdr.usr_ptr)
7208 memcpy(&rep->io_hdr, &io_hdr, sizeof(sg_io_hdr_t));
7209 hp = &rep->io_hdr;
7216 rep->blk, rep->num_blks);
7225 "%s blk=%d", rep->wr ? "writing" : "reading",
7226 rep->blk);
7241 if (rep->dio &&
7243 rep->dio_incomplete = 1; /* count dios done as indirect IO */
7245 rep->dio_incomplete = 0;
7246 rep->resid = hp->resid;
7247 if (rep->debug > 8)