Add SPDX identifiers matching explicit existing grants: GPL-2.0-only,
GPL-2.0-or-later, or the GPL version 2 / Linux-OpenIB choice. Preserve
all original copyright and license notices, including the MD5 type
header.
Linux-OpenIB identifies the two BSD conditions with the MIT disclaimer;
BSD-2-Clause would not describe that text. The three one-line userspace
debug inclusion files identify the GPL-2.0-only source they contain.
Leave ambiguous or absent version grants for a provenance decision. This
identifies existing licenses and does not change their terms.
Checkpatch reports SPDX_LICENSE_TAG:
Missing or malformed SPDX-License-Identifier tag in line 1
Normalize userspace indentation, operator spacing, pointer placement,
continuation alignment and long declarations, calls and expressions.
Keep changes at existing argument/operator boundaries and retain
literal contents, operand evaluation order and preprocessor branches.
Keep conditional directives at column zero; align their continued
operands independently.
Checkpatch reports SPACING, CODE_INDENT, POINTER_LOCATION. One example:
No space is necessary after a cast
Checkpatch reports SUSPECT_CODE_INDENT:
suspect code indent for conditional statements (24, 40)
Checkpatch reports SPACING, PARENTHESIS_ALIGNMENT, LINE_SPACING. One
example:
spaces preferred around that '|' (ctx:VxV)
Checkpatch reports BLOCK_COMMENT_STYLE, OPEN_BRACE. One example:
Block comments use * on subsequent lines
Checkpatch reports INDENTED_LABEL, PARENTHESIS_ALIGNMENT. One example:
labels should not be indented
Checkpatch reports PARENTHESIS_ALIGNMENT, SWITCH_CASE_INDENT_LEVEL. One
example:
Alignment should match open parenthesis
Checkpatch reports LONG_LINE:
line length of 125 exceeds 100 columns
Checkpatch reports OPEN_ENDED_LINE:
Lines should not end with a '('
Keep complete diagnostic strings together and separate adjacent portable
format macros with spaces in the source. Preserve literal bytes, numeric
escape boundaries, argument conversions and severity; move arguments to
continuation lines where needed.
Pass constant messages directly to the logging macros and use
pr_info_once for the two latency notices. This helper is already
available in Linux 3.10.
Checkpatch reports SPLIT_STRING:
quoted string split across lines
Checkpatch reports CONCATENATED_STRING:
Concatenated strings should use spaces between elements
Checkpatch reports LONG_LINE, PREFER_PR_LEVEL. One example:
line length of 102 exceeds 100 columns
Place static before const in option tables. Keep the conftest-selected
const qualifier beside the RDMA WR type, and use __maybe_unused for the
architecture-dependent page variable. Both conftest alternatives retain
their pointer types; storage duration and option values are unchanged.
Checkpatch reports STATIC_CONST:
Move const after static - use 'static const struct option'
Checkpatch reports PREFER_DEFINED_ATTRIBUTE_MACRO:
__always_unused or __maybe_unused is preferred over
__attribute__((__unused__))
Flatten else branches after unconditional exits and remove final empty
returns from void userspace functions. Preserve early exits, label
targets, retry behavior and all error values.
Balance braces across mixed conditional arms and remove unnecessary
single-statement wrappers while retaining declaration scope, jump
targets and preprocessor ownership. Initialize the ready-to-transfer
result before its optional CONFIG_SCST_TEST_IO_IN_SIRQ override. Keep
disabled debug and rotational branches intact.
Checkpatch reports RETURN_VOID:
void function return statements are not generally useful
Checkpatch reports UNNECESSARY_ELSE:
else is not generally useful after a break or return
Checkpatch reports BRACES:
braces {} should be used on all arms of this statement
Use direct pointer truth tests, put scalar constants on the right and
remove redundant parentheses from conditions and address expressions.
Preserve required precedence, dereferenced-pointer semantics and
short-circuit evaluation. Keep preprocessor expressions and disabled
debug alternatives intact.
Use __func__ for unchanged parameter-error diagnostics and correct the
byte-order diagnostic spelling.
Source review also identified eight negated negative-index tests in
the daemon's parameter lookup chains. Use explicit >= 0 comparisons
while retaining assignment order and short-circuit evaluation. This
readability cleanup does not remove assignment-in-condition findings.
Checkpatch reports COMPARISON_TO_NULL:
Comparison to NULL could be written "target"
Checkpatch reports UNNECESSARY_PARENTHESES:
Unnecessary parentheses around tlv->value
Checkpatch reports CONSTANT_COMPARISON, COMPARISON_TO_NULL. One example:
Comparisons should place the constant on the right side of the test
Checkpatch reports CONSTANT_COMPARISON, EMBEDDED_FUNCTION_NAME,
TYPO_SPELLING. One example:
Comparisons should place the constant on the right side of the test
Qualify userspace event, fileio and state-change-daemon views that only
read request, reply, command or configuration data. Keep mode-page input
parameters read-only and leave writable response buffers and ownership
operations unchanged. No shared ABI or registered callback changes.
Cppcheck reports constParameterPointer and constVariablePointer,
including:
Parameter 'dev' can be declared as pointer to const
Variable 'cdb' can be declared as pointer to const
Variable 'reply' can be declared as pointer to const
Remove overwritten initial values, unused offsets and zero-bit flag
operands. Derive the saved sense length from its captured value and rely
on C zero initialization for static-duration userspace objects. The FC
copy path remains unconditional because its buffers outlive the request.
Select CRC availability with the same four CONFIG predicates and use
else for a negative SRP residual only inside the nonzero-residual branch.
Group ternary bit tests and trim the PR filename's newline with strchr(),
retaining the empty-filename fallback. Manual review also identified the
overwritten QLogic tag initializer; every allocator branch assigns it.
Cppcheck reports:
redundantAssignment: Variable 'tp' is reassigned a value before the
old one has been used.
unreadVariable: Variable 'sg_cnt' is assigned a value that is never used.
unreadVariable: Variable 'data_offset' is assigned a value that is
never used.
clarifyCalculation: Clarify calculation precedence for '&' and '?'.
ignoredReturnValue: Return value of function strsep() is not used.
knownConditionTrueFalse: Condition '!crc32c' is always false.
knownConditionTrueFalse: Condition 'resid<0' is always true.
badBitmaskCheck: Operator '|' with one operand equal to zero is redundant.
It also marks the initial rc value in dev_user_process_cleanup() unread.
Checkpatch reports GLOBAL_INITIALISERS:
do not initialise globals to false
Copy iSCSI text fragments as bytes: their lengths are bounded by the
remaining strlen, while framing emits separators and terminators
separately. Keep virtual-device name rejection and use the existing
strscpy compatibility helper for accepted bounded names.
Reuse checked redirect and directory-entry lengths, including the NUL,
and copy the fixed CHAP prefix by its literal size. Replace command-line
strncpy/termination pairs with snprintf while retaining existing
truncation and zero-filled padding. Copy terminated fixed-width event
fields and the constant core issuer by their exact extents.
Checkpatch reports STRNCPY:
Prefer strscpy, strscpy_pad, or __nonstring over strncpy
Checkpatch reports STRCPY:
Prefer strscpy over strcpy
Cppcheck reports at the affected calls:
invalidPrintfArgType_sint: %d requires 'int' but the argument type
is 'unsigned int'.
invalidPrintfArgType_sint: %zd requires 'ssize_t' but the argument
type is 'size_t {aka unsigned long}'.
invalidPrintfArgType_uint: %llx requires 'unsigned long long' but
the argument type is 'unsigned long'.
invalidPrintfArgType_uint: %u requires 'unsigned int' but the
argument type is 'signed int'.
invalidScanfArgType_int: %lld requires 'long long *' but the
argument type is 'unsigned long long *'.
Use unsigned formats for command states, event IDs, handles and sizes.
Cast the u64 disk ID for %llx on both 32-bit and 64-bit builds. Preserve
unsigned export-link naming through an explicit counter conversion. Use
%llu for the unsigned virtual-disk size destination; retain the byte/MiB
shifts and overflow check.
At five DLM lock-name calls, explicitly convert node IDs to int for the
existing %d formats. Switching them to %u would change high-bit node
IDs' lock identities and break matching with older peers. Preserve that
signed spelling and leave membership and node-ID storage unchanged.
Keep RPM artifact creation, archive generation, package release preparation
and version updates in one directory. Switch all component archive targets,
the top-level RPM target and the RPM workflow to the relocated helpers.
Point archive generation at the shared source inventory in source/ while
preserving its caller-directory semantics and the existing package inputs.
The scst_user specification copies ioctl structures and command payloads
that predate several ABI extensions. Building a handler from those
layouts can select the wrong union member, alignment or completion path.
Commit 3fc775c75a ("EXTENDED COPY support") added remapping payloads.
Commit daee4dcb7e ("WRITE SAME command improvements") added WRITE
SAME descriptors. Commit d1bd22afd9 ("scst_user: avoid global locks")
left the explicit unregister ioctl as an obsolete no-op.
Use scst/include/scst_user.h and scst_user.c as the producer-side
source of truth. Synchronize registration, command, reply and subcommand
layouts, version checks, reserved fields and ioctl rules.
Update the fileio_tgt, stpgd and event guides from current code. Make
live-storage and event-consumption risks explicit.
Transport Target mode server need to able to function when running in
containerized form factor in a secure and multi-tenant platform.
Solution: Such applications when containerized can run in any container
based platform such as Kubernetes/OpenShift or a custom one. These
applications are generic in nature and all they need is access to SCST
user storage device driver (/dev/scst_user). The security policy of the
platform may not allow these applications to manage Fibre Channel (FC)
port and /sys file-system. The platform, however, can manage the FC ports
on behalf of these applications. The containerized applications can
remain generic in nature and run on any containerized platforms. The
sequence of operations would be 1. The platform converts the desired FC
ports to target mode prior to starting the containerized application 2.
The application does device registration using exported the SCST user
storage device driver 3. The platform, at this point, asynchronously adds
FC port LUNs to the user device registered by the application. As the
application inside the container can auto or manual restart
asynchronously, the platform would add the LUNs every time the
application does device registration.
Patch description: The SCST event mechanism is leveraged to achieve the
asynchronous LUN additions when application does device registration. The
current set of SCST events is extended to send a new event whenever there
is a virtual user device registration happens. The platform can watch for
the specific event and make business logic decisions to allow target mode
applications function securely. By extending the set of event, the SCST
module will be friendly to containerized applications and platforms.
Signed-off-by: Vikas Goel <vikas.goel@veritas.com>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9210 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Move the build_mode file from the top level into the scst directory. Write
build mode defines into scst/include/build_mode.h and include that file
directly or indirectly in all source files that depend on these #defines.
This approach has the advantage that "make clean" does no longer has to
be run when switching between build modes because the kernel build system
recognizes build_mode.h as a dependency and triggers a rebuild of all
source files that directly or indirectly include the build_mode.h header
file.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8347 d57e44dd-8a1f-0410-8b47-8ef2f437770f