tools/testing/selftests/vfio/scripts/setup.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/vfio/scripts/setup.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/vfio/scripts/setup.sh- Extension
.sh- Size
- 992 bytes
- Lines
- 49
- 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 main
Annotated Snippet
function main() {
local device_bdf
local device_dir
local numvfs
local driver
if [ $# = 0 ]; then
echo "usage: $0 segment:bus:device.function ..." >&2
exit 1
fi
for device_bdf in "$@"; do
test -d /sys/bus/pci/devices/${device_bdf}
device_dir=${DEVICES_DIR}/${device_bdf}
if [ -d "${device_dir}" ]; then
echo "${device_bdf} has already been set up, exiting."
exit 0
fi
mkdir -p ${device_dir}
numvfs=$(get_sriov_numvfs ${device_bdf})
if [ "${numvfs}" ]; then
set_sriov_numvfs ${device_bdf} 0
echo ${numvfs} > ${device_dir}/sriov_numvfs
fi
driver=$(get_driver ${device_bdf})
if [ "${driver}" ]; then
unbind ${device_bdf} ${driver}
echo ${driver} > ${device_dir}/driver
fi
set_driver_override ${device_bdf} vfio-pci
touch ${device_dir}/driver_override
bind ${device_bdf} vfio-pci
touch ${device_dir}/vfio-pci
done
}
main "$@"
Annotation
- Detected declarations: `function main`.
- 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.