From owner-svn-src-head@FreeBSD.ORG Sat Aug 1 19:26:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AD4B106566B; Sat, 1 Aug 2009 19:26:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33FD28FC13; Sat, 1 Aug 2009 19:26:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n71JQTPY090321; Sat, 1 Aug 2009 19:26:29 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n71JQSML090262; Sat, 1 Aug 2009 19:26:28 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200908011926.n71JQSML090262@svn.freebsd.org> From: Robert Watson Date: Sat, 1 Aug 2009 19:26:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196019 - in head: . lib/libkvm sys/arm/arm sys/compat/linprocfs sys/compat/linux sys/compat/svr4 sys/conf sys/contrib/altq/altq sys/contrib/ipfilter/netinet sys/contrib/pf/net sys/cont... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2009 19:26:29 -0000 Author: rwatson Date: Sat Aug 1 19:26:27 2009 New Revision: 196019 URL: http://svn.freebsd.org/changeset/base/196019 Log: Merge the remainder of kern_vimage.c and vimage.h into vnet.c and vnet.h, we now use jails (rather than vimages) as the abstraction for virtualization management, and what remained was specific to virtual network stacks. Minor cleanups are done in the process, and comments updated to reflect these changes. Reviewed by: bz Approved by: re (vimage blanket) Deleted: head/sys/kern/kern_vimage.c head/sys/sys/vimage.h Modified: head/ObsoleteFiles.inc head/lib/libkvm/kvm_vnet.c head/sys/arm/arm/minidump_machdep.c head/sys/compat/linprocfs/linprocfs.c head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_socket.c head/sys/compat/svr4/svr4_sockio.c head/sys/conf/files head/sys/contrib/altq/altq/altq_subr.c head/sys/contrib/ipfilter/netinet/fil.c head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c head/sys/contrib/pf/net/pf.c head/sys/contrib/pf/net/pf_if.c head/sys/contrib/pf/net/pf_ioctl.c head/sys/contrib/pf/net/pf_subr.c head/sys/contrib/rdma/rdma_cma.c head/sys/ddb/db_sym.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c head/sys/fs/nfs/nfsport.h head/sys/kern/kern_jail.c head/sys/kern/kern_linker.c head/sys/kern/kern_poll.c head/sys/kern/kern_sysctl.c head/sys/kern/kern_uuid.c head/sys/kern/sys_socket.c head/sys/kern/uipc_domain.c head/sys/kern/uipc_socket.c head/sys/kern/uipc_syscalls.c head/sys/kern/uipc_usrreq.c head/sys/net/bpf.c head/sys/net/bridgestp.c head/sys/net/flowtable.c head/sys/net/if.c head/sys/net/if_bridge.c head/sys/net/if_clone.c head/sys/net/if_ef.c head/sys/net/if_enc.c head/sys/net/if_epair.c head/sys/net/if_ethersubr.c head/sys/net/if_faith.c head/sys/net/if_gif.c head/sys/net/if_gre.c head/sys/net/if_llatbl.c head/sys/net/if_loop.c head/sys/net/if_mib.c head/sys/net/if_spppsubr.c head/sys/net/if_stf.c head/sys/net/if_tun.c head/sys/net/if_vlan.c head/sys/net/netisr.c head/sys/net/raw_cb.c head/sys/net/raw_usrreq.c head/sys/net/route.c head/sys/net/rtsock.c head/sys/net/vnet.c head/sys/net/vnet.h head/sys/net80211/ieee80211_ddb.c head/sys/net80211/ieee80211_freebsd.c head/sys/netgraph/atm/ng_atm.c head/sys/netgraph/ng_base.c head/sys/netgraph/ng_bridge.c head/sys/netgraph/ng_eiface.c head/sys/netgraph/ng_ether.c head/sys/netgraph/ng_gif.c head/sys/netgraph/ng_iface.c head/sys/netgraph/ng_pipe.c head/sys/netgraph/ng_source.c head/sys/netinet/if_ether.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in_gif.c head/sys/netinet/in_mcast.c head/sys/netinet/in_pcb.c head/sys/netinet/in_proto.c head/sys/netinet/in_rmx.c head/sys/netinet/ip_carp.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_icmp.c head/sys/netinet/ip_input.c head/sys/netinet/ip_ipsec.c head/sys/netinet/ip_mroute.c head/sys/netinet/ip_options.c head/sys/netinet/ip_output.c head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_nat.c head/sys/netinet/ipfw/ip_fw_pfil.c head/sys/netinet/raw_ip.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet/tcp_hostcache.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_offload.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_sack.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_timewait.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/dest6.c head/sys/netinet6/frag6.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6.c head/sys/netinet6/in6_gif.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_mcast.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_proto.c head/sys/netinet6/in6_rmx.c head/sys/netinet6/in6_src.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_ipsec.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/ip6_output.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/raw_ip6.c head/sys/netinet6/route6.c head/sys/netinet6/scope6.c head/sys/netinet6/udp6_usrreq.c head/sys/netipsec/ipsec.c head/sys/netipsec/ipsec_input.c head/sys/netipsec/ipsec_mbuf.c head/sys/netipsec/ipsec_output.c head/sys/netipsec/key.c head/sys/netipsec/keysock.c head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/netipsec/xform_ipcomp.c head/sys/netipsec/xform_ipip.c head/sys/netipsec/xform_tcp.c head/sys/nfsclient/bootp_subr.c head/sys/nfsclient/nfs_diskless.c head/sys/nfsclient/nfs_vnops.c Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sat Aug 1 15:40:22 2009 (r196018) +++ head/ObsoleteFiles.inc Sat Aug 1 19:26:27 2009 (r196019) @@ -14,6 +14,8 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090801: vimage.h removed in favour of vnet.h +OLD_FILES+=usr/include/sys/vimage.h # 20090719: library version bump for 8.0 OLD_LIBS+=lib/libalias.so.6 OLD_LIBS+=lib/libavl.so.1 Modified: head/lib/libkvm/kvm_vnet.c ============================================================================== --- head/lib/libkvm/kvm_vnet.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/lib/libkvm/kvm_vnet.c Sat Aug 1 19:26:27 2009 (r196019) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include Modified: head/sys/arm/arm/minidump_machdep.c ============================================================================== --- head/sys/arm/arm/minidump_machdep.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/arm/arm/minidump_machdep.c Sat Aug 1 19:26:27 2009 (r196019) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/compat/linprocfs/linprocfs.c Sat Aug 1 19:26:27 2009 (r196019) @@ -73,7 +73,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/compat/linux/linux_ioctl.c Sat Aug 1 19:26:27 2009 (r196019) @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/compat/linux/linux_socket.c Sat Aug 1 19:26:27 2009 (r196019) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/compat/svr4/svr4_sockio.c ============================================================================== --- head/sys/compat/svr4/svr4_sockio.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/compat/svr4/svr4_sockio.c Sat Aug 1 19:26:27 2009 (r196019) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/conf/files Sat Aug 1 19:26:27 2009 (r196019) @@ -1992,7 +1992,6 @@ kern/kern_time.c standard kern/kern_timeout.c standard kern/kern_umtx.c standard kern/kern_uuid.c standard -kern/kern_vimage.c optional vimage kern/kern_xxx.c standard kern/link_elf.c standard kern/linker_if.m standard Modified: head/sys/contrib/altq/altq/altq_subr.c ============================================================================== --- head/sys/contrib/altq/altq/altq_subr.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/altq/altq/altq_subr.c Sat Aug 1 19:26:27 2009 (r196019) @@ -47,9 +47,6 @@ #include #include #include -#ifdef __FreeBSD__ -#include -#endif #include #include Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/ipfilter/netinet/fil.c Sat Aug 1 19:26:27 2009 (r196019) @@ -33,9 +33,6 @@ # if (__FreeBSD_version == 400019) # define CSUM_DELAY_DATA # endif -# if (__FreeBSD_version >= 800044) -# include -# endif # endif # include #else Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Aug 1 19:26:27 2009 (r196019) @@ -63,7 +63,6 @@ static const char rcsid[] = "@(#)$Id: ip # include #endif #if __FreeBSD_version >= 800044 -# include # include #else #define V_path_mtu_discovery path_mtu_discovery Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/pf/net/pf.c Sat Aug 1 19:26:27 2009 (r196019) @@ -91,7 +91,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #else #include #endif Modified: head/sys/contrib/pf/net/pf_if.c ============================================================================== --- head/sys/contrib/pf/net/pf_if.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/pf/net/pf_if.c Sat Aug 1 19:26:27 2009 (r196019) @@ -54,9 +54,6 @@ __FBSDID("$FreeBSD$"); #include #endif #include -#ifdef __FreeBSD__ -#include -#endif #include #include Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/pf/net/pf_ioctl.c Sat Aug 1 19:26:27 2009 (r196019) @@ -83,7 +83,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #else #include #include Modified: head/sys/contrib/pf/net/pf_subr.c ============================================================================== --- head/sys/contrib/pf/net/pf_subr.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/pf/net/pf_subr.c Sat Aug 1 19:26:27 2009 (r196019) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/contrib/rdma/rdma_cma.c ============================================================================== --- head/sys/contrib/rdma/rdma_cma.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/rdma/rdma_cma.c Sat Aug 1 19:26:27 2009 (r196019) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/ddb/db_sym.c ============================================================================== --- head/sys/ddb/db_sym.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/ddb/db_sym.c Sat Aug 1 19:26:27 2009 (r196019) @@ -32,9 +32,9 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include -#include #include Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c ============================================================================== --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Sat Aug 1 19:26:27 2009 (r196019) @@ -54,9 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if __FreeBSD_version >= 800044 -#include -#else +#if __FreeBSD_version < 800044 #define V_ifnet ifnet #endif Modified: head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c ============================================================================== --- head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Sat Aug 1 19:26:27 2009 (r196019) @@ -48,9 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if __FreeBSD_version >= 800044 -#include -#else +#if __FreeBSD_version < 800044 #define V_tcp_do_autosndbuf tcp_do_autosndbuf #define V_tcp_autosndbuf_max tcp_autosndbuf_max #define V_tcp_do_rfc1323 tcp_do_rfc1323 Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/fs/nfs/nfsport.h Sat Aug 1 19:26:27 2009 (r196019) @@ -78,7 +78,6 @@ #include #include #include -#include #include #include #include Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/kern_jail.c Sat Aug 1 19:26:27 2009 (r196019) @@ -58,9 +58,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + #include +#include + #include + #ifdef DDB #include #ifdef INET6 Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/kern_linker.c Sat Aug 1 19:26:27 2009 (r196019) @@ -51,7 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + +#include #include Modified: head/sys/kern/kern_poll.c ============================================================================== --- head/sys/kern/kern_poll.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/kern_poll.c Sat Aug 1 19:26:27 2009 (r196019) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include /* for IFF_* flags */ #include /* for NETISR_POLL */ Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/kern_sysctl.c Sat Aug 1 19:26:27 2009 (r196019) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef KTRACE #include #endif Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/kern_uuid.c Sat Aug 1 19:26:27 2009 (r196019) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/kern/sys_socket.c ============================================================================== --- head/sys/kern/sys_socket.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/sys_socket.c Sat Aug 1 19:26:27 2009 (r196019) @@ -48,10 +48,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include +#include #include Modified: head/sys/kern/uipc_domain.c ============================================================================== --- head/sys/kern/uipc_domain.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/uipc_domain.c Sat Aug 1 19:26:27 2009 (r196019) @@ -43,7 +43,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + +#include + #include /* Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/uipc_socket.c Sat Aug 1 19:26:27 2009 (r196019) @@ -129,7 +129,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + +#include #include Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/uipc_syscalls.c Sat Aug 1 19:26:27 2009 (r196019) @@ -64,12 +64,13 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #ifdef KTRACE #include #endif +#include + #include #include Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/uipc_usrreq.c Sat Aug 1 19:26:27 2009 (r196019) @@ -88,7 +88,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + +#include #ifdef DDB #include Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/bpf.c Sat Aug 1 19:26:27 2009 (r196019) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -73,6 +72,7 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include #include #include Modified: head/sys/net/bridgestp.c ============================================================================== --- head/sys/net/bridgestp.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/bridgestp.c Sat Aug 1 19:26:27 2009 (r196019) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/flowtable.c Sat Aug 1 19:26:27 2009 (r196019) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if.c Sat Aug 1 19:26:27 2009 (r196019) @@ -59,7 +59,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_bridge.c Sat Aug 1 19:26:27 2009 (r196019) @@ -101,7 +101,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/net/if_clone.c ============================================================================== --- head/sys/net/if_clone.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_clone.c Sat Aug 1 19:26:27 2009 (r196019) @@ -39,7 +39,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_ef.c ============================================================================== --- head/sys/net/if_ef.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_ef.c Sat Aug 1 19:26:27 2009 (r196019) @@ -39,7 +39,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_enc.c ============================================================================== --- head/sys/net/if_enc.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_enc.c Sat Aug 1 19:26:27 2009 (r196019) @@ -38,7 +38,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_epair.c ============================================================================== --- head/sys/net/if_epair.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_epair.c Sat Aug 1 19:26:27 2009 (r196019) @@ -38,7 +38,7 @@ /* * Things to re-think once we have more experience: * - ifp->if_reassign function once we can test with vimage. Depending on - * how if_vomve() is going to be improved. + * how if_vmove() is going to be improved. * - Real random etheraddrs that are checked to be uniquish; we would need * to re-do them in case we move the interface between network stacks * in a private if_reassign function. @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -70,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define EPAIRNAME "epair" Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_ethersubr.c Sat Aug 1 19:26:27 2009 (r196019) @@ -50,7 +50,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_faith.c ============================================================================== --- head/sys/net/if_faith.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_faith.c Sat Aug 1 19:26:27 2009 (r196019) @@ -54,7 +54,6 @@ #include #include #include -#include #include #include @@ -62,6 +61,7 @@ #include #include #include +#include #ifdef INET #include Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_gif.c Sat Aug 1 19:26:27 2009 (r196019) @@ -49,7 +49,6 @@ #include #include #include -#include #include #include @@ -58,6 +57,7 @@ #include #include #include +#include #include #include Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_gre.c Sat Aug 1 19:26:27 2009 (r196019) @@ -64,13 +64,13 @@ #include #include #include -#include #include #include #include #include #include +#include #ifdef INET #include Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_llatbl.c Sat Aug 1 19:26:27 2009 (r196019) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -51,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_loop.c Sat Aug 1 19:26:27 2009 (r196019) @@ -49,7 +49,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_mib.c ============================================================================== --- head/sys/net/if_mib.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_mib.c Sat Aug 1 19:26:27 2009 (r196019) @@ -34,7 +34,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_spppsubr.c ============================================================================== --- head/sys/net/if_spppsubr.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_spppsubr.c Sat Aug 1 19:26:27 2009 (r196019) @@ -36,7 +36,6 @@ #include #include #include -#include #include @@ -44,6 +43,7 @@ #include #include #include +#include #include #include #include Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_stf.c Sat Aug 1 19:26:27 2009 (r196019) @@ -92,7 +92,6 @@ #include #include -#include #include #include @@ -100,6 +99,7 @@ #include #include #include +#include #include #include Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_tun.c Sat Aug 1 19:26:27 2009 (r196019) @@ -43,13 +43,13 @@ #include #include #include -#include #include #include #include #include #include +#include #ifdef INET #include #endif Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_vlan.c Sat Aug 1 19:26:27 2009 (r196019) @@ -55,7 +55,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/netisr.c ============================================================================== --- head/sys/net/netisr.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/netisr.c Sat Aug 1 19:26:27 2009 (r196019) @@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef DDB #include @@ -87,6 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /*- * Synchronize use and modification of the registered netisr data structures; Modified: head/sys/net/raw_cb.c ============================================================================== --- head/sys/net/raw_cb.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/raw_cb.c Sat Aug 1 19:26:27 2009 (r196019) @@ -42,7 +42,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/raw_usrreq.c ============================================================================== --- head/sys/net/raw_usrreq.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/raw_usrreq.c Sat Aug 1 19:26:27 2009 (r196019) @@ -44,7 +44,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/route.c Sat Aug 1 19:26:27 2009 (r196019) @@ -51,11 +51,11 @@ #include #include #include -#include #include #include #include +#include #ifdef RADIX_MPATH #include Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/rtsock.c Sat Aug 1 19:26:27 2009 (r196019) @@ -50,7 +50,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/vnet.c ============================================================================== --- head/sys/net/vnet.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/vnet.c Sat Aug 1 19:26:27 2009 (r196019) @@ -1,4 +1,12 @@ /*- + * Copyright (c) 2004-2009 University of Zagreb + * Copyright (c) 2006-2009 FreeBSD Foundation + * All rights reserved. + * + * This software was developed by the University of Zagreb and the + * FreeBSD Foundation under sponsorship by the Stichting NLnet and the + * FreeBSD Foundation. + * * Copyright (c) 2009 Jeffrey Roberson * Copyright (c) 2009 Robert N. M. Watson * All rights reserved. @@ -28,30 +36,67 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ddb.h" + #include #include +#include #include #include #include #include #include #include +#include #include #include -#include +#ifdef DDB +#include +#endif + +#include +#include #include /*- * This file implements core functions for virtual network stacks: * + * - Core virtual network stack management functions. + * * - Virtual network stack memory allocator, which virtualized global * variables in the network stack * * - Virtualized SYSINIT's/SYSUNINIT's, which allow network stack subsystems * to register startup/shutdown events to be run for each virtual network * stack instance. - * + */ + +MALLOC_DEFINE(M_VNET, "vnet", "network stack control block"); + +/* + * The virtual network stack list has two read-write locks, one sleepable and + * the other not, so that the list can be stablized and walked in a variety + * of network stack contexts. Both must be acquired exclusively to modify + * the list. + */ +struct rwlock vnet_rwlock; +struct sx vnet_sxlock; + +#define VNET_LIST_WLOCK() do { \ + sx_xlock(&vnet_sxlock); \ + rw_wlock(&vnet_rwlock); \ +} while (0) + +#define VNET_LIST_WUNLOCK() do { \ + rw_wunlock(&vnet_rwlock); \ + sx_xunlock(&vnet_sxlock); \ +} while (0) + +struct vnet_list_head vnet_head; +struct vnet *vnet0; + +/* * The virtual network stack allocator provides storage for virtualized * global variables. These variables are defined/declared using the * VNET_DEFINE()/VNET_DECLARE() macros, which place them in the 'set_vnet' @@ -157,6 +202,114 @@ static TAILQ_HEAD(, vnet_data_free) vnet static struct sx vnet_data_free_lock; /* + * Allocate a virtual network stack. + */ +struct vnet * +vnet_alloc(void) +{ + struct vnet *vnet; + + vnet = malloc(sizeof(struct vnet), M_VNET, M_WAITOK | M_ZERO); + vnet->vnet_magic_n = VNET_MAGIC_N; + vnet_data_init(vnet); + + /* Initialize / attach vnet module instances. */ + CURVNET_SET_QUIET(vnet); + + sx_xlock(&vnet_sxlock); + vnet_sysinit(); + CURVNET_RESTORE(); + + rw_wlock(&vnet_rwlock); + LIST_INSERT_HEAD(&vnet_head, vnet, vnet_le); + VNET_LIST_WUNLOCK(); + + return (vnet); +} + +/* + * Destroy a virtual network stack. + */ +void +vnet_destroy(struct vnet *vnet) +{ + struct ifnet *ifp, *nifp; + + KASSERT(vnet->vnet_sockcnt == 0, + ("%s: vnet still has sockets", __func__)); + + VNET_LIST_WLOCK(); + LIST_REMOVE(vnet, vnet_le); + rw_wunlock(&vnet_rwlock); + + CURVNET_SET_QUIET(vnet); + + /* Return all inherited interfaces to their parent vnets. */ + TAILQ_FOREACH_SAFE(ifp, &V_ifnet, if_link, nifp) { + if (ifp->if_home_vnet != ifp->if_vnet) + if_vmove(ifp, ifp->if_home_vnet); + } + + vnet_sysuninit(); + sx_xunlock(&vnet_sxlock); + + CURVNET_RESTORE(); + + /* Hopefully, we are OK to free the vnet container itself. */ + vnet_data_destroy(vnet); + vnet->vnet_magic_n = 0xdeadbeef; + free(vnet, M_VNET); +} + +static void +vnet_foreach(void (*vnet_foreach_fn)(struct vnet *, void *), void *arg) +{ + struct vnet *vnet; + + VNET_LIST_RLOCK(); + LIST_FOREACH(vnet, &vnet_head, vnet_le) + vnet_foreach_fn(vnet, arg); + VNET_LIST_RUNLOCK(); +} + +/* + * Boot time initialization and allocation of virtual network stacks. + */ +static void +vnet_init_prelink(void *arg) +{ + + rw_init(&vnet_rwlock, "vnet_rwlock"); + sx_init(&vnet_sxlock, "vnet_sxlock"); + LIST_INIT(&vnet_head); +} +SYSINIT(vnet_init_prelink, SI_SUB_VNET_PRELINK, SI_ORDER_FIRST, + vnet_init_prelink, NULL); + +static void +vnet0_init(void *arg) +{ + + /* + * We MUST clear curvnet in vi_init_done() before going SMP, + * otherwise CURVNET_SET() macros would scream about unnecessary + * curvnet recursions. + */ + curvnet = prison0.pr_vnet = vnet0 = vnet_alloc(); +} +SYSINIT(vnet0_init, SI_SUB_VNET, SI_ORDER_FIRST, vnet0_init, NULL); + +static void +vnet_init_done(void *unused) +{ + + curvnet = NULL; +} + +SYSINIT(vnet_init_done, SI_SUB_VNET_DONE, SI_ORDER_FIRST, vnet_init_done, + NULL); + +/* * Allocate storage for virtualized global variables in a new virtual network * stack instance, and copy in initial values from our 'master' copy. */ @@ -490,3 +643,20 @@ vnet_sysuninit(void) vs->func(vs->arg); } } + +#ifdef DDB +DB_SHOW_COMMAND(vnets, db_show_vnets) +{ + VNET_ITERATOR_DECL(vnet_iter); + +#if SIZE_MAX == UINT32_MAX /* 32-bit arch */ + db_printf(" vnet ifs socks\n"); +#else /* 64-bit arch, most probaly... */ + db_printf(" vnet ifs socks\n"); +#endif + VNET_FOREACH(vnet_iter) { + db_printf("%p %3d %5d\n", vnet_iter, vnet_iter->vnet_ifcnt, + vnet_iter->vnet_sockcnt); + } +} +#endif Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/vnet.h Sat Aug 1 19:26:27 2009 (r196019) @@ -1,4 +1,12 @@ /*- + * Copyright (c) 2006-2009 University of Zagreb + * Copyright (c) 2006-2009 FreeBSD Foundation + * All rights reserved. + * + * This software was developed by the University of Zagreb and the + * FreeBSD Foundation under sponsorship by the Stichting NLnet and the + * FreeBSD Foundation. + * * Copyright (c) 2009 Jeffrey Roberson * Copyright (c) 2009 Robert N. M. Watson * All rights reserved. @@ -31,6 +39,9 @@ * This header file defines several sets of interfaces supporting virtualized * network stacks: * + * - Definition of 'struct vnet' and functions and macros to allocate/free/ + * manipulate it. + * * - A virtual network stack memory allocator, which provides support for * virtualized global variables via a special linker set, set_vnet. * @@ -47,17 +58,133 @@ #define _NET_VNET_H_ /* - * Virtual network stack memory allocator, which allows global variables to - * be automatically instantiated for each network stack instance. + * struct vnet describes a virtualized network stack, and is primarily a + * pointer to storage for virtualized global variables. Expose to userspace + * as required for libkvm. */ #if defined(_KERNEL) || defined(_WANT_VNET) +#include + +struct vnet { + LIST_ENTRY(vnet) vnet_le; /* all vnets list */ + u_int vnet_magic_n; + u_int vnet_ifcnt; + u_int vnet_sockcnt; + void *vnet_data_mem; + uintptr_t vnet_data_base; +}; +#define VNET_MAGIC_N 0x3e0d8f29 + +/* + * These two virtual network stack allocator definitions are also required + * for libkvm so that it can evaluate virtualized global variables. + */ #define VNET_SETNAME "set_vnet" #define VNET_SYMPREFIX "vnet_entry_" #endif #ifdef _KERNEL + #ifdef VIMAGE +#include +#include /* for struct thread */ +#include +#include + +/* + * Functions to allocate and destroy virtual network stacks. + */ +struct vnet *vnet_alloc(void); +void vnet_destroy(struct vnet *vnet); +/* + * The current virtual network stack -- we may wish to move this to struct + * pcpu in the future. + */ +#define curvnet curthread->td_vnet + +/* + * Various macros -- get and set the current network stack, but also + * assertions. + */ +#ifdef INVARIANTS +#define VNET_DEBUG +#endif +#ifdef VNET_DEBUG +#define VNET_ASSERT(condition) \ + if (!(condition)) { \ + printf("VNET_ASSERT @ %s:%d %s():\n", \ + __FILE__, __LINE__, __FUNCTION__); \ + panic(#condition); \ + } + +#define CURVNET_SET_QUIET(arg) \ + VNET_ASSERT((arg)->vnet_magic_n == VNET_MAGIC_N); \ + struct vnet *saved_vnet = curvnet; \ + const char *saved_vnet_lpush = curthread->td_vnet_lpush; \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***