fs/xfs/libxfs/xfs_types.c
Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_types.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/libxfs/xfs_types.c- Extension
.c- Size
- 5474 bytes
- Lines
- 257
- 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_format.hxfs_shared.hxfs_trans_resv.hxfs_bit.hxfs_mount.hxfs_ag.hxfs_rtbitmap.hxfs_rtgroup.h
Detected Declarations
function Copyrightfunction xfs_verify_fsbnofunction xfs_verify_fsbextfunction xfs_verify_agno_aginofunction xfs_verify_inofunction xfs_is_sb_inumfunction xfs_verify_dir_inofunction xfs_verify_rtbnofunction xfs_verify_rtbextfunction xfs_icount_rangefunction xfs_verify_icountfunction xfs_verify_dablkfunction xfs_verify_fileofffunction xfs_verify_fileext
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
* Copyright (C) 2017 Oracle.
* All Rights Reserved.
*/
#include "xfs_platform.h"
#include "xfs_fs.h"
#include "xfs_format.h"
#include "xfs_shared.h"
#include "xfs_trans_resv.h"
#include "xfs_bit.h"
#include "xfs_mount.h"
#include "xfs_ag.h"
#include "xfs_rtbitmap.h"
#include "xfs_rtgroup.h"
/*
* Verify that an AG block number pointer neither points outside the AG
* nor points at static metadata.
*/
static inline bool
xfs_verify_agno_agbno(
struct xfs_mount *mp,
xfs_agnumber_t agno,
xfs_agblock_t agbno)
{
xfs_agblock_t eoag;
eoag = xfs_ag_block_count(mp, agno);
if (agbno >= eoag)
return false;
if (agbno <= XFS_AGFL_BLOCK(mp))
return false;
return true;
}
/*
* Verify that an FS block number pointer neither points outside the
* filesystem nor points at static AG metadata.
*/
inline bool
xfs_verify_fsbno(
struct xfs_mount *mp,
xfs_fsblock_t fsbno)
{
xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, fsbno);
if (agno >= mp->m_sb.sb_agcount)
return false;
return xfs_verify_agno_agbno(mp, agno, XFS_FSB_TO_AGBNO(mp, fsbno));
}
/*
* Verify that a data device extent is fully contained inside the filesystem,
* does not cross an AG boundary, and does not point at static metadata.
*/
bool
xfs_verify_fsbext(
struct xfs_mount *mp,
xfs_fsblock_t fsbno,
xfs_fsblock_t len)
{
if (fsbno + len <= fsbno)
return false;
if (!xfs_verify_fsbno(mp, fsbno))
return false;
if (!xfs_verify_fsbno(mp, fsbno + len - 1))
return false;
return XFS_FSB_TO_AGNO(mp, fsbno) ==
XFS_FSB_TO_AGNO(mp, fsbno + len - 1);
}
/*
* Verify that an AG inode number pointer neither points outside the AG
* nor points at static metadata.
*/
static inline bool
xfs_verify_agno_agino(
struct xfs_mount *mp,
xfs_agnumber_t agno,
xfs_agino_t agino)
{
xfs_agino_t first;
xfs_agino_t last;
Annotation
- Immediate include surface: `xfs_platform.h`, `xfs_fs.h`, `xfs_format.h`, `xfs_shared.h`, `xfs_trans_resv.h`, `xfs_bit.h`, `xfs_mount.h`, `xfs_ag.h`.
- Detected declarations: `function Copyright`, `function xfs_verify_fsbno`, `function xfs_verify_fsbext`, `function xfs_verify_agno_agino`, `function xfs_verify_ino`, `function xfs_is_sb_inum`, `function xfs_verify_dir_ino`, `function xfs_verify_rtbno`, `function xfs_verify_rtbext`, `function xfs_icount_range`.
- 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.