Lines Matching refs:schp

207 static int sg_build_indi(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size);
208 static int sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp,
221 static void sg_remove_scat(Sg_scatter_hold * schp);
222 static char * sg_get_sgat_msa(Sg_scatter_hold * schp);
243 static void sg_unmap_and(Sg_scatter_hold * schp, int free_also);
1630 static int sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, in sg_build_sgat() argument
1640 schp->buffer = sg_malloc(sfp, sg_bufflen, &ret_sz, &mem_src); in sg_build_sgat()
1641 if (! schp->buffer) in sg_build_sgat()
1647 schp->buffer_mem_src = (char)mem_src; in sg_build_sgat()
1648 schp->sglist_len = sg_bufflen; in sg_build_sgat()
1649 memset(schp->buffer, 0, sg_bufflen); in sg_build_sgat()
1671 static void sg_unmap_and(Sg_scatter_hold * schp, int free_also) in sg_unmap_and() argument
1676 if (schp && schp->kiobp) { in sg_unmap_and()
1677 if (schp->mapped) { in sg_unmap_and()
1678 unmap_kiobuf(schp->kiobp); in sg_unmap_and()
1679 schp->mapped = 0; in sg_unmap_and()
1682 sg_free_kiovec(1, &schp->kiobp, &nbhs); in sg_unmap_and()
1683 schp->kiobp = NULL; in sg_unmap_and()
1698 Sg_scatter_hold * schp = &srp->data; in sg_build_dir() local
1702 res = sg_alloc_kiovec(1, &schp->kiobp, &nbhs); in sg_build_dir()
1709 schp->kiobp, (unsigned long)hp->dxferp, dxfer_len); in sg_build_dir()
1713 sg_unmap_and(schp, 1); in sg_build_dir()
1716 schp->mapped = 1; in sg_build_dir()
1717 kp = schp->kiobp; in sg_build_dir()
1727 schp->k_use_sg = 0; in sg_build_dir()
1728 schp->buffer = page_address(kp->maplist[0]) + kp->offset; in sg_build_dir()
1729 schp->bufflen = dxfer_len; in sg_build_dir()
1730 schp->buffer_mem_src = SG_USER_MEM; in sg_build_dir()
1731 schp->b_malloc_len = dxfer_len; in sg_build_dir()
1735 mx_sc_elems = sg_build_sgat(schp, sfp, sg_tablesize); in sg_build_dir()
1737 sg_unmap_and(schp, 1); in sg_build_dir()
1738 sg_remove_scat(schp); in sg_build_dir()
1741 mem_src_arr = schp->buffer + (mx_sc_elems * sizeof(struct scatterlist)); in sg_build_dir()
1742 for (k = 0, sclp = schp->buffer, rem_sz = dxfer_len; in sg_build_dir()
1759 schp->k_use_sg = k; in sg_build_dir()
1762 schp->bufflen = dxfer_len; in sg_build_dir()
1764 sg_unmap_and(schp, 1); in sg_build_dir()
1765 sg_remove_scat(schp); in sg_build_dir()
1775 static int sg_build_indi(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size) in sg_build_indi() argument
1795 schp->k_use_sg = 0; in sg_build_indi()
1796 schp->buffer = p; in sg_build_indi()
1797 schp->bufflen = blk_size; in sg_build_indi()
1798 schp->buffer_mem_src = (char)mem_src; in sg_build_indi()
1799 schp->b_malloc_len = blk_size; in sg_build_indi()
1819 mx_sc_elems = sg_build_sgat(schp, sfp, sg_tablesize); in sg_build_indi()
1822 mem_src_arr = schp->buffer + in sg_build_indi()
1825 for (k = 0, sclp = schp->buffer, rem_sz = blk_size; in sg_build_indi()
1848 schp->k_use_sg = k; in sg_build_indi()
1851 schp->bufflen = blk_size; in sg_build_indi()
1861 Sg_scatter_hold * schp = &srp->data; in sg_write_xfer() local
1873 if (schp->bufflen < num_xfer) in sg_write_xfer()
1874 num_xfer = schp->bufflen; in sg_write_xfer()
1882 num_xfer, iovec_count, schp->k_use_sg)); in sg_write_xfer()
1892 if (0 == schp->k_use_sg) { /* kernel has single buffer */ in sg_write_xfer()
1893 if (SG_USER_MEM != schp->buffer_mem_src) { /* else nothing to do */ in sg_write_xfer()
1895 for (j = 0, p = schp->buffer; j < onum; ++j) { in sg_write_xfer()
1908 struct scatterlist * sclp = (struct scatterlist *)schp->buffer; in sg_write_xfer()
1909 char * mem_src_arr = sg_get_sgat_msa(schp); in sg_write_xfer()
1941 if (k >= schp->k_use_sg) in sg_write_xfer()
1978 static char * sg_get_sgat_msa(Sg_scatter_hold * schp) in sg_get_sgat_msa() argument
1981 int mx_sc_elems = schp->sglist_len / elem_sz; in sg_get_sgat_msa()
1982 return schp->buffer + (sizeof(struct scatterlist) * mx_sc_elems); in sg_get_sgat_msa()
1985 static void sg_remove_scat(Sg_scatter_hold * schp) in sg_remove_scat() argument
1988 schp->k_use_sg)); in sg_remove_scat()
1989 if (schp->buffer && schp->sglist_len) { in sg_remove_scat()
1991 struct scatterlist * sclp = (struct scatterlist *)schp->buffer; in sg_remove_scat()
1992 char * mem_src_arr = sg_get_sgat_msa(schp); in sg_remove_scat()
1994 for (k = 0; (k < schp->k_use_sg) && sclp->address; ++k, ++sclp) { in sg_remove_scat()
2006 sg_free(schp->buffer, schp->sglist_len, schp->buffer_mem_src); in sg_remove_scat()
2008 else if (schp->buffer) in sg_remove_scat()
2009 sg_free(schp->buffer, schp->b_malloc_len, schp->buffer_mem_src); in sg_remove_scat()
2010 memset(schp, 0, sizeof(*schp)); in sg_remove_scat()
2016 Sg_scatter_hold * schp = &srp->data; in sg_read_xfer() local
2028 if (schp->bufflen < num_xfer) in sg_read_xfer()
2029 num_xfer = schp->bufflen; in sg_read_xfer()
2037 num_xfer, iovec_count, schp->k_use_sg)); in sg_read_xfer()
2047 if (0 == schp->k_use_sg) { /* kernel has single buffer */ in sg_read_xfer()
2048 if (SG_USER_MEM != schp->buffer_mem_src) { /* else nothing to do */ in sg_read_xfer()
2050 for (j = 0, p = schp->buffer; j < onum; ++j) { in sg_read_xfer()
2063 struct scatterlist * sclp = (struct scatterlist *)schp->buffer; in sg_read_xfer()
2064 char * mem_src_arr = sg_get_sgat_msa(schp); in sg_read_xfer()
2096 if (k >= schp->k_use_sg) in sg_read_xfer()
2106 Sg_scatter_hold * schp = &srp->data; in sg_read_oxfer() local
2112 if(schp->k_use_sg > 0) { in sg_read_oxfer()
2114 struct scatterlist * sclp = (struct scatterlist *)schp->buffer; in sg_read_oxfer()
2116 for (k = 0; (k < schp->k_use_sg) && sclp->address; ++k, ++sclp) { in sg_read_oxfer()
2132 __copy_to_user(outp, schp->buffer, num_read_xfer); in sg_read_oxfer()
2137 Sg_scatter_hold * schp = &sfp->reserve; in sg_build_reserve() local
2143 if (0 == sg_build_indi(schp, sfp, req_size)) in sg_build_reserve()
2146 sg_remove_scat(schp); in sg_build_reserve()