diff --git a/repos/dde_linux/include/lxip/lxip.h b/repos/dde_linux/include/lxip/lxip.h deleted file mode 100644 index 18ba93eaff..0000000000 --- a/repos/dde_linux/include/lxip/lxip.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * \brief Lxip: Linux TCP/IP as a library - * \author Christian Helmuth - * \author Sebastian Sumpf - * \date 2013-09-04 - */ - -/* - * Copyright (C) 2012-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _INCLUDE_LXIP_LXIP_H_ -#define _INCLUDE_LXIP_LXIP_H_ - -#include - -namespace Lxip { - - struct Handle - { - void *socket; - bool non_block; - - Handle() : socket(0), non_block(false) { } - }; - - enum Type { TYPE_STREAM, TYPE_DGRAM }; - - typedef Genode::uint8_t uint8_t; - typedef Genode::uint16_t uint16_t; - typedef Genode::uint32_t uint32_t; - typedef signed long ssize_t; - typedef Genode::size_t size_t; - - enum Poll_mask { - POLLIN = 0x1, - POLLOUT = 0x2, - POLLEX = 0x4, - }; - - enum Message_flags { - LINUX_MSG_COMPAT = 0x0, - LINUX_MSG_OOB = 0x1, - LINUX_MSG_PEEK = 0x2, - LINUX_MSG_DONTROUTE = 0x4, - LINUX_MSG_CTRUNC = 0x8, - LINUX_MSG_TRUNC = 0x20, - LINUX_MSG_DONTWAIT = 0x40, - LINUX_MSG_EOR = 0x80, - LINUX_MSG_WAITALL = 0x100, - LINUX_MSG_EOF = 0x200, - LINUX_MSG_NOSIGNAL = 0x4000, - }; - - enum Socket_level { - LINUX_SOL_SOCKET = 1, - }; - - enum Ioctl_cmd { - LINUX_FIONREAD = 0x541b, /* == SIOCINQ */ - LINUX_IFADDR = 0x8915, /* == SIOCGIFADDR */ - }; - - /* - * Must match errno values from lx_emul.h - */ - enum Io_result { - LINUX_EAGAIN = -35, - LINUX_EINPROGRESS = -36, - LINUX_EALREADY = -37, - LINUX_EISCONN = -56, - }; -} - -#endif /* _INCLUDE_LXIP_LXIP_H_ */ diff --git a/repos/dde_linux/lib/import/import-lxip_include.mk b/repos/dde_linux/lib/import/import-lxip_include.mk deleted file mode 100644 index 0dab978eee..0000000000 --- a/repos/dde_linux/lib/import/import-lxip_include.mk +++ /dev/null @@ -1,38 +0,0 @@ -LXIP_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/lxip -SRC_DIR := $(REP_DIR)/src/lib/legacy_lxip - -# architecture-dependent includes -ifeq ($(filter-out $(SPECS),x86),) - ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/x86 - ifeq ($(filter-out $(SPECS),32bit),) - ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/x86_32 - endif # 32bit - ifeq ($(filter-out $(SPECS),64bit),) - ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/x86_64 - endif # 64bit -endif # x86 - -ifeq ($(filter-out $(SPECS),arm),) - ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/arm - ifeq ($(filter-out $(SPECS),arm_v6),) - ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/arm_v6 - endif # arm_v6 - ifeq ($(filter-out $(SPECS),arm_v7),) - ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/arm_v7 - endif # arm_v7 -endif # arm -ifeq ($(filter-out $(SPECS),arm_v8),) - ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/arm_v8 -endif # arm_v8 - -# -# The order of include-search directories is important, we need to look into -# 'contrib' before falling back to our custom 'lx_emul.h' header. -# -INC_DIR += $(SRC_DIR) \ - $(SRC_DIR)/include -INC_DIR += $(REP_DIR)/src/include -INC_DIR += $(ARCH_SRC_INC_DIR) -INC_DIR += $(LXIP_CONTRIB_DIR)/include \ - $(LXIP_CONTRIB_DIR)/include/uapi -INC_DIR += $(LIB_CACHE_DIR)/lxip_include/include/include/include diff --git a/repos/dde_linux/lib/mk/legacy_lxip.mk b/repos/dde_linux/lib/mk/legacy_lxip.mk deleted file mode 100644 index f9aa7cc478..0000000000 --- a/repos/dde_linux/lib/mk/legacy_lxip.mk +++ /dev/null @@ -1,54 +0,0 @@ -SHARED_LIB = yes - -LIB_DIR = $(REP_DIR)/src/lib/legacy_lxip -LIB_INC_DIR = $(LIB_DIR)/include - -LIBS += lxip_include format - -LX_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/lxip -NET_DIR := $(LX_CONTRIB_DIR)/net - -SETUP_SUFFIX = -CC_OPT += -DSETUP_SUFFIX=$(SETUP_SUFFIX) - -CC_OPT += -U__linux__ -D__KERNEL__ -CC_OPT += -DCONFIG_INET -DCONFIG_BASE_SMALL=0 -DCONFIG_DEBUG_LOCK_ALLOC \ - -DCONFIG_IP_PNP_DHCP - -CC_WARN = -Wall -Wno-unused-variable -Wno-uninitialized \ - -Wno-unused-function -Wno-overflow -Wno-pointer-arith \ - -Wno-sign-compare -Wno-builtin-declaration-mismatch - -CC_C_OPT += -std=gnu89 -CC_C_OPT += -Wno-unused-but-set-variable -Wno-pointer-sign - -CC_C_OPT += -include $(LIB_INC_DIR)/lx_emul.h -CC_CXX_OPT += -fpermissive - -SRC_CC = dummies.cc lxcc_emul.cc nic_handler.cc \ - timer_handler.cc random.cc - -SRC_CC += malloc.cc printf.cc bug.cc env.cc - -SRC_C += driver.c dummies_c.c lxc_emul.c - -SRC_C += net/802/p8023.c -SRC_C += $(addprefix net/core/,$(notdir $(wildcard $(NET_DIR)/core/*.c))) -SRC_C += $(addprefix net/ipv4/,$(notdir $(wildcard $(NET_DIR)/ipv4/*.c))) -SRC_C += net/ethernet/eth.c -SRC_C += net/netlink/af_netlink.c -SRC_C += net/sched/sch_generic.c -SRC_C += lib/checksum.c -SRC_C += lib/rhashtable.c -SRC_C += drivers/net/loopback.c - -#SRC_C = net/ipv4/inet_connection_sock.c - -net/ethernet/eth.o: SETUP_SUFFIX="_eth" - -vpath %.c $(LX_CONTRIB_DIR) -vpath %.c $(LIB_DIR) -vpath %.cc $(LIB_DIR) -vpath %.cc $(REP_DIR)/src/lib/legacy/lx_kit - -CC_CXX_WARN_STRICT = diff --git a/repos/dde_linux/lib/mk/lxip_include.mk b/repos/dde_linux/lib/mk/lxip_include.mk deleted file mode 100644 index 29f2810998..0000000000 --- a/repos/dde_linux/lib/mk/lxip_include.mk +++ /dev/null @@ -1,39 +0,0 @@ -ifeq ($(called_from_lib_mk),yes) - -LXIP_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/lxip -LX_EMUL_H := $(REP_DIR)/src/lib/legacy_lxip/include/lx_emul.h - -# -# Determine the header files included by the contrib code. For each -# of these header files we create a symlink to 'lx_emul.h'. -# -SCAN_DIRS := $(addprefix $(LXIP_CONTRIB_DIR)/include/, asm-generic linux net uapi) \ - $(addprefix $(LXIP_CONTRIB_DIR)/, drivers lib net) -GEN_INCLUDES := $(shell grep -rIh "^\#include .*\/" $(SCAN_DIRS) |\ - sed "s/^\#include [^<\"]*[<\"]\([^>\"]*\)[>\"].*/\1/" |\ - sort | uniq) -# -# Filter out original Linux headers that exist in the contrib directory -# -NO_GEN_INCLUDES := $(shell cd $(LXIP_CONTRIB_DIR)/; find include -name "*.h" |\ - sed "s/.\///" | sed "s/.*include\///") -GEN_INCLUDES := $(filter-out $(NO_GEN_INCLUDES),$(GEN_INCLUDES)) - -# -# Put Linux headers in 'GEN_INC' dir, since some include use "../../" paths use -# three level include hierarchy -# -GEN_INC := $(shell pwd)/include/include/include -GEN_INCLUDES := $(addprefix $(GEN_INC)/,$(GEN_INCLUDES)) - -all: $(GEN_INCLUDES) - -$(GEN_INCLUDES): - $(VERBOSE)mkdir -p $(dir $@) - $(VERBOSE)ln -s $(LX_EMUL_H) $@ - -endif - -# vi: set ft=make : - -CC_CXX_WARN_STRICT = diff --git a/repos/dde_linux/lxip.list b/repos/dde_linux/lxip.list deleted file mode 100644 index c283e9fe1f..0000000000 --- a/repos/dde_linux/lxip.list +++ /dev/null @@ -1,154 +0,0 @@ -linux-x.x.x/drivers/net/loopback.c -linux-x.x.x/include/asm-generic/atomic64.h -linux-x.x.x/include/asm-generic/bitops/__ffs.h -linux-x.x.x/include/asm-generic/bitops/__fls.h -linux-x.x.x/include/asm-generic/bitops/ffs.h -linux-x.x.x/include/asm-generic/bitops/fls.h -linux-x.x.x/include/asm-generic/bitops/fls64.h -linux-x.x.x/include/asm-generic/bitops/non-atomic.h -linux-x.x.x/include/linux/errqueue.h -linux-x.x.x/include/linux/etherdevice.h -linux-x.x.x/include/linux/ethtool.h -linux-x.x.x/include/linux/icmp.h -linux-x.x.x/include/linux/if_arp.h -linux-x.x.x/include/linux/if_ether.h -linux-x.x.x/include/linux/if_link.h -linux-x.x.x/include/linux/inetdevice.h -linux-x.x.x/include/linux/jhash.h -linux-x.x.x/include/linux/list.h -linux-x.x.x/include/linux/list_nulls.h -linux-x.x.x/include/linux/log2.h -linux-x.x.x/include/linux/netdev_features.h -linux-x.x.x/include/linux/netdevice.h -linux-x.x.x/include/linux/net.h -linux-x.x.x/include/linux/netlink.h -linux-x.x.x/include/linux/rbtree.h -linux-x.x.x/include/linux/rhashtable.h -linux-x.x.x/include/linux/skbuff.h -linux-x.x.x/include/linux/socket.h -linux-x.x.x/include/linux/swab.h -linux-x.x.x/include/linux/tcp.h -linux-x.x.x/include/linux/udp.h -linux-x.x.x/include/net/arp.h -linux-x.x.x/include/net/datalink.h -linux-x.x.x/include/net/dsfield.h -linux-x.x.x/include/net/dst.h -linux-x.x.x/include/net/dst_metadata.h -linux-x.x.x/include/net/dst_ops.h -linux-x.x.x/include/net/flow.h -linux-x.x.x/include/net/icmp.h -linux-x.x.x/include/net/inet_connection_sock.h -linux-x.x.x/include/net/inet_frag.h -linux-x.x.x/include/net/inet_hashtables.h -linux-x.x.x/include/net/inetpeer.h -linux-x.x.x/include/net/inet_sock.h -linux-x.x.x/include/net/inet_timewait_sock.h -linux-x.x.x/include/net/ipconfig.h -linux-x.x.x/include/net/ip_fib.h -linux-x.x.x/include/net/ip.h -linux-x.x.x/include/net/neighbour.h -linux-x.x.x/include/net/netlink.h -linux-x.x.x/include/net/netns/ipv4.h -linux-x.x.x/include/net/netns/mib.h -linux-x.x.x/include/net/ping.h -linux-x.x.x/include/net/pkt_sched.h -linux-x.x.x/include/net/protocol.h -linux-x.x.x/include/net/raw.h -linux-x.x.x/include/net/request_sock.h -linux-x.x.x/include/net/route.h -linux-x.x.x/include/net/sch_generic.h -linux-x.x.x/include/net/snmp.h -linux-x.x.x/include/net/sock.h -linux-x.x.x/include/net/tcp.h -linux-x.x.x/include/net/tcp_states.h -linux-x.x.x/include/net/timewait_sock.h -linux-x.x.x/include/net/udp.h -linux-x.x.x/include/net/udplite.h -linux-x.x.x/include/uapi/asm-generic/socket.h -linux-x.x.x/include/uapi/linux/byteorder/little_endian.h -linux-x.x.x/include/uapi/linux/errqueue.h -linux-x.x.x/include/uapi/linux/ethtool.h -linux-x.x.x/include/uapi/linux/fib_rules.h -linux-x.x.x/include/uapi/linux/gen_stats.h -linux-x.x.x/include/uapi/linux/icmp.h -linux-x.x.x/include/uapi/linux/if_addr.h -linux-x.x.x/include/uapi/linux/if_arp.h -linux-x.x.x/include/uapi/linux/if_ether.h -linux-x.x.x/include/uapi/linux/if.h -linux-x.x.x/include/uapi/linux/if_link.h -linux-x.x.x/include/uapi/linux/if_packet.h -linux-x.x.x/include/uapi/linux/in6.h -linux-x.x.x/include/uapi/linux/inet_diag.h -linux-x.x.x/include/uapi/linux/in.h -linux-x.x.x/include/uapi/linux/in_route.h -linux-x.x.x/include/uapi/linux/ip.h -linux-x.x.x/include/uapi/linux/neighbour.h -linux-x.x.x/include/uapi/linux/netconf.h -linux-x.x.x/include/uapi/linux/netdevice.h -linux-x.x.x/include/uapi/linux/netfilter.h -linux-x.x.x/include/uapi/linux/net.h -linux-x.x.x/include/uapi/linux/netlink.h -linux-x.x.x/include/uapi/linux/pkt_sched.h -linux-x.x.x/include/uapi/linux/route.h -linux-x.x.x/include/uapi/linux/rtnetlink.h -linux-x.x.x/include/uapi/linux/snmp.h -linux-x.x.x/include/uapi/linux/socket.h -linux-x.x.x/include/uapi/linux/sockios.h -linux-x.x.x/include/uapi/linux/swab.h -linux-x.x.x/include/uapi/linux/tcp.h -linux-x.x.x/include/uapi/linux/udp.h -linux-x.x.x/lib/checksum.c -linux-x.x.x/lib/rbtree.c -linux-x.x.x/lib/rhashtable.c -linux-x.x.x/net/802/p8023.c -linux-x.x.x/net/core/datagram.c -linux-x.x.x/net/core/dev_addr_lists.c -linux-x.x.x/net/core/dev.c -linux-x.x.x/net/core/dst.c -linux-x.x.x/net/core/ethtool.c -linux-x.x.x/net/core/neighbour.c -linux-x.x.x/net/core/net-sysfs.h -linux-x.x.x/net/core/request_sock.c -linux-x.x.x/net/core/skbuff.c -linux-x.x.x/net/core/sock.c -linux-x.x.x/net/core/stream.c -linux-x.x.x/net/core/utils.c -linux-x.x.x/net/ethernet/eth.c -linux-x.x.x/net/ipv4/af_inet.c -linux-x.x.x/net/ipv4/arp.c -linux-x.x.x/net/ipv4/devinet.c -linux-x.x.x/net/ipv4/datagram.c -linux-x.x.x/net/ipv4/fib_frontend.c -linux-x.x.x/net/ipv4/fib_lookup.h -linux-x.x.x/net/ipv4/fib_semantics.c -linux-x.x.x/net/ipv4/fib_trie.c -linux-x.x.x/net/ipv4/icmp.c -linux-x.x.x/net/ipv4/inet_connection_sock.c -linux-x.x.x/net/ipv4/inet_fragment.c -linux-x.x.x/net/ipv4/inet_hashtables.c -linux-x.x.x/net/ipv4/inetpeer.c -linux-x.x.x/net/ipv4/ipconfig.c -linux-x.x.x/net/ipv4/ip_forward.c -linux-x.x.x/net/ipv4/ip_fragment.c -linux-x.x.x/net/ipv4/ip_input.c -linux-x.x.x/net/ipv4/ip_options.c -linux-x.x.x/net/ipv4/ip_output.c -linux-x.x.x/net/ipv4/ip_sockglue.c -linux-x.x.x/net/ipv4/ping.c -linux-x.x.x/net/ipv4/protocol.c -linux-x.x.x/net/ipv4/raw.c -linux-x.x.x/net/ipv4/route.c -linux-x.x.x/net/ipv4/tcp_cong.c -linux-x.x.x/net/ipv4/tcp_cubic.c -linux-x.x.x/net/ipv4/tcp_diag.c -linux-x.x.x/net/ipv4/tcp_input.c -linux-x.x.x/net/ipv4/tcp_ipv4.c -linux-x.x.x/net/ipv4/tcp_minisocks.c -linux-x.x.x/net/ipv4/tcp.c -linux-x.x.x/net/ipv4/tcp_output.c -linux-x.x.x/net/ipv4/tcp_timer.c -linux-x.x.x/net/ipv4/udp_impl.h -linux-x.x.x/net/ipv4/udp.c -linux-x.x.x/net/netlink/af_netlink.c -linux-x.x.x/net/netlink/af_netlink.h -linux-x.x.x/net/sched/sch_generic.c diff --git a/repos/dde_linux/patches/legacy_lxip_icmp.patch b/repos/dde_linux/patches/legacy_lxip_icmp.patch deleted file mode 100644 index 5513b1fc25..0000000000 --- a/repos/dde_linux/patches/legacy_lxip_icmp.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -r a4522abad72d net/ipv4/icmp.c ---- a/net/ipv4/icmp.c Tue Oct 15 12:18:08 2013 +0200 -+++ b/net/ipv4/icmp.c Tue Oct 15 12:18:33 2013 +0200 -@@ -787,7 +787,7 @@ - if (!net->ipv4.sysctl_icmp_echo_ignore_all) { - struct icmp_bxm icmp_param; - -- icmp_param.data.icmph = *icmp_hdr(skb); -+ memcpy(&icmp_param.data.icmph, icmp_hdr(skb), sizeof(struct icmphdr)); - icmp_param.data.icmph.type = ICMP_ECHOREPLY; - icmp_param.skb = skb; - icmp_param.offset = 0; diff --git a/repos/dde_linux/patches/legacy_lxip_ip_config.patch b/repos/dde_linux/patches/legacy_lxip_ip_config.patch deleted file mode 100644 index c4922ab561..0000000000 --- a/repos/dde_linux/patches/legacy_lxip_ip_config.patch +++ /dev/null @@ -1,113 +0,0 @@ -ip_config.patch - -From: Sebastian Sumpf - - ---- - net/ipv4/ipconfig.c | 55 ++++++++++++++++++++++++++++++++++++++++++--------- - 1 file changed, 45 insertions(+), 10 deletions(-) - -diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c -index 0bc7412..a92c6e3 100644 ---- a/net/ipv4/ipconfig.c -+++ b/net/ipv4/ipconfig.c -@@ -133,7 +133,7 @@ int ic_proto_enabled __initdata = 0 - static int ic_host_name_set __initdata; /* Host name set by us? */ - - __be32 ic_myaddr = NONE; /* My IP address */ --static __be32 ic_netmask = NONE; /* Netmask for local subnet */ -+__be32 ic_netmask = NONE; /* Netmask for local subnet */ - __be32 ic_gateway = NONE; /* Gateway IP address */ - - __be32 ic_addrservaddr = NONE; /* IP Address of the IP addresses'server */ -@@ -153,7 +153,7 @@ static char dhcp_client_identifier[253] __initdata; - /* Persistent data: */ - - static int ic_proto_used; /* Protocol used, if any */ --static __be32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */ -+__be32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */ - static u8 ic_domain[64]; /* DNS (not NIS) domain name */ - - /* -@@ -435,6 +435,33 @@ static int __init ic_setup_routes(void) - return 0; - } - -+static int __init ic_delete_routes(void) -+{ -+ /* No need to delete device routes, only the default route... */ -+ -+ if (ic_gateway != NONE) { -+ struct rtentry rm; -+ int err; -+ -+ memset(&rm, 0, sizeof(rm)); -+ if ((ic_gateway ^ ic_myaddr) & ic_netmask) { -+ pr_err("IP-Config: Gateway not on directly connected network\n"); -+ return -1; -+ } -+ set_sockaddr((struct sockaddr_in *) &rm.rt_dst, 0, 0); -+ set_sockaddr((struct sockaddr_in *) &rm.rt_genmask, 0, 0); -+ set_sockaddr((struct sockaddr_in *) &rm.rt_gateway, ic_gateway, 0); -+ rm.rt_flags = RTF_UP | RTF_GATEWAY; -+ if ((err = ic_route_ioctl(SIOCDELRT, &rm)) < 0) { -+ pr_err("IP-Config: Cannot delete default route (%d)\n", -+ err); -+ return -1; -+ } -+ } -+ -+ return 0; -+} -+ - /* - * Fill in default values for all missing parameters. - */ -@@ -1531,24 +1558,24 @@ static int __init ip_auto_config(void) - */ - pr_info("IP-Config: Complete:\n"); - -- pr_info(" device=%s, hwaddr=%*phC, ipaddr=%pI4, mask=%pI4, gw=%pI4\n", -- ic_dev->name, ic_dev->addr_len, ic_dev->dev_addr, -- &ic_myaddr, &ic_netmask, &ic_gateway); -+ pr_info(" device=%s, len=%u hwaddr=" MAC_FMT ", ipaddr=" IP_FMT ", mask=" IP_FMT " , gw=" IP_FMT "\n", -+ ic_dev->name, ic_dev->addr_len, MAC_ARG(ic_dev->dev_addr), -+ IP_ARG(ic_myaddr), IP_ARG(ic_netmask), IP_ARG(ic_gateway)); - pr_info(" host=%s, domain=%s, nis-domain=%s\n", - utsname()->nodename, ic_domain, utsname()->domainname); -- pr_info(" bootserver=%pI4, rootserver=%pI4, rootpath=%s", -- &ic_servaddr, &root_server_addr, root_server_path); -+ pr_info(" bootserver=" IP_FMT ", rootserver=" IP_FMT ", rootpath=%s\n", -+ IP_ARG(ic_servaddr), IP_ARG(root_server_addr), root_server_path); - if (ic_dev_mtu) - pr_cont(", mtu=%d", ic_dev_mtu); - for (i = 0; i < CONF_NAMESERVERS_MAX; i++) - if (ic_nameservers[i] != NONE) { -- pr_info(" nameserver%u=%pI4", -- i, &ic_nameservers[i]); -+ pr_info(" nameserver%u=" IP_FMT, -+ i, IP_ARG(ic_nameservers[i])); - break; - } - for (i++; i < CONF_NAMESERVERS_MAX; i++) - if (ic_nameservers[i] != NONE) -- pr_cont(", nameserver%u=%pI4", i, &ic_nameservers[i]); -+ pr_cont(", nameserver%u=" IP_FMT, i, IP_ARG(ic_nameservers[i])); - pr_cont("\n"); - #endif /* !SILENT */ - -@@ -1621,6 +1648,14 @@ static int __init ip_auto_config_setup(char *addrs) - ic_set_manually = 1; - ic_enable = 1; - -+ ic_delete_routes(); -+ -+ ic_myaddr = NONE; -+ ic_netmask = NONE; -+ ic_gateway = NONE; -+ ic_servaddr = NONE; -+ ic_got_reply = 0; -+ - /* - * If any dhcp, bootp etc options are set, leave autoconfig on - * and skip the below static IP processing. diff --git a/repos/dde_linux/patches/legacy_lxip_log2.patch b/repos/dde_linux/patches/legacy_lxip_log2.patch deleted file mode 100644 index 8a7a05657c..0000000000 --- a/repos/dde_linux/patches/legacy_lxip_log2.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/include/linux/log2.h 2016-02-25 21:01:36.000000000 +0100 -+++ b/include/linux/log2.h 2020-01-03 14:59:54.572400301 +0100 -@@ -18,7 +18,6 @@ - /* - * deal with unrepresentable constant logarithms - */ --extern __attribute__((const, noreturn)) - int ____ilog2_NaN(void); - - /* diff --git a/repos/dde_linux/patches/legacy_lxip_netlink.patch b/repos/dde_linux/patches/legacy_lxip_netlink.patch deleted file mode 100644 index 42b71b1936..0000000000 --- a/repos/dde_linux/patches/legacy_lxip_netlink.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/include/net/netlink.h -+++ b/include/net/netlink.h -@@ -321,7 +321,7 @@ - static inline struct nlattr *nlmsg_attrdata(const struct nlmsghdr *nlh, - int hdrlen) - { -- unsigned char *data = nlmsg_data(nlh); -+ unsigned char *data = (unsigned char *)nlmsg_data(nlh); - return (struct nlattr *) (data + NLMSG_ALIGN(hdrlen)); - } - -@@ -730,7 +730,7 @@ - static inline struct nlattr * - nla_find_nested(const struct nlattr *nla, int attrtype) - { -- return nla_find(nla_data(nla), nla_len(nla), attrtype); -+ return nla_find((const struct nlattr *)nla_data(nla), nla_len(nla), attrtype); - } - - /** -@@ -746,7 +746,7 @@ - const struct nlattr *nla, - const struct nla_policy *policy) - { -- return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); -+ return nla_parse(tb, maxtype, (const struct nlattr *)nla_data(nla), nla_len(nla), policy); - } - - /** -@@ -1174,7 +1174,7 @@ - static inline int nla_validate_nested(const struct nlattr *start, int maxtype, - const struct nla_policy *policy) - { -- return nla_validate(nla_data(start), nla_len(start), maxtype, policy); -+ return nla_validate((const struct nlattr *)nla_data(start), nla_len(start), maxtype, policy); - } - - /** diff --git a/repos/dde_linux/patches/legacy_lxip_request_sock.patch b/repos/dde_linux/patches/legacy_lxip_request_sock.patch deleted file mode 100644 index 2f35391f85..0000000000 --- a/repos/dde_linux/patches/legacy_lxip_request_sock.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/include/net/request_sock.h b/include/net/request_sock.h -index a0dde04..dccc51f 100644 ---- a/include/net/request_sock.h -+++ b/include/net/request_sock.h -@@ -109,7 +109,7 @@ reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener, - static inline void reqsk_free(struct request_sock *req) - { - /* temporary debugging */ -- WARN_ON_ONCE(atomic_read(&req->rsk_refcnt) != 0); -+ // WARN_ON_ONCE(atomic_read(&req->rsk_refcnt) != 0); - - req->rsk_ops->destructor(req); - if (req->rsk_listener) -@@ -120,7 +120,8 @@ static inline void reqsk_free(struct request_sock *req) - - static inline void reqsk_put(struct request_sock *req) - { -- if (atomic_dec_and_test(&req->rsk_refcnt)) -+ if (atomic_dec_and_test(&req->rsk_refcnt) -+ || req->rsk_refcnt.counter == 1) - reqsk_free(req); - } - diff --git a/repos/dde_linux/patches/legacy_lxip_sk_wq.patch b/repos/dde_linux/patches/legacy_lxip_sk_wq.patch deleted file mode 100644 index 0aab10be49..0000000000 --- a/repos/dde_linux/patches/legacy_lxip_sk_wq.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c -index 5c5db66..6cb68a1 100644 ---- a/net/ipv4/af_inet.c -+++ b/net/ipv4/af_inet.c -@@ -733,6 +733,8 @@ - inet_autobind(sk)) - return -EAGAIN; - -+ if (sk->sk_wq == 0) sk->sk_wq = sock->wq; -+ - return sk->sk_prot->sendmsg(sk, msg, size); - } - EXPORT_SYMBOL(inet_sendmsg); -@@ -764,6 +766,8 @@ - - sock_rps_record_flow(sk); - -+ if (sk->sk_wq == 0) sk->sk_wq = sock->wq; -+ - err = sk->sk_prot->recvmsg(sk, msg, size, flags & MSG_DONTWAIT, - flags & ~MSG_DONTWAIT, &addr_len); - if (err >= 0) diff --git a/repos/dde_linux/patches/legacy_lxip_skbuff_cast.patch b/repos/dde_linux/patches/legacy_lxip_skbuff_cast.patch deleted file mode 100644 index 5e63596db9..0000000000 --- a/repos/dde_linux/patches/legacy_lxip_skbuff_cast.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h -index 9147f9f..c63ee5c 100644 ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -3281,7 +3281,7 @@ static inline void skb_remcsum_process(struct sk_buff *skb, void *ptr, - - if (unlikely(skb->ip_summed != CHECKSUM_COMPLETE)) { - __skb_checksum_complete(skb); -- skb_postpull_rcsum(skb, skb->data, ptr - (void *)skb->data); -+ skb_postpull_rcsum(skb, skb->data, (unsigned char*)ptr - skb->data); - } - - delta = remcsum_adjust(ptr, skb->csum, start, offset); diff --git a/repos/dde_linux/ports/dde_linux.hash b/repos/dde_linux/ports/dde_linux.hash deleted file mode 100644 index e1b9c61442..0000000000 --- a/repos/dde_linux/ports/dde_linux.hash +++ /dev/null @@ -1 +0,0 @@ -489d34e0dfdb6dd5cc3c26d1bf69f9b0f06f0a29 diff --git a/repos/dde_linux/ports/dde_linux.port b/repos/dde_linux/ports/dde_linux.port deleted file mode 100644 index 2a9acccad2..0000000000 --- a/repos/dde_linux/ports/dde_linux.port +++ /dev/null @@ -1,37 +0,0 @@ -LICENSE := GPLv2 -VERSION := individual (see sources) -DOWNLOADS := lxip.archive - -# -# IP stack sources -# -SRC_DIR_LXIP := src/lib/lxip -VERSION(lxip) := 4.4.3 -URL(lxip) := https://www.kernel.org/pub/linux/kernel/v4.x/linux-${VERSION(lxip)}.tar.xz -SHA(lxip) := 0b379cb19bbd7e38fc5a9a000ea927db55cce519a7400ec7fa705c581a6491dd -DIR(lxip) := $(SRC_DIR_LXIP) -TAR_OPT(lxip) := --strip-components=1 --files-from - < <(sed 's/-x.x.x/-${VERSION(lxip)}/g' $(REP_DIR)/lxip.list) -HASH_INPUT += $(REP_DIR)/lxip.list - -# -# Patches -# -PATCHES += patches/legacy_lxip_icmp.patch -PATCHES += patches/legacy_lxip_ip_config.patch -PATCHES += patches/legacy_lxip_log2.patch -PATCHES += patches/legacy_lxip_netlink.patch -PATCHES += patches/legacy_lxip_request_sock.patch -PATCHES += patches/legacy_lxip_sk_wq.patch -PATCHES += patches/legacy_lxip_skbuff_cast.patch - -#IP stack -LXIP_OPT = -p1 -d$(SRC_DIR_LXIP) -PATCH_OPT(patches/legacy_lxip_icmp.patch) := $(LXIP_OPT) -PATCH_OPT(patches/legacy_lxip_ip_config.patch) := $(LXIP_OPT) -PATCH_OPT(patches/legacy_lxip_log2.patch) := $(LXIP_OPT) -PATCH_OPT(patches/legacy_lxip_netlink.patch) := $(LXIP_OPT) -PATCH_OPT(patches/legacy_lxip_request_sock.patch) := $(LXIP_OPT) -PATCH_OPT(patches/legacy_lxip_sk_wq.patch) := $(LXIP_OPT) -PATCH_OPT(patches/legacy_lxip_skbuff_cast.patch) := $(LXIP_OPT) - -# vi: set ft=make : diff --git a/repos/dde_linux/src/lib/legacy_lxip/driver.c b/repos/dde_linux/src/lib/legacy_lxip/driver.c deleted file mode 100644 index 8e9c3cb1d8..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/driver.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * \brief Back-end driver for IP stack - * \author Sebastian Sumpf - * \author Stefan Kalkowski - * \date 2013-09-04 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Linux includes */ -#include -#include - -/* local includes */ -#include -#include - - -static struct net_device *_dev; - - -static int driver_net_open(struct net_device *dev) -{ - _dev = dev; - return 0; -} - - -static int driver_net_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct net_device_stats *stats = (struct net_device_stats*) netdev_priv(dev); - int len = skb->len; - void* addr = skb->data; - - /* transmit to nic-session */ - if (net_tx(addr, len)) { - /* tx queue is full, could not enqueue packet */ - pr_debug("TX packet dropped\n"); - return NETDEV_TX_BUSY; - } - - dev_kfree_skb(skb); - - /* save timestamp */ - dev->trans_start = jiffies; - - stats->tx_packets++; - stats->tx_bytes += len; - - return NETDEV_TX_OK; -} - - -static int driver_change_mtu(struct net_device *dev, int new_mtu) -{ - /* possible point to reflect successful MTU setting */ - return eth_change_mtu(dev, new_mtu); -} - - -static const struct net_device_ops driver_net_ops = -{ - .ndo_open = driver_net_open, - .ndo_start_xmit = driver_net_xmit, - .ndo_change_mtu = driver_change_mtu, -}; - - -static int driver_init(void) -{ - struct net_device *dev; - int err = -ENODEV; - - dev = alloc_etherdev(0); - - if (!(dev = alloc_etherdev(0))) - goto out; - - dev->netdev_ops = &driver_net_ops; - - /* set MAC */ - net_mac(dev->dev_addr, ETH_ALEN); - - if ((err = register_netdev(dev))) { - panic("driver: Could not register back-end %d\n", err); - goto out_free; - } - - return 0; - -out_free: - free_netdev(dev); -out: - return err; -} - - -module_init(driver_init); - - -/** - * Called by Nic_client when a packet was received - */ -void net_driver_rx(void *addr, unsigned long size) -{ - struct net_device_stats *stats; - - if (!_dev) - return; - - stats = (struct net_device_stats*) netdev_priv(_dev); - - /* allocate skb */ - enum { - ADDITIONAL_HEADROOM = 4, /* smallest value found by trial & error */ - }; - struct sk_buff *skb = netdev_alloc_skb_ip_align(_dev, size + ADDITIONAL_HEADROOM); - if (!skb) { - printk(KERN_NOTICE "genode_net_rx: low on mem - packet dropped!\n"); - stats->rx_dropped++; - return; - } - - /* copy packet */ - memcpy(skb_put(skb, size), addr, size); - - skb->dev = _dev; - skb->protocol = eth_type_trans(skb, _dev); - skb->ip_summed = CHECKSUM_NONE; - - netif_receive_skb(skb); - - stats->rx_packets++; - stats->rx_bytes += size; -} diff --git a/repos/dde_linux/src/lib/legacy_lxip/dummies.cc b/repos/dde_linux/src/lib/legacy_lxip/dummies.cc deleted file mode 100644 index ae1230975c..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/dummies.cc +++ /dev/null @@ -1,664 +0,0 @@ -/* - * \brief Dummy functions - * \author Sebastian Sumpf - * \date 2013-08-26 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include - - -extern "C" { - typedef long DUMMY; - -enum { - SHOW_DUMMY = 0, - SHOW_SKIP = 0, - SHOW_RET = 0, - SHOW_SHOW = 1, -}; - -#define DUMMY(retval, name) \ - DUMMY name(void) { \ - if (SHOW_DUMMY) \ - Genode::log(__func__, ": " #name " called " \ - "(from ", __builtin_return_address(0), ") " \ - "not implemented"); \ - return retval; \ - } - -#define DUMMY_SKIP(retval, name) \ - DUMMY name(void) { \ - if (SHOW_SKIP) \ - Genode::log(__func__, ": " #name " called " \ - "(from ", __builtin_return_address(0), ") " \ - "skipped"); \ - return retval; \ - } - -#define DUMMY_RET(retval, name) \ - DUMMY name(void) { \ - if (SHOW_RET) \ - Genode::log(__func__, ": " #name " called " \ - "(from ", __builtin_return_address(0), ") " \ - "return ", retval); \ - return retval; \ - } - -#define DUMMY_SHOW(retval, name) \ - DUMMY name(void) { \ - if (SHOW_SHOW) \ - Genode::log(__func__, ": " #name " called " \ - "(from ", __builtin_return_address(0), ") " \ - "return ", retval); \ - return retval; \ - } - -#define DUMMY_STOP(retval, name) \ - DUMMY name(void) { \ - do { \ - Genode::warning(__func__, ": " #name " called " \ - "(from ", __builtin_return_address(0), ") " \ - "stopped"); \ - Genode::sleep_forever(); \ - } while (0); \ - return retval; \ - } - - -/* - * Changed return values - */ -DUMMY_RET(0, in_irq) -DUMMY_RET(0, inet_twsk_alloc) -DUMMY_RET(0, ipv6_only_sock) -DUMMY_RET(0, netpoll_receive_skb) -DUMMY_RET(0, netpoll_rx_disable) -DUMMY_RET(1, nf_hook) -DUMMY_RET(0, notifier_to_errno) -DUMMY_RET(0, net_hash_mix) -DUMMY_RET(0, netdev_kobject_init) -DUMMY_RET(0, netdev_register_kobject) -DUMMY_RET(0, netpoll_rx) -DUMMY_RET(0, nla_put) -DUMMY_RET(1, ns_capable) -DUMMY_RET(1, num_possible_cpus) -DUMMY_RET(0, read_seqretry) -DUMMY_RET(0, secpath_exists) -DUMMY_RET(0, security_inet_conn_request) -DUMMY_RET(0, security_sk_alloc) -DUMMY_RET(0, signal_pending) -DUMMY_RET(0, sk_filter) -DUMMY_RET(0, sock_tx_timestamp) -DUMMY_RET(0, sscanf) -DUMMY_RET(0, static_key_false) -DUMMY_RET(0, vlan_tx_nonzero_tag_present) -DUMMY_RET(0, vlan_tx_tag_present) -DUMMY_RET(1, xfrm4_policy_check) -DUMMY_RET(0, xfrm_sk_clone_policy) -DUMMY_RET(0, xfrm_decode_session_reverse) -DUMMY_RET(1, try_module_get) /* important in sk_prot_alloc() */ - - -/* - * Unnecessary to trace - */ -DUMMY_SKIP( 0, ASSERT_RTNL) -DUMMY_SKIP(-1, debug_check_no_locks_freed) -DUMMY_SKIP(-1, local_bh_disable) -DUMMY_SKIP(-1, local_bh_enable) -DUMMY_SKIP(-1, local_irq_disable) -DUMMY_SKIP(-1, local_irq_enable) -DUMMY_SKIP(-1, local_irq_restore) -DUMMY_SKIP(-1, local_irq_save) -DUMMY_SKIP(-1, lockdep_init_map) -DUMMY_SKIP(-1, lockdep_set_class_and_name) -DUMMY_SKIP(-1, kmemcheck_annotate_variable) -DUMMY_SKIP(-1, might_sleep) -DUMMY_SKIP(-1, mutex_acquire) -DUMMY_SKIP(-1, mutex_init) -DUMMY_SKIP(-1, mutex_release) -DUMMY_SKIP(-1, mutex_unlock) -DUMMY_SKIP(-1, prefetchw) -DUMMY_SKIP(-1, mutex_lock) -DUMMY_SKIP(-1, rcu_read_lock) -DUMMY_SKIP(-1, rcu_read_unlock) -DUMMY_SKIP(-1, rcu_read_lock_bh) -DUMMY_SKIP(-1, rcu_read_unlock_bh) -DUMMY_SKIP(-1, read_lock) -DUMMY_SKIP(-1, read_seqbegin) -DUMMY_SKIP(-1, read_unlock) -DUMMY_SKIP(-1, read_lock_bh) -DUMMY_SKIP(-1, read_unlock_bh) -DUMMY_SKIP(-1, rwlock_init) -DUMMY_SKIP(-1, seqlock_init) -DUMMY_SKIP(-1, smp_mb) -DUMMY_SKIP(-1, smp_rmb) -DUMMY_SKIP(-1, smp_wmb) -DUMMY_SKIP(-1, spin_lock_irqsave) -DUMMY_RET( 1, spin_trylock) -DUMMY_SKIP(-1, spin_unlock_irqrestore) -DUMMY_SKIP(-1, synchronize_rcu) -DUMMY_SKIP(-1, trace_kfree_skb) -DUMMY_SKIP(-1, trace_consume_skb) -DUMMY_SKIP(-1, trace_net_dev_xmit) -DUMMY_SKIP(-1, trace_netif_receive_skb) -DUMMY_SKIP(-1, write_lock) -DUMMY_SKIP(-1, write_lock_bh) -DUMMY_SKIP(-1, write_lock_irq) -DUMMY_SKIP(-1, write_seqlock) -DUMMY_SKIP(-1, write_seqlock_bh) -DUMMY_SKIP(-1, write_sequnlock) -DUMMY_SKIP(-1, write_sequnlock_bh) -DUMMY_SKIP(-1, write_unlock) -DUMMY_SKIP(-1, write_unlock_bh) -DUMMY_SKIP(-1, write_unlock_irq) - -/* requires CONFIG_MEMCG_KMEM */ -DUMMY_SKIP(-1, sock_release_memcg) - -DUMMY_SKIP(-1, waitqueue_active) -DUMMY_SKIP(-1, wake_up) - -/* - * Test - */ -DUMMY_SKIP(-1, rtmsg_ifinfo) -DUMMY_RET(0, rtnl_is_locked) -DUMMY_SKIP(-1, rtnl_lock) -DUMMY(-1, rtnl_set_sk_err) -DUMMY_SKIP(-1, rtnl_unlock) -DUMMY_RET(0, rtnetlink_put_metrics) -DUMMY(-1, rtnl_af_register) -DUMMY(-1, rtnl_put_cacheinfo) -DUMMY_SKIP(-1, rtnl_register) -DUMMY(-1, rtnl_unicast) - - - -/* - * Dummies - */ -DUMMY(-1, access_ok) -DUMMY(-1, add_device_randomness) -DUMMY(-1, addrconf_finite_timeout) -DUMMY(-1, addrconf_timeout_fixup) -DUMMY(-1, add_wait_queue) -DUMMY(-1, add_wait_queue_exclusive) -DUMMY(-1, atomic_notifier_call_chain) -DUMMY(-1, atomic_notifier_chain_register) -DUMMY(-1, atomic_notifier_chain_unregister) -DUMMY(-1, audit_enabled) -DUMMY(-1, audit_get_loginuid) -DUMMY(-1, audit_get_sessionid) -DUMMY(-1, audit_log) -DUMMY(-1, autoremove_wake_function) -DUMMY(-1, blocking_notifier_chain_unregister) -DUMMY(-1, call_netevent_notifiers) -DUMMY(-1, cancel_delayed_work) -DUMMY(-1, cancel_delayed_work_sync) -DUMMY(-1, capable) -DUMMY(-1, cipso_v4_validate) -DUMMY(-1, __clear_bit) -DUMMY(-1, clear_bit) -DUMMY(-1, cond_resched) -DUMMY(-1, cond_resched_softirq) -DUMMY(-1, __copy_from_user_nocache) -DUMMY(-1, csum_block_sub) -DUMMY(-1, csum_replace2) -DUMMY(-1, csum_sub) -DUMMY(-1, csum_unfold) -DUMMY(-1, current) -DUMMY(-1, current_egid) -DUMMY(-1, current_text_addr) -DUMMY(-1, del_timer_sync) -DUMMY(-1, dev_driver_string) -DUMMY(-1, device_rename) -DUMMY(-1, dev_ioctl) -DUMMY(-1, dev_is_pci) -DUMMY(-1, dev_load) -DUMMY(-1, dev_name) -DUMMY(-1, dev_num_vf) -DUMMY(-1, dev_printk_emit) -DUMMY(-1, div64_u64) -DUMMY(-1, div_u64) -DUMMY(-1, do_softirq) -DUMMY(-1, dump_stack) -DUMMY(-1, ether_addr_equal_64bits) -DUMMY(-1, exit_fn) -DUMMY(-1, file_inode) -DUMMY(-1, free_pages) -DUMMY(-1, from_kgid) -DUMMY(-1, from_kgid_munged) -DUMMY(-1, from_kuid) -DUMMY(-1, from_kuid_munged) -DUMMY(-1, generic_pipe_buf_confirm) -DUMMY(-1, generic_pipe_buf_map) -DUMMY(-1, generic_pipe_buf_unmap) -DUMMY(-1, gen_kill_estimator) -DUMMY(-1, get_current_groups) -DUMMY(-1, get_ds) -DUMMY(-1, __get_free_pages) - -DUMMY_SKIP(0, get_fs) -DUMMY_SKIP(0, set_fs) - -DUMMY(-1, get_net_ns_by_fd) -DUMMY(-1, get_net_ns_by_pid) -DUMMY(-1, getnstimeofday) -DUMMY(-1, get_nulls_value) -DUMMY(-1, get_options) -DUMMY(-1, get_page) -DUMMY(-1, gfp_pfmemalloc_allowed) -DUMMY(-1, gid_lte) -DUMMY(-1, hash32_ptr) -DUMMY(-1, hex_to_bin) -DUMMY(-1, hlist_add_after_rcu) -DUMMY(-1, hlist_add_before_rcu) -DUMMY(-1, hlist_nulls_del) -DUMMY(-1, hlist_nulls_empty) -DUMMY(-1, hotcpu_notifier) -DUMMY_STOP(0, hweight64) -DUMMY(-1, inet_ctl_sock_destroy) -DUMMY(-1, inet_diag_dump_icsk) -DUMMY(-1, inet_diag_dump_one_icsk) -DUMMY(-1, inet_diag_register) -DUMMY(-1, inet_diag_unregister) -DUMMY(-1, INET_ECN_dontxmit) -DUMMY(-1, INET_ECN_is_not_ect) -DUMMY(-1, INET_ECN_xmit) -DUMMY(-1, inet_twdr_hangman) -DUMMY(-1, inet_twdr_twcal_tick) -DUMMY(-1, inet_twdr_twkill_work) -DUMMY(-1, inet_twsk_bind_unhash) -DUMMY(-1, inet_twsk_deschedule) -DUMMY(-1, __inet_twsk_hashdance) -DUMMY(-1, inet_twsk_purge) -DUMMY(-1, inet_twsk_put) -DUMMY(-1, inet_twsk_schedule) -DUMMY(-1, inet_twsk_unhash) -DUMMY(-1, inet_v6_ipv6only) -DUMMY(-1, INIT_DEFERRABLE_WORK) -DUMMY(-1, INIT_HLIST_NULLS_HEAD) -DUMMY(-1, init_user_ns) -DUMMY(-1, init_waitqueue_head) -DUMMY(-1, INIT_WORK) -DUMMY(-1, in_softirq) -DUMMY(-1, ip_check_mc_rcu) -DUMMY(-1, ip_mc_destroy_dev) -DUMMY(-1, ip_mc_down) -DUMMY(-1, ip_mc_drop_socket) -DUMMY(-1, ip_mc_init_dev) -DUMMY(-1, ip_mc_join_group) -DUMMY(-1, ip_mc_leave_group) -DUMMY(-1, ip_mc_msfilter) -DUMMY(-1, ip_mc_remap) -DUMMY(-1, ip_mc_sf_allow) -DUMMY(-1, ip_mc_source) -DUMMY(-1, ip_mc_unmap) -DUMMY(-1, ip_mc_up) -DUMMY(-1, ip_mroute_getsockopt) -DUMMY(-1, ip_mroute_opt) -DUMMY(-1, ip_mroute_setsockopt) -DUMMY(-1, ipv4_is_local_multicast) -DUMMY(-1, irqs_disabled) -DUMMY(-1, is_vlan_dev) -DUMMY(-1, kernel_sendmsg) -DUMMY(-1, kobject_put) -DUMMY(-1, kobject_uevent) -DUMMY(-1, krealloc) -DUMMY(-1, kstrdup) -DUMMY(-1, ktime_equal) -DUMMY(-1, ktime_to_timespec) -DUMMY(-1, ktime_to_timeval) -DUMMY(-1, ktime_us_delta) -DUMMY(-1, kunmap) -DUMMY(-1, kunmap_atomic) -DUMMY(-1, linkwatch_fire_event) -DUMMY(-1, linkwatch_forget_dev) -DUMMY(-1, linkwatch_init_dev) -DUMMY(-1, linkwatch_run_queue) -DUMMY(-1, local_softirq_pending) -DUMMY(-1, lockdep_rtnl_is_held) -DUMMY(-1, module_put) -DUMMY(-1, move_addr_to_kernel) -DUMMY(-1, mq_qdisc_ops) -DUMMY(-1, msleep) -DUMMY(-1, mutex_is_locked) -DUMMY(-1, need_resched) -DUMMY(-1, netdev_queue_update_kobjects) -DUMMY(-1, netdev_unregister_kobject) -DUMMY(-1, net_dmaengine_get) -DUMMY(-1, net_dmaengine_put) -DUMMY(-1, net_eq) -DUMMY(-1, net_namespace_list) -DUMMY(-1, netpoll_poll_lock) -DUMMY(-1, netpoll_poll_unlock) -DUMMY(-1, netpoll_rx_enable) -DUMMY(-1, netpoll_rx_on) -DUMMY(-1, next_pseudo_random32) -DUMMY(-1, nf_bridge_pad) -DUMMY(-1, nf_ct_attach) -DUMMY(-1, nla_find) -DUMMY(-1, nla_memcpy) -DUMMY(-1, nla_parse) -DUMMY(-1, nla_reserve) -DUMMY(-1, nla_strcmp) -DUMMY(-1, nla_strlcpy) -DUMMY(-1, nla_validate) -DUMMY(-1, notifier_from_errno) -DUMMY(-1, num_online_cpus) -DUMMY(-1, on_each_cpu) -DUMMY(-1, open_softirq) -DUMMY(-1, PageHighMem) -DUMMY(-1, percpu_counter_destroy) -DUMMY(-1, percpu_counter_sum_positive) -DUMMY(-1, pid_vnr) -DUMMY(-1, pr_crit) -DUMMY(-1, pr_err_once) -DUMMY(-1, preempt_disable) -DUMMY(-1, preempt_enable) -DUMMY(-1, prefetch) -DUMMY(-1, pr_emerg) - -DUMMY_SKIP(0, finish_wait) -DUMMY_SKIP(0, prepare_to_wait) -DUMMY_SKIP(0, prepare_to_wait_exclusive) - -DUMMY(-1, pr_err) -DUMMY(-1, pr_info) -DUMMY(-1, pr_info_once) -DUMMY(-1, pr_warn) -DUMMY(-1, put_cmsg) -DUMMY(-1, put_cpu) -DUMMY(-1, put_cpu_var) -DUMMY(-1, put_cred) -DUMMY(-1, put_device) -DUMMY(-1, put_pid) -DUMMY(-1, __raise_softirq_irqoff) -DUMMY(-1, raise_softirq_irqoff) -DUMMY(-1, random32) -DUMMY(-1, ___ratelimit) -DUMMY(-1, raw_notifier_chain_unregister) -DUMMY(-1, rcu_barrier) -DUMMY(-1, register_gifconf) -DUMMY(-1, release_net) -DUMMY(-1, remove_proc_entry) -DUMMY(-1, remove_wait_queue) -DUMMY(-1, request_module) -DUMMY(-1, rt_genid_bump) -DUMMY(-1, rtnetlink_init) -DUMMY(-1, __rtnl_unlock) -DUMMY_STOP(-1, schedule) -DUMMY_STOP(-1, schedule_timeout_interruptible) -DUMMY_STOP(-1, schedule_work) -DUMMY(-1, scm_destroy) -DUMMY(-1, scm_recv) -DUMMY(-1, scm_send) -DUMMY(-1, scnprintf) -DUMMY(-1, secpath_reset) -DUMMY(-1, secure_ip_id) -DUMMY(-1, secure_ipv4_port_ephemeral) -DUMMY(-1, secure_ipv6_id) -DUMMY(-1, secure_tcp_sequence_number) -DUMMY(-1, security_inet_conn_established) -DUMMY(-1, security_inet_csk_clone) -DUMMY(-1, security_netlink_send) -DUMMY(-1, security_release_secctx) -DUMMY(-1, security_req_classify_flow) -DUMMY(-1, security_skb_classify_flow) -DUMMY(-1, security_skb_owned_by) -DUMMY(-1, security_sk_classify_flow) -DUMMY(-1, security_sk_free) -DUMMY(-1, security_socket_getpeersec_dgram) -DUMMY(-1, security_socket_getpeersec_stream) -DUMMY(-1, security_sock_graft) -DUMMY(-1, send_sigurg) -DUMMY(-1, send_sig) -DUMMY_STOP(-1, set_bit) -DUMMY(-1, __set_current_state) -DUMMY(-1, set_current_state) -DUMMY_STOP(-1, sg_mark_end) -DUMMY_STOP(-1, sg_set_buf) -DUMMY_STOP(-1, sg_set_page) -DUMMY(-1, sha_transform) -DUMMY(-1, si_meminfo) -DUMMY(-1, S_ISSOCK) -DUMMY(-1, sk_attach_filter) -DUMMY(-1, sk_detach_filter) -DUMMY(-1, sk_filter_len) -DUMMY(-1, sk_filter_release_rcu) -DUMMY(-1, sk_get_filter) -DUMMY(-1, smp_mb__after_clear_bit) -DUMMY(-1, smp_mb__before_atomic_dec) -DUMMY(-1, __sock_recv_timestamp) -DUMMY(-1, __sock_recv_ts_and_drops) -DUMMY(-1, __sock_recv_wifi_status) -DUMMY(-1, sock_release) -DUMMY(-1, sock_update_classid) -DUMMY(-1, sock_update_memcg) -DUMMY(-1, sock_update_netprioidx) -DUMMY(-1, sock_wake_async) -DUMMY(-1, splice_to_pipe) -DUMMY(-1, srandom32) -DUMMY(-1, ssleep) -DUMMY(-1, static_key_enabled) -DUMMY(-1, static_key_slow_dec) -DUMMY(-1, static_key_slow_inc) -DUMMY(-1, strcat) -DUMMY(-1, strsep) -DUMMY(-1, strncpy_from_user) -DUMMY(-1, synchronize_rcu_expedited) -DUMMY(-1, sysctl_igmp_max_msf) -DUMMY(-1, sysctl_tcp_fastopen) -DUMMY(-1, system_wq) -DUMMY(-1, tasklet_init) -DUMMY(-1, tasklet_schedule) -DUMMY(-1, task_pid_nr) -DUMMY(-1, task_tgid_vnr) -DUMMY(-1, tcp_fastopen_cache_get) -DUMMY(-1, tcp_fastopen_cache_set) -DUMMY(-1, tcp_fastopen_cookie_gen) -DUMMY(-1, tcp_fetch_timewait_stamp) -DUMMY(-1, tcp_hdrlen) -DUMMY(-1, tcp_init_metrics) -DUMMY(-1, tcp_metrics_init) -DUMMY(-1, tcp_peer_is_proven) -DUMMY(-1, tcp_remember_stamp) -DUMMY(-1, tcp_tw_remember_stamp) -DUMMY(-1, tcp_update_metrics) -DUMMY(-1, textsearch_find) -DUMMY(-1, __this_cpu_read) -DUMMY_SKIP(-1, trace_napi_poll) -DUMMY_SKIP(-1, trace_net_dev_queue) -DUMMY_SKIP(-1, trace_netif_rx) -DUMMY_SKIP(-1, trace_skb_copy_datagram_iovec) -DUMMY_SKIP(-1, trace_sock_exceed_buf_limit) -DUMMY_SKIP(-1, trace_sock_rcvqueue_full) -DUMMY_SKIP(-1, trace_udp_fail_queue_rcv_skb) -DUMMY(-1, tsk_restore_flags) -DUMMY(-1, u64_stats_fetch_begin_bh) -DUMMY(-1, u64_stats_fetch_retry_bh) -DUMMY(-1, u64_stats_update_begin) -DUMMY(-1, u64_stats_update_end) -DUMMY(-1, udplite4_register) -DUMMY(-1, uid_eq) -DUMMY(-1, virt_to_page) -DUMMY(-1, vlan_do_receive) -DUMMY(-1, __vlan_put_tag) -DUMMY(-1, vlan_untag) -DUMMY(-1, vzalloc) -DUMMY(-1, wake_up_interruptible) -DUMMY(-1, wake_up_interruptible_all) -DUMMY(-1, wake_up_interruptible_poll) -DUMMY(-1, wake_up_interruptible_sync_poll) -DUMMY(-1, WARN_ONCE) -DUMMY(-1, write_seqcount_begin) -DUMMY(-1, write_seqcount_end) -DUMMY(-1, xfrm4_policy_check_reverse) -DUMMY(-1, xfrm4_route_forward) -DUMMY(-1, xfrm4_udp_encap_rcv) -DUMMY(-1, xfrm_sk_free_policy) -DUMMY(-1, xfrm_user_policy) -DUMMY(-1, yield) - -DUMMY(0, __inet_twsk_schedule) -// DUMMY_RET(0xdeadbeef, __netlink_kernel_create) /* needs to be != 0, otherwise FIB will nag */ -// DUMMY(0, __nlmsg_put) -DUMMY(0, __skb_flow_dissect) -DUMMY(0, __skb_get_hash) -DUMMY(0, __skb_get_poff) -DUMMY(0, __sock_tx_timestamp) -DUMMY(0, __this_cpu_write) -DUMMY(0, __vlan_get_protocol) -DUMMY(0, __vlan_hwaccel_push_inside) -DUMMY(0, __vlan_hwaccel_put_tag) -DUMMY(0, __vlan_insert_tag) -DUMMY(0, bpf_tell_extensions) -DUMMY_STOP(0, cancel_work_sync) -DUMMY_STOP(0, copy_from_iter_nocache) -// DUMMY(0, core_netlink_proto_init) -// DUMMY(0, csum_and_copy_from_iter) -// DUMMY_STOP(0, csum_and_copy_to_iter) -DUMMY(0, csum_ipv6_magic) -DUMMY(0, csum_replace4) -DUMMY(0, file_ns_capable) -DUMMY(0, flow_keys_buf_dissector) -DUMMY(0, fnhe_genid) -DUMMY(0, gfpflags_allow_blocking) -DUMMY(0, hlist_add_behind_rcu) -DUMMY(0, hlist_replace_rcu) -DUMMY(0, hrtimer_cancel) -DUMMY(0, hrtimer_init) -DUMMY(0, hrtimer_start) -DUMMY(0, icmp6_hdr) -DUMMY(0, inet_twsk_deschedule_put) -DUMMY(0, inet_twsk_free) -DUMMY_STOP(0, iov_iter_advance) -DUMMY_STOP(0, iov_iter_get_pages) -DUMMY(0, ip_tunnel_core_init) -DUMMY(0, iptunnel_metadata_reply) -DUMMY(0, ipv6_hdr) -DUMMY(0, ipv6_sk_rxinfo) -DUMMY(0, is_vmalloc_addr) -DUMMY(0, kstrtou8) -DUMMY(0, kvfree) - -/* only relevant when CONFIG_NET_L3_MASTER_DEV set */ -DUMMY_RET(0, l3mdev_fib_oif_rcu) -DUMMY_RET(0, l3mdev_fib_table) /* 0 is valid if !CONFIG_IP_MULTIPLE_TABLES */ -DUMMY_RET(0, l3mdev_fib_table_by_index) -DUMMY_RET(0, l3mdev_get_rtable) -DUMMY_RET(0, l3mdev_get_saddr) -DUMMY_RET(0, l3mdev_master_ifindex) -DUMMY_RET(0, l3mdev_master_ifindex_rcu) - -DUMMY(0, local_clock) - -/* only relevant when CONFIG_LWTUNNEL set */ -DUMMY(0, lwt_tun_info) -DUMMY(0, lwtstate_free) -DUMMY(0, lwtstate_get) -DUMMY_RET(0, lwtstate_put) /* no return value */ -DUMMY_RET(0, lwtunnel_cmp_encap) -DUMMY(0, lwtunnel_fill_encap) -DUMMY(0, lwtunnel_get_encap_size) -DUMMY(0, lwtunnel_input_redirect) -DUMMY(0, lwtunnel_output_redirect) - -DUMMY(0, make_kgid) -DUMMY(0, mod_timer_pending) -DUMMY(0, mod_timer_pinned) -DUMMY(0, netif_index_is_l3_master) -// DUMMY(0, netlink_kernel_release) -// DUMMY(0, netlink_unicast) -DUMMY(0, netpoll_poll_disable) -DUMMY(0, netpoll_poll_enable) -DUMMY(0, nf_hook_ingress_init) -DUMMY(0, nosteal_pipe_buf_ops) -DUMMY(0, ns_to_ktime) -DUMMY(0, page_is_pfmemalloc) -DUMMY(0, page_private) -DUMMY(0, percpu_counter_sum) -DUMMY(0, pr_warn_once) -DUMMY(0, prandom_seed) -DUMMY(0, prandom_u32_max) -DUMMY(0, put_group_info) -DUMMY_SHOW(0, queue_delayed_work) -DUMMY(0, raw_seqcount_begin) -DUMMY(0, read_seqcount_retry) -DUMMY(0, reciprocal_scale) -DUMMY(0, round_down) -DUMMY(0, rtmsg_ifinfo_build_skb) -DUMMY(0, rtmsg_ifinfo_send) -DUMMY_SKIP(0, sched_annotate_sleep) -DUMMY(0, set_page_private) -DUMMY(0, sk_attach_bpf) -DUMMY(0, sk_busy_loop) -DUMMY(0, sk_can_busy_loop) -DUMMY(0, sk_filter_charge) -DUMMY(0, sk_filter_uncharge) -DUMMY(0, sk_mark_napi_id) -DUMMY(0, skb_vlan_tag_get) -DUMMY(0, skb_vlan_tag_get_id) -DUMMY(0, skb_vlan_tag_present) -DUMMY(0, skb_vlan_tagged) -DUMMY(0, smp_mb__after_atomic) -DUMMY(0, sock_diag_broadcast_destroy) -DUMMY(0, sock_diag_has_destroy_listeners) - -/* only relevant when CONFIG_NET_SWITCHDEV was set */ -DUMMY_RET(0, switchdev_fib_ipv4_abort) /* actually void, no return value */ -DUMMY_RET(0, switchdev_fib_ipv4_add) -DUMMY_RET(0, switchdev_fib_ipv4_del) - -DUMMY(0, sysctl_tcp_recovery) -DUMMY(0, sysfs_create_link) -DUMMY(0, sysfs_remove_link) -DUMMY(0, tcp_fastopen_init_key_once) -DUMMY(0, tcp_rack_advance) -DUMMY(0, tcp_rack_mark_lost) -DUMMY(0, tcp_try_fastopen) -DUMMY(0, tcpv4_offload_init) -DUMMY(0, this_cpu_ksoftirqd) -DUMMY_SKIP(0, trace_fib_table_lookup) -DUMMY_SKIP(0, trace_fib_table_lookup_nh) -DUMMY_SKIP(0, trace_fib_validate_source) -DUMMY_SKIP(0, trace_napi_gro_frags_entry) -DUMMY_SKIP(0, trace_napi_gro_receive_entry) -DUMMY_SKIP(0, trace_net_dev_start_xmit) -DUMMY_SKIP(0, trace_netif_receive_skb_entry) -DUMMY_SKIP(0, trace_netif_rx_entry) -DUMMY_SKIP(0, trace_netif_rx_ni_entry) -DUMMY(0, u64_stats_fetch_begin_irq) -DUMMY(0, u64_stats_fetch_retry_irq) -DUMMY(0, u64_stats_init) -DUMMY(0, udpv4_offload_init) -DUMMY(0, vlan_features_check) -DUMMY(0, vlan_hw_offload_capable) -DUMMY(0, vlan_set_encap_proto) -DUMMY(0, wait_woken) -DUMMY_STOP(0, work_pending) -DUMMY(0, __module_get) -DUMMY_RET(0, peernet2id) -DUMMY(0, ktime_get_ns) -DUMMY(0, ipv6_get_dsfield) - -DUMMY_SKIP(0, spin_lock_init) -DUMMY_SKIP(0, spin_lock_nested) -DUMMY_SKIP(0, spin_lock) -DUMMY_SKIP(0, spin_unlock) -DUMMY_SKIP(0, spin_lock_bh) -DUMMY_SKIP(0, spin_unlock_bh) - -DUMMY(0, peernet_has_id) - -} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/legacy_lxip/dummies_c.c b/repos/dde_linux/src/lib/legacy_lxip/dummies_c.c deleted file mode 100644 index 7392a6cac1..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/dummies_c.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * \brief Dummies that cannot be implemented with the DUMMY macros - * \author Sebastian Sumpf - * \date 2014-02-10 - */ - -/* - * Copyright (C) 2014-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* local includes */ -#include - - -int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) -{ - printk("%s called (from %p) not implemented", __func__, __builtin_return_address(0)); - - *seclen = 0; - return -1; -} - - -int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, - struct ip_msfilter *optval, int *optlen) -{ - printk("%s called (from %p) not implemented", __func__, __builtin_return_address(0)); - - *optlen = 0; - return -1; -} - -int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, - struct group_filter *optval, int *optlen) -{ - printk("%s called (from %p) not implemented", __func__, __builtin_return_address(0)); - - *optlen = 0; - return -1; -} diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/linux/in.h b/repos/dde_linux/src/lib/legacy_lxip/include/linux/in.h deleted file mode 100644 index 9fdef9490e..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/linux/in.h +++ /dev/null @@ -1,5 +0,0 @@ -#define __UAPI_DEF_IN_ADDR 1 -#define __UAPI_DEF_SOCKADDR_IN 1 -#include -#undef __UAPI_DEF_SOCKADDR_IN -#undef __UAPI_DEF_IN_ADDR diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/linux/in6.h b/repos/dde_linux/src/lib/legacy_lxip/include/linux/in6.h deleted file mode 100644 index 863720bc27..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/linux/in6.h +++ /dev/null @@ -1,5 +0,0 @@ -#define __UAPI_DEF_IPPROTO_V6 1 -#define __UAPI_DEF_IN6_ADDR 1 -#include -#undef __UAPI_DEF_IN6_ADDR -#undef __UAPI_DEF_IPPROTO_V6 diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/linux/ip.h b/repos/dde_linux/src/lib/legacy_lxip/include/linux/ip.h deleted file mode 100644 index 6c06293674..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/linux/ip.h +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/linux/ipv6.h b/repos/dde_linux/src/lib/legacy_lxip/include/linux/ipv6.h deleted file mode 100644 index e86aa29be1..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/linux/ipv6.h +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/linux/module.h b/repos/dde_linux/src/lib/legacy_lxip/include/linux/module.h deleted file mode 100644 index 40be734446..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/linux/module.h +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef pr_fmt -#define pr_fmt(fmt) fmt -#endif diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/linux/netfilter_arp.h b/repos/dde_linux/src/lib/legacy_lxip/include/linux/netfilter_arp.h deleted file mode 100644 index 97864e723a..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/linux/netfilter_arp.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/linux/netfilter_ipv4.h b/repos/dde_linux/src/lib/legacy_lxip/include/linux/netfilter_ipv4.h deleted file mode 100644 index 97864e723a..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/linux/netfilter_ipv4.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/linux/sockios.h b/repos/dde_linux/src/lib/legacy_lxip/include/linux/sockios.h deleted file mode 100644 index b459fcf57f..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/linux/sockios.h +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/lx_emul.h b/repos/dde_linux/src/lib/legacy_lxip/include/lx_emul.h deleted file mode 100644 index 502b098d45..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/lx_emul.h +++ /dev/null @@ -1,3444 +0,0 @@ -/* - * \brief Emulation of the Linux kernel API - * \author Sebastian Sumpf - * \date 2013-08-19 - * - * The content of this file, in particular data structures, is partially - * derived from Linux-internal headers. - */ - -/* - * Copyright (C) 2012-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _LX_EMUL_H_ -#define _LX_EMUL_H_ - -#include -#include - -#include - -#define DEBUG_PRINTK 1 -#define DEBUG_SLAB 0 -#define DEBUG_TIMER 0 -#define DEBUG_LEVEL 0 - -#define KBUILD_MODNAME "mod-noname" - - -/***************** - ** asm/param.h ** - *****************/ - -enum { HZ = 100UL }; - - -/****************** - ** asm/atomic.h ** - ******************/ - -#include - - -/******************* - ** linux/types.h ** - *******************/ - -#include - -typedef __u8 u_int8_t; - -typedef __u16 __le16; -typedef __u32 __le32; -typedef __u64 __le64; - -typedef __u64 __be64; - -typedef __u16 __sum16; -typedef __u32 __wsum; - -#define __aligned_u64 __u64 __attribute__((aligned(8))) - -#define DECLARE_BITMAP(name,bits) \ - unsigned long name[BITS_TO_LONGS(bits)] - - -/********************** - ** linux/compiler.h ** - **********************/ - -#include - - -/************************** - ** asm-generic/bitops.h ** - **************************/ - -#include - -#define ffz(x) __ffs(~(x)) - -/******************************* - ** asm-generic/bitops/find.h ** - *******************************/ - -unsigned long find_first_zero_bit(unsigned long const *addr, unsigned long size); - -static inline unsigned long find_next_bit(const unsigned long *addr, unsigned long size, - unsigned long offset) -{ - unsigned long i = offset / BITS_PER_LONG; - offset -= (i * BITS_PER_LONG); - - for (; offset < size; offset++) - if (addr[i] & (1UL << offset)) - return offset; - - return size; -} - -#define find_first_bit(addr, size) find_next_bit((addr), (size), 0) - - -/**************************** - ** bitops/const_hweight.h ** - ****************************/ - -static inline unsigned int hweight32(unsigned int w) -{ - w -= (w >> 1) & 0x55555555; - w = (w & 0x33333333) + ((w >> 2) & 0x33333333); - w = (w + (w >> 4)) & 0x0f0f0f0f; - return (w * 0x01010101) >> 24; - -} - -unsigned int hweight64(__u64 w); - - -/**************************** - ** asm-generic/getorder.h ** - ****************************/ - -int get_order(unsigned long size); - - -/************************ - ** uapi/linux/types.h ** - ************************/ - -struct callback_head { - struct callback_head *next; - void (*func)(struct callback_head *head); -}; -#define rcu_head callback_head - - -/******************************* - ** linux/errno.h and friends ** - *******************************/ - -#include - - -/******************** - ** linux/module.h ** - ********************/ - -#include - -#ifdef __setup -#undef __setup -#endif - -#define __setup(str, fn) void SETUP_CONCAT(fn, SETUP_SUFFIX)(void *addrs) { fn(addrs); } - - -/****************** - ** linux/init.h ** - ******************/ - -#define __initdata -#define fs_initcall(fn) void fs_##fn(void) { fn(); } -#define late_initcall(fn) void late_##fn(void) { fn(); } - - -/******************* - ** asm/barrier.h ** - *******************/ - -#include - -#define smp_load_acquire(p) *(p) -#define smp_store_release(p, v) *(p) = v; -#define smp_mb__before_atomic() mb() -#define smp_mb__after_atomic() mb() - - -/********************* - ** linux/kconfig.h ** - *********************/ - -#define CONFIG_DEFAULT_TCP_CONG "cubic" - - -/********************** - ** linux/compiler.h ** - **********************/ - -#include - -#define __deprecated - -#define __aligned(x) __attribute__((aligned(x))) - -#define noinline_for_stack - -static inline void __write_once_size(volatile void *p, void *res, int size) -{ - switch (size) { - case 1: *(volatile __u8 *)p = *(__u8 *)res; break; - case 2: *(volatile __u16 *)p = *(__u16 *)res; break; - case 4: *(volatile __u32 *)p = *(__u32 *)res; break; - case 8: *(volatile __u64 *)p = *(__u64 *)res; break; - default: - barrier(); - __builtin_memcpy((void *)p, (const void *)res, size); - barrier(); - } -} - -static inline void __read_once_size(const volatile void *p, void *res, int size) -{ - switch (size) { - case 1: *(__u8 *)res = *(volatile __u8 *)p; break; - case 2: *(__u16 *)res = *(volatile __u16 *)p; break; - case 4: *(__u32 *)res = *(volatile __u32 *)p; break; - case 8: *(__u64 *)res = *(volatile __u64 *)p; break; - default: - barrier(); - __builtin_memcpy((void *)res, (const void *)p, size); - barrier(); - } -} - -#define READ_ONCE(x) \ -({ \ - union { typeof(x) __val; char __c[1]; } __u; \ - __read_once_size(&(x), __u.__c, sizeof(x)); \ - __u.__val; \ -}) - -#define __HAVE_BUILTIN_BSWAP32__ -#define __HAVE_BUILTIN_BSWAP64__ - - -/*************** - ** asm/bug.h ** - ***************/ - -#include - - -/******************** - ** linux/printk.h ** - ********************/ - -#include - -#define pr_crit(fmt, ...) lx_printf(KERN_CRIT fmt, ##__VA_ARGS__) -#define pr_emerg(fmt, ...) lx_printf(KERN_EMERG fmt, ##__VA_ARGS__) -#define pr_err(fmt, ...) lx_printf(KERN_ERR fmt, ##__VA_ARGS__) -#define pr_warn(fmt, ...) lx_printf(KERN_WARN fmt, ##__VA_ARGS__) -#define pr_warn_once(fmt, ...) lx_printf(KERN_WARN fmt, ##__VA_ARGS__) -#define pr_info(fmt, ...) lx_printf(KERN_INFO fmt, ##__VA_ARGS__) -#define pr_notice(fmt, ...) lx_printf(KERN_NOTICE fmt, ##__VA_ARGS__) -#define pr_cont(fmt, ...) lx_printf(KERN_CONT fmt, ##__VA_ARGS__) -#define pr_info_once(fmt, ...) lx_printf(KERN_INFO fmt, ##__VA_ARGS__) -#define pr_err_once(fmt, ...) lx_printf(KERN_ERR fmt, ##__VA_ARGS__) - -#if DEBUG_LEVEL -#define pr_debug(fmt, ...) lx_printf(KERN_DEBUG fmt, ##__VA_ARGS__) -#else -#define pr_debug(fmt, ...) -#endif - -static inline __printf(1, 2) int no_printk(const char *fmt, ...) { return 0; } - - -/******************** - ** linux/kernel.h ** - ********************/ - -#include - -#define KERN_CONT "" - -#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) - -#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) - -#define SIZE_MAX (~(size_t)0) - -#define U32_MAX ((u32)~0U) -#define S32_MAX ((s32)(U32_MAX>>1)) -#define S32_MIN ((s32)(-S32_MAX - 1)) - -#define PTR_ALIGN(p, a) ({ \ - unsigned long _p = (unsigned long)p; \ - _p = (_p + a - 1) & ~(a - 1); \ - p = (typeof(p))_p; \ - p; \ -}) - -enum { SPRINTF_STR_LEN = 64 }; - -int snprintf(char *buf, size_t size, const char *fmt, ...); -int sprintf(char *buf, const char *fmt, ...); -int sscanf(const char *, const char *, ...); -int kstrtoul(const char *, unsigned int, unsigned long *); -int scnprintf(char *, size_t, const char *, ...); - -#define sprintf(buf, fmt, ...) snprintf(buf, SPRINTF_STR_LEN, fmt, __VA_ARGS__) - -#define kasprintf(gfp, fmt, ...) ({ \ - void *buf = kmalloc(SPRINTF_STR_LEN, 0); \ - sprintf(buf, fmt, __VA_ARGS__); \ - buf; \ -}) - -char *get_options(const char *str, int nints, int *ints); -int hex_to_bin(char); - -u32 reciprocal_scale(u32 val, u32 ep_ro); - -#define sched_annotate_sleep() do { } while (0) - -int kstrtou8(const char *s, unsigned int base, u8 *res); - - -/********************* - ** linux/jiffies.h ** - *********************/ - -#include - -enum { - INITIAL_JIFFIES = 0, -}; - -static inline unsigned int jiffies_to_usecs(const unsigned long j) { return j * JIFFIES_TICK_US; } - -void update_jiffies(void); - - -/****************** - ** linux/kmod.h ** - ******************/ - -int request_module(const char *name, ...); - - -/******************************* - ** uapi/asm-generic/signal.h ** - *******************************/ - -enum { SIGPIPE }; - - -/******************** - ** linux/bitmap.h ** - ********************/ - -void bitmap_fill(unsigned long *dst, int nbits); -void bitmap_zero(unsigned long *dst, int nbits); - - -/******************* - ** linux/ctype.h ** - *******************/ - -#define __ismask(x) (_ctype[(int)(unsigned char)(x)]) -#define isspace(c) ((unsigned char)c == 0x20U) - - -/******************************* - ** asm-generic/scatterlist.h ** - *******************************/ - -struct scatterlist -{ - unsigned dummy; -}; - -struct page; - -void sg_mark_end(struct scatterlist *sg); -void sg_set_buf(struct scatterlist *, const void *, unsigned int); -void sg_set_page(struct scatterlist *, struct page *, unsigned int, - unsigned int); - - -/****************** - ** linux/hash.h ** - ******************/ - -u32 hash_32(u32 val, unsigned int); -u32 hash32_ptr(const void *); - - -/**************************************************************** - ** arch/(*)/include/asm/(processor.h|segment.h|thread_info.h) ** - ****************************************************************/ - -typedef unsigned long mm_segment_t; - -void prefetchw(const void *); -void prefetch(const void *); - -void *current_text_addr(void); - - -/************************************* - ** linux/byteorder/little_endian.h ** - *************************************/ - -#include - -#define htons(x) __cpu_to_be16(x) -#define ntohs(x) __be16_to_cpu(x) -#define htonl(x) __cpu_to_be32(x) -#define ntohl(x) __be32_to_cpu(x) - - -/********************************* - ** linux/unaligned/access_ok.h ** - *********************************/ - -static inline u16 get_unaligned_be16(const void *p) { - return be16_to_cpup((__be16 *)p); } - -static inline u32 get_unaligned_be32(const void *p) { - return be32_to_cpup((__be32 *)p); } - -static inline u32 __get_unaligned_cpu32(const void *p) { - return *(u32*)p; } - -static inline void put_unaligned_be32(u32 val, void *p) { - *((__le32 *)p) = cpu_to_be32(val); } - - -/********************* - ** linux/stringify ** - *********************/ - -#define __stringify_1(x...) #x -#define __stringify(x...) __stringify_1(x) - - -/************************** - ** uapi/linux/sysinfo.h ** - **************************/ - -struct sysinfo -{ - unsigned long totalram; -}; - - -/**************************** - ** tools/perf/util/util.h ** - ****************************/ - -void dump_stack(void); - - -/******************** - ** linux/uidgid.h ** - ********************/ - -struct user_namespace; -#define GLOBAL_ROOT_UID (kuid_t)0 - -bool gid_lte(kgid_t, kgid_t); -uid_t from_kuid_munged(struct user_namespace *, kuid_t); -gid_t from_kgid_munged(struct user_namespace *, kgid_t); -uid_t from_kuid(struct user_namespace *, kuid_t); -gid_t from_kgid(struct user_namespace *, kgid_t); -bool uid_eq(kuid_t, kuid_t); -kgid_t make_kgid(struct user_namespace *from, gid_t gid); - - -/***************** - ** linux/pid.h ** - ****************/ - -struct pid; - -pid_t pid_vnr(struct pid *); -void put_pid(struct pid *); - - -/*********************** - ** linux/kmemcheck.h ** - ***********************/ - -#define kmemcheck_bitfield_begin(name) -#define kmemcheck_bitfield_end(name) -#define kmemcheck_annotate_bitfield(ptr, name) -#define kmemcheck_annotate_variable(var) - - -/************************* - ** asm-generic/div64.h ** - *************************/ - -#define do_div(n,base) ({ \ - unsigned long __base = (base); \ - unsigned long __rem; \ - __rem = ((uint64_t)(n)) % __base; \ - (n) = ((uint64_t)(n)) / __base; \ - __rem; \ -}) - - -/******************** - ** linux/math64.h ** - ********************/ - -u64 div64_u64(u64, u64); -u64 div_u64(u64, u32); - - -/************************* - ** asm-generic/cache.h ** - *************************/ - -enum { - L1_CACHE_BYTES = 32, //XXX is 64 for CA15 */ - SMP_CACHE_BYTES = L1_CACHE_BYTES, -}; - -#define ____cacheline_aligned_in_smp -#define ____cacheline_aligned - - -/******************** - ** linux/dcache.h ** - ********************/ - -#define __read_mostly -unsigned int full_name_hash(const unsigned char *, unsigned int); - -/****************** - ** linux/numa.h ** - ******************/ - -enum { NUMA_NO_NODE = -1 }; - - -/************************ - ** linux/jump_label.h ** - ************************/ - -struct static_key { unsigned dummy; }; - -#define STATIC_KEY_INIT_FALSE ((struct static_key) {}) - -void static_key_slow_inc(struct static_key *); -void static_key_slow_dec(struct static_key *); -bool static_key_false(struct static_key *); -bool static_key_enabled(struct static_key *); - - -/******************** - ** linux/poison.h ** - ********************/ - -#include - - -/**************** - ** asm/page.h ** - ****************/ - -/* - * For now, hardcoded - */ -#define PAGE_SIZE 4096 -#define PAGE_MASK (~(PAGE_SIZE-1)) - -enum { - PAGE_SHIFT = 12, -}; - -struct page -{ - int pfmemalloc; - int mapping; - atomic_t _count; - void *addr; - unsigned long private; -} __attribute((packed)); - - -/************************* - ** linux/res_counter.h ** - *************************/ - -enum { RES_USAGE }; -struct res_counter; -int res_counter_charge_nofail(struct res_counter *, unsigned long, - struct res_counter **); -u64 res_counter_uncharge(struct res_counter *, unsigned long); -u64 res_counter_read_u64(struct res_counter *counter, int member); - - -/**************************** - ** linux/percpu_counter.h ** - ****************************/ - -struct percpu_counter -{ - s64 count; -}; - -static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount, gfp_t gfp) -{ - fbc->count = amount; - return 0; -} - -static inline s64 percpu_counter_read(struct percpu_counter *fbc) -{ - return fbc->count; -} - -static inline -void percpu_counter_add(struct percpu_counter *fbc, s64 amount) -{ - fbc->count += amount; -} - -static inline -void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch) -{ - percpu_counter_add(fbc, amount); -} - -s64 percpu_counter_sum_positive(struct percpu_counter *fbc); - -static inline void percpu_counter_inc(struct percpu_counter *fbc) -{ - percpu_counter_add(fbc, 1); -} - -static inline void percpu_counter_dec(struct percpu_counter *fbc) -{ - percpu_counter_add(fbc, -1); -} - -static inline -s64 percpu_counter_read_positive(struct percpu_counter *fbc) -{ - return fbc->count; -} - -void percpu_counter_destroy(struct percpu_counter *fbc); - -s64 percpu_counter_sum(struct percpu_counter *fbc); - - -/************************** - ** linux/page_counter.h ** - **************************/ - -struct page_counter -{ - atomic_long_t count; - unsigned long limit; -}; - -static inline unsigned long page_counter_read(struct page_counter *counter) { - return atomic_long_read(&counter->count); } - -void page_counter_charge(struct page_counter *counter, unsigned long nr_pages); -void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages); - - -/************************ - ** linux/memcontrol.h ** - ************************/ - -struct sock; - -enum { UNDER_LIMIT, SOFT_LIMIT, OVER_LIMIT }; - -void sock_update_memcg(struct sock *); -void sock_release_memcg(struct sock *); - -struct cg_proto -{ - struct page_counter memory_allocated; - struct percpu_counter sockets_allocated; - int memory_pressure; - long sysctl_mem[3]; -}; - - -/********************* - ** mm/memcontrol.c ** - *********************/ - -struct mem_cgroup; - - -/********************** - ** linux/mm-types.h ** - **********************/ - -struct page_frag -{ - struct page *page; - __u16 offset; - __u16 size; -}; - -struct page_frag_cache -{ - bool pfmemalloc; -}; - - -/**************** - ** linux/mm.h ** - ****************/ - -int is_vmalloc_addr(const void *x); - -extern unsigned long totalram_pages; -extern unsigned long num_physpages; - -static inline struct page *compound_head(struct page *page) { return page; } -static inline void *page_address(struct page *page) { return page->addr; }; - -void get_page(struct page *page); -void put_page(struct page *page); - -struct page *virt_to_head_page(const void *x); -struct page *virt_to_page(const void *x); - -void si_meminfo(struct sysinfo *); - -bool page_is_pfmemalloc(struct page *page); - -#define page_private(page) ((page)->private) -#define set_page_private(page, v) ((page)->private = (v)) - - -/******************** - ** linux/mmzone.h ** - ********************/ - -enum { PAGE_ALLOC_COSTLY_ORDER = 3u }; - -int PageHighMem(struct page *); - - -/****************** - ** linux/swap.h ** - ******************/ - -unsigned long nr_free_buffer_pages(void); - - -/***************** - ** linux/gfp.h ** - *****************/ - -#include - -enum { - __GFP_COLD = 0x00000100u, - __GFP_REPEAT = 0x00000400u, -}; - -struct page *alloc_pages_node(int nid, gfp_t gfp_mask, - unsigned int order); - -struct page *alloc_pages(gfp_t gfp_mask, unsigned int order); - -#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) - -unsigned long get_zeroed_page(gfp_t gfp_mask); -#define free_page(p) kfree((void *)p) - -bool gfp_pfmemalloc_allowed(gfp_t); -unsigned long __get_free_pages(gfp_t, unsigned int); -void free_pages(unsigned long, unsigned int); -void __free_page_frag(void *addr); -bool gfpflags_allow_blocking(const gfp_t gfp_flags); - -void *__alloc_page_frag(struct page_frag_cache *nc, unsigned int fragsz, gfp_t gfp_mask); - - -/****************** - ** linux/slab.h ** - ******************/ - -enum { - SLAB_HWCACHE_ALIGN = 0x2000, - SLAB_PANIC = 0x40000, - SLAB_DESTROY_BY_RCU = 0x80000, - /* set to 1M, increase if necessary */ - KMALLOC_MAX_SIZE = 1 << 20, -}; - -void *kmalloc(size_t size, gfp_t flags); -void *kmalloc_array(size_t n, size_t size, gfp_t flags); -void *kzalloc(size_t size, gfp_t flags); -void *kcalloc(size_t n, size_t size, gfp_t flags); -void *krealloc(const void *, size_t, gfp_t); -void *kzalloc_node(size_t size, gfp_t flags, int node); -void *kmalloc_node_track_caller(size_t size, gfp_t flags, int node); -void kfree(const void *); -void kvfree(const void *); -void kzfree(const void *); -size_t ksize(void *objp); /* XXX is void const* */ - -struct kmem_cache; - -struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, - unsigned long, void (*)(void *)); -void *kmem_cache_alloc(struct kmem_cache *, gfp_t); -void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); - -void kmem_cache_free(struct kmem_cache *cache, void *objp); -void kmem_cache_destroy(struct kmem_cache *); -void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t flags); - - -/********************* - ** linux/vmalloc.h ** - *********************/ - -void *vmalloc(unsigned long size); -void *vzalloc(unsigned long size); -void vfree(const void *addr); - - -/********************** - ** linux/highmem.h ** - **********************/ - -void kunmap_atomic(void *); - -static inline void *kmap(struct page *page) { return page_address(page); } -static inline void *kmap_atomic(struct page *page) { return kmap(page); } -void kunmap(struct page *); - - -/********************* - ** linux/bootmem.h ** - *********************/ - -void *alloc_large_system_hash(const char *tablename, - unsigned long bucketsize, - unsigned long numentries, - int scale, - int flags, - unsigned int *_hash_shift, - unsigned int *_hash_mask, - unsigned long low_limit, - unsigned long high_limit); - - -/************************ - ** linux/debug_lock.h ** - ************************/ - -void debug_check_no_locks_freed(const void *from, unsigned long len); - - -/********************** - ** linux/spinlock.h ** - **********************/ - -#include - - -/******************* - ** linux/mutex.h ** - *******************/ - -#include - -LX_MUTEX_INIT_DECLARE(dst_gc_mutex); -LX_MUTEX_INIT_DECLARE(proto_list_mutex); - -#define dst_gc_mutex LX_MUTEX(dst_gc_mutex) -#define proto_list_mutex LX_MUTEX(proto_list_mutex) - - -/*********************************** - ** linux/rwlock_types.h/rwlock.h ** - ***********************************/ - -typedef unsigned rwlock_t; - -#define DEFINE_RWLOCK(x) rwlock_t x; -#define __RW_LOCK_UNLOCKED(x) 0 - -void rwlock_init(rwlock_t *); - -void write_lock_bh(rwlock_t *); -void write_unlock_bh(rwlock_t *); -void write_lock(rwlock_t *); -void write_unlock(rwlock_t *); -void write_lock_irq(rwlock_t *); -void write_unlock_irq(rwlock_t *); - -void read_lock(rwlock_t *); -void read_unlock(rwlock_t *); -void read_lock_bh(rwlock_t *); -void read_unlock_bh(rwlock_t *); - - -/******************* - ** linux/rwsem.h ** - *******************/ - -#include - - -/********************* - ** linux/seqlock.h ** - *********************/ - -typedef unsigned seqlock_t; - -void seqlock_init (seqlock_t *); - -#define __SEQLOCK_UNLOCKED(x) 0 - - -/****************** - ** linux/time.h ** - ******************/ - -struct timeval -{ - __kernel_time_t tv_sec; - __kernel_suseconds_t tv_usec; -}; - -struct timespec { - __kernel_time_t tv_sec; - long tv_nsec; -}; - -enum { - CLOCK_MONOTONIC = 1, - - MSEC_PER_SEC = 1000L, - USEC_PER_SEC = MSEC_PER_SEC * 1000L, - NSEC_PER_MSEC = 1000L * 1000L, - NSEC_PER_USEC = NSEC_PER_MSEC * 1000L, - NSEC_PER_SEC = MSEC_PER_SEC * NSEC_PER_MSEC, - USEC, - USEC_PER_MSEC = 1000L, -}; - -unsigned long get_seconds(void); -void getnstimeofday(struct timespec *); - - -/******************* - ** linux/ktime.h ** - *******************/ - -union ktime { - s64 tv64; -}; - -typedef union ktime ktime_t; - -#define ktime_to_ns(kt) ((kt).tv64) - -struct timeval ktime_to_timeval(const ktime_t); -struct timespec ktime_to_timespec(const ktime_t kt); - -ktime_t ktime_sub(const ktime_t, const ktime_t); -ktime_t ktime_get(void); -int ktime_equal(const ktime_t, const ktime_t); -s64 ktime_us_delta(const ktime_t, const ktime_t); - -static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) -{ - return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; -} - -static inline s64 ktime_to_ms(const ktime_t kt) -{ - return kt.tv64 / NSEC_PER_MSEC; -} - -static inline ktime_t ktime_get_real(void) -{ - return (ktime_t) { .tv64 = (s64)(jiffies * (1000 / HZ) * NSEC_PER_MSEC) }; -} - -ktime_t ns_to_ktime(u64 ns); - - -/************************* - ** linux/timekeeping.h ** - *************************/ - -u64 ktime_get_ns(void); - - -/******************* - ** linux/timer.h ** - *******************/ - -struct timer_list -{ - unsigned long expires; - void (*function)(unsigned long); - unsigned long data; - void *timer; -}; - - -#define TIMER_INITIALIZER(_function, _expires, _data) { \ - .function = (_function), \ - .expires = (_expires), \ - .data = (_data), \ -} - -void init_timer(struct timer_list *timer); -void add_timer(struct timer_list *timer); -int mod_timer(struct timer_list *timer, unsigned long expires); -int mod_timer_pending(struct timer_list *timer, unsigned long expires); -int mod_timer_pinned(struct timer_list *timer, unsigned long expires); -void setup_timer(struct timer_list *timer,void (*function)(unsigned long), - unsigned long data); -int timer_pending(const struct timer_list * timer); -int del_timer(struct timer_list *timer); -void timer_stats_timer_clear_start_info(struct timer_list *); -unsigned long round_jiffies_relative(unsigned long); - -unsigned long round_jiffies(unsigned long); -unsigned long round_jiffies_up(unsigned long); - -#define del_timer_sync del_timer - - -/********************* - ** linux/hrtimer.h ** - *********************/ - -enum hrtimer_restart -{ - HRTIMER_NORESTART, -}; - -enum hrtimer_mode { - HRTIMER_MODE_REL_PINNED = 0x03, -}; - -struct hrtimer -{ - enum hrtimer_restart (*function)(struct hrtimer *); -}; - -typedef int clockid_t; - -void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, enum hrtimer_mode mode); -void hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode); -int hrtimer_cancel(struct hrtimer *timer); - - -/******************* - ** linux/delay.h ** - *******************/ - -void msleep(unsigned int); -void ssleep(unsigned int); - - -/*********************** - ** linux/ratelimit.h ** - ***********************/ - -struct ratelimit_state -{ - int burst; - int interval; -}; - -#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init) \ - struct ratelimit_state name = { \ - .interval = interval_init, \ - .burst = burst_init, \ - } - -extern int ___ratelimit(struct ratelimit_state *, const char *); -#define __ratelimit(state) ___ratelimit(state, __func__) - - -/******************* - ** linux/sched.h ** - *******************/ - -enum { - PF_EXITING = 0x4, - PF_MEMALLOC = 0x800, - - //MAX_SCHEDULE_TIMEOUT = (~0U >> 1) - MAX_SCHEDULE_TIMEOUT = 1000, -}; - -enum { - TASK_RUNNING = 0, - TASK_INTERRUPTIBLE = 1, - TASK_UNINTERRUPTIBLE = 2, - TASK_COMM_LEN = 16, -}; - -struct task_struct -{ - unsigned int flags; - struct page_frag task_frag; - char comm[TASK_COMM_LEN]; - struct audit_context *audit_context; -}; - -/* normally defined in asm/current.h, included by sched.h */ -extern struct task_struct *current; - -signed long schedule_timeout_interruptible(signed long); -long schedule_timeout_uninterruptible(signed long); -signed long schedule_timeout(signed long timeout); - -void cond_resched(void); -void cond_resched_softirq(void); -int signal_pending(struct task_struct *); -int send_sig(int, struct task_struct *, int); -void tsk_restore_flags(struct task_struct *, unsigned long, unsigned long); -pid_t task_pid_nr(struct task_struct *); -void schedule(void); -int need_resched(void); -void yield(void); -void __set_current_state(int); -void set_current_state(int); -pid_t task_tgid_vnr(struct task_struct *); - -u64 local_clock(void); - - -/************************ - ** linux/textsearch.h ** - ************************/ - -struct ts_state -{ - char cb[40]; -}; - -struct ts_config -{ - unsigned int (*get_next_block)(unsigned int consumed, - const u8 **dst, - struct ts_config *conf, - struct ts_state *state); - void (*finish)(struct ts_config *conf, - struct ts_state *state); -}; - -unsigned int textsearch_find(struct ts_config *, struct ts_state *); - - -/**************************** - ** linux/rcu_list_nulls.h ** - ****************************/ - -#include - -#define hlist_nulls_add_head_rcu hlist_nulls_add_head - -static inline void hlist_nulls_del_init_rcu(struct hlist_nulls_node *n) -{ - if (!hlist_nulls_unhashed(n)) { - __hlist_nulls_del(n); - n->pprev = NULL; - } -} - - -/********************* - ** linux/lockdep.h ** - *********************/ - -enum { - SINGLE_DEPTH_NESTING = 1, -}; - -#define lockdep_set_class(lock, key) -#define lockdep_set_class_and_name(lock, key, name) -#define mutex_acquire(l, s, t, i) -#define mutex_release(l, n, i) - -struct lock_class_key { }; -struct lockdep_map { }; - -void lockdep_init_map(struct lockdep_map *, const char *, - struct lock_class_key *, int); - - -/***************** - ** linux/smp.h ** - *****************/ - -#define raw_smp_processor_id() 0 -#define smp_processor_id() 0 -#define put_cpu() - -typedef void (*smp_call_func_t)(void *info); - -int on_each_cpu(smp_call_func_t, void *, int); - - -/********************** - ** linux/rcupdate.h ** - **********************/ - -#define kfree_rcu(ptr, offset) kfree(ptr) - -#define rcu_dereference(p) p -#define rcu_dereference_bh(p) p -#define rcu_dereference_check(p, c) p -#define rcu_dereference_protected(p, c) p -#define rcu_dereference_raw(p) p -#define rcu_dereference_rtnl(p) p -#define rcu_dereference_index_check(p, c) p - -#define rcu_assign_pointer(p, v) p = v -#define rcu_access_pointer(p) p - -void rcu_read_lock(void); -void rcu_read_unlock(void); - -void rcu_read_lock_bh(void); -void rcu_read_unlock_bh(void); - -void synchronize_rcu(void); - -static inline int rcu_read_lock_held(void) { return 1; } -static inline int rcu_read_lock_bh_held(void) { return 1; } - -static inline void call_rcu(struct rcu_head *head, - void (*func)(struct rcu_head *head)) -{ func(head); } - -#define RCU_INIT_POINTER(p, v) p = (typeof(*v) *)v - - -/********************* - ** linux/rculist.h ** - *********************/ - -#define hlist_first_rcu(head) (*((struct hlist_node **)(&(head)->first))) - -#define hlist_for_each_entry_rcu(pos, head, member) \ - hlist_for_each_entry(pos, head, member) - -#define list_next_rcu(list) (*((struct list_head **)(&(list)->next))) - -#define list_for_each_entry_rcu(pos, head, member) \ - list_for_each_entry(pos, head, member) - -#define list_first_or_null_rcu(ptr, type, member) ({ \ - struct list_head *__ptr = (ptr); \ - struct list_head __rcu *__next = list_next_rcu(__ptr); \ - __ptr != __next ? container_of(__next, type, member) : NULL; \ -}) - -#define list_add_rcu list_add -#define list_add_tail_rcu list_add_tail -#define hlist_add_head_rcu hlist_add_head - -#define list_entry_rcu(ptr, type, member) container_of(ptr, type, member) - -#define list_del_rcu list_del -#define hlist_del_rcu hlist_del - -#define hlist_del_init_rcu hlist_del_init - -#define free_percpu(pdata) kfree(pdata) - -void hlist_add_after_rcu(struct hlist_node *, struct hlist_node *); -void hlist_add_before_rcu(struct hlist_node *,struct hlist_node *); - -void list_replace_rcu(struct list_head *, struct list_head *); -void hlist_replace_rcu(struct hlist_node *old, struct hlist_node *new); -void hlist_add_behind_rcu(struct hlist_node *n, struct hlist_node *prev); - - -/*************************** - ** linux/rculist_nulls.h ** - ***************************/ - -#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \ - hlist_nulls_for_each_entry(tpos, pos, head, member) - - -/********************* - ** linux/rcutree.h ** - *********************/ - -void rcu_barrier(void); -void synchronize_rcu_expedited(void); - - -/*********************** - ** linux/hashtable.h ** - ***********************/ - -#define HASH_SIZE(name) (ARRAY_SIZE(name)) - -#define HLIST_HEAD_INIT { .first = NULL } - -#define DEFINE_HASHTABLE(name, bits) \ - struct hlist_head name[1 << (bits)] = \ - { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT } - - -/************************* - ** linux/percpu-defs.h ** - *************************/ - -#define DECLARE_PER_CPU_ALIGNED(type, name) \ - extern typeof(type) name - -#define DECLARE_PER_CPU(type, name) \ - extern typeof(type) name - -#define DEFINE_PER_CPU_ALIGNED(type, name) \ - typeof(type) name - -#define DEFINE_PER_CPU(type, name) \ - typeof(type) name - -#define EXPORT_PER_CPU_SYMBOL(x) - - -/******************** - ** linux/percpu.h ** - ********************/ - -void *__alloc_percpu(size_t size, size_t align); - -#define __alloc_percpu_gfp(size, align, gfp) __alloc_percpu(size, align) - -#define alloc_percpu_gfp(type, gfp) \ - (typeof(type) __percpu *)__alloc_percpu_gfp(sizeof(type), __alignof__(type), gfp) - -#define alloc_percpu(type) \ - (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) - -#define per_cpu(var, cpu) var -#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu);(typeof(*(ptr)) *)(ptr); }) -#define get_cpu_var(var) var -#define put_cpu_var(var) ({ (void)&(var); }) -#define __get_cpu_var(var) var -#define __this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) -#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) -#define __this_cpu_write(pcp, val) pcp = val -#define __this_cpu_read(pcp) pcp -#define this_cpu_read(pcp) __this_cpu_read(pcp) - -#define this_cpu_inc(pcp) pcp += 1 -#define this_cpu_dec(pcp) pcp -= 1 - -#define __this_cpu_inc(pcp) this_cpu_inc(pcp) -#define __this_cpu_dec(pcp) this_cpu_dec(pcp) - -#define this_cpu_add(pcp, val) pcp += val -#define __this_cpu_add(pcp, val) this_cpu_add(pcp, val) -#define get_cpu() 0 - -#define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) -#define raw_cpu_inc(pcp) pcp += 1 - - -/********************* - ** linux/cpumask.h ** - *********************/ - -#define num_online_cpus() 1U - -unsigned num_possible_cpus(void); - - -/***************** - ** linux/cpu.h ** - *****************/ - -enum { - CPU_DEAD = 0x7, - CPU_TASKS_FROZEN = 0x10, - CPU_DEAD_FROZEN = CPU_DEAD | CPU_TASKS_FROZEN, -}; - - -/********************* - ** linux/cpumask.h ** - *********************/ - -extern const struct cpumask *const cpu_possible_mask; - -#define nr_cpu_ids 1 - -#define for_each_cpu(cpu, mask) \ - for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) - -#define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask) -#define hotcpu_notifier(fn, pri) - - -/******************* - ** linux/preempt ** - *******************/ - -void preempt_enable(void); -void preempt_disable(void); - - -/********************* - ** linux/kobject.h ** - *********************/ - -enum kobject_action -{ - KOBJ_ADD, - KOBJ_REMOVE, -}; - -struct kobject { }; - -void kobject_put(struct kobject *); -int kobject_uevent(struct kobject *, enum kobject_action); - - -/*********************** - ** linux/interrupt.h ** - ***********************/ - -enum { - NET_TX_SOFTIRQ, - NET_RX_SOFTIRQ, - NET_SOFTIRQS, -}; - -struct tasklet_struct; -struct softirq_action { }; - -void raise_softirq_irqoff(unsigned int); -void __raise_softirq_irqoff(unsigned int ); - -bool irqs_disabled(void); -void do_softirq(void); - -void open_softirq(int, void (*)(struct softirq_action *)); - -void tasklet_init(struct tasklet_struct *, void (*)(unsigned long), - unsigned long); -void tasklet_schedule(struct tasklet_struct *); - -struct task_struct *this_cpu_ksoftirqd(void); - - -/*********************** - ** /linux/irqflags.h ** - ***********************/ - -void local_irq_save(unsigned long); -void local_irq_restore(unsigned long); -void local_irq_enable(void); -void local_irq_disable(void); - - -/********************* - ** linux/hardirq.h ** - *********************/ - -int in_softirq(void); -int in_irq(void); - - -/************************* - ** linux/irq_cpustat.h ** - *************************/ - -bool local_softirq_pending(void); - - -/************************* - ** linux/bottom_half.h ** - *************************/ - -void local_bh_disable(void); -void local_bh_enable(void); - - -/******************** - ** linux/string.h ** - ********************/ - -#include - -char *strnchr(const char *, size_t, int); - - -/*************************** - ** asm-generic/uaccess.h ** - ***************************/ - -enum { VERIFY_READ = 0 }; - -static inline -long copy_from_user(void *to, const void *from, unsigned long n) -{ - memcpy(to, from, n); - return 0; -} - -static inline -long copy_to_user(void *to, const void *from, unsigned long n) -{ - memcpy(to, from, n); - return 0; -} - -int access_ok(int, const void *, unsigned long); - -#define get_user(src, dst) ({ \ - src = *dst; \ - 0; }) - -#define put_user(x, ptr) ({ \ - *ptr = x; \ - 0; }) - -#define __copy_from_user copy_from_user -#define __copy_from_user_nocache copy_from_user - -long strncpy_from_user(char *, const char *src, long); - -mm_segment_t get_fs(void); -mm_segment_t get_ds(void); - -void set_fs(mm_segment_t); - - -/***************************** - ** uapi/linux/capability.h ** - *****************************/ - -enum { - CAP_NET_BIND_SERVICE = 10, - CAP_NET_BROADCAST = 11, - CAP_NET_ADMIN = 12, - CAP_NET_RAW = 13, -}; - - -/************************* - ** linux/capability.h ** - *************************/ - -bool capable(int cap); -bool ns_capable(struct user_namespace *, int); -struct file; -bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); - - -/******************** - ** linux/sysctl.h ** - ********************/ - -struct ctl_table; - -typedef int proc_handler (struct ctl_table *ctl, int write, - void __user *buffer, size_t *lenp, loff_t *ppos); - - -/************************ - ** fs/proc/internal.h ** - ************************/ - -struct proc_dir_entry { }; - - -/******************* - ** linux/proc_fs ** - *******************/ - -void remove_proc_entry(const char *, struct proc_dir_entry *); - - -/********************************* - ** uapi/asm-generic/siginfo..h ** - *********************************/ - -enum -{ - POLL_IN = 1, - POLL_OUT = 2, - POLL_ERR = 4, - POLL_PRI = 5, - POLL_HUP = 6, -}; - - -/******************** - ** linux/pm_qos.h ** - ********************/ - -struct pm_qos_request { }; - - -/********************************* - ** (uapi|linux|kernel)/audit.h ** - *********************************/ - -enum { - AUDIT_ANOM_PROMISCUOUS = 1700, -}; - -extern int audit_enabled; - -struct audit_context { }; - -void audit_log(struct audit_context *, gfp_t, int, const char *, ...); -kuid_t audit_get_loginuid(struct task_struct *); -int audit_get_sessionid(struct task_struct *); - - -/******************** - ** linux/device.h ** - ********************/ - -struct device_driver -{ - char const *name; -}; - - -struct device -{ - struct kobject kobj; - struct device *parent; - struct device_driver *driver; -}; - -struct class_attribute { }; - -const char *dev_driver_string(const struct device *); -const char *dev_name(const struct device *); -int device_rename(struct device *, const char *); -void put_device(struct device *); - -int dev_printk_emit(int, const struct device *, const char *, ...); - - -/************************* - ** linux/dma-direction ** - *************************/ - -enum dma_data_direction { D = 1}; - - -/************************* - ** linux/dma-mapping.h ** - *************************/ - -dma_addr_t dma_map_page(struct device *dev, struct page *page, - size_t offset, size_t size, - enum dma_data_direction dir); - - -/*********************** - ** linux/dmaenging.h ** - ***********************/ - -void net_dmaengine_get(void); -void net_dmaengine_put(void); - - -/***************** - ** linux/phy.h ** - *****************/ - -struct ethtool_ts_info; -struct ethtool_modinfo; -struct ethtool_eeprom; - -struct phy_device; - -struct phy_driver -{ - int (*ts_info)(struct phy_device *phydev, struct ethtool_ts_info *ti); - int (*module_info)(struct phy_device *dev, struct ethtool_modinfo *modinfo); - int (*module_eeprom)(struct phy_device *dev, struct ethtool_eeprom *ee, u8 *data); -}; - -struct phy_device -{ - struct phy_driver *drv; -}; - - -/***************************** - ** uapi/asm-generic/poll.h ** - *****************************/ - -enum { - POLLIN = 0x1, - POLLPRI = 0x2, - POLLOUT = 0x4, - POLLERR = 0x8, - POLLHUP = 0x10, - POLLRDNORM = 0x40, - POLLRDBAND = 0x80, - POLLWRNORM = 0x100, - POLLWRBAND = 0x200, - POLLRDHUP = 0x2000, -}; - - -/*********************** - ** linux/workqueue.h ** - ***********************/ - -#include - -#define wait_queue_t wait_queue_entry_t - -void INIT_DEFERRABLE_WORK(struct delayed_work *, void (*func)(struct work_struct *)); - -#define system_power_efficient_wq 0 -#define work_pending(work) 0 - - -/****************** - ** linux/wait.h ** - ******************/ - -long wait_woken(wait_queue_t *wait, unsigned mode, long timeout); - - -/****************** - ** linux/poll.h ** - ******************/ - -typedef struct poll_table_struct { } poll_table; - -struct file; -void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p); -bool poll_does_not_wait(const poll_table *); - - -/**************************** - ** linux/user_namespace.h ** - ****************************/ - -struct user_namespace { }; - - -/****************** - ** linux/cred.h ** - ******************/ - -enum { - NGROUPS_PER_BLOCK = PAGE_SIZE / sizeof(kgid_t) -}; - -struct cred -{ - struct user_namespace *user_ns; - kuid_t euid; - kgid_t egid; -}; - -struct group_info -{ - int ngroups; - int nblocks; - kgid_t *blocks[0]; -}; - -extern struct user_namespace init_user_ns; -#define current_user_ns() (&init_user_ns) - -struct group_info *get_current_groups(); -void put_cred(const struct cred *); -void put_group_info(struct group_info*); - -static inline void current_uid_gid(kuid_t *u, kgid_t *g) -{ - *u = 0; - *g =0; -} - -kgid_t current_egid(void); - - -/************************* - ** asm-generic/fcntl.h ** - *************************/ - -enum { O_NONBLOCK = 0x4000 }; - - -/********************* - ** uapi/linux/fs.h ** - *********************/ - -enum { - NR_FILE = 8192, -}; - - -/**************** - ** linux/fs.h ** - ****************/ - -struct fown_struct { }; - -struct file -{ - unsigned int f_flags; - const struct cred *f_cred; - struct fown_struct f_owner; -}; - -typedef struct -{ - size_t count; - union - { - void *data; - } arg; -} read_descriptor_t; - -struct inode -{ - umode_t i_mode; - kuid_t i_uid; - unsigned long i_ino; -}; - -struct inode *file_inode(struct file *f); -int send_sigurg(struct fown_struct *); - - -/*********************** - ** linux/pipe_fs_i.h ** - ***********************/ - -struct pipe_buffer -{ - struct page *page; -}; - -struct pipe_inode_info; - -struct pipe_buf_operations -{ - int can_merge; - void * (*map)(struct pipe_inode_info *, struct pipe_buffer *, int); - void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *, void *); - int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *); - void (*release)(struct pipe_inode_info *, struct pipe_buffer *); - int (*steal)(struct pipe_inode_info *, struct pipe_buffer *); - void (*get)(struct pipe_inode_info *, struct pipe_buffer *); -}; - -void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); -void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *); -int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *); - -extern const struct pipe_buf_operations nosteal_pipe_buf_ops; - - -/******************** - ** linux/splice.h ** - ********************/ - -struct partial_page -{ - unsigned int offset; - unsigned int len; -}; - -struct splice_pipe_desc -{ - struct page **pages; - struct partial_page *partial; - int nr_pages; - unsigned int nr_pages_max; - unsigned int flags; - - const struct pipe_buf_operations *ops; - void (*spd_release)(struct splice_pipe_desc *, unsigned int); -}; - -ssize_t splice_to_pipe(struct pipe_inode_info *, struct splice_pipe_desc *); - - -/***************** - ** linux/aio.h ** - *****************/ - -struct kiocb -{ - void *private; -}; - - -/***************** - ** linux/uio.h ** - *****************/ - -enum { UIO_MAXIOV = 1024 }; - -struct iovec -{ - void *iov_base; - __kernel_size_t iov_len; -}; - -struct kvec -{ - void *iov_base; - size_t iov_len; -}; - -int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); - -struct iov_iter { - int type; - size_t iov_offset; - size_t count; - union { - const struct iovec *iov; - const struct kvec *kvec; - const struct bio_vec *bvec; - }; - unsigned long nr_segs; -}; - -static inline size_t iov_iter_count(struct iov_iter *i) { return i->count; } - -size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i); -size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i); -size_t copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i); - -size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, struct iov_iter *i); -size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, struct iov_iter *i); - -void iov_iter_advance(struct iov_iter *i, size_t bytes); -ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, - size_t maxsize, unsigned maxpages, size_t *start); - -size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i); -size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i); - -bool iter_is_iovec(struct iov_iter *i); - - -/******************************* - ** uapi/asm-generic/ioctls.h ** - *******************************/ - -enum { - TIOCOUTQ = 0x5411, - FIONREAD = 0x541b, -}; - - -/********************* - ** linux/utsname.h ** - *********************/ - -enum { __NEW_UTS_LEN = 64 }; - -struct new_utsname -{ - char nodename[65]; - char domainname[65]; -}; - -struct uts_name { - struct new_utsname name; -}; - -extern struct uts_name init_uts_ns; - -struct new_utsname *init_utsname(void); -struct new_utsname *utsname(void); - - -/************************* - ** uapi/linux/filter.h ** - *************************/ - -struct sock_fprog { }; - - -/******************** - ** linux/filter.h ** - ********************/ - -struct sk_buff; -struct sock_filter; -struct sk_filter -{ - atomic_t refcnt; - struct rcu_head rcu; -}; - -unsigned int sk_filter_len(const struct sk_filter *); -int sk_filter(struct sock *, struct sk_buff *); -bool sk_filter_charge(struct sock *sk, struct sk_filter *fp); -void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp); -int sk_attach_filter(struct sock_fprog *, struct sock *); -int sk_detach_filter(struct sock *); -int sk_get_filter(struct sock *, struct sock_filter *, unsigned); -int sk_attach_bpf(u32 ufd, struct sock *sk); - -int bpf_tell_extensions(void); - - -/***************************** - ** uapi/linux/hdlc/ioctl.h ** - *****************************/ - -typedef struct { } fr_proto; -typedef struct { } fr_proto_pvc; -typedef struct { } fr_proto_pvc_info; -typedef struct { } cisco_proto; -typedef struct { } raw_hdlc_proto; -typedef struct { } te1_settings; -typedef struct { } sync_serial_settings; - - -/********************** - ** linux/interrupt.h ** - **********************/ - -struct tasklet_struct -{ }; - - -/******************** - ** linux/crypto.h ** - ********************/ - -struct hash_desc { }; - - -/************************ - ** linux/cryptohash.h ** - ************************/ - -enum { - SHA_DIGEST_WORDS = 5, - SHA_MESSAGE_BYTES = 512 * 8, - SHA_WORKSPACE_WORDS = 16, -}; - -void sha_transform(__u32 *, const char *, __u32 *); - - -/*********************** - ** linux/rtnetlink.h ** - ***********************/ - -struct net_device; -struct nlmsghdr; -struct net; -struct sk_buff; -struct netlink_callback; -struct rtnl_af_ops; -struct dst_entry; - -typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); -typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); -typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *); - - -void rtnetlink_init(void); -void rtnl_register(int protocol, int msgtype, - rtnl_doit_func, rtnl_dumpit_func, - rtnl_calcit_func); -int rtnl_af_register(struct rtnl_af_ops *); - -struct netdev_queue *dev_ingress_queue(struct net_device *dev); -void rtnl_notify(struct sk_buff *, struct net *, u32, u32, struct nlmsghdr *, - gfp_t); -int rtnl_unicast(struct sk_buff *, struct net *, u32); -int rtnetlink_put_metrics(struct sk_buff *, u32 *); -void rtnl_set_sk_err(struct net *, u32, int); -void ASSERT_RTNL(void); -void rtnl_lock(void); -void rtnl_unlock(void); -void __rtnl_unlock(void); -int rtnl_is_locked(void); -int rtnl_put_cacheinfo(struct sk_buff *, struct dst_entry *, u32, long, u32); - -bool lockdep_rtnl_is_held(void); - -struct sk_buff *rtmsg_ifinfo_build_skb(int type, struct net_device *dev, unsigned change, gfp_t flags); -void rtmsg_ifinfo_send(struct sk_buff *skb, struct net_device *dev, gfp_t flags); - - -/*********************** - ** linux/genetlink.h ** - ***********************/ - -extern atomic_t genl_sk_destructing_cnt; -extern wait_queue_head_t genl_sk_destructing_waitq; - - -/********************* - ** net/flow_keys.h ** - *********************/ - -enum flow_dissector_key_id -{ - FLOW_DISSECTOR_KEY_IPV4_ADDRS, -}; - -struct flow_dissector_key_control -{ - u16 thoff; - u16 addr_type; - u32 flags; -}; - -struct flow_dissector_key_ipv4_addrs { - /* (src,dst) must be grouped, in the same way than in IP header */ - __be32 src; - __be32 dst; -}; - -struct flow_dissector_key_addrs { - union { - struct flow_dissector_key_ipv4_addrs v4addrs; - }; -}; - -struct flow_keys -{ - /* (src,dst) must be grouped, in the same way than in IP header */ - __be32 src; - __be32 dst; - union { - __be32 ports; - __be16 port16[2]; - }; - u16 thoff; - u8 ip_proto; - - struct flow_dissector_key_control control; - struct flow_dissector_key_addrs addrs; -}; - -struct flow_dissector_key -{ - unsigned dummy; -}; - -struct flow_dissector -{ - unsigned dummy; -}; - -extern struct flow_dissector flow_keys_dissector; -extern struct flow_dissector flow_keys_buf_dissector; - -bool flow_keys_have_l4(struct flow_keys *keys); - - -/******************** - ** net/netevent.h ** - ********************/ - -enum netevent_notif_type { - NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */ -}; - -int call_netevent_notifiers(unsigned long, void *); - - -/*************** - ** net/scm.h ** - ***************/ - -struct scm_creds -{ -}; - -struct scm_cookie -{ - struct scm_creds creds; -}; - -struct msghdr; -struct socket; - -int scm_send(struct socket *, struct msghdr *, struct scm_cookie *, bool); -void scm_recv(struct socket *, struct msghdr *, struct scm_cookie *, int); -void scm_destroy(struct scm_cookie *); - - -/********************* - ** net/fib_rules.h ** - *********************/ - -enum -{ - FIB_LOOKUP_NOREF = 1, - FIB_LOOKUP_IGNORE_LINKSTATE = 2, -}; - - -/**************************** - ** linux/u64_stats_sync.h ** - ****************************/ - -struct u64_stats_sync { unsigned dummy; }; - -void u64_stats_init(struct u64_stats_sync *syncp); -void u64_stats_update_begin(struct u64_stats_sync *syncp); -void u64_stats_update_end(struct u64_stats_sync *syncp); - -unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *p); -bool u64_stats_fetch_retry_irq(const struct u64_stats_sync *p, unsigned int s); - - -/********************** - ** net/netns/core.h ** - **********************/ - -struct netns_core -{ - int sysctl_somaxconn; -}; - - -/************************* - ** net/net_namespace.h ** - *************************/ - -#include -#include -#include - -enum { - LOOPBACK_IFINDEX = 1, - NETDEV_HASHBITS = 8, - NETDEV_HASHENTRIES = 1 << NETDEV_HASHBITS, -}; - -struct user_namespace; - -extern struct net init_net; - -struct net -{ - struct list_head list; - struct list_head exit_list; - struct list_head dev_base_head; - struct hlist_head *dev_name_head; - struct hlist_head *dev_index_head; - unsigned int dev_base_seq; - int ifindex; - unsigned int dev_unreg_count; - struct net_device *loopback_dev; - struct netns_core core; - struct user_namespace *user_ns; - struct proc_dir_entry *proc_net_stat; - struct sock *rtnl; - struct netns_mib mib; - struct netns_ipv4 ipv4; - atomic_t rt_genid; - atomic_t fnhe_genid; -}; - - -struct pernet_operations -{ - int (*init)(struct net *net); - void (*exit)(struct net *net); - void (*exit_batch)(struct list_head *net_exit_list); -}; - -extern struct list_head net_namespace_list; - -#define __net_initdata -#define __net_init -#define __net_exit - -#define for_each_net(VAR) \ - for(VAR = &init_net; VAR; VAR = 0) - -#define read_pnet(pnet) (&init_net) -#define write_pnet(pnet, net) do { (void)(net);} while (0) - -static inline struct net *hold_net(struct net *net) { return net; } -static inline struct net *get_net(struct net *net) { return net; } -static inline void put_net(struct net *net) { } -static inline int net_eq(const struct net *net1, const struct net *net2) { - return net1 == net2; } - -typedef struct { unsigned dummy; } possible_net_t; - -struct net *get_net_ns_by_pid(pid_t pid); -struct net *get_net_ns_by_fd(int pid); - -int register_pernet_subsys(struct pernet_operations *); -int register_pernet_device(struct pernet_operations *); -void release_net(struct net *net); - -int rt_genid(struct net *); -int rt_genid_ipv4(struct net *net); -void rt_genid_bump(struct net *); -void rt_genid_bump_ipv4(struct net *net); - -int fnhe_genid(struct net *net); - -int peernet2id(struct net *net, struct net *peer); -bool peernet_has_id(struct net *net, struct net *peer); - - -/************************** - ** linux/seq_file_net.h ** - **************************/ - -struct seq_net_private { - struct net *net; -}; - -struct seq_operations { }; - - -/************************** - ** linux/seq_file.h ** - **************************/ - -struct seq_file { }; - - -/********************* - ** linux/seqlock.h ** - *********************/ - -typedef struct seqcount { - unsigned sequence; -} seqcount_t; - -unsigned read_seqbegin(const seqlock_t *sl); -unsigned read_seqretry(const seqlock_t *sl, unsigned start); -void write_seqlock_bh(seqlock_t *); -void write_sequnlock_bh(seqlock_t *); -void write_seqlock(seqlock_t *); -void write_sequnlock(seqlock_t *); -void write_seqcount_begin(seqcount_t *); -void write_seqcount_end(seqcount_t *); - -unsigned raw_seqcount_begin(const seqcount_t *s); -int read_seqcount_retry(const seqcount_t *s, unsigned start); - - -/********************** - ** net/secure_seq.h ** - **********************/ - -u32 secure_ipv4_port_ephemeral(__be32, __be32, __be16); -__u32 secure_tcp_sequence_number(__be32, __be32, __be16, __be16); - -__u32 secure_ip_id(__be32 ); -__u32 secure_ipv6_id(const __be32 [4]); - - -/********************** - ** linux/notifier.h ** - **********************/ - -enum { - NOTIFY_DONE = 0, - NOTIFY_OK = 0x1, - NOTIFY_STOP_MASK = 0x8000, - - NETLINK_URELEASE = 0x1, -}; - - -struct notifier_block; - -typedef int (*notifier_fn_t)(struct notifier_block *nb, - unsigned long action, void *data); - -struct notifier_block -{ - notifier_fn_t notifier_call; - struct notifier_block *next; - int priority; -}; - -struct raw_notifier_head -{ - struct notifier_block *head; -}; - -#define RAW_NOTIFIER_HEAD(name) \ - struct raw_notifier_head name; - -struct blocking_notifier_head { - struct rw_semaphore rwsem; - struct notifier_block *head; -}; - -struct atomic_notifier_head { - struct notifier_block *head; - -}; - -int atomic_notifier_chain_register(struct atomic_notifier_head *, - struct notifier_block *); - -int atomic_notifier_chain_unregister(struct atomic_notifier_head *, - struct notifier_block *); - -int atomic_notifier_call_chain(struct atomic_notifier_head *, - unsigned long, void *); - -int raw_notifier_chain_register(struct raw_notifier_head *nh, - struct notifier_block *n); - -int raw_notifier_chain_unregister(struct raw_notifier_head *nh, - struct notifier_block *nb); - -int raw_notifier_call_chain(struct raw_notifier_head *nh, - unsigned long val, void *v); - -int blocking_notifier_chain_register(struct blocking_notifier_head *nh, - struct notifier_block *n); - -int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, - struct notifier_block *nb); - -int blocking_notifier_call_chain(struct blocking_notifier_head *nh, - unsigned long val, void *v); - -int notifier_to_errno(int); -int notifier_from_errno(int); - -#define BLOCKING_NOTIFIER_INIT(name) { \ - .rwsem = __RWSEM_INITIALIZER((name).rwsem), .head = NULL } - -#define BLOCKING_NOTIFIER_HEAD(name) \ - struct blocking_notifier_head name = BLOCKING_NOTIFIER_INIT(name) - -#define ATOMIC_NOTIFIER_INIT(name) { \ - .head = NULL } - -#define ATOMIC_NOTIFIER_HEAD(name) \ - struct atomic_notifier_head name = ATOMIC_NOTIFIER_INIT(name) - - -/**************************** - ** asm-generic/checksum.h ** - ****************************/ - -__sum16 csum_fold(__wsum csum); -__sum16 ip_fast_csum(const void *iph, unsigned int ihl); - -__wsum csum_partial(const void *buff, int len, __wsum sum); -__wsum csum_partial_copy(const void *src, void *dst, int len, __wsum sum); -__wsum csum_partial_copy_from_user(const void __user *src, void *dst, int len, - __wsum sum, int *csum_err); - -#define csum_partial_copy_nocheck(src, dst, len, sum) \ - csum_partial_copy((src), (dst), (len), (sum)) - -#define csum_and_copy_from_user csum_partial_copy_from_user - -__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, - unsigned short proto, __wsum sum); - -static inline -__sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, - unsigned short proto, __wsum sum) -{ - return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); -} - -static inline -__wsum csum_and_copy_to_user(const void *src, void __user *dst, int len, - __wsum sum, int *err_ptr) -{ - sum = csum_partial(src, len, sum); - - memcpy(dst, src, len); - return sum; -} - -__wsum remcsum_adjust(void *ptr, __wsum csum, int start, int offset); -void csum_replace4(__sum16 *sum, __be32 from, __be32 to); - - -/********************* - ** linux/if_vlan.h ** - *********************/ - -enum { - VLAN_HLEN = 4, - VLAN_ETH_HLEN = 18, -}; - -struct vlan_hdr -{ - __be16 h_vlan_TCI; - __be16 h_vlan_encapsulated_proto; -}; - -struct vlan_ethhdr -{ - __be16 h_vlan_encapsulated_proto; -}; - -static inline -struct net_device *vlan_dev_real_dev(const struct net_device *dev) -{ - return NULL; -} - -#define vlan_tx_tag_get(__skb) 0 -struct sk_buff *__vlan_put_tag(struct sk_buff *, u16); -struct sk_buff *vlan_untag(struct sk_buff *); -int is_vlan_dev(struct net_device *); -u16 vlan_tx_tag_present(struct sk_buff *); -bool vlan_do_receive(struct sk_buff **); -bool vlan_tx_nonzero_tag_present(struct sk_buff *); - -enum { - VLAN_VID_MASK = 0x0fff, - VLAN_CFI_MASK = 0x1000, /* Canonical Format Indicator */ - VLAN_TAG_PRESENT = VLAN_CFI_MASK, -}; - -#define skb_vlan_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) -#define skb_vlan_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) -#define skb_vlan_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK) - -__be16 __vlan_get_protocol(struct sk_buff *skb, __be16 type, int *depth); -void __vlan_hwaccel_put_tag(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); -int __vlan_insert_tag(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); - - -typedef u64 netdev_features_t; /* XXX actually defined in netdev_features.h */ - -bool skb_vlan_tagged(const struct sk_buff *skb); -netdev_features_t vlan_features_check(const struct sk_buff *skb, netdev_features_t features); -bool vlan_hw_offload_capable(netdev_features_t features, __be16 proto); -struct sk_buff *__vlan_hwaccel_push_inside(struct sk_buff *skb); -void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vhdr); - - -/***************************** - ** uapi/linux/if_bonding.h ** - *****************************/ - -typedef struct ifbond { unsigned dummy; } ifbond; - -typedef struct ifslave { unsigned dummy; } ifslave; - - -/******************** - ** net/checksum.h ** - ********************/ - -#define CSUM_MANGLED_0 ((__sum16)0xffff) - -__wsum csum_and_copy_from_user(const void __user *src, void *dst, - int len, __wsum sum, int *err_ptr); -__wsum csum_add(__wsum csum, __wsum addend); -__wsum csum_block_add(__wsum csum, __wsum csum2, int offset); -__wsum csum_block_sub(__wsum, __wsum, int); -__wsum csum_sub(__wsum csum, __wsum addend); -__wsum csum_unfold(__sum16 n); - -static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum) -{ - return csum_partial(buff, len, sum); -} - -__wsum csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len); - -void csum_replace2(__sum16 *, __be16, __be16); - -static inline void remcsum_unadjust(__sum16 *psum, __wsum delta) { - *psum = csum_fold(csum_sub(delta, *psum)); } - - -/***************************** - ** uapi/linux/net_tstamp.h ** - *****************************/ - -#include -#include - -enum { - SOF_TIMESTAMPING_TX_HARDWARE = 1 << 0, - SOF_TIMESTAMPING_TX_SOFTWARE = 1 << 1, - SOF_TIMESTAMPING_RX_HARDWARE = 1 << 2, - SOF_TIMESTAMPING_RX_SOFTWARE = 1 << 3, - SOF_TIMESTAMPING_SOFTWARE = 1 << 4, - SOF_TIMESTAMPING_SYS_HARDWARE = 1 << 5, - SOF_TIMESTAMPING_RAW_HARDWARE = 1 << 6, - SOF_TIMESTAMPING_OPT_ID = 1 << 7, - SOF_TIMESTAMPING_TX_ACK = 1 << 9, - SOF_TIMESTAMPING_OPT_CMSG = 1 << 10, - SOF_TIMESTAMPING_OPT_TSONLY = 1 << 11, - SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_RAW_HARDWARE - 1) | - SOF_TIMESTAMPING_RAW_HARDWARE, -}; - - -struct rtnl_link_ops -{ - struct list_head list; - const char *kind; - size_t priv_size; - void (*setup)(struct net_device *dev); - int maxtype; - const struct nla_policy *policy; - void (*dellink)(struct net_device *dev, - struct list_head *head); - size_t (*get_size)(const struct net_device *dev); - size_t (*get_xstats_size)(const struct net_device *dev); - - int (*fill_info)(struct sk_buff *skb, - const struct net_device *dev); - int (*fill_xstats)(struct sk_buff *skb, - const struct net_device *dev); - unsigned int (*get_num_tx_queues)(void); - unsigned int (*get_num_rx_queues)(void); - int (*changelink)(struct net_device *dev, - struct nlattr *tb[], - struct nlattr *data[]); - int (*validate)(struct nlattr *tb[], - struct nlattr *data[]); - int (*newlink)(struct net *src_net, - struct net_device *dev, - struct nlattr *tb[], - struct nlattr *data[]); -}; - -struct rtnl_af_ops -{ - struct list_head list; - int family; - - size_t (*get_link_af_size)(const struct net_device *dev); - int (*fill_link_af)(struct sk_buff *skb, - const struct net_device *dev); - int (*validate_link_af)(const struct net_device *dev, - const struct nlattr *attr); - int (*set_link_af)(struct net_device *dev, - const struct nlattr *attr); -}; - -typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); -typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); -typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *); - -#define rtnl_dereference(p) p - -extern const struct nla_policy ifla_policy[IFLA_MAX+1]; - -void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change, gfp_t flags); - - -/********************** - ** net/gent_stats.h ** - **********************/ - -struct gnet_dump { }; - - -/*************** - ** net/tcp.h ** - ***************/ - -enum { - TFO_SERVER_ENABLE = 2, - TFO_SERVER_WO_SOCKOPT1 = 0x400, - TFO_SERVER_WO_SOCKOPT2 = 0x800, -}; - -extern int sysctl_tcp_fastopen; - - -/********************** - ** net/ip_tunnels.h ** - **********************/ - -enum -{ - IP_TUNNEL_INFO_TX = 0x01, - IP_TUNNEL_INFO_IPV6 = 0x02, -}; - -struct ip_tunnel_key { - __be64 tun_id; - union { - struct { - __be32 src; - __be32 dst; - } ipv4; - struct { - struct in6_addr src; - struct in6_addr dst; - } ipv6; - } u; - __be16 tun_flags; - u8 tos; /* TOS for IPv4, TC for IPv6 */ - u8 ttl; /* TTL for IPv4, HL for IPv6 */ - __be16 tp_src; - __be16 tp_dst; -}; - -struct ip_tunnel_info -{ - struct ip_tunnel_key key; - - u8 options_len; - u8 mode; -}; - -void ip_tunnel_key_init(struct ip_tunnel_key *key, - __be32 saddr, __be32 daddr, - u8 tos, u8 ttl, - __be16 tp_src, __be16 tp_dst, - __be64 tun_id, __be16 tun_flags); - -struct lwtunnel_state; -struct ip_tunnel_info *lwt_tun_info(struct lwtunnel_state *lwtstate); -struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md, gfp_t flags); - -void ip_tunnel_core_init(void); - - -/******************************** - ** uapi/asm-generic/sockios.h ** - ********************************/ - -enum { - SIOCATMARK = 0x8905, - SIOCGSTAMP = 0x8906, - SIOCGSTAMPNS = 0x8907, -}; - - -/********************** - ** net/cls_cgroup.h ** - **********************/ - -void sock_update_classid(struct sock *); - - -/**************** - ** linux/ip.h ** - ****************/ - -#include - -struct ip_hdr; - -struct iphdr *ip_hdr(const struct sk_buff *skb); - - -/************************* - ** uapi/linux/icmpv6.h ** - *************************/ - -enum -{ - ICMPV6_ECHO_REQUEST = 128, -}; - - -struct icmp6hdr -{ - __u8 icmp6_type; - __u8 icmp6_code; -}; - - -/******************** - ** linux/icmpv6.h ** - ********************/ - -struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb); - - -/*********************** - ** uapi/linux/ipv6.h ** - ***********************/ - -struct ipv6hdr -{ - __u8 priority:4, version:4; - __be16 payload_len; - __u8 hop_limit; - __u8 nexthdr; - struct in6_addr saddr; - struct in6_addr daddr; -}; - -struct ipv6_opt_hdr -{ - __u8 nexthdr; - __u8 hdrlen; -} __attribute__((packed)); - -struct frag_hdr -{ - __u8 nexthdr; - /* __u8 reserved; */ - __be16 frag_off; - /* __be32 identification; */ -}; - - -static inline __u8 ipv6_get_dsfield(const struct ipv6hdr *ipv6h); - -struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb); - - -/******************************** - ** uapi/linux/netfilter_arp.h ** - ********************************/ - -enum { - NF_ARP_IN = 0, - NF_ARP_OUT = 1, -}; - - -/*************************** - ** uapi/linux/lwtunnel.h ** - ***************************/ - -enum lwtunnel_encap_types -{ - LWTUNNEL_ENCAP_NONE, -}; - - -/******************** - ** net/lwtunnel.h ** - ********************/ - -struct lwtunnel_state -{ - int (*orig_output)(struct net *net, struct sock *sk, struct sk_buff *skb); - int (*orig_input)(struct sk_buff *); -}; - -static inline int lwtunnel_output(struct net *net, struct sock *sk, struct sk_buff *skb) -{ - return -EOPNOTSUPP; -} - -static inline int lwtunnel_input(struct sk_buff *skb) -{ - return -EOPNOTSUPP; -} - -static inline int lwtunnel_build_state(struct net_device *dev, u16 encap_type, - struct nlattr *encap, - unsigned int family, const void *cfg, - struct lwtunnel_state **lws) -{ - return -EOPNOTSUPP; -} - -void lwtstate_free(struct lwtunnel_state *lws); -void lwtstate_put(struct lwtunnel_state *lws); -int lwtunnel_fill_encap(struct sk_buff *skb, struct lwtunnel_state *lwtstate); - -static inline bool lwtunnel_output_redirect(struct lwtunnel_state *lwtstate) { return false; } -static inline bool lwtunnel_input_redirect(struct lwtunnel_state *lwtstate) { return false; } - -struct lwtunnel_state * lwtstate_get(struct lwtunnel_state *lws); -int lwtunnel_cmp_encap(struct lwtunnel_state *a, struct lwtunnel_state *b); -int lwtunnel_get_encap_size(struct lwtunnel_state *lwtstate); - - -/**************** - ** net/ax25.h ** - ****************/ - -enum { AX25_P_IP = 0xcc }; - - -/******************** - ** net/addrconf.h ** - ********************/ - -enum { - ADDR_CHECK_FREQUENCY = (120*HZ), - ADDRCONF_TIMER_FUZZ_MINUS = (HZ > 50 ? HZ / 50 : 1), - ADDRCONF_TIMER_FUZZ = (HZ / 4), - ADDRCONF_TIMER_FUZZ_MAX = (HZ), -}; - -unsigned long addrconf_timeout_fixup(u32, unsigned int); -int addrconf_finite_timeout(unsigned long); - - -/*********************** - ** uapi/linux/xfrm.h ** - ***********************/ - -enum { - XFRM_POLICY_IN = 0, - XFRM_POLICY_FWD = 2, - - XFRM_MAX_DEPTH = 6, - XFRM_STATE_ICMP = 16, -}; - - -/**************** - ** net/xfrm.h ** - ****************/ - -struct flowi; -struct xfrm_state -{ - struct - { - u8 flags; - } props; -}; - -struct sec_path -{ - int len; - struct xfrm_state *xvec[XFRM_MAX_DEPTH]; -}; - -int xfrm_sk_clone_policy(struct sock *, const struct sock *osk); -int xfrm_decode_session_reverse(struct sk_buff *, struct flowi *, - unsigned int); -void xfrm_sk_free_policy(struct sock *); -int xfrm4_policy_check(struct sock *sk, int, struct sk_buff *); -int xfrm4_policy_check_reverse(struct sock *, int, struct sk_buff *); -int xfrm4_route_forward(struct sk_buff *); -int xfrm_user_policy(struct sock *, int, u8 *, int); -void secpath_reset(struct sk_buff *); -int secpath_exists(struct sk_buff *); - - -/********************* - ** net/incet_ecn.h ** - *********************/ - -enum { - INET_ECN_CE = 3, - INET_ECN_MASK = 3, -}; - - -/****************** - ** linux/igmp.h ** - ******************/ - -extern int sysctl_igmp_max_msf; - -struct in_device; -struct ip_mreqn; -struct ip_msfilter; -struct ip_mreq_source; -struct group_filter; - -int ip_check_mc_rcu(struct in_device *, __be32, __be32, u16); - -void ip_mc_init_dev(struct in_device *); -void ip_mc_up(struct in_device *); -void ip_mc_down(struct in_device *); -void ip_mc_destroy_dev(struct in_device *); -void ip_mc_drop_socket(struct sock *); -int ip_mc_gsfget(struct sock *, struct group_filter *, struct group_filter *, int *); -int ip_mc_join_group(struct sock *, struct ip_mreqn *); -int ip_mc_leave_group(struct sock *, struct ip_mreqn *); -int ip_mc_msfilter(struct sock *, struct ip_msfilter *,int); -int ip_mc_msfget(struct sock *, struct ip_msfilter *, struct ip_msfilter *, int *); -void ip_mc_remap(struct in_device *); -int ip_mc_sf_allow(struct sock *, __be32, __be32, int); -int ip_mc_source(int, int, struct sock *, struct ip_mreq_source *, int); -void ip_mc_unmap(struct in_device *); - - -/************************** - ** uapi/linux/pkg_sched ** - **************************/ - -#include - -enum { - TC_PRIO_BESTEFFORT = 0, - TC_PRIO_BULK = 2, - TC_PRIO_INTERACTIVE_BULK = 4, - TC_PRIO_INTERACTIVE = 6, -}; - - -/*********************** - ** net/inet_common.h ** - ***********************/ - -int __inet_stream_connect(struct socket *, struct sockaddr *, int, int); -void inet_sock_destruct(struct sock *); -int inet_ctl_sock_create(struct sock **, unsigned short, - unsigned short, unsigned char, - struct net *); -void inet_ctl_sock_destroy(struct sock *); -int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len); - - -/*********************** - ** linux/inet_diag.h ** - ***********************/ - -struct inet_hashinfo; - -struct inet_diag_handler -{ - void (*dump)(struct sk_buff *skb, - struct netlink_callback *cb, - struct inet_diag_req_v2 *r, - struct nlattr *bc); - - int (*dump_one)(struct sk_buff *in_skb, - const struct nlmsghdr *nlh, - struct inet_diag_req_v2 *req); - - void (*idiag_get_info)(struct sock *sk, - struct inet_diag_msg *r, - void *info); - __u16 idiag_type; - __u16 idiag_info_size; -}; - - -void inet_diag_dump_icsk(struct inet_hashinfo *, struct sk_buff *, - struct netlink_callback *, const struct inet_diag_req_v2 *, - struct nlattr *); -int inet_diag_dump_one_icsk(struct inet_hashinfo *, struct sk_buff *, - const struct nlmsghdr *, const struct inet_diag_req_v2 *); - -int inet_diag_register(const struct inet_diag_handler *); -void inet_diag_unregister(const struct inet_diag_handler *); - - -/******************** - ** net/inet_ecn.h ** - ********************/ - -enum { - INET_ECN_NOT_ECT = 0, -}; - -int INET_ECN_is_not_ect(__u8); -void INET_ECN_xmit(struct sock *); -void INET_ECN_dontxmit(struct sock *); - - -/***************** - ** net/xfrm4.h ** - *****************/ - -int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb); - - -/********************* - ** linux/netpoll.h ** - *********************/ - -struct napi_struct; - -void *netpoll_poll_lock(struct napi_struct *); -int netpoll_rx_disable(struct net_device *); -void netpoll_rx_enable(struct net_device *); -bool netpoll_rx(struct sk_buff *); -bool netpoll_rx_on(struct sk_buff *); -int netpoll_receive_skb(struct sk_buff *); -void netpoll_poll_unlock(void *); - -void netpoll_poll_disable(struct net_device *dev); -void netpoll_poll_enable(struct net_device *dev); - - -/************************ - ** net/ethernet/eth.c ** - ************************/ - -extern const struct header_ops eth_header_ops; - - -/*********************** - ** linux/netfilter.h ** - ***********************/ - -#define NF_HOOK(pf, hook, net, sk, skb, indev, outdev, okfn) (okfn)(net, sk, skb) -#define NF_HOOK_COND(pf, hook, net, sk, skb, indev, outdev, okfn, cond) (okfn)(net, sk, skb) - -int nf_hook(u_int8_t pf, unsigned int hook, struct net *net, - struct sock *sk, struct sk_buff *skb, - struct net_device *indev, struct net_device *outdev, - int (*okfn)(struct net *, struct sock *, struct sk_buff *)); -void nf_ct_attach(struct sk_buff *, struct sk_buff *); - - -/******************************* - ** linux/netfilter_ingress.h ** - *******************************/ - -void nf_hook_ingress_init(struct net_device *dev); - - -/****************************** - ** linux/netfilter_bridge.h ** - ******************************/ - -unsigned int nf_bridge_pad(const struct sk_buff *); - - -/**************** - ** linux/in.h ** - ****************/ - -bool ipv4_is_local_multicast(__be32); - -#define INADDR_BROADCAST ((unsigned long int) 0xffffffff) - -static inline bool ipv4_is_multicast(__be32 addr) -{ - return (addr & htonl(0xf0000000)) == htonl(0xe0000000); -} - -static inline bool ipv4_is_zeronet(__be32 addr) -{ - return (addr & htonl(0xff000000)) == htonl(0x00000000); -} - -static inline bool ipv4_is_lbcast(__be32 addr) -{ - /* limited broadcast */ - return addr == htonl(INADDR_BROADCAST); -} - -static inline bool ipv4_is_loopback(__be32 addr) -{ - return (addr & htonl(0xff000000)) == htonl(0x7f000000); -} - -#define IP_FMT "%u.%u.%u.%u" -#define IP_ARG(x) (x >> 0) & 0xff, (x >> 8) & 0xff, (x >> 16) & 0xff, (x >> 24) & 0xff -#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" -#define MAC_ARG(x) x[0], x[1], x[2], x[3], x[4], x[5] - -#define __UAPI_DEF_IPPROTO_V6 1 -#define __UAPI_DEF_IN6_ADDR 1 -#include -#undef __UAPI_DEF_IN6_ADDR -#undef __UAPI_DEF_IPPROTO_V6 - -#define __UAPI_DEF_IN_IPPROTO 1 -#define __UAPI_DEF_IN_ADDR 1 -#define __UAPI_DEF_SOCKADDR_IN 1 -#define __UAPI_DEF_IN_CLASS 1 -#define __UAPI_DEF_IP_MREQ 1 -#define __UAPI_DEF_IN_PKTINFO 1 -#include -#undef __UAPI_DEF_IN_PKTINFO -#undef __UAPI_DEF_IP_MREQ -#undef __UAPI_DEF_IN_CLASS -#undef __UAPI_DEF_SOCKADDR_IN -#undef __UAPI_DEF_IN_IPPROTO -#undef __UAPI_DEF_IN_ADDR - - -/******************** - ** linux/random.h ** - ********************/ - -void get_random_bytes(void *buf, int nbytes); - -#define get_random_once(buf, nbytes) \ - ({ \ - static bool initialized = false; \ - if (!initialized) { \ - get_random_bytes((buf), (nbytes)); \ - initialized = true; \ - } \ - }) - -u32 prandom_u32(void); - -static inline void prandom_bytes(void *buf, size_t nbytes) -{ - get_random_bytes(buf, nbytes); -} - -u32 random32(void); -void add_device_randomness(const void *, unsigned int); -u32 next_pseudo_random32(u32); -void srandom32(u32 seed); -u32 prandom_u32_max(u32 ep_ro); -void prandom_seed(u32 seed); - - -/********************** - ** linux/security.h ** - **********************/ - -struct request_sock; - -void security_sock_graft(struct sock *, struct socket *); -void security_sk_classify_flow(struct sock *, struct flowi *); -int security_socket_getpeersec_stream(struct socket *, char *, int *, unsigned ); -int security_sk_alloc(struct sock *, int, gfp_t); -void security_sk_free(struct sock *); -void security_req_classify_flow(const struct request_sock *, struct flowi *); -int security_inet_conn_request(struct sock *, struct sk_buff *, struct request_sock *); -void security_inet_csk_clone(struct sock *, const struct request_sock *); -int security_socket_getpeersec_dgram(struct socket *, struct sk_buff *, u32 *); -int security_secid_to_secctx(u32 secid, char **secdata, u32 *); -void security_release_secctx(char *secdata, u32 seclen); -void security_skb_classify_flow(struct sk_buff *, struct flowi *); -void security_skb_owned_by(struct sk_buff *, struct sock *); -void security_inet_conn_established(struct sock *, struct sk_buff *); -int security_netlink_send(struct sock *, struct sk_buff *); - - -/********************** - ** net/netns/hash.h ** - **********************/ - -unsigned int net_hash_mix(struct net const *); - - -/************************** - ** net/netprio_cgroup.h ** - **************************/ - -void sock_update_netprioidx(struct sock *); - - -/**************** - ** net/ipv6.h ** - ****************/ - -enum { - IP6_MF = 0x0001, - IP6_OFFSET = 0xfff8, -}; - - -/****************** - ** linux/ipv6.h ** - ******************/ - -struct inet6_skb_parm { unsigned dummy; }; - -int inet_v6_ipv6only(const struct sock *); -int ipv6_only_sock(const struct sock *); - -#define ipv6_optlen(p) (((p)->hdrlen+1) << 3) -#define ipv6_authlen(p) (((p)->hdrlen+2) << 2) -#define ipv6_sk_rxinfo(sk) 0 - -/* XXX not the sanest thing to do... */ -struct ipv6_pinfo { - __u16 recverr:1; -}; -static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) { return NULL; } - - -/******************** - ** linux/mroute.h ** - ********************/ - -int ip_mroute_opt(int); -int ip_mroute_getsockopt(struct sock *, int, char*, int *); -int ip_mroute_setsockopt(struct sock *, int, char *, unsigned int); - - -/****************** - ** linux/inet.h ** - ******************/ - -__be32 in_aton(const char *); - - -/********************** - ** net/cipso_ipv4.h ** - **********************/ - -int cipso_v4_validate(const struct sk_buff *, unsigned char **option); - - -/*********************** - ** uapi/linux/stat.h ** - ***********************/ - -bool S_ISSOCK(int); - - -/********************* - ** net/gen_stats.h ** - *********************/ - -struct gnet_stats_basic_cpu { - unsigned bstats; /* normally gnet_stats_basic_packed */ - unsigned syncp; /* normally u64_stats_sync */ -}; - -struct gnet_stats_basic_packed; -struct gnet_stats_rate_est; - -void gen_kill_estimator(struct gnet_stats_basic_packed *, - struct gnet_stats_rate_est *); - - -/******************* - ** linux/sysfs.h ** - *******************/ - -struct attribute { - const char *name; - mode_t mode; -}; - -int sysfs_create_link(struct kobject *kobj, struct kobject *target, const char *name); -void sysfs_remove_link(struct kobject *kobj, const char *name); -void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name, const char *link_name); - - -/********************* - ** net/pusy_poll.h ** - *********************/ - -bool sk_busy_loop(struct sock *sk, int nonblock); -bool sk_can_busy_loop(struct sock *sk); -void sk_mark_napi_id(struct sock *sk, struct sk_buff *skb); - - -/****************** - ** net/l3mdev.h ** - ******************/ - -int l3mdev_get_saddr(struct net *net, int ifindex, struct flowi4 *fl4); -struct rtable *l3mdev_get_rtable(const struct net_device *dev, const struct flowi4 *fl4); -bool netif_index_is_l3_master(struct net *net, int ifindex); -u32 l3mdev_fib_table(const struct net_device *dev); -int l3mdev_master_ifindex_rcu(struct net_device *dev); -int l3mdev_fib_oif_rcu(struct net_device *dev); -u32 l3mdev_fib_table_by_index(struct net *net, int ifindex); -int l3mdev_master_ifindex(struct net_device *dev); - - -/*********************** - ** linux/sock_diag.h ** - ***********************/ - -bool sock_diag_has_destroy_listeners(const struct sock *sk); -void sock_diag_broadcast_destroy(struct sock *sk); - - -/************************ - ** net/ip6_checksum.h ** - ************************/ - -__sum16 csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, - __u32 len, unsigned short proto, __wsum csum); - - -/*********************** - ** linux/switchdev.h ** - ***********************/ - -struct fib_info; - -int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, u8 tos, u8 type, u32 nlflags, u32 tb_id); -int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, u8 tos, u8 type, u32 tb_id); -void switchdev_fib_ipv4_abort(struct fib_info *fi); - - -/******************* - ** Tracing stuff ** - *******************/ - -struct proto; - -void trace_kfree_skb(struct sk_buff *, void *); -void trace_consume_skb(struct sk_buff *); -void trace_sock_exceed_buf_limit(struct sock *, struct proto *, long); -void trace_sock_rcvqueue_full(struct sock *, struct sk_buff *); -void trace_net_dev_xmit(struct sk_buff *, int , struct net_device *, - unsigned int); -void trace_net_dev_queue(struct sk_buff *); -void trace_netif_rx(struct sk_buff *); -void trace_netif_receive_skb(struct sk_buff *); -void trace_napi_poll(struct napi_struct *); -void trace_skb_copy_datagram_iovec(const struct sk_buff *, int); -void trace_udp_fail_queue_rcv_skb(int, struct sock*); -void trace_net_dev_start_xmit(struct sk_buff*, struct net_device*); -void trace_netif_rx_entry(struct sk_buff*); -void trace_netif_rx_ni_entry(struct sk_buff*); -void trace_netif_receive_skb_entry(struct sk_buff*); -void trace_napi_gro_receive_entry(struct sk_buff*); -void trace_napi_gro_frags_entry(struct sk_buff*); -void trace_fib_validate_source(const struct net_device *, const struct flowi4 *); -void trace_fib_table_lookup(const void *, const void *); -void trace_fib_table_lookup_nh(const void *); - - -/****************** - ** Lxip private ** - ******************/ - -void set_sock_wait(struct socket *sock, unsigned long ptr); -int socket_check_state(struct socket *sock); -void log_sock(struct socket *sock); - -void lx_trace_event(char const *, ...) __attribute__((format(printf, 1, 2))); - -#include - -#endif /* _LX_EMUL_H_ */ diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/msghdr.h b/repos/dde_linux/src/lib/legacy_lxip/include/msghdr.h deleted file mode 100644 index bbd43ebc23..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/msghdr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * \brief Complete initialization of msghdr - * \author Christian Helmuth - * \date 2017-05-29 - */ - -/* - * Copyright (C) 202017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _MSGHDR_H_ -#define _MSGHDR_H_ - -#include -#include -#include - - -static inline msghdr create_msghdr(void *name, int namelen, size_t datalen, - struct iovec *iov) -{ - msghdr msg; - - msg.msg_name = name; - msg.msg_namelen = namelen; - msg.msg_iter.type = 0; - msg.msg_iter.iov_offset = 0; - msg.msg_iter.count = datalen; - msg.msg_iter.iov = iov; - msg.msg_iter.nr_segs = 1; - msg.msg_control = nullptr; - msg.msg_controllen = 0; - msg.msg_flags = 0; - msg.msg_iocb = nullptr; - - return msg; -} - -#endif /* _MSGHDR_H_ */ diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/net/fib_rules.h b/repos/dde_linux/src/lib/legacy_lxip/include/net/fib_rules.h deleted file mode 100644 index 8d57665181..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/net/fib_rules.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/net/gen_stats.h b/repos/dde_linux/src/lib/legacy_lxip/include/net/gen_stats.h deleted file mode 100644 index be44e8e9bf..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/net/gen_stats.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/net/inet_ecn.h b/repos/dde_linux/src/lib/legacy_lxip/include/net/inet_ecn.h deleted file mode 100644 index 3f3cc1850a..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/net/inet_ecn.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/net/xfrm.h b/repos/dde_linux/src/lib/legacy_lxip/include/net/xfrm.h deleted file mode 100644 index cb4d699137..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/net/xfrm.h +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -struct ipv6hdr; - -#include diff --git a/repos/dde_linux/src/lib/legacy_lxip/include/nic.h b/repos/dde_linux/src/lib/legacy_lxip/include/nic.h deleted file mode 100644 index e727c44114..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/include/nic.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * \brief C back-end - * \author Sebastian Sumpf - * \date 2013-09-09 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _INCLUDE__NIC_H_ -#define _INCLUDE__NIC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -void net_mac(void* mac, unsigned long size); -int net_tx(void* addr, unsigned long len); -void net_driver_rx(void *addr, unsigned long size); - -#ifdef __cplusplus -} -#endif -#endif /* _INCLUDE__NIC_H_ */ diff --git a/repos/dde_linux/src/lib/legacy_lxip/lx.h b/repos/dde_linux/src/lib/legacy_lxip/lx.h deleted file mode 100644 index bc5f12c53e..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/lx.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * \brief Lx env - * \author Josef Soentgen - * \author Emery Hemingway - * \date 2014-10-17 - */ - -/* - * Copyright (C) 2014-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _LX_H_ -#define _LX_H_ - -#include -#include - -namespace Lx_kit { class Env; } - -namespace Lx { - - void nic_client_init(Genode::Env &env, - Genode::Allocator &alloc, - void (*ticker)()); - - void timer_init(Genode::Entrypoint &ep, - ::Timer::Connection &timer, - Genode::Allocator &alloc, - void (*ticker)()); - - void timer_update_jiffies(); - - void lxcc_emul_init(Lx_kit::Env &env); -} - -extern "C" void lxip_init(); - -extern "C" void lxip_configure_static(char const *addr, - char const *netmask, - char const *gateway, - char const *nameserver); -extern "C" void lxip_configure_dhcp(); -extern "C" void lxip_configure_mtu(unsigned mtu); - -extern "C" bool lxip_do_dhcp(); - -#endif /* _LX_H_ */ diff --git a/repos/dde_linux/src/lib/legacy_lxip/lxc_emul.c b/repos/dde_linux/src/lib/legacy_lxip/lxc_emul.c deleted file mode 100644 index 0d242fe0f5..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/lxc_emul.c +++ /dev/null @@ -1,610 +0,0 @@ -/* - * \brief Linux emulation code - * \author Sebastian Sumpf - * \author Josef Soentgen - * \date 2013-08-30 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Linux includes */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/*********************** - ** linux/genetlink.h ** - ***********************/ - -/* needed by af_netlink.c */ -atomic_t genl_sk_destructing_cnt; -wait_queue_head_t genl_sk_destructing_waitq; - - -/**************************** - ** asm-generic/atomic64.h ** - ****************************/ - -long long atomic64_read(const atomic64_t *v) -{ - return v->counter; -} - - -void atomic64_set(atomic64_t *v, long long i) -{ - v->counter = i; -} - - -/******************** - ** linux/bitmap.h ** - ********************/ - -void bitmap_fill(unsigned long *dst, int nbits) -{ - int count = nbits / (8 * sizeof (long)); - int i; - - memset(dst, 0xff, count * sizeof(long)); - dst += count; - - count = nbits % (8 * sizeof(long)); - - for (i = 0; i < count; i++) - *dst |= (1 << i); -} - - -void bitmap_zero(unsigned long *dst, int nbits) -{ - int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); - memset(dst, 0, len); -} - - -/***************** - ** linux/gfp.h ** - *****************/ - -unsigned long get_zeroed_page(gfp_t gfp_mask) -{ - return (unsigned long)kzalloc(PAGE_SIZE, 0); -} - - -/******************** - ** linux/percpu.h ** - ********************/ - -void *__alloc_percpu(size_t size, size_t align) -{ - return kzalloc(size, 0); -} - - -/****************** - ** linux/hash.h ** - ******************/ - -u32 hash_32(u32 val, unsigned int bits) -{ - enum { GOLDEN_RATIO_PRIME_32 = 0x9e370001UL }; - u32 hash = val * GOLDEN_RATIO_PRIME_32; - - hash = hash >> (32 - bits); - return hash; -} - - -/****************** - ** linux/dcache ** - ******************/ - -unsigned int full_name_hash(const unsigned char *name, unsigned int len) -{ - unsigned hash = 0, i; - for (i = 0; i < len; i++) - hash += name[i]; - - return hash; -} - - -/****************************** - * net/core/net/namespace.h ** - ******************************/ - -int register_pernet_subsys(struct pernet_operations *ops) -{ - if (ops->init) - ops->init(&init_net); - - return 0; -} - -int register_pernet_device(struct pernet_operations *ops) -{ - return register_pernet_subsys(ops); -} - - -/************************* - ** net/net_namespace.h ** - *************************/ - -int rt_genid(struct net *net) -{ - int ret = atomic_read(&net->rt_genid); - return -1; -} - -int rt_genid_ipv4(struct net *net) -{ - return atomic_read(&net->ipv4.rt_genid); -} - -void rt_genid_bump_ipv4(struct net *net) -{ - atomic_inc(&net->ipv4.rt_genid); -} - -/********************** - ** linx/rtnetlink.h ** - **********************/ - -struct netdev_queue *dev_ingress_queue(struct net_device *dev) -{ - return dev->ingress_queue; -} - -void rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group, - struct nlmsghdr *nlh, gfp_t flags) -{ - nlmsg_free(skb); -} - - -/**************** - ** linux/ip.h ** - ****************/ - -struct iphdr *ip_hdr(const struct sk_buff *skb) -{ - return (struct iphdr *)skb_network_header(skb); -} - - -/******************************* - ** asm-generic/bitops/find.h ** - *******************************/ - -unsigned long find_first_zero_bit(unsigned long const *addr, unsigned long size) -{ - unsigned long i, j; - - for (i = 0; i < (size / BITS_PER_LONG); i++) - if (addr[i] != ~0UL) - break; - - if (i == size) - return size; - - for (j = 0; j < BITS_PER_LONG; j++) - if ((~addr[i]) & (1 << j)) - break; - - return (i * BITS_PER_LONG) + j; -} - - -/**************************** - ** asm-generic/getorder.h ** - ****************************/ - -int get_order(unsigned long size) -{ - int order; - - size--; - size >>= PAGE_SHIFT; - - order = __builtin_ctzl(size); - return order; -} - - -/********************* - ** linux/jiffies.h ** - *********************/ - -clock_t jiffies_to_clock_t(unsigned long j) -{ - return j / HZ; /* XXX not sure if this is enough */ -} - - -/********************* - ** linux/utsname.h ** - *********************/ - -struct uts_name init_uts_ns; - -struct new_utsname *init_utsname(void) { return &init_uts_ns.name; } -struct new_utsname *utsname(void) { return init_utsname(); } - - -/********************** - ** linux/notifier.h ** - **********************/ - -int raw_notifier_chain_register(struct raw_notifier_head *nh, - struct notifier_block *n) -{ - struct notifier_block *nl = nh->head; - struct notifier_block *pr = 0; - while (nl) { - if (n->priority > nl->priority) - break; - pr = nl; - nl = nl->next; - } - - n->next = nl; - if (pr) - pr->next = n; - else - nh->head = n; - - return 0; -} - - -int raw_notifier_call_chain(struct raw_notifier_head *nh, - unsigned long val, void *v) -{ - int ret = NOTIFY_DONE; - struct notifier_block *nb = nh->head; - - while (nb) { - - ret = nb->notifier_call(nb, val, v); - if ((ret & NOTIFY_STOP_MASK) == NOTIFY_STOP_MASK) - break; - - nb = nb->next; - } - - return ret; -} - - -int blocking_notifier_chain_register(struct blocking_notifier_head *nh, - struct notifier_block *n) -{ - return raw_notifier_chain_register((struct raw_notifier_head *)nh, n); -} - - -int blocking_notifier_call_chain(struct blocking_notifier_head *nh, - unsigned long val, void *v) -{ - return raw_notifier_call_chain((struct raw_notifier_head *)nh, val, v); -} - - -/**************************** - ** asm-generic/checksum.h ** - ****************************/ - -__sum16 csum_fold(__wsum csum) -{ - u32 sum = (u32)csum; - sum = (sum & 0xffff) + (sum >> 16); - sum = (sum & 0xffff) + (sum >> 16); - return (__sum16)~sum; -} - - -/******************* -** net/checksum.h ** -********************/ - -__wsum csum_add(__wsum csum, __wsum addend) -{ - u32 res = (u32)csum; - res += (u32)addend; - return (__wsum)(res + (res < (u32)addend)); -} - - -__wsum csum_block_add(__wsum csum, __wsum csum2, int offset) -{ - u32 sum = (u32)csum2; - if (offset&1) - sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF); - return csum_add(csum, (__wsum)sum); -} - - -__wsum csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len) -{ - return csum_block_add(csum, csum2, offset); -} - - -/*************************** - ** Linux socket function ** - ***************************/ - -static const struct net_proto_family *net_families[NPROTO]; - - -int sock_register(const struct net_proto_family *ops) -{ - if (ops->family >= NPROTO) { - printk("protocol %d >= NPROTO (%d)\n", ops->family, NPROTO); - return -ENOBUFS; - } - - net_families[ops->family] = ops; - pr_info("NET: Registered protocol family %d\n", ops->family); - return 0; -} - - -struct socket *sock_alloc(void) -{ - struct socket *sock = (struct socket *)kzalloc(sizeof(struct socket), 0); - - /* - * Linux normally allocates the socket_wq when calling - * sock_alloc_inode() while we do it here hoping for the best. - */ - sock->wq = (struct socket_wq*)kzalloc(sizeof(*sock->wq), 0); - if (!sock->wq) { - kfree(sock); - return NULL; - } - - return sock; -} - - -int sock_create_lite(int family, int type, int protocol, struct socket **res) - -{ - struct socket *sock = sock_alloc(); - - if (!sock) - return -ENOMEM; - - sock->type = type; - *res = sock; - return 0; -} - - -int sock_create_kern(struct net *net, int family, int type, int proto, - struct socket **res) -{ - struct socket *sock; - const struct net_proto_family *pf; - int err; - - if (family < 0 || family > NPROTO) - return -EAFNOSUPPORT; - - if (type < 0 || type > SOCK_MAX) - return -EINVAL; - - pf = net_families[family]; - - if (!pf) { - printk("No protocol found for family %d\n", family); - return -ENOPROTOOPT; - } - - sock = sock_alloc(); - if (!sock) { - printk("Could not allocate socket\n"); - return -ENFILE; - } - - sock->type = type; - - err = pf->create(&init_net, sock, proto, 1); - if (err) { - kfree(sock); - return err; - } - - *res = sock; - - return 0; -} - - -static void sock_init(void) -{ - skb_init(); -} - - -core_initcall(sock_init); - - -/************************* - ** Lxip initialization ** - *************************/ - -/* - * Header declarations and tuning - */ -struct net init_net; - -unsigned long *sysctl_local_reserved_ports; - - -/** - * nr_free_buffer_pages - count number of pages beyond high watermark - * - * nr_free_buffer_pages() counts the number of pages which are beyond the - * high - * watermark within ZONE_DMA and ZONE_NORMAL. - */ -unsigned long nr_free_buffer_pages(void) -{ - return 1000; -} - - -/* - * Declare stuff used - */ -int __ip_auto_config_setup(char *addrs); -void core_sock_init(void); -void core_netlink_proto_init(void); -void subsys_net_dev_init(void); -void fs_inet_init(void); -void module_driver_init(void); -void module_cubictcp_register(void); -void late_ip_auto_config(void); -void late_tcp_congestion_default(void); - - -int __set_thash_entries(char *str); -int __set_uhash_entries(char *str); - -static void lxip_kernel_params(void) -{ - __set_thash_entries("2048"); - __set_uhash_entries("2048"); -} - -/** - * Initialize sub-systems - */ -void lxip_init() -{ - /* init data */ - INIT_LIST_HEAD(&init_net.dev_base_head); - - core_sock_init(); - core_netlink_proto_init(); - - /* sub-systems */ - subsys_net_dev_init(); - - lxip_kernel_params(); - fs_inet_init(); - - /* enable local accepts */ - IPV4_DEVCONF_ALL(&init_net, ACCEPT_LOCAL) = 0x1; - - /* congestion control */ - module_cubictcp_register(); - - /* driver */ - module_driver_init(); - - /* late */ - late_tcp_congestion_default(); -} - - -/* - * Network configuration - */ -static void lxip_configure(char const *address_config) -{ - __ip_auto_config_setup((char *)address_config); - late_ip_auto_config(); -} - - -static bool dhcp_configured = false; -static bool dhcp_pending = false; - -void lxip_configure_mtu(unsigned mtu) -{ - /* zero mtu means reset to default */ - unsigned new_mtu = mtu ? mtu : ETH_DATA_LEN; - - struct net *net; - struct net_device *dev; - - for_each_net(net) { - for_each_netdev(net, dev) { - dev_set_mtu(dev, new_mtu); - } - } -} - - -void lxip_configure_static(char const *addr, char const *netmask, - char const *gateway, char const *nameserver) -{ - char address_config[128]; - - dhcp_configured = false; - - snprintf(address_config, sizeof(address_config), - "%s::%s:%s:::off:%s", - addr, gateway, netmask, nameserver); - lxip_configure(address_config); -} - - -void lxip_configure_dhcp() -{ - dhcp_configured = true; - dhcp_pending = true; - - lxip_configure("dhcp"); - dhcp_pending = false; -} - - -bool lxip_do_dhcp() -{ - return dhcp_configured && !dhcp_pending; -} - - -/****************** - ** Lxip private ** - ******************/ - -void set_sock_wait(struct socket *sock, unsigned long ptr) -{ - sock->sk->sk_wq = (struct socket_wq *)ptr; -} - - -int socket_check_state(struct socket *socket) -{ - if (socket->sk->sk_state == TCP_CLOSE_WAIT) - return -EINTR; - - return 0; -} - - -void log_sock(struct socket *socket) -{ - printk("\nNEW socket %p sk %p fsk %x &sk %p &fsk %p\n\n", - socket, socket->sk, socket->flags, &socket->sk, &socket->flags); -} diff --git a/repos/dde_linux/src/lib/legacy_lxip/lxcc_emul.cc b/repos/dde_linux/src/lib/legacy_lxip/lxcc_emul.cc deleted file mode 100644 index 33d153efaf..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/lxcc_emul.cc +++ /dev/null @@ -1,671 +0,0 @@ -/* - * \brief Linux emulation code - * \author Sebastian Sumpf - * \author Emery Hemingway - * \author Christian Helmuth - * \date 2013-08-28 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include -#include -#include -#include - -/* format-string includes */ -#include - -/* local includes */ -#include -#include - -/* Lx_kit */ -#include - -/********************************* - ** Lx::Backend_alloc interface ** - *********************************/ - -#include - -struct Memory_object_base; - -static Lx_kit::Env *lx_env; - -static Genode::Object_pool *memory_pool_ptr; - - -void Lx::lxcc_emul_init(Lx_kit::Env &env) -{ - static Genode::Object_pool memory_pool; - - memory_pool_ptr = &memory_pool; - - lx_env = &env; - - LX_MUTEX_INIT(dst_gc_mutex); - LX_MUTEX_INIT(proto_list_mutex); -} - - -struct Memory_object_base : Genode::Object_pool::Entry -{ - Memory_object_base(Genode::Ram_dataspace_capability cap) - : Genode::Object_pool::Entry(cap) {} - - void free() { lx_env->ram().free(ram_cap()); } - - Genode::Ram_dataspace_capability ram_cap() - { - using namespace Genode; - return reinterpret_cap_cast(cap()); - } -}; - - -Genode::Ram_dataspace_capability -Lx::backend_alloc(Genode::addr_t size, Genode::Cache) -{ - using namespace Genode; - - Genode::Ram_dataspace_capability cap = lx_env->ram().alloc(size); - Memory_object_base *o = new (lx_env->heap()) Memory_object_base(cap); - - memory_pool_ptr->insert(o); - return cap; -} - - -void Lx::backend_free(Genode::Ram_dataspace_capability cap) -{ - using namespace Genode; - - Memory_object_base *object; - memory_pool_ptr->apply(cap, [&] (Memory_object_base *o) { - if (!o) return; - - o->free(); - memory_pool_ptr->remove(o); - - object = o; /* save for destroy */ - }); - destroy(lx_env->heap(), object); -} - - -Genode::addr_t Lx::backend_dma_addr(Genode::Ram_dataspace_capability) -{ - return 0; -} - - -/************************************* - ** Memory allocation, linux/slab.h ** - *************************************/ - -#include - - -void *alloc_large_system_hash(const char *tablename, - unsigned long bucketsize, - unsigned long numentries, - int scale, - int flags, - unsigned int *_hash_shift, - unsigned int *_hash_mask, - unsigned long low_limit, - unsigned long high_limit) -{ - unsigned long elements = numentries ? numentries : high_limit; - unsigned long nlog2 = ilog2(elements); - nlog2 <<= (1 << nlog2) < elements ? 1 : 0; - - - return lx_env->heap().try_alloc(elements * bucketsize).convert( - - [&] (void *table_ptr) { - - if (_hash_mask) - *_hash_mask = (1 << nlog2) - 1; - - if (_hash_shift) - *_hash_shift = nlog2; - - return table_ptr; - }, - - [&] (Genode::Allocator::Alloc_error) -> void * { - Genode::error("alloc_large_system_hash allocation failed"); - return nullptr; - } - ); -} - - -void *kmalloc_array(size_t n, size_t size, gfp_t flags) -{ - if (size != 0 && n > SIZE_MAX / size) return NULL; - return kmalloc(n * size, flags); -} - - -/******************** - ** linux/slab.h ** - ********************/ - -void *kmem_cache_alloc_node(struct kmem_cache *cache, gfp_t flags, int node) -{ - return (void*)cache->alloc_element(); -} - -void *kmem_cache_zalloc(struct kmem_cache *cache, gfp_t flags) -{ - void *addr = (void*)cache->alloc_element(); - if (addr) { memset(addr, 0, cache->size()); } - - return addr; -} - - -/********************* - ** linux/vmalloc.h ** - *********************/ - -void *vmalloc(unsigned long size) -{ - return kmalloc(size, 0); -} - - -void vfree(void const *addr) -{ - kfree(addr); -} - - -/******************** - ** linux/string.h ** - ********************/ - -char *strcpy(char *to, const char *from) -{ - char *save = to; - for (; (*to = *from); ++from, ++to); - return(save); -} - - -char *strncpy(char *dst, const char* src, size_t n) -{ - Genode::copy_cstring(dst, src, n); - return dst; -} - - -char *strchr(const char *p, int ch) -{ - char c; - c = ch; - for (;; ++p) { - if (*p == c) - return ((char *)p); - if (*p == '\0') - break; - } - - return 0; -} - - -char *strnchr(const char *p, size_t count, int ch) -{ - char c; - c = ch; - for (; count; ++p, count--) { - if (*p == c) - return ((char *)p); - if (*p == '\0') - break; - } - - return 0; -} - - -size_t strnlen(const char *s, size_t maxlen) -{ - size_t c; - for (c = 0; c < maxlen; c++) - if (!s[c]) - return c; - - return maxlen; -} - - -size_t strlen(const char *s) { return Genode::strlen(s); } - - -int strcmp(const char *s1, const char *s2) { return Genode::strcmp(s1, s2); } - - -int strncmp(const char *s1, const char *s2, size_t len) { - return Genode::strcmp(s1, s2, len); } - - -int memcmp(const void *p0, const void *p1, size_t size) { - return Genode::memcmp(p0, p1, size); } - - -int snprintf(char *str, size_t size, const char *format, ...) -{ - va_list list; - va_start(list, format); - - Format::String_console sc(str, size); - sc.vprintf(format, list); - va_end(list); - - return sc.len(); -} - - -size_t strlcpy(char *dest, const char *src, size_t size) -{ - size_t ret = strlen(src); - - if (size) { - size_t len = (ret >= size) ? size - 1 : ret; - Genode::memcpy(dest, src, len); - dest[len] = '\0'; - } - return ret; -} - - -/* from linux/lib/string.c */ -char *strstr(char const *s1, char const *s2) -{ - size_t l1, l2; - - l2 = strlen(s2); - if (!l2) - return (char *)s1; - l1 = strlen(s1); - while (l1 >= l2) { - l1--; - if (!memcmp(s1, s2, l2)) - return (char *)s1; - s1++; - } - return NULL; -} - -void *memset(void *s, int c, size_t n) -{ - return Genode::memset(s, c, n); -} - - -void *memcpy(void *d, const void *s, size_t n) -{ - return Genode::memcpy(d, s, n); -} - - -void *memmove(void *d, const void *s, size_t n) -{ - return Genode::memmove(d, s, n); -} - - -/***************** - ** linux/gfp.h ** - *****************/ - -class Avl_page : public Genode::Avl_node -{ - private: - - Genode::addr_t _addr; - Genode::size_t _size; - struct page *_page; - - public: - - Avl_page(Genode::size_t size) : _size(size) - { - _addr =(Genode::addr_t)kmalloc(size, 0); - if (!_addr) - throw -1; - - _page = (struct page *) kzalloc(sizeof(struct page), 0); - if (!_page) { - kfree((void *)_addr); - throw -2; - } - - _page->addr = (void *)_addr; - atomic_set(&_page->_count, 1); - - lx_log(DEBUG_SLAB, "alloc page: %p addr: %lx-%lx", _page, _addr, _addr + _size); - } - - virtual ~Avl_page() - { - lx_log(DEBUG_SLAB, "free page: %p addr: %lx-%lx", _page, _addr, _addr + _size); - kfree((void *)_addr); - kfree((void *)_page); - } - - struct page* page() { return _page; } - - bool higher(Avl_page *c) - { - return c->_addr > _addr; - } - - Avl_page *find_by_address(Genode::addr_t addr) - { - if (addr >= _addr && addr < _addr + _size) - return this; - - bool side = addr > _addr; - Avl_page *c = Avl_node::child(side); - return c ? c->find_by_address(addr) : 0; - } -}; - - -static Genode::Avl_tree & tree() -{ - static Genode::Avl_tree _tree; - return _tree; -} - - -struct page *alloc_pages(gfp_t gfp_mask, unsigned int order) -{ - Avl_page *p; - try { - p = (Avl_page *)new (lx_env->heap()) Avl_page(PAGE_SIZE << order); - tree().insert(p); - } catch (...) { return 0; } - - return p->page(); -} - - -void *__alloc_page_frag(struct page_frag_cache *nc, - unsigned int fragsz, gfp_t gfp_mask) -{ - struct page *page = alloc_pages(gfp_mask, fragsz / PAGE_SIZE); - if (!page) return nullptr; - - return page->addr; -} - - -void __free_page_frag(void *addr) -{ - Avl_page *p = tree().first()->find_by_address((Genode::addr_t)addr); - - tree().remove(p); - destroy(lx_env->heap(), p); -} - - -/**************** - ** linux/mm.h ** - ****************/ - -struct page *virt_to_head_page(const void *x) -{ - Avl_page *p = tree().first()->find_by_address((Genode::addr_t)x); - lx_log(DEBUG_SLAB, "virt_to_head_page: %p page %p\n", x,p ? p->page() : 0); - - return p ? p->page() : 0; -} - - -void put_page(struct page *page) -{ - if (!atomic_dec_and_test(&page->_count)) - return; - - lx_log(DEBUG_SLAB, "put_page: %p", page); - Avl_page *p = tree().first()->find_by_address((Genode::addr_t)page->addr); - - tree().remove(p); - destroy(lx_env->heap(), p); -} - - -static void create_event(char const *fmt, va_list list) -{ - enum { BUFFER_LEN = 64, EVENT_LEN = BUFFER_LEN + 32 }; - char buf[BUFFER_LEN]; - - using namespace Genode; - - Format::String_console sc(buf, BUFFER_LEN); - sc.vprintf(fmt, list); - - char event[EVENT_LEN]; - static Trace::Timestamp last = 0; - Trace::Timestamp now = Trace::timestamp(); - Format::snprintf(event, sizeof(event), "delta = %llu ms %s", - (now - last) / 2260000, buf); - Thread::trace(event); - last = now; -} - - -extern "C" void lx_trace_event(char const *fmt, ...) -{ - va_list list; - va_start(list, fmt); - create_event(fmt, list); - va_end(list); -} - - -/***************** - ** linux/uio.h ** - *****************/ - -static inline size_t _copy_iter(void *addr, size_t bytes, - struct iov_iter *i, bool to_iter) -{ - if (addr == nullptr) { return 0; } - - if (i->count == 0 || - i->iov == nullptr || - i->iov->iov_len == 0) { - return 0; - } - - if (i->nr_segs > 1) { - Genode::error(__func__, ": too many segments ", i->nr_segs); - return 0; - } - - /* make sure the whole iter fits as there is only 1 iovec */ - if (i->iov->iov_len < i->count) { - Genode::error(__func__, ": " - "iov->iov_len: ", i->iov->iov_len, " < " - "i->count: ", i->count); - return 0; - } - - struct iovec const * const iov = i->iov; - size_t const iov_len = iov->iov_len; - void * const base = (iov->iov_base + i->iov_offset); - - if (bytes > i->count) { bytes = i->count; } - - size_t const len = (size_t)(bytes < iov_len ? bytes : iov_len); - void * const dst = to_iter ? base : addr; - void const * const src = to_iter ? addr : base; - - /* actual function body */ - { - Genode::memcpy(dst, src, len); - } - - i->iov_offset += len; - i->count -= len; - - return len; -} - - -size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i) -{ - return _copy_iter(addr, bytes, i, false); -} - - -size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i) -{ - return _copy_iter(addr, bytes, i, true); -} - - -size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, - struct iov_iter *i) -{ - return copy_to_iter(reinterpret_cast(page->addr) + offset, bytes, i); -} - - -size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, - struct iov_iter *i) -{ - return copy_from_iter(reinterpret_cast(page->addr) + offset, bytes, i); -} - - -static size_t _csum_and_copy_iter(void *addr, size_t bytes, __wsum *csum, - struct iov_iter *i, bool to_iter) -{ - if (addr == nullptr) { return 0; } - - if (i->count == 0 || - i->iov == nullptr || - i->iov->iov_len == 0) { - return 0; - } - - if (i->nr_segs > 1) { - Genode::error(__func__, ": too many segments ", i->nr_segs); - return 0; - } - - /* make sure the whole iter fits as there is only 1 iovec */ - if (i->iov->iov_len < i->count) { - Genode::error(__func__, ": " - "iov->iov_len: ", i->iov->iov_len, " < " - "i->count: ", i->count); - return 0; - } - - struct iovec const * const iov = i->iov; - size_t const iov_len = iov->iov_len; - void * const base = (iov->iov_base + i->iov_offset); - - if (bytes > i->count) { bytes = i->count; } - - size_t const len = (size_t)(bytes < iov_len ? bytes : iov_len); - void * const dst = to_iter ? base : addr; - void const * const src = to_iter ? addr : base; - - /* actual function body */ - { - int err = 0; - __wsum next = csum_and_copy_from_user(src, dst, len, 0, &err); - - if (err) { - Genode::error(__func__, ": err: ", err, " - sleeping"); - Genode::sleep_forever(); - } - - *csum = csum_block_add(*csum, next, 0); - } - - i->iov_offset += len; - i->count -= len; - - return len; -} - - -size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i) -{ - return _csum_and_copy_iter(addr, bytes, csum, i, false); -} - - -size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i) -{ - return _csum_and_copy_iter(addr, bytes, csum, i, true); -} - - -/****************** - ** linux/wait.h ** - ******************/ - -void __wake_up(wait_queue_head_t *q, bool all) { } - - -/*********************** - ** linux/workqueue.h ** - ***********************/ - -static void execute_delayed_work(unsigned long dwork) -{ - delayed_work *d = (delayed_work *)dwork; - d->work.func(&d->work); -} - - -bool mod_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork, - unsigned long delay) -{ - /* treat delayed work without delay like any other work */ - if (delay == 0) { - execute_delayed_work((unsigned long)dwork); - } else { - if (!dwork->timer.function) { - setup_timer(&dwork->timer, execute_delayed_work, - (unsigned long)dwork); - } - mod_timer(&dwork->timer, jiffies + delay); - } - return true; -} - -int schedule_delayed_work(struct delayed_work *dwork, unsigned long delay) -{ - return mod_delayed_work(0, dwork, delay); -} - - -int kstrtoul(const char *s, unsigned int base, unsigned long *res) -{ - unsigned long val = 0; - Genode::ascii_to(s, val); - *res = val; - return 0; -} diff --git a/repos/dde_linux/src/lib/legacy_lxip/nic_handler.cc b/repos/dde_linux/src/lib/legacy_lxip/nic_handler.cc deleted file mode 100644 index 8ea7b31a74..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/nic_handler.cc +++ /dev/null @@ -1,193 +0,0 @@ -/* - * \brief Linux emulation code - * \author Sebastian Sumpf - * \author Josef Soentgen - * \author Emery Hemingway - * \date 2013-08-28 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include -#include - -/* format-string includes */ -#include - -/* local includes */ -#include -#include - -bool ic_link_state = false; - - -class Nic_client -{ - private: - - enum { - PACKET_SIZE = Nic::Packet_allocator::DEFAULT_PACKET_SIZE, - BUF_SIZE = Nic::Session::QUEUE_SIZE * PACKET_SIZE, - }; - - Nic::Packet_allocator _tx_block_alloc; - Nic::Connection _nic; - - Genode::Io_signal_handler _sink_ack; - Genode::Io_signal_handler _sink_submit; - Genode::Io_signal_handler _source_ack; - Genode::Io_signal_handler _link_state_change; - - void (*_tick)(); - - void _link_state() - { - bool const link_state = _nic.link_state(); - ic_link_state = link_state; - - if (link_state == false || lxip_do_dhcp() == false) - return; - - Lx::timer_update_jiffies(); - - /* reconnect dhcp client */ - lxip_configure_dhcp(); - } - - /** - * submit queue not empty anymore - */ - void _packet_avail() - { - Lx::timer_update_jiffies(); - - /* process a batch of only MAX_PACKETS in one run */ - enum { MAX_PACKETS = 20 }; - - int count = 0; - while (_nic.rx()->packet_avail() && - _nic.rx()->ready_to_ack() && - count++ < MAX_PACKETS) - { - Nic::Packet_descriptor p = _nic.rx()->get_packet(); - try { net_driver_rx(_nic.rx()->packet_content(p), p.size()); } - catch (Genode::Packet_descriptor::Invalid_packet) { - Genode::error("received invalid Nic packet"); } - _nic.rx()->acknowledge_packet(p); - } - - /* schedule next batch if there are still packets available */ - if (_nic.rx()->packet_avail()) - Genode::Signal_transmitter(_sink_submit).submit(); - - /* tick the higher layer of the component */ - _tick(); - } - - /** - * acknoledgement queue not full anymore - */ - void _ready_to_ack() - { - _packet_avail(); - } - - /** - * acknoledgement queue not empty anymore - */ - void _ack_avail() - { - while (_nic.tx()->ack_avail()) { - Nic::Packet_descriptor p = _nic.tx()->get_acked_packet(); - _nic.tx()->release_packet(p); - } - } - - - public: - - Nic_client(Genode::Env &env, - Genode::Allocator &alloc, - void (*ticker)()) - : - _tx_block_alloc(&alloc), - _nic(env, &_tx_block_alloc, BUF_SIZE, BUF_SIZE), - _sink_ack(env.ep(), *this, &Nic_client::_packet_avail), - _sink_submit(env.ep(), *this, &Nic_client::_ready_to_ack), - _source_ack(env.ep(), *this, &Nic_client::_ack_avail), - _link_state_change(env.ep(), *this, &Nic_client::_link_state), - _tick(ticker) - { - ic_link_state = _nic.link_state(); - - _nic.rx_channel()->sigh_ready_to_ack(_sink_ack); - _nic.rx_channel()->sigh_packet_avail(_sink_submit); - _nic.tx_channel()->sigh_ack_avail(_source_ack); - _nic.link_state_sigh(_link_state_change); - /* ready_to_submit not handled */ - } - - Nic::Connection *nic() { return &_nic; } -}; - - -static Nic_client *_nic_client; - - -void Lx::nic_client_init(Genode::Env &env, - Genode::Allocator &alloc, - void (*ticker)()) -{ - static Nic_client _inst(env, alloc, ticker); - _nic_client = &_inst; -} - - -/** - * Call by back-end driver while initializing - */ -void net_mac(void* mac, unsigned long size) -{ - enum { MAC_LEN = 17, ETH_ALEN = 6, }; - - char str[MAC_LEN + 1]; - using namespace Genode; - - Nic::Mac_address m = _nic_client->nic()->mac_address(); - Genode::memcpy(mac, &m.addr, min(sizeof(m.addr), (size_t)size)); - - unsigned char const *mac_addr = (unsigned char const*)m.addr; - for (int i = 0; i < ETH_ALEN; i++) { - Format::snprintf((char *)&str[i * 3], 3, "%02x", mac_addr[i]); - if ((i * 3) < MAC_LEN) - str[(i * 3) + 2] = ':'; - } - str[MAC_LEN] = 0; - - Genode::log("Received mac: ", Cstring(str)); -} - - -/** - * Call by back-end driver when a packet should be sent - */ -int net_tx(void* addr, unsigned long len) -{ - try { - Nic::Packet_descriptor packet = _nic_client->nic()->tx()->alloc_packet(len); - void* content = _nic_client->nic()->tx()->packet_content(packet); - - Genode::memcpy((char *)content, addr, len); - _nic_client->nic()->tx()->submit_packet(packet); - - return 0; - /* Packet_alloc_failed */ - } catch(...) { return 1; } -} diff --git a/repos/dde_linux/src/lib/legacy_lxip/random.cc b/repos/dde_linux/src/lib/legacy_lxip/random.cc deleted file mode 100644 index 4a7f5b497d..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/random.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* - * \brief Linux random emulation code - * \author Josef Soentgen - * \date 2016-10-19 - */ - -/* - * Copyright (C) 2016-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include - - -using Genode::uint64_t; - -/* - * Xoroshiro128+ written in 2014-2016 by Sebastiano Vigna (vigna@acm.org) - * - * (see http://xoroshiro.di.unimi.it/xorshift128plus.c and - * http://xoroshiro.di.unimi.it/splitmix64.c) - */ - -struct Xoroshiro -{ - uint64_t seed; - - uint64_t splitmix64() - { - uint64_t z = (seed += __UINT64_C(0x9E3779B97F4A7C15)); - z = (z ^ (z >> 30)) * __UINT64_C(0xBF58476D1CE4E5B9); - z = (z ^ (z >> 27)) * __UINT64_C(0x94D049BB133111EB); - return z ^ (z >> 31); - } - - Xoroshiro(uint64_t seed) : seed(seed) - { - s[0] = splitmix64(); - s[1] = splitmix64(); - } - - uint64_t s[2]; - - static uint64_t rotl(uint64_t const x, int k) { - return (x << k) | (x >> (64 - k)); - } - - uint64_t get() - { - uint64_t const s0 = s[0]; - uint64_t s1 = s[1]; - uint64_t const result = s0 + s1; - - s1 ^= s0; - - s[0] = rotl(s0, 55) ^ s1 ^ (s1 << 14); - s[1] = rotl(s1, 36); - - return result; - } -}; - - -static Xoroshiro & xoroshiro() -{ - static Xoroshiro xoroshiro(42); - return xoroshiro; -} - - -/******************** - ** linux/random.h ** - ********************/ - -extern "C" void get_random_bytes(void *buf, int nbytes) -{ - if (nbytes <= 0) { - return; - } - - char *p = reinterpret_cast(buf); - - int const rounds = nbytes / 8; - for (int i = 0; i < rounds; i++) { - uint64_t const v = xoroshiro().get(); - - Genode::memcpy(p, &v, 8); - p += 8; - } - - int const remain = nbytes - rounds * 8; - if (!remain) { - return; - } - - uint64_t const v = xoroshiro().get(); - Genode::memcpy(p, &v, remain); -} - - -extern "C" unsigned int prandom_u32(void) -{ - return xoroshiro().get(); -} diff --git a/repos/dde_linux/src/lib/legacy_lxip/timer_handler.cc b/repos/dde_linux/src/lib/legacy_lxip/timer_handler.cc deleted file mode 100644 index 76f3384af5..0000000000 --- a/repos/dde_linux/src/lib/legacy_lxip/timer_handler.cc +++ /dev/null @@ -1,504 +0,0 @@ -/* - * \brief Signal context for timer events - * \author Sebastian Sumpf - * \author Emery Hemingway - * \author Christian Helmuth - * \date 2012-05-23 - */ - -/* - * Copyright (C) 2012-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include -#include - -/* Linux kit includes */ -#include - -/* local includes */ -#include -#include - - -/********************* - ** linux/jiffies.h ** - *********************/ - -unsigned long jiffies; - -/** - * Lx::Timer - */ -namespace Lx { - class Timer; -} - -class Lx::Timer -{ - public: - - /** - * Context encapsulates a regular linux timer_list - */ - struct Context : public Lx_kit::List::Element - { - enum { INVALID_TIMEOUT = ~0UL }; - enum Type { LIST }; - - Type type; - void *timer; - bool pending { false }; - unsigned long timeout { INVALID_TIMEOUT }; /* absolute in jiffies */ - - Context(struct timer_list *timer) : type(LIST), timer(timer) { } - - void expires(unsigned long e) - { - if (type == LIST) - static_cast(timer)->expires = e; - } - - void function() - { - switch (type) { - case LIST: - { - timer_list *t = static_cast(timer); - if (t->function) - t->function(t->data); - } - break; - - } - } - }; - - private: - - Genode::Entrypoint &_ep; - ::Timer::Connection &_timer; - - /* One-shot timeout for timer list */ - ::Timer::One_shot_timeout _timers_one_shot { - _timer, *this, &Lx::Timer::_handle_timers }; - - /* One-shot timeout for 'wait' */ - ::Timer::One_shot_timeout _wait_one_shot { - _timer, *this, &Lx::Timer::_handle_wait }; - - Lx_kit::List _list; - Genode::Tslab _timer_alloc; - - void (*_tick)(); - - public: - - bool ready { true }; - - private: - - /** - * Lookup local timer - */ - Context *_find_context(void const *timer) - { - for (Context *c = _list.first(); c; c = c->next()) - if (c->timer == timer) - return c; - - return 0; - } - - /** - * Program the first timer in the list - */ - void _program_first_timer() - { - Context *ctx = _list.first(); - if (!ctx) - return; - - /* calculate relative microseconds for trigger */ - Genode::uint64_t us = ctx->timeout > jiffies ? - (Genode::uint64_t)jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0; - _timers_one_shot.schedule(Genode::Microseconds{us}); - } - - /** - * Schedule timer - * - * Add the context to the scheduling list depending on its timeout - * and reprogram the first timer. - */ - void _schedule_timer(Context *ctx, unsigned long expires) - { - _list.remove(ctx); - - ctx->timeout = expires; - ctx->pending = true; - - /* - * Also write the timeout value to the expires field in - * struct timer_list because some code the checks - * it directly. - */ - ctx->expires(expires); - - Context *c; - for (c = _list.first(); c; c = c->next()) - if (ctx->timeout <= c->timeout) - break; - _list.insert_before(ctx, c); - - _program_first_timer(); - } - - inline void _upate_jiffies(Genode::Duration dur) - { - auto new_jiffies = usecs_to_jiffies(dur.trunc_to_plain_us().value); - if (new_jiffies < jiffies) - jiffies = usecs_to_jiffies(_timer.curr_time().trunc_to_plain_us().value); - else - jiffies = new_jiffies; - } - - /** - * Check timers and wake application - */ - void _handle_timers(Genode::Duration dur) - { - _upate_jiffies(dur); - - while (Lx::Timer::Context *ctx = _list.first()) { - if (ctx->timeout > jiffies) - break; - - ctx->pending = false; - ctx->function(); - - if (!ctx->pending) - del(ctx->timer); - } - - /* tick the higher layer of the component */ - _tick(); - } - - void _handle_wait(Genode::Duration dur) { _upate_jiffies(dur); } - - public: - - /** - * Constructor - */ - Timer(Genode::Entrypoint &ep, - ::Timer::Connection &timer, - Genode::Allocator &alloc, - void (*tick)()) - : - _ep(ep), - _timer(timer), - _timer_alloc(&alloc), - _tick(tick) - { - update_jiffies(); - } - - /** - * Add new linux timer - */ - template - void add(TIMER *timer) - { - Context *t = new (&_timer_alloc) Context(timer); - _list.append(t); - } - - /** - * Delete linux timer - */ - int del(void *timer) - { - Context *ctx = _find_context(timer); - - /** - * If the timer expired it was already cleaned up after its - * execution. - */ - if (!ctx) - return 0; - - int rv = ctx->pending ? 1 : 0; - - _list.remove(ctx); - destroy(&_timer_alloc, ctx); - - return rv; - } - - /** - * Initial scheduling of linux timer - */ - int schedule(void *timer, unsigned long expires) - { - Context *ctx = _find_context(timer); - if (!ctx) { - Genode::error("schedule unknown timer ", timer); - return -1; /* XXX better use 0 as rv? */ - } - - /* - * If timer was already active return 1, otherwise 0. The return - * value is needed by mod_timer(). - */ - int rv = ctx->pending ? 1 : 0; - - _schedule_timer(ctx, expires); - - return rv; - } - - /** - * Schedule next linux timer - */ - void schedule_next() { _program_first_timer(); } - - /** - * Check if the timer is currently pending - */ - bool pending(void const *timer) - { - Context *ctx = _find_context(timer); - if (!ctx) { - return false; - } - - return ctx->pending; - } - - Context *find(struct timer_list const *timer) { - return _find_context(timer); } - - /** - * Update jiffie counter - */ - void update_jiffies() - { - /* - * Do not use lx_emul usecs_to_jiffies(unsigned int) because - * of implicit truncation! - */ - jiffies = _timer.curr_time().trunc_to_plain_ms().value / JIFFIES_TICK_MS; - } - - /** - * Get first timer context - */ - Context* first() { return _list.first(); } - - void wait(unsigned long timeo = 0) - { - /** - * XXX - * in contrast to wait_uninterruptible(), wait() should be interruptible - * although we return immediately once we dispatched any signal, we - * need to reflect this via signal_pending() - */ - - if (timeo > 0) - _wait_one_shot.schedule(Genode::Microseconds(jiffies_to_usecs(timeo))); - - _ep.wait_and_dispatch_one_io_signal(); - /* update jiffies if we dispatched another signal */ - if (_wait_one_shot.scheduled()) - update_jiffies(); - } - - void wait_uninterruptible(unsigned long timeo) - { - if (timeo > 0) { - _wait_one_shot.schedule(Genode::Microseconds(jiffies_to_usecs(timeo))); - while (_wait_one_shot.scheduled()) - _ep.wait_and_dispatch_one_io_signal(); - } - } -}; - - -static Lx::Timer *_timer; - - -void Lx::timer_init(Genode::Entrypoint &ep, - ::Timer::Connection &timer, - Genode::Allocator &alloc, - void (*tick)()) -{ - static Lx::Timer inst(ep, timer, alloc, tick); - _timer = &inst; -} - - -void update_jiffies() { _timer->update_jiffies(); } - -void Lx::timer_update_jiffies() { update_jiffies(); } - -/******************* - ** linux/timer.h ** - *******************/ - -void init_timer(struct timer_list *timer) { } - - -void add_timer(struct timer_list *timer) -{ - BUG_ON(timer_pending(timer)); - mod_timer(timer, timer->expires); -} - - -int mod_timer(struct timer_list *timer, unsigned long expires) -{ - update_jiffies(); - - if (!_timer->find(timer)) - _timer->add(timer); - - return _timer->schedule(timer, expires); -} - - -void setup_timer(struct timer_list *timer,void (*function)(unsigned long), - unsigned long data) -{ - timer->function = function; - timer->data = data; -} - - -int timer_pending(const struct timer_list * timer) -{ - bool pending = _timer->pending(timer); - lx_log(DEBUG_TIMER, "Pending %p %u", timer, pending); - return pending; -} - - -int del_timer(struct timer_list *timer) -{ - update_jiffies(); - lx_log(DEBUG_TIMER, "Delete timer %p", timer); - int rv = _timer->del(timer); - _timer->schedule_next(); - - return rv; -} - - -/******************* - ** linux/sched.h ** - *******************/ - -signed long schedule_timeout(signed long timeout) -{ - unsigned long expire = timeout + jiffies; - - /** - * XXX - * schedule_timeout is called from sock_wait_for_wmem() (UDP) and - * sk_stream_wait_memory() (TCP) if sk_wmem_alloc (UDP) resp. - * sk_wmem_queued (TCP) reaches are certain threshold - * unfortunately, recovery from this state seems to be broken - * so that we land here for every skb once we hit the threshold - */ - static bool warned = false; - if (!warned) { - Genode::warning(__func__, " called (tx throttled?)"); - warned = true; - } - - long start = jiffies; - _timer->wait(timeout); - timeout -= jiffies - start; - - return timeout < 0 ? 0 : timeout; -} - -long schedule_timeout_uninterruptible(signed long timeout) -{ - _timer->wait_uninterruptible(timeout); - return 0; -} - -void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) -{ - _timer->wait(); -} - -bool poll_does_not_wait(const poll_table *p) -{ - return p == nullptr; -} - - -/****************** - ** linux/time.h ** - ******************/ - -unsigned long get_seconds(void) -{ - return jiffies / HZ; -} - - -/******************* - ** linux/timer.h ** - *******************/ - -static unsigned long round_jiffies(unsigned long j, bool force_up) -{ - unsigned remainder = j % HZ; - - /* - * from timer.c - * - * If the target jiffie is just after a whole second (which can happen - * due to delays of the timer irq, long irq off times etc etc) then - * we should round down to the whole second, not up. Use 1/4th second - * as cutoff for this rounding as an extreme upper bound for this. - * But never round down if @force_up is set. - */ - - /* per default round down */ - j = j - remainder; - - /* round up if remainder more than 1/4 second (or if we're forced to) */ - if (remainder >= HZ/4 || force_up) - j += HZ; - - return j; -} - -unsigned long round_jiffies(unsigned long j) -{ - return round_jiffies(j, false); -} - - -unsigned long round_jiffies_up(unsigned long j) -{ - return round_jiffies(j, true); -} - - -unsigned long round_jiffies_relative(unsigned long j) -{ - return round_jiffies(j + jiffies, false) - jiffies; -}