scsi.c (cecdd52a3dd312564f81a39df08378b7b39a2654) scsi.c (de4f5fed3f231a8ff4790bf52975f847b95b85ea)
1// SPDX-License-Identifier: GPL-2.0+
2/*******************************************************************************
3 * Vhost kernel TCM fabric driver for virtio SCSI initiators
4 *
5 * (C) Copyright 2010-2013 Datera, Inc.
6 * (C) Copyright 2010-2012 IBM Corp.
7 *
8 * Authors: Nicholas A. Bellinger <nab@daterainc.com>

--- 657 unchanged lines hidden (view full) ---

666 return npages;
667}
668
669static int
670vhost_scsi_calc_sgls(struct iov_iter *iter, size_t bytes, int max_sgls)
671{
672 int sgl_count = 0;
673
1// SPDX-License-Identifier: GPL-2.0+
2/*******************************************************************************
3 * Vhost kernel TCM fabric driver for virtio SCSI initiators
4 *
5 * (C) Copyright 2010-2013 Datera, Inc.
6 * (C) Copyright 2010-2012 IBM Corp.
7 *
8 * Authors: Nicholas A. Bellinger <nab@daterainc.com>

--- 657 unchanged lines hidden (view full) ---

666 return npages;
667}
668
669static int
670vhost_scsi_calc_sgls(struct iov_iter *iter, size_t bytes, int max_sgls)
671{
672 int sgl_count = 0;
673
674 if (!iter || !iter->iov) {
674 if (!iter || !iter_iov(iter)) {
675 pr_err("%s: iter->iov is NULL, but expected bytes: %zu"
676 " present\n", __func__, bytes);
677 return -EINVAL;
678 }
679
680 sgl_count = iov_iter_npages(iter, 0xffff);
681 if (sgl_count > max_sgls) {
682 pr_err("%s: requested sgl_count: %d exceeds pre-allocated"

--- 1845 unchanged lines hidden ---
675 pr_err("%s: iter->iov is NULL, but expected bytes: %zu"
676 " present\n", __func__, bytes);
677 return -EINVAL;
678 }
679
680 sgl_count = iov_iter_npages(iter, 0xffff);
681 if (sgl_count > max_sgls) {
682 pr_err("%s: requested sgl_count: %d exceeds pre-allocated"

--- 1845 unchanged lines hidden ---