fs/ufs/util.h
Source file repositories/reference/linux-study-clean/fs/ufs/util.h
File Facts
- System
- Linux kernel
- Corpus path
fs/ufs/util.h- Extension
.h- Size
- 16056 bytes
- Lines
- 598
- 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/buffer_head.hlinux/fs.hswab.h
Detected Declarations
function Copyrightfunction ufs_get_fs_statefunction ufs_set_fs_statefunction ufs_get_fs_npsectfunction ufs_get_fs_qbmaskfunction ufs_get_fs_qfmaskfunction ufs_get_de_namlenfunction ufs_set_de_namlenfunction ufs_set_de_typefunction ufs_get_inode_uidfunction ufs_set_inode_uidfunction ufs_get_inode_gidfunction ufs_set_inode_gidfunction ufs_put_locked_foliofunction ufs_freefragsfunction _ubh_find_next_zero_bit_function find_last_zero_bitfunction _ubh_find_last_zero_bit_function ubh_isblocksetfunction ubh_clrblockfunction ubh_setblockfunction ufs_fragacctfunction ufs_data_ptr_to_cpufunction ufs_cpu_to_data_ptrfunction ufs_data_ptr_clearfunction ufs_is_data_ptr_zerofunction ufs_get_seconds
Annotated Snippet
if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT) {
usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value);
break;
}
fallthrough; /* to UFS_ST_SUN */
case UFS_ST_SUN:
usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value);
break;
case UFS_ST_SUNx86:
usb1->fs_u1.fs_sunx86.fs_state = cpu_to_fs32(sb, value);
break;
case UFS_ST_44BSD:
usb3->fs_un2.fs_44.fs_state = cpu_to_fs32(sb, value);
break;
}
}
static inline u32
ufs_get_fs_npsect(struct super_block *sb, struct ufs_super_block_first *usb1,
struct ufs_super_block_third *usb3)
{
if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86)
return fs32_to_cpu(sb, usb3->fs_un2.fs_sunx86.fs_npsect);
else
return fs32_to_cpu(sb, usb1->fs_u1.fs_sun.fs_npsect);
}
static inline u64
ufs_get_fs_qbmask(struct super_block *sb, struct ufs_super_block_third *usb3)
{
__fs64 tmp;
switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
case UFS_ST_SUNOS:
case UFS_ST_SUN:
((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qbmask[0];
((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qbmask[1];
break;
case UFS_ST_SUNx86:
((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sunx86.fs_qbmask[0];
((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sunx86.fs_qbmask[1];
break;
case UFS_ST_44BSD:
((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_44.fs_qbmask[0];
((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_44.fs_qbmask[1];
break;
}
return fs64_to_cpu(sb, tmp);
}
static inline u64
ufs_get_fs_qfmask(struct super_block *sb, struct ufs_super_block_third *usb3)
{
__fs64 tmp;
switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
case UFS_ST_SUNOS:
case UFS_ST_SUN:
((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qfmask[0];
((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qfmask[1];
break;
case UFS_ST_SUNx86:
((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sunx86.fs_qfmask[0];
((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sunx86.fs_qfmask[1];
break;
case UFS_ST_44BSD:
((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_44.fs_qfmask[0];
((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_44.fs_qfmask[1];
break;
}
return fs64_to_cpu(sb, tmp);
}
static inline u16
ufs_get_de_namlen(struct super_block *sb, struct ufs_dir_entry *de)
{
if ((UFS_SB(sb)->s_flags & UFS_DE_MASK) == UFS_DE_OLD)
return fs16_to_cpu(sb, de->d_u.d_namlen);
else
return de->d_u.d_44.d_namlen; /* XXX this seems wrong */
}
static inline void
ufs_set_de_namlen(struct super_block *sb, struct ufs_dir_entry *de, u16 value)
{
if ((UFS_SB(sb)->s_flags & UFS_DE_MASK) == UFS_DE_OLD)
de->d_u.d_namlen = cpu_to_fs16(sb, value);
else
Annotation
- Immediate include surface: `linux/buffer_head.h`, `linux/fs.h`, `swab.h`.
- Detected declarations: `function Copyright`, `function ufs_get_fs_state`, `function ufs_set_fs_state`, `function ufs_get_fs_npsect`, `function ufs_get_fs_qbmask`, `function ufs_get_fs_qfmask`, `function ufs_get_de_namlen`, `function ufs_set_de_namlen`, `function ufs_set_de_type`, `function ufs_get_inode_uid`.
- 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.