Deleted Added
full compact
linux_ioctl.c (272059) linux_ioctl.c (283421)
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: head/sys/compat/linux/linux_ioctl.c 272059 2014-09-24 08:18:11Z mav $");
32__FBSDID("$FreeBSD: head/sys/compat/linux/linux_ioctl.c 283421 2015-05-24 15:51:18Z 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>

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

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_var.h>
70#include <net/if_dl.h>
71#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>

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

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_var.h>
70#include <net/if_dl.h>
71#include <net/if_types.h>
72#include <net/vnet.h>
73
74#include <dev/usb/usb_ioctl.h>
75
76#ifdef COMPAT_LINUX32
77#include <machine/../linux32/linux.h>
78#include <machine/../linux32/linux32_proto.h>
79#else
80#include <machine/../linux/linux.h>

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

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

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

--- 1548 unchanged lines hidden ---