tools/lib/python/kdoc/kdoc_item.py
Source file repositories/reference/linux-study-clean/tools/lib/python/kdoc/kdoc_item.py
File Facts
- System
- Linux kernel
- Corpus path
tools/lib/python/kdoc/kdoc_item.py- Extension
.py- Size
- 2923 bytes
- Lines
- 99
- 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
# SPDX-License-Identifier: GPL-2.0
#
# A class that will, eventually, encapsulate all of the parsed data that we
# then pass into the output modules.
#
"""
Data class to store a kernel-doc Item.
"""
class KdocItem:
"""
A class that will, eventually, encapsulate all of the parsed data that we
then pass into the output modules.
"""
def __init__(self, name, fname, type, start_line,
**other_stuff):
self.name = name
self.fname = fname
self.type = type
self.declaration_start_line = start_line
self.sections = {}
self.sections_start_lines = {}
self.parameterlist = []
self.parameterdesc_start_lines = {}
self.parameterdescs = {}
self.parametertypes = {}
self.warnings = []
#
# Just save everything else into our own dict so that the output
# side can grab it directly as before. As we move things into more
# structured data, this will, hopefully, fade away.
#
known_keys = {
'declaration_start_line',
'sections',
'sections_start_lines',
'parameterlist',
'parameterdesc_start_lines',
'parameterdescs',
'parametertypes',
'warnings',
}
self.other_stuff = {}
for k, v in other_stuff.items():
if k in known_keys:
setattr(self, k, v) # real attribute
else:
self.other_stuff[k] = v
def get(self, key, default = None):
"""
Get a value from optional keys.
"""
return self.other_stuff.get(key, default)
def __getitem__(self, key):
return self.get(key)
def __repr__(self):
return f"KdocItem({self.name}, {self.fname}, {self.type}, {self.declaration_start_line})"
@classmethod
def from_dict(cls, d):
"""Create a KdocItem from a plain dict."""
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.