SCST spans a kernel core, transport drivers, user-space programs and configuration tools. Each area has different ABI, build, validation and safety constraints, but the repository has no persistent guidance for automated contributors. Add a root AGENTS.md with cross-component contracts and nested files for components with independent boundaries. Record authoritative sources, generated files, compatibility policy and destructive workflows so changes start from the correct context and avoid live storage state.
9.4 KiB
SCST Repository Guidance
Scope and context
This file supplies repository-wide context. Before changing a file, read every
AGENTS.md from the repository root down to that file; a nested file adds
component-specific rules and does not replace this one. Start by checking
git status and preserve unrelated tracked, untracked, ignored, and generated
worktree state.
SCST is a Linux SCSI target stack. The repository contains a kernel target core, device handlers, transport target drivers, configuration software, and user-space handlers and daemons.
Architecture map
scst/owns the SCST core, built-in device handlers, exported kernel interfaces, kernel/user ABI headers, and in-tree Kbuild/Kconfig integration.iscsi-scst/owns the iSCSI target: its SCST kernel driver, control daemon, protocol/control interfaces, and optional iSER transport.qla2x00t-32gbit/is the default, newer QLogic FC target/initiator source tree for the top-level out-of-tree build;qla2x00t/is the alternative legacy tree selected there withQLA_32GBIT=no. Generated in-tree patches select a tree independently inscripts/generate-kernel-patch; inspect its current target-kernel condition. The trees are alternatives, not interchangeable copies.srpt/,fcst/, andscst_local/own the SRP/RDMA, FCoE/libfc, and local loopback target drivers respectively.usr/owns user-space SCST ABI consumers: thescst_userfile handler, ALUA state-change daemon, and event example.scstadmin/owns the configuration grammar, sysfs discovery and mutation, service integration, and configuration application policy.scripts/owns source, patch, release, checkpatch, regression, and performance helpers.doc/contains design and ABI references;www/contains website material.debian/, spec templates,nightly/, and.github/workflows/own packaging, nightly, and CI integration.
Cross-component contracts
scst/include/scst.his the current target-driver and device-handler registration/lifecycle contract.scst/include/scst_const.h,scst/include/scst_sgv.h,scst/include/scst_debug.h, andscst/include/backport.hare shared support interfaces.backport.his the common kernel-API compatibility layer used by the core and external modules; its availability checks must account for upstream releases, stable-series backports, and vendor kernels rather than onlyLINUX_VERSION_CODE. Changes require an audit of all in-tree consumers, including every target driver and device handler; do not infer callback context, command ownership, teardown ordering, or API availability from an old document.scst/include/scst_user.hplusscst/src/dev_handlers/scst_user.cdefine the/dev/scst_userABI consumed byusr/fileio/.scst/include/scst_event.hplusscst/src/scst_event.cdefine the event ABI consumed byusr/events/andusr/stpgd/. Update producers and consumers together and preserve explicit version checks where present.scst/SysfsRules, current sysfs implementations, and the[key]metadata convention define the user-visible control contract. Target drivers and handlers produce it;scstadmindiscovers and consumes it. Keep management operations generic and preserve configuration ordering, especially creating objects before attributes/LUNs and enabling a target last./etc/scst.confis produced and consumed byscstadminand service integration. iSCSI configuration additionally crosses the kernel/daemon control boundary iniscsi-scst/. Treat grammar, names, defaults, and emitted sysfs values as compatibility-sensitive user interfaces.- SCSI command, task-management, data-transfer, cancellation, session, and
target teardown ownership crosses the core/transport boundary. Exact rules
live in the current
scst.hcallback comments and each driver's receive, completion, abort, and unregister paths. - T10 protection information crosses the core, supporting device handlers,
and PI-capable target drivers. Use
scst/T10-PIto locate the concepts, then verify capabilities, data and PI scatterlists, actions, and ownership in the currentscst.hdeclarations and implementations on both sides.
Verification order and compatibility
This hierarchy is a routing and safety guide, not an interface specification. Resolve a claim by inspecting the nearest current implementation first:
- Current tracked code, installed/shared headers, and comments next to the
implementation define actual behavior and interfaces. Executable
Makefile, Kbuild, Kconfig, scripts, and CI definitions define actual build, generation, and validation behavior. - Use
README.mdandINSTALL.mdfor orientation and workflows, andREADME.clang,README.cross-compilation,README.module-signing, design documents, and component READMEs for rationale and special cases. Recheck every operational or interface claim against current code and recipes. - Use Git history to explain compatibility intent or an otherwise unclear boundary. If prose and implementation differ, do not change behavior merely to match prose or copy the discrepancy here; report it and update the appropriate source or document when that work is in scope.
AGENTS.mdrecords ownership, coupling, risk, and where to investigate. It must not be used as evidence for a callback, field, default, command, path, kernel capability, or supported workflow without checking the referenced implementation or documentation.
The top-level Makefile coordinates KDIR, KVER, PASS_CC_TO_MAKE,
PKG_BUILD_MODE, QLA_32GBIT, and the component order: core, iSCSI, the
selected QLA tree, SRPT, local, FCST, user programs, then scstadmin. Kernel
builds consume ARCH and CROSS_COMPILE; programs under usr/ use CC
directly, and scstadmin uses Perl MakeMaker. Verify propagation in the
current top-level and component recipes before assuming a variable applies to
the whole tree.
doc/scst_pg.sgmlanddoc/scst_user_spec.sgmlare design and ABI explanations; verify copied declarations and layouts against current headers and code.ABT_KERNELSinnightly/conf/nightly.confis the maintained, canonical list of supported upstream and distribution kernels.nightly/bin/nightlypasses it toscripts/run-regression-tests; the GitHub Actions regression matrix is a practical subset, not the complete support list. Treat changes toABT_KERNELSas support-policy changes and keep duplicated CI entries aligned where applicable.- Do not turn historical minimum-kernel claims into policy. Use the nightly list, compatibility code/conftests, build recipes, and relevant Git history to decide whether a compatibility path is still required. Preserve user-visible configuration and ABI behavior unless a deliberate compatibility change is in scope.
Generated state
Consult .gitignore and the producing Makefile/script before editing an
unfamiliar file. Never hand-edit generated interface/version headers such as
scst/include/scst_itf_ver.h, scst/include/build_mode.h, or
iscsi-scst/include/iscsi_scst_itf_ver.h; conftest results; MakeMaker output;
module-signing keys; Module.symvers; kernel/user objects, modules, binaries,
or dependency files; packaging trees/spec output; release archives; or QLogic
source-extraction and generated in-tree-patch output. Change the source or
recipe and regenerate only when regeneration is part of the task. Treat
scst/src/certs/*.priv as generated secrets: never display their contents,
publish, commit, upload, or pass them to certificate-enrollment tooling; only
the public certificate is an enrollment input.
Validation
- Use the narrowest real entry point from the top-level/component Makefiles.
The top-level build and packaging workflows are represented by
.github/workflows/ci.ymland.github/workflows/coverity.yml. - Kernel-style checks use
scripts/checkpatch,scripts/checkpatch_diff, orscripts/checkpatch_commits. The kernel compatibility, compile, sparse, and smatch workflow isscripts/run-regression-testsas configured by.github/workflows/run_regression_tests.yaml; it is heavyweight, downloads or prepares kernel trees, and is not a quick unit test. - There is no repository-wide lightweight unit-test target. Read a local
AGENTS.mdbefore using a componenttesttarget. For instruction-only or documentation-only changes, inspect the full diff and rungit diff --check; do not build merely to validate prose. - Never use an untracked local helper as an established project entry point.
Safety boundaries
Without explicit authorization for the exact host, devices, transports, and configuration, do not:
- install or uninstall files, sign/enroll keys, run DKMS/package installation,
call
depmod, or start/stop/reload system services; - load, unload, or reload modules with
modprobe,insmod, orrmmod; - write SCST or initiator sysfs, apply/save live configuration, or change DLM, ALUA, persistent-reservation, or HA state;
- export or write a real block device or backing file, create a target, LUN, session, login, portal, or initiator connection;
- change iSCSI, FC/FCoE, QLogic HBA, InfiniBand, RoCE, iWARP, or other RDMA state, including resets, LIPs, discovery, or fabric logins;
- run destructive/stress/performance tests, especially scripts that write devices, create filesystems, drop caches, alter CPU policy, access remote hosts, inject faults, or exercise module/service teardown.