net/iucv/af_iucv.c
Source file repositories/reference/linux-study-clean/net/iucv/af_iucv.c
File Facts
- System
- Linux kernel
- Corpus path
net/iucv/af_iucv.c- Extension
.c- Size
- 56646 bytes
- Lines
- 2348
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/filter.hlinux/module.hlinux/netdevice.hlinux/types.hlinux/limits.hlinux/list.hlinux/errno.hlinux/kernel.hlinux/sched/signal.hlinux/slab.hlinux/skbuff.hlinux/init.hlinux/poll.hlinux/security.hlinux/uio.hnet/sock.hasm/machine.hasm/ebcdic.hasm/cpcmd.hlinux/kmod.hnet/iucv/af_iucv.h
Detected Declarations
function high_nmcpyfunction low_nmcpyfunction iucv_msg_lengthfunction iucv_sock_in_statefunction iucv_below_msglimfunction iucv_sock_wake_msglimfunction afiucv_hs_sendfunction iucv_sock_destructfunction iucv_sock_cleanup_listenfunction iucv_sock_linkfunction iucv_sock_unlinkfunction iucv_sock_killfunction iucv_sever_pathfunction iucv_send_ctrlfunction iucv_sock_closefunction iucv_sock_initfunction iucv_accept_enqueuefunction iucv_accept_unlinkfunction list_for_each_entry_safefunction __iucv_auto_namefunction iucv_sock_bindfunction iucv_sock_autobindfunction afiucv_path_connectfunction iucv_sock_connectfunction iucv_sock_listenfunction iucv_sock_acceptfunction iucv_sock_getnamefunction iucv_send_iprmfunction iucv_sock_sendmsgfunction SOCK_SEQPACKETfunction iucv_process_messagefunction iucv_process_message_qfunction list_for_each_entry_safefunction iucv_sock_recvmsgfunction iucv_accept_pollfunction list_for_each_entry_safefunction iucv_sock_pollfunction iucv_sock_shutdownfunction iucv_sock_releasefunction iucv_sock_setsockoptfunction iucv_sock_getsockoptfunction iucv_callback_connreqfunction iucv_callback_connackfunction iucv_callback_rxfunction iucv_callback_txdonefunction iucv_callback_connrejfunction iucv_callback_shutdownfunction afiucv_swap_src_dest
Annotated Snippet
static const struct proto_ops iucv_sock_ops = {
.family = PF_IUCV,
.owner = THIS_MODULE,
.release = iucv_sock_release,
.bind = iucv_sock_bind,
.connect = iucv_sock_connect,
.listen = iucv_sock_listen,
.accept = iucv_sock_accept,
.getname = iucv_sock_getname,
.sendmsg = iucv_sock_sendmsg,
.recvmsg = iucv_sock_recvmsg,
.poll = iucv_sock_poll,
.ioctl = sock_no_ioctl,
.mmap = sock_no_mmap,
.socketpair = sock_no_socketpair,
.shutdown = iucv_sock_shutdown,
.setsockopt = iucv_sock_setsockopt,
.getsockopt_iter = iucv_sock_getsockopt,
};
static int iucv_sock_create(struct net *net, struct socket *sock, int protocol,
int kern)
{
struct sock *sk;
if (protocol && protocol != PF_IUCV)
return -EPROTONOSUPPORT;
sock->state = SS_UNCONNECTED;
switch (sock->type) {
case SOCK_STREAM:
case SOCK_SEQPACKET:
/* currently, proto ops can handle both sk types */
sock->ops = &iucv_sock_ops;
break;
default:
return -ESOCKTNOSUPPORT;
}
sk = iucv_sock_alloc(sock, protocol, GFP_KERNEL, kern);
if (!sk)
return -ENOMEM;
iucv_sock_init(sk, NULL);
return 0;
}
static const struct net_proto_family iucv_sock_family_ops = {
.family = AF_IUCV,
.owner = THIS_MODULE,
.create = iucv_sock_create,
};
static struct packet_type iucv_packet_type = {
.type = cpu_to_be16(ETH_P_AF_IUCV),
.func = afiucv_hs_rcv,
};
static int __init afiucv_init(void)
{
int err;
if (machine_is_vm() && IS_ENABLED(CONFIG_IUCV)) {
cpcmd("QUERY USERID", iucv_userid, sizeof(iucv_userid), &err);
if (unlikely(err)) {
WARN_ON(err);
err = -EPROTONOSUPPORT;
goto out;
}
pr_iucv = &iucv_if;
} else {
memset(&iucv_userid, 0, sizeof(iucv_userid));
pr_iucv = NULL;
}
err = proto_register(&iucv_proto, 0);
if (err)
goto out;
err = sock_register(&iucv_sock_family_ops);
if (err)
goto out_proto;
if (pr_iucv) {
err = pr_iucv->iucv_register(&af_iucv_handler, 0);
if (err)
goto out_sock;
}
Annotation
- Immediate include surface: `linux/filter.h`, `linux/module.h`, `linux/netdevice.h`, `linux/types.h`, `linux/limits.h`, `linux/list.h`, `linux/errno.h`, `linux/kernel.h`.
- Detected declarations: `function high_nmcpy`, `function low_nmcpy`, `function iucv_msg_length`, `function iucv_sock_in_state`, `function iucv_below_msglim`, `function iucv_sock_wake_msglim`, `function afiucv_hs_send`, `function iucv_sock_destruct`, `function iucv_sock_cleanup_listen`, `function iucv_sock_link`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.