Lines Matching refs:k
367 int k, res; in sg_read() local
382 if ((k = verify_area(VERIFY_WRITE, buf, count))) in sg_read()
383 return k; in sg_read()
511 int mxsize, cmd_size, k; in sg_write() local
533 if ((k = verify_area(VERIFY_READ, buf, count))) in sg_write()
534 return k; /* protects following copy_from_user()s + get_user()s */ in sg_write()
596 k = sg_common_write(sfp, srp, cmnd, sfp->timeout, blocking); in sg_write()
597 return (k < 0) ? k : count; in sg_write()
603 int k; in sg_new_write() local
611 if ((k = verify_area(VERIFY_READ, buf, count))) in sg_new_write()
612 return k; /* protects following copy_from_user()s + get_user()s */ in sg_new_write()
644 if ((k = verify_area(VERIFY_READ, hp->cmdp, hp->cmd_len))) { in sg_new_write()
646 return k; /* protects following copy_from_user()s + get_user()s */ in sg_new_write()
654 k = sg_common_write(sfp, srp, cmnd, timeout, blocking); in sg_new_write()
655 if (k < 0) return k; in sg_new_write()
663 int k; in sg_common_write() local
681 if ((k = sg_start_req(srp))) { in sg_common_write()
682 SCSI_LOG_TIMEOUT(1, printk("sg_write: start_req err=%d\n", k)); in sg_common_write()
684 return k; /* probably out of space --> ENOMEM */ in sg_common_write()
686 if ((k = sg_write_xfer(srp))) { in sg_common_write()
689 return k; in sg_common_write()
1072 int k, m; in sg_rb_correct4mmap() local
1080 for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sclp) { in sg_rb_correct4mmap()
1125 int k; in sg_vma_nopage() local
1130 for (k = 0; (k < rsv_schp->k_use_sg) && (sa < vma->vm_end); in sg_vma_nopage()
1131 ++k, ++sclp) { in sg_vma_nopage()
1173 int k; in sg_mmap() local
1178 for (k = 0; (k < rsv_schp->k_use_sg) && (sa < vma->vm_end); in sg_mmap()
1179 ++k, ++sclp) { in sg_mmap()
1408 int k; in sg_attach() local
1430 for(k = 0; k < sg_template.dev_max; k++) in sg_attach()
1431 if(! sg_dev_arr[k]) break; in sg_attach()
1432 if (k > MINORMASK) { in sg_attach()
1441 if(k < sg_template.dev_max) in sg_attach()
1452 SCSI_LOG_TIMEOUT(3, printk("sg_attach: dev=%d \n", k)); in sg_attach()
1460 sdp->i_rdev = MKDEV(SCSI_GENERIC_MAJOR, k); in sg_attach()
1462 SCSI_GENERIC_MAJOR, k, in sg_attach()
1466 sg_dev_arr[k] = sdp; in sg_attach()
1476 " %d, id %d, lun %d, type %d\n", k, scsidp->host->host_no, in sg_attach()
1494 int k, delay; in sg_detach() local
1500 for (k = 0; k < sg_template.dev_max; k++) { in sg_detach()
1501 sdp = sg_dev_arr[k]; in sg_detach()
1527 SCSI_LOG_TIMEOUT(3, printk("sg_detach: dev=%d, dirty\n", k)); in sg_detach()
1532 sg_dev_arr[k] = NULL; in sg_detach()
1536 SCSI_LOG_TIMEOUT(3, printk("sg_detach: dev=%d\n", k)); in sg_detach()
1539 sg_dev_arr[k] = NULL; in sg_detach()
1692 int res, k, split, offset, num, mx_sc_elems, rem_sz; in sg_build_dir() local
1719 for (k = 1, split = 0; k < kp->nr_pages; ++k, prev_addr = addr) { in sg_build_dir()
1720 addr = (unsigned long) page_address(kp->maplist[k]); in sg_build_dir()
1722 split = k; in sg_build_dir()
1742 for (k = 0, sclp = schp->buffer, rem_sz = dxfer_len; in sg_build_dir()
1743 (rem_sz > 0) && (k < mx_sc_elems); in sg_build_dir()
1744 ++k, ++sclp) { in sg_build_dir()
1745 offset = (0 == k) ? kp->offset : 0; in sg_build_dir()
1748 sclp->address = page_address(kp->maplist[k]) + offset; in sg_build_dir()
1753 mem_src_arr[k] = SG_USER_MEM; in sg_build_dir()
1757 k, sclp->address, num, mem_src_arr[k])); in sg_build_dir()
1759 schp->k_use_sg = k; in sg_build_dir()
1761 printk("sg_build_dir: k_use_sg=%d, rem_sz=%d\n", k, rem_sz)); in sg_build_dir()
1812 int k, rem_sz, num; in sg_build_indi() local
1825 for (k = 0, sclp = schp->buffer, rem_sz = blk_size; in sg_build_indi()
1826 (rem_sz > 0) && (k < mx_sc_elems); in sg_build_indi()
1827 ++k, rem_sz -= ret_sz, ++sclp) { in sg_build_indi()
1842 mem_src_arr[k] = mem_src; in sg_build_indi()
1846 k, sclp->address, ret_sz, mem_src)); in sg_build_indi()
1848 schp->k_use_sg = k; in sg_build_indi()
1850 printk("sg_build_indi: k_use_sg=%d, rem_sz=%d\n", k, rem_sz)); in sg_build_indi()
1863 int j, k, onum, usglen, ksglen, res, ok; in sg_write_xfer() local
1885 if ((k = verify_area(VERIFY_READ, hp->dxferp, in sg_write_xfer()
1887 return k; in sg_write_xfer()
1913 for (j = 0, k = 0; j < onum; ++j) { in sg_write_xfer()
1918 ok = (SG_USER_MEM != mem_src_arr[k]); in sg_write_xfer()
1940 ++k; in sg_write_xfer()
1941 if (k >= schp->k_use_sg) in sg_write_xfer()
1954 int count, k; in sg_u_iovec() local
1971 if ((k = verify_area(wr_xf ? VERIFY_READ : VERIFY_WRITE, p, count))) in sg_u_iovec()
1972 return k; in sg_u_iovec()
1990 int k, mem_src; in sg_remove_scat() local
1994 for (k = 0; (k < schp->k_use_sg) && sclp->address; ++k, ++sclp) { in sg_remove_scat()
1995 mem_src = mem_src_arr[k]; in sg_remove_scat()
1998 k, sclp->address, sclp->length, mem_src)); in sg_remove_scat()
2018 int j, k, onum, usglen, ksglen, res, ok; in sg_read_xfer() local
2040 if ((k = verify_area(VERIFY_READ, hp->dxferp, in sg_read_xfer()
2042 return k; in sg_read_xfer()
2068 for (j = 0, k = 0; j < onum; ++j) { in sg_read_xfer()
2073 ok = (SG_USER_MEM != mem_src_arr[k]); in sg_read_xfer()
2095 ++k; in sg_read_xfer()
2096 if (k >= schp->k_use_sg) in sg_read_xfer()
2113 int k, num; in sg_read_oxfer() local
2116 for (k = 0; (k < schp->k_use_sg) && sclp->address; ++k, ++sclp) { in sg_read_oxfer()
2160 int k, num; in sg_link_reserve() local
2164 for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sclp) { in sg_link_reserve()
2167 if (0 == k) { in sg_link_reserve()
2174 req_schp->k_use_sg = k + 1; in sg_link_reserve()
2186 if (k >= rsv_schp->k_use_sg) in sg_link_reserve()
2246 int k; in sg_get_nth_request() local
2249 for (k = 0, resp = sfp->headrp; resp && (k < nth); in sg_get_nth_request()
2250 ++k, resp = resp->nextrp) in sg_get_nth_request()
2260 int k; in sg_add_request() local
2277 for (k = 0; k < SG_MAX_QUEUE; ++k, ++rp) { in sg_add_request()
2281 if (k < SG_MAX_QUEUE) { in sg_add_request()
2340 int k; in sg_get_nth_sfp() local
2343 for (k = 0, resp = sdp->headfp; resp && (k < nth); in sg_get_nth_sfp()
2344 ++k, resp = resp->nextfp) in sg_get_nth_sfp()
2439 int k, maxd; in sg_remove_sfp() local
2442 for (k = 0; k < maxd; ++k) { in sg_remove_sfp()
2443 if (sdp == sg_dev_arr[k]) in sg_remove_sfp()
2446 if (k < maxd) in sg_remove_sfp()
2447 sg_dev_arr[k] = NULL; in sg_remove_sfp()
2657 int k; in sg_allow_access() local
2661 for (k = 0; k < sizeof(allow_ops); ++k) { in sg_allow_access()
2662 if (opcode == allow_ops[k]) in sg_allow_access()
2672 int k; in sg_last_dev() local
2676 for (k = sg_template.dev_max - 1; k >= 0; --k) in sg_last_dev()
2677 if (sg_dev_arr[k] && sg_dev_arr[k]->device) break; in sg_last_dev()
2679 return k + 1; /* origin 1 */ in sg_last_dev()
2785 int k, mask; in sg_proc_init() local
2795 for (k = 0; k < leaves; ++k) { in sg_proc_init()
2796 mask = sg_proc_leaf_writes[k] ? S_IRUGO | S_IWUSR : S_IRUGO; in sg_proc_init()
2797 pdep = create_proc_entry(sg_proc_leaf_names[k], mask, sg_proc_sgp); in sg_proc_init()
2799 pdep->read_proc = sg_proc_leaf_reads[k]; in sg_proc_init()
2800 if (sg_proc_leaf_writes[k]) in sg_proc_init()
2801 pdep->write_proc = sg_proc_leaf_writes[k]; in sg_proc_init()
2809 int k; in sg_proc_cleanup() local
2814 for (k = 0; k < leaves; ++k) in sg_proc_cleanup()
2815 remove_proc_entry(sg_proc_leaf_names[k], sg_proc_sgp); in sg_proc_cleanup()
2860 unsigned long k = ULONG_MAX; in sg_proc_dressz_write() local
2868 k = simple_strtoul(buff, 0, 10); in sg_proc_dressz_write()
2869 if (k <= 1048576) { in sg_proc_dressz_write()
2870 sg_big_buff = k; in sg_proc_dressz_write()
2902 int dev, k, m, blen, usg; in sg_proc_debug_info() local
2922 for (k = 0; (fp = sg_get_nth_sfp(sdp, k)); ++k) { in sg_proc_debug_info()
2924 "(res)sgat=%d low_dma=%d\n", k + 1, in sg_proc_debug_info()
3027 int k; in sg_proc_host_info() local
3029 for (k = 0, shp = scsi_hostlist; shp; shp = shp->next, ++k) { in sg_proc_host_info()
3030 for ( ; k < shp->host_no; ++k) in sg_proc_host_info()
3061 int k; in sg_proc_hoststrs_info() local
3065 for (k = 0, shp = scsi_hostlist; shp; shp = shp->next, ++k) { in sg_proc_hoststrs_info()
3066 for ( ; k < shp->host_no; ++k) in sg_proc_hoststrs_info()