Deleted Added
full compact
linux_ioctl.c (280258) linux_ioctl.c (293527)
1/*-
2 * Copyright (c) 1994-1995 S��ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include "opt_compat.h"
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1994-1995 S��ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include "opt_compat.h"
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: stable/10/sys/compat/linux/linux_ioctl.c 280258 2015-03-19 13:37:36Z rwatson $");
32__FBSDID("$FreeBSD: stable/10/sys/compat/linux/linux_ioctl.c 293527 2016-01-09 16:08:22Z dchagin $");
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/sysproto.h>
37#include <sys/capsicum.h>
38#include <sys/cdio.h>
39#include <sys/dvdio.h>
40#include <sys/conf.h>

--- 22 unchanged lines hidden (view full) ---

63#include <sys/uio.h>
64#include <sys/types.h>
65#include <sys/mman.h>
66#include <sys/resourcevar.h>
67
68#include <net/if.h>
69#include <net/if_dl.h>
70#include <net/if_types.h>
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/sysproto.h>
37#include <sys/capsicum.h>
38#include <sys/cdio.h>
39#include <sys/dvdio.h>
40#include <sys/conf.h>

--- 22 unchanged lines hidden (view full) ---

63#include <sys/uio.h>
64#include <sys/types.h>
65#include <sys/mman.h>
66#include <sys/resourcevar.h>
67
68#include <net/if.h>
69#include <net/if_dl.h>
70#include <net/if_types.h>
71#include <net/vnet.h>
72
73#include <dev/usb/usb_ioctl.h>
74
75#ifdef COMPAT_LINUX32
76#include <machine/../linux32/linux.h>
77#include <machine/../linux32/linux32_proto.h>
78#else
79#include <machine/../linux/linux.h>

--- 2023 unchanged lines hidden (view full) ---

2103}
2104
2105/*
2106 * Criteria for interface name translation
2107 */
2108#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER)
2109
2110/*
71
72#include <dev/usb/usb_ioctl.h>
73
74#ifdef COMPAT_LINUX32
75#include <machine/../linux32/linux.h>
76#include <machine/../linux32/linux32_proto.h>
77#else
78#include <machine/../linux/linux.h>

--- 2023 unchanged lines hidden (view full) ---

2102}
2103
2104/*
2105 * Criteria for interface name translation
2106 */
2107#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER)
2108
2109/*
2111 * Interface function used by linprocfs (at the time of writing). It's not
2112 * used by the Linuxulator itself.
2113 */
2114int
2115linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen)
2116{
2117 struct ifnet *ifscan;
2118 int ethno;
2119
2120 IFNET_RLOCK_ASSERT();
2121
2122 /* Short-circuit non ethernet interfaces */
2123 if (!IFP_IS_ETH(ifp))
2124 return (strlcpy(buffer, ifp->if_xname, buflen));
2125
2126 /* Determine the (relative) unit number for ethernet interfaces */
2127 ethno = 0;
2128 TAILQ_FOREACH(ifscan, &V_ifnet, if_link) {
2129 if (ifscan == ifp)
2130 return (snprintf(buffer, buflen, "eth%d", ethno));
2131 if (IFP_IS_ETH(ifscan))
2132 ethno++;
2133 }
2134
2135 return (0);
2136}
2137
2138/*
2139 * Translate a Linux interface name to a FreeBSD interface name,
2140 * and return the associated ifnet structure
2141 * bsdname and lxname need to be least IFNAMSIZ bytes long, but
2142 * can point to the same buffer.
2143 */
2144
2145static struct ifnet *
2146ifname_linux_to_bsd(struct thread *td, const char *lxname, char *bsdname)

--- 1548 unchanged lines hidden ---
2110 * Translate a Linux interface name to a FreeBSD interface name,
2111 * and return the associated ifnet structure
2112 * bsdname and lxname need to be least IFNAMSIZ bytes long, but
2113 * can point to the same buffer.
2114 */
2115
2116static struct ifnet *
2117ifname_linux_to_bsd(struct thread *td, const char *lxname, char *bsdname)

--- 1548 unchanged lines hidden ---