drivers/block/drbd/drbd_polymorph_printk.h
Source file repositories/reference/linux-study-clean/drivers/block/drbd/drbd_polymorph_printk.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/block/drbd/drbd_polymorph_printk.h- Extension
.h- Size
- 5217 bytes
- Lines
- 142
- Domain
- Driver Families
- Bucket
- drivers/block
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
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
#ifndef DRBD_POLYMORPH_PRINTK_H
#define DRBD_POLYMORPH_PRINTK_H
#if !defined(CONFIG_DYNAMIC_DEBUG)
#undef DEFINE_DYNAMIC_DEBUG_METADATA
#undef __dynamic_pr_debug
#undef DYNAMIC_DEBUG_BRANCH
#define DEFINE_DYNAMIC_DEBUG_METADATA(D, F) const char *D = F; ((void)D)
#define __dynamic_pr_debug(D, F, args...) do { (void)(D); if (0) printk(F, ## args); } while (0)
#define DYNAMIC_DEBUG_BRANCH(D) false
#endif
#define __drbd_printk_drbd_device_prep(device) \
const struct drbd_device *__d = (device); \
const struct drbd_resource *__r = __d->resource
#define __drbd_printk_drbd_device_fmt(fmt) "drbd %s/%u drbd%u: " fmt
#define __drbd_printk_drbd_device_args() __r->name, __d->vnr, __d->minor
#define __drbd_printk_drbd_device_unprep()
#define __drbd_printk_drbd_peer_device_prep(peer_device) \
const struct drbd_device *__d; \
const struct drbd_resource *__r; \
__d = (peer_device)->device; \
__r = __d->resource
#define __drbd_printk_drbd_peer_device_fmt(fmt) \
"drbd %s/%u drbd%u: " fmt
#define __drbd_printk_drbd_peer_device_args() \
__r->name, __d->vnr, __d->minor
#define __drbd_printk_drbd_peer_device_unprep()
#define __drbd_printk_drbd_resource_prep(resource) \
const struct drbd_resource *__r = resource
#define __drbd_printk_drbd_resource_fmt(fmt) "drbd %s: " fmt
#define __drbd_printk_drbd_resource_args() __r->name
#define __drbd_printk_drbd_resource_unprep(resource)
#define __drbd_printk_drbd_connection_prep(connection) \
const struct drbd_connection *__c = (connection); \
const struct drbd_resource *__r = __c->resource
#define __drbd_printk_drbd_connection_fmt(fmt) \
"drbd %s: " fmt
#define __drbd_printk_drbd_connection_args() \
__r->name
#define __drbd_printk_drbd_connection_unprep()
void drbd_printk_with_wrong_object_type(void);
void drbd_dyn_dbg_with_wrong_object_type(void);
#define __drbd_printk_choose_cond(obj, struct_name) \
(__builtin_types_compatible_p(typeof(obj), struct struct_name *) || \
__builtin_types_compatible_p(typeof(obj), const struct struct_name *))
#define __drbd_printk_if_same_type(obj, struct_name, level, fmt, args...) \
__drbd_printk_choose_cond(obj, struct_name), \
({ \
__drbd_printk_ ## struct_name ## _prep((const struct struct_name *)(obj)); \
printk(level __drbd_printk_ ## struct_name ## _fmt(fmt), \
__drbd_printk_ ## struct_name ## _args(), ## args); \
__drbd_printk_ ## struct_name ## _unprep(); \
})
#define drbd_printk(level, obj, fmt, args...) \
__builtin_choose_expr( \
__drbd_printk_if_same_type(obj, drbd_device, level, fmt, ## args), \
__builtin_choose_expr( \
__drbd_printk_if_same_type(obj, drbd_resource, level, fmt, ## args), \
__builtin_choose_expr( \
__drbd_printk_if_same_type(obj, drbd_connection, level, fmt, ## args), \
__builtin_choose_expr( \
__drbd_printk_if_same_type(obj, drbd_peer_device, level, fmt, ## args), \
drbd_printk_with_wrong_object_type()))))
#define __drbd_dyn_dbg_if_same_type(obj, struct_name, fmt, args...) \
__drbd_printk_choose_cond(obj, struct_name), \
({ \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (DYNAMIC_DEBUG_BRANCH(descriptor)) { \
__drbd_printk_ ## struct_name ## _prep((const struct struct_name *)(obj)); \
__dynamic_pr_debug(&descriptor, __drbd_printk_ ## struct_name ## _fmt(fmt), \
__drbd_printk_ ## struct_name ## _args(), ## args); \
__drbd_printk_ ## struct_name ## _unprep(); \
} \
})
#define dynamic_drbd_dbg(obj, fmt, args...) \
__builtin_choose_expr( \
__drbd_dyn_dbg_if_same_type(obj, drbd_device, fmt, ## args), \
__builtin_choose_expr( \
__drbd_dyn_dbg_if_same_type(obj, drbd_resource, fmt, ## args), \
__builtin_choose_expr( \
Annotation
- Atlas domain: Driver Families / drivers/block.
- 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.