fs/xfs/xfs_platform.h
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_platform.h
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_platform.h- Extension
.h- Size
- 7805 bytes
- Lines
- 304
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/uuid.hlinux/semaphore.hlinux/mm.hlinux/sched/mm.hlinux/kernel.hlinux/blkdev.hlinux/slab.hlinux/vmalloc.hlinux/crc32c.hlinux/module.hlinux/mutex.hlinux/file.hlinux/filelock.hlinux/swap.hlinux/errno.hlinux/sched/signal.hlinux/bitops.hlinux/major.hlinux/pagemap.hlinux/vfs.hlinux/seq_file.hlinux/init.hlinux/list.hlinux/proc_fs.hlinux/sort.hlinux/cpu.hlinux/notifier.hlinux/delay.hlinux/log2.hlinux/rwsem.hlinux/spinlock.h
Detected Declarations
struct xfs_kobjstruct xstatsfunction delayfunction xfs_to_linux_dev_tfunction linux_to_xfs_dev_tfunction rounddown_64function roundup_64function howmany_64function isaligned_64function log2_if_power2function mask64_if_power2function kmem_to_page
Annotated Snippet
struct xfs_kobj {
struct kobject kobject;
struct completion complete;
};
struct xstats {
struct xfsstats __percpu *xs_stats;
struct xfs_kobj xs_kobj;
};
extern struct xstats xfsstats;
static inline dev_t xfs_to_linux_dev_t(xfs_dev_t dev)
{
return MKDEV(sysv_major(dev) & 0x1ff, sysv_minor(dev));
}
static inline xfs_dev_t linux_to_xfs_dev_t(dev_t dev)
{
return sysv_encode_dev(dev);
}
/*
* Various platform dependent calls that don't fit anywhere else
*/
#define xfs_sort(a,n,s,fn) sort(a,n,s,fn,NULL)
#define xfs_stack_trace() dump_stack()
static inline uint64_t rounddown_64(uint64_t x, uint32_t y)
{
do_div(x, y);
return x * y;
}
static inline uint64_t roundup_64(uint64_t x, uint32_t y)
{
x += y - 1;
do_div(x, y);
return x * y;
}
static inline uint64_t howmany_64(uint64_t x, uint32_t y)
{
x += y - 1;
do_div(x, y);
return x;
}
static inline bool isaligned_64(uint64_t x, uint32_t y)
{
return do_div(x, y) == 0;
}
/* If @b is a power of 2, return log2(b). Else return -1. */
static inline int8_t log2_if_power2(unsigned long b)
{
return is_power_of_2(b) ? ilog2(b) : -1;
}
/* If @b is a power of 2, return a mask of the lower bits, else return zero. */
static inline unsigned long long mask64_if_power2(unsigned long b)
{
return is_power_of_2(b) ? b - 1 : 0;
}
int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,
char *data, enum req_op op);
#define ASSERT_ALWAYS(expr) \
(likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
#ifdef DEBUG
#define ASSERT(expr) \
(likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
#else /* !DEBUG */
#ifdef XFS_WARN
/*
* Please note that this ASSERT doesn't kill the kernel. It will if the kernel
* has panic_on_warn set.
*/
#define ASSERT(expr) \
(likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
#else /* !DEBUG && !XFS_WARN */
#define ASSERT(expr) ((void)0)
Annotation
- Immediate include surface: `linux/types.h`, `linux/uuid.h`, `linux/semaphore.h`, `linux/mm.h`, `linux/sched/mm.h`, `linux/kernel.h`, `linux/blkdev.h`, `linux/slab.h`.
- Detected declarations: `struct xfs_kobj`, `struct xstats`, `function delay`, `function xfs_to_linux_dev_t`, `function linux_to_xfs_dev_t`, `function rounddown_64`, `function roundup_64`, `function howmany_64`, `function isaligned_64`, `function log2_if_power2`.
- 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.