tools/testing/selftests/ublk/common.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/ublk/common.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/ublk/common.c- Extension
.c- Size
- 1074 bytes
- Lines
- 56
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
kublk.h
Detected Declarations
function backing_file_tgt_deinitfunction backing_file_tgt_init
Annotated Snippet
if (fd < 0) {
ublk_err("%s: backing file %s can't be opened: %s\n",
__func__, file, strerror(errno));
return -EBADF;
}
if (fstat(fd, &st) < 0) {
close(fd);
return -EBADF;
}
if (S_ISREG(st.st_mode))
bytes = st.st_size;
else if (S_ISBLK(st.st_mode)) {
if (ioctl(fd, BLKGETSIZE64, &bytes) != 0)
return -1;
} else {
return -EINVAL;
}
dev->tgt.backing_file_size[i] = bytes;
dev->fds[dev->nr_fds] = fd;
dev->nr_fds += 1;
}
return 0;
}
Annotation
- Immediate include surface: `kublk.h`.
- Detected declarations: `function backing_file_tgt_deinit`, `function backing_file_tgt_init`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
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.