tools/testing/selftests/vfio/scripts/lib.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/vfio/scripts/lib.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/vfio/scripts/lib.sh- Extension
.sh- Size
- 964 bytes
- Lines
- 43
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function write_tofunction bindfunction set_driver_override
Annotated Snippet
function write_to() {
# Unfortunately set -x does not show redirects so use echo to manually
# tell the user what commands are being run.
echo "+ echo \"${2}\" > ${1}"
echo "${2}" > ${1}
}
function get_driver() {
if [ -L /sys/bus/pci/devices/${1}/driver ]; then
basename $(readlink -m /sys/bus/pci/devices/${1}/driver)
fi
}
function bind() {
write_to /sys/bus/pci/drivers/${2}/bind ${1}
}
function unbind() {
write_to /sys/bus/pci/drivers/${2}/unbind ${1}
}
function set_sriov_numvfs() {
write_to /sys/bus/pci/devices/${1}/sriov_numvfs ${2}
}
function get_sriov_numvfs() {
if [ -f /sys/bus/pci/devices/${1}/sriov_numvfs ]; then
cat /sys/bus/pci/devices/${1}/sriov_numvfs
fi
}
function set_driver_override() {
write_to /sys/bus/pci/devices/${1}/driver_override ${2}
}
function clear_driver_override() {
set_driver_override ${1} ""
}
Annotation
- Detected declarations: `function write_to`, `function bind`, `function set_driver_override`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.