include/uapi/linux/phonet.h
Source file repositories/reference/linux-study-clean/include/uapi/linux/phonet.h
File Facts
- System
- Linux kernel
- Corpus path
include/uapi/linux/phonet.h- Extension
.h- Size
- 4640 bytes
- Lines
- 187
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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
linux/types.hlinux/socket.h
Detected Declarations
struct phonethdrstruct phonetmsgstruct sockaddr_pnfunction pn_objectfunction pn_objfunction pn_devfunction pn_portfunction pn_addrfunction pn_sockaddr_set_addrfunction pn_sockaddr_set_portfunction pn_sockaddr_set_objectfunction pn_sockaddr_set_resourcefunction pn_sockaddr_get_addrfunction pn_sockaddr_get_portfunction pn_sockaddr_get_objectfunction pn_sockaddr_get_resource
Annotated Snippet
struct phonethdr {
__u8 pn_rdev;
__u8 pn_sdev;
__u8 pn_res;
__be16 pn_length;
__u8 pn_robj;
__u8 pn_sobj;
} __attribute__((packed));
/* Common Phonet payload header */
struct phonetmsg {
__u8 pn_trans_id; /* transaction ID */
__u8 pn_msg_id; /* message type */
union {
struct {
__u8 pn_submsg_id; /* message subtype */
__u8 pn_data[5];
} base;
struct {
__u16 pn_e_res_id; /* extended resource ID */
__u8 pn_e_submsg_id; /* message subtype */
__u8 pn_e_data[3];
} ext;
} pn_msg_u;
};
#define PN_COMMON_MESSAGE 0xF0
#define PN_COMMGR 0x10
#define PN_PREFIX 0xE0 /* resource for extended messages */
#define pn_submsg_id pn_msg_u.base.pn_submsg_id
#define pn_e_submsg_id pn_msg_u.ext.pn_e_submsg_id
#define pn_e_res_id pn_msg_u.ext.pn_e_res_id
#define pn_data pn_msg_u.base.pn_data
#define pn_e_data pn_msg_u.ext.pn_e_data
/* data for unreachable errors */
#define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP 0x01
#define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP 0x14
#define pn_orig_msg_id pn_data[0]
#define pn_status pn_data[1]
#define pn_e_orig_msg_id pn_e_data[0]
#define pn_e_status pn_e_data[1]
/* Phonet socket address structure */
struct sockaddr_pn {
__kernel_sa_family_t spn_family;
__u8 spn_obj;
__u8 spn_dev;
__u8 spn_resource;
__u8 spn_zero[sizeof(struct sockaddr) - sizeof(__kernel_sa_family_t) - 3];
} __attribute__((packed));
/* Well known address */
#define PN_DEV_PC 0x10
static inline __u16 pn_object(__u8 addr, __u16 port)
{
return (addr << 8) | (port & 0x3ff);
}
static inline __u8 pn_obj(__u16 handle)
{
return handle & 0xff;
}
static inline __u8 pn_dev(__u16 handle)
{
return handle >> 8;
}
static inline __u16 pn_port(__u16 handle)
{
return handle & 0x3ff;
}
static inline __u8 pn_addr(__u16 handle)
{
return (handle >> 8) & 0xfc;
}
static inline void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr)
{
spn->spn_dev &= 0x03;
spn->spn_dev |= addr & 0xfc;
}
static inline void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port)
{
spn->spn_dev &= 0xfc;
spn->spn_dev |= (port >> 8) & 0x03;
spn->spn_obj = port & 0xff;
Annotation
- Immediate include surface: `linux/types.h`, `linux/socket.h`.
- Detected declarations: `struct phonethdr`, `struct phonetmsg`, `struct sockaddr_pn`, `function pn_object`, `function pn_obj`, `function pn_dev`, `function pn_port`, `function pn_addr`, `function pn_sockaddr_set_addr`, `function pn_sockaddr_set_port`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.