fs/xfs/xfs_hooks.c
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_hooks.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_hooks.c- Extension
.c- Size
- 1192 bytes
- Lines
- 53
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
xfs_platform.hxfs_fs.hxfs_shared.hxfs_format.hxfs_trans_resv.hxfs_mount.hxfs_ag.hxfs_trace.h
Detected Declarations
function Copyrightfunction xfs_hooks_addfunction xfs_hooks_delfunction xfs_hooks_call
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2022-2024 Oracle. All Rights Reserved.
* Author: Darrick J. Wong <djwong@kernel.org>
*/
#include "xfs_platform.h"
#include "xfs_fs.h"
#include "xfs_shared.h"
#include "xfs_format.h"
#include "xfs_trans_resv.h"
#include "xfs_mount.h"
#include "xfs_ag.h"
#include "xfs_trace.h"
/* Initialize a notifier chain. */
void
xfs_hooks_init(
struct xfs_hooks *chain)
{
BLOCKING_INIT_NOTIFIER_HEAD(&chain->head);
}
/* Make it so a function gets called whenever we hit a certain hook point. */
int
xfs_hooks_add(
struct xfs_hooks *chain,
struct xfs_hook *hook)
{
ASSERT(hook->nb.notifier_call != NULL);
BUILD_BUG_ON(offsetof(struct xfs_hook, nb) != 0);
return blocking_notifier_chain_register(&chain->head, &hook->nb);
}
/* Remove a previously installed hook. */
void
xfs_hooks_del(
struct xfs_hooks *chain,
struct xfs_hook *hook)
{
blocking_notifier_chain_unregister(&chain->head, &hook->nb);
}
/* Call a hook. Returns the NOTIFY_* value returned by the last hook. */
int
xfs_hooks_call(
struct xfs_hooks *chain,
unsigned long val,
void *priv)
{
return blocking_notifier_call_chain(&chain->head, val, priv);
}
Annotation
- Immediate include surface: `xfs_platform.h`, `xfs_fs.h`, `xfs_shared.h`, `xfs_format.h`, `xfs_trans_resv.h`, `xfs_mount.h`, `xfs_ag.h`, `xfs_trace.h`.
- Detected declarations: `function Copyright`, `function xfs_hooks_add`, `function xfs_hooks_del`, `function xfs_hooks_call`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- 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.