include/rdma/ib.h
Source file repositories/reference/linux-study-clean/include/rdma/ib.h
File Facts
- System
- Linux kernel
- Corpus path
include/rdma/ib.h- Extension
.h- Size
- 2117 bytes
- Lines
- 82
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/sched.hlinux/cred.hlinux/uaccess.hlinux/fs.h
Detected Declarations
struct ib_addrstruct sockaddr_ibfunction ib_addr_anyfunction ib_addr_loopbackfunction ib_addr_setfunction ib_addr_cmpfunction write
Annotated Snippet
struct ib_addr {
union {
__u8 uib_addr8[16];
__be16 uib_addr16[8];
__be32 uib_addr32[4];
__be64 uib_addr64[2];
} ib_u;
#define sib_addr8 ib_u.uib_addr8
#define sib_addr16 ib_u.uib_addr16
#define sib_addr32 ib_u.uib_addr32
#define sib_addr64 ib_u.uib_addr64
#define sib_raw ib_u.uib_addr8
#define sib_subnet_prefix ib_u.uib_addr64[0]
#define sib_interface_id ib_u.uib_addr64[1]
};
static inline bool ib_addr_any(const struct ib_addr *a)
{
return ((a->sib_addr64[0] | a->sib_addr64[1]) == 0);
}
static inline bool ib_addr_loopback(const struct ib_addr *a)
{
return ((a->sib_addr32[0] | a->sib_addr32[1] |
a->sib_addr32[2] | (a->sib_addr32[3] ^ htonl(1))) == 0);
}
static inline void ib_addr_set(struct ib_addr *addr,
__be32 w1, __be32 w2, __be32 w3, __be32 w4)
{
addr->sib_addr32[0] = w1;
addr->sib_addr32[1] = w2;
addr->sib_addr32[2] = w3;
addr->sib_addr32[3] = w4;
}
static inline int ib_addr_cmp(const struct ib_addr *a1, const struct ib_addr *a2)
{
return memcmp(a1, a2, sizeof(struct ib_addr));
}
struct sockaddr_ib {
unsigned short int sib_family; /* AF_IB */
__be16 sib_pkey;
__be32 sib_flowinfo;
struct ib_addr sib_addr;
__be64 sib_sid;
__be64 sib_sid_mask;
__u64 sib_scope_id;
};
/*
* The IB interfaces that use write() as bi-directional ioctl() are
* fundamentally unsafe, since there are lots of ways to trigger "write()"
* calls from various contexts with elevated privileges. That includes the
* traditional suid executable error message writes, but also various kernel
* interfaces that can write to file descriptors.
*
* This function provides protection for the legacy API by restricting the
* calling context.
*/
static inline bool ib_safe_file_access(struct file *filp)
{
return filp->f_cred == current_cred();
}
#endif /* _RDMA_IB_H */
Annotation
- Immediate include surface: `linux/types.h`, `linux/sched.h`, `linux/cred.h`, `linux/uaccess.h`, `linux/fs.h`.
- Detected declarations: `struct ib_addr`, `struct sockaddr_ib`, `function ib_addr_any`, `function ib_addr_loopback`, `function ib_addr_set`, `function ib_addr_cmp`, `function write`.
- Atlas domain: Repository Root And Misc / include.
- 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.