fs/btrfs/messages.h
Source file repositories/reference/linux-study-clean/fs/btrfs/messages.h
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/messages.h- Extension
.h- Size
- 6576 bytes
- Lines
- 208
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/printk.hlinux/bug.h
Detected Declarations
struct btrfs_fs_infofunction __printffunction verify_assert_printk_format
Annotated Snippet
static inline void verify_assert_printk_format(const char *fmt, ...) {
/* Stub to verify the assertion format string. */
}
/* Take the first token if any. */
#define __FIRST_ARG(_, ...) _
/*
* Skip the first token and return the rest, if it's empty the comma is dropped.
* As ##__VA_ARGS__ cannot be at the beginning of the macro the __VA_OPT__ is needed
* and supported since GCC 8 and Clang 12.
*/
#define __REST_ARGS(_, ... ) __VA_OPT__(,) __VA_ARGS__
/*
* Assertion with optional printk() format.
*
* Accepted syntax:
* ASSERT(condition);
* ASSERT(condition, "string");
* ASSERT(condition, "variable=%d", variable);
*
* How it works:
* - if there's no format string, ""[0] evaluates at compile time to 0 and the
* true branch is executed
* - any non-empty format string with the "" prefix evaluates to != 0 at
* compile time and the false branch is executed
* - stringified condition is printed as %s so we don't accidentally mix format
* strings (the % operator)
* - there can be only one printk() call, so the format strings and arguments are
* spliced together:
* DEFAULT_FMT [USER_FMT], DEFAULT_ARGS [, USER_ARGS]
* - comma between DEFAULT_ARGS and USER_ARGS is handled by preprocessor
* (requires __VA_OPT__ support)
* - otherwise we could use __VA_OPT(,) __VA_ARGS__ for the 2nd+ argument of args,
*/
#define ASSERT(cond, args...) \
do { \
verify_assert_printk_format("check the format string" args); \
if (!likely(cond)) { \
if (("" __FIRST_ARG(args) [0]) == 0) { \
pr_err("assertion failed: %s, in %s:%d\n", \
#cond, __FILE__, __LINE__); \
} else { \
pr_err("assertion failed: %s, in %s:%d (" __FIRST_ARG(args) ")\n", \
#cond, __FILE__, __LINE__ __REST_ARGS(args)); \
} \
BUG(); \
} \
} while(0)
#else
/* Compile check the @cond expression but don't generate any code. */
#define ASSERT(cond, args...) BUILD_BUG_ON_INVALID(cond)
#endif
#ifdef CONFIG_BTRFS_DEBUG
/* Verbose warning only under debug build. */
#define DEBUG_WARN(args...) WARN(1, KERN_ERR args)
#else
#define DEBUG_WARN(...) do {} while(0)
#endif
__printf(5, 6)
__cold
void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function,
unsigned int line, int error, const char *fmt, ...);
const char * __attribute_const__ btrfs_decode_error(int error);
#define btrfs_handle_fs_error(fs_info, error, fmt, args...) \
__btrfs_handle_fs_error((fs_info), __func__, __LINE__, \
(error), fmt, ##args)
__printf(5, 6)
__cold
void __btrfs_panic(const struct btrfs_fs_info *fs_info, const char *function,
unsigned int line, int error, const char *fmt, ...);
/*
* If BTRFS_MOUNT_PANIC_ON_FATAL_ERROR is in mount_opt, __btrfs_panic
* will panic(). Otherwise we BUG() here.
*/
#define btrfs_panic(fs_info, error, fmt, args...) \
do { \
__btrfs_panic(fs_info, __func__, __LINE__, error, fmt, ##args); \
BUG(); \
} while (0)
#if BITS_PER_LONG == 32
#define BTRFS_32BIT_MAX_FILE_SIZE (((u64)ULONG_MAX + 1) << PAGE_SHIFT)
/*
Annotation
- Immediate include surface: `linux/types.h`, `linux/printk.h`, `linux/bug.h`.
- Detected declarations: `struct btrfs_fs_info`, `function __printf`, `function verify_assert_printk_format`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.