tools/testing/selftests/damon/sysfs.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/damon/sysfs.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/damon/sysfs.sh- Extension
.sh- Size
- 10602 bytes
- Lines
- 433
- 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
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
source _common.sh
# Kselftest frmework requirement - SKIP code is 4.
ksft_skip=4
ensure_write_succ()
{
file=$1
content=$2
reason=$3
if ! echo "$content" > "$file"
then
echo "writing $content to $file failed"
echo "expected success because $reason"
exit 1
fi
}
ensure_write_fail()
{
file=$1
content=$2
reason=$3
if (echo "$content" > "$file") 2> /dev/null
then
echo "writing $content to $file succeed ($fail_reason)"
echo "expected failure because $reason"
exit 1
fi
}
ensure_dir()
{
dir=$1
to_ensure=$2
if [ "$to_ensure" = "exist" ] && [ ! -d "$dir" ]
then
echo "$dir dir is expected but not found"
exit 1
elif [ "$to_ensure" = "not_exist" ] && [ -d "$dir" ]
then
echo "$dir dir is not expected but found"
exit 1
fi
}
ensure_file()
{
file=$1
to_ensure=$2
permission=$3
if [ "$to_ensure" = "exist" ]
then
if [ ! -f "$file" ]
then
echo "$file is expected but not found"
exit 1
fi
perm=$(stat -c "%a" "$file")
if [ ! "$perm" = "$permission" ]
then
echo "$file permission: expected $permission but $perm"
exit 1
fi
elif [ "$to_ensure" = "not_exist" ] && [ -f "$dir" ]
Annotation
- 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.