Spdk/lib/scsi/scsi.c
Jim Harris 488570ebd4 Replace most BSD 3-clause license text with SPDX identifier.
Many open source projects have moved to using SPDX identifiers
to specify license information, reducing the amount of
boilerplate code in every source file.  This patch replaces
the bulk of SPDK .c, .cpp and Makefiles with the BSD-3-Clause
identifier.

Almost all of these files share the exact same license text,
and this patch only modifies the files that contain the
most common license text.  There can be slight variations
because the third clause contains company names - most say
"Intel Corporation", but there are instances for Nvidia,
Samsung, Eideticom and even "the copyright holder".

Used a bash script to automate replacement of the license text
with SPDX identifier which is checked into scripts/spdx.sh.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaa88ab5e92ea471691dc298cfe41ebfb5d169780
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12904
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: <qun.wan@intel.com>
2022-06-09 07:35:12 +00:00

74 lines
1.5 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (C) 2008-2012 Daisuke Aoyama <aoyama@peach.ne.jp>.
* Copyright (c) Intel Corporation.
* All rights reserved.
*/
#include "scsi_internal.h"
int
spdk_scsi_init(void)
{
return 0;
}
void
spdk_scsi_fini(void)
{
}
SPDK_TRACE_REGISTER_FN(scsi_trace, "scsi", TRACE_GROUP_SCSI)
{
spdk_trace_register_owner(OWNER_SCSI_DEV, 'd');
spdk_trace_register_object(OBJECT_SCSI_TASK, 't');
spdk_trace_register_description("SCSI_TASK_DONE", TRACE_SCSI_TASK_DONE,
OWNER_SCSI_DEV, OBJECT_SCSI_TASK, 0,
SPDK_TRACE_ARG_TYPE_INT, "");
spdk_trace_register_description("SCSI_TASK_START", TRACE_SCSI_TASK_START,
OWNER_SCSI_DEV, OBJECT_SCSI_TASK, 0,
SPDK_TRACE_ARG_TYPE_INT, "");
}
uint64_t
spdk_scsi_lun_id_int_to_fmt(int lun_id)
{
uint64_t fmt_lun, method;
if (lun_id < 0x0100) {
/* below 256 */
method = 0x00U;
fmt_lun = (method & 0x03U) << 62;
fmt_lun |= ((uint64_t)lun_id & 0x00ffU) << 48;
} else if (lun_id < 0x4000) {
/* below 16384 */
method = 0x01U;
fmt_lun = (method & 0x03U) << 62;
fmt_lun |= ((uint64_t)lun_id & 0x3fffU) << 48;
} else {
/* XXX */
fmt_lun = 0;
}
return fmt_lun;
}
int
spdk_scsi_lun_id_fmt_to_int(uint64_t fmt_lun)
{
uint64_t method;
int lun_i;
method = (fmt_lun >> 62) & 0x03U;
fmt_lun = fmt_lun >> 48;
if (method == 0x00U) {
lun_i = (int)(fmt_lun & 0x00ffU);
} else if (method == 0x01U) {
lun_i = (int)(fmt_lun & 0x3fffU);
} else {
lun_i = 0xffffU;
}
return lun_i;
}
SPDK_LOG_REGISTER_COMPONENT(scsi)