Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Decouple sockets linkage from interface code by making i...
details: https://anonhg.NetBSD.org/src/rev/958737c72a2e
branches: trunk
changeset: 328969:958737c72a2e
user: pooka <pooka%NetBSD.org@localhost>
date: Sat Apr 26 11:16:22 2014 +0000
description:
Decouple sockets linkage from interface code by making ifioctl() a pointer.
diffstat:
sys/kern/sys_socket.c | 6 ++++--
sys/net/if.c | 12 ++++++++----
sys/net/if.h | 4 ++--
3 files changed, 14 insertions(+), 8 deletions(-)
diffs (92 lines):
diff -r 2b51e09889c4 -r 958737c72a2e sys/kern/sys_socket.c
--- a/sys/kern/sys_socket.c Sat Apr 26 11:10:10 2014 +0000
+++ b/sys/kern/sys_socket.c Sat Apr 26 11:16:22 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_socket.c,v 1.66 2014/04/26 11:10:10 pooka Exp $ */
+/* $NetBSD: sys_socket.c,v 1.67 2014/04/26 11:16:22 pooka Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.66 2014/04/26 11:10:10 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.67 2014/04/26 11:16:22 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -92,6 +92,8 @@
.fo_restart = soo_restart,
};
+int (*ifioctl)(struct socket *, u_long, void *, struct lwp *) = (void *)eopnotsupp;
+
/* ARGSUSED */
int
soo_read(file_t *fp, off_t *offset, struct uio *uio, kauth_cred_t cred,
diff -r 2b51e09889c4 -r 958737c72a2e sys/net/if.c
--- a/sys/net/if.c Sat Apr 26 11:10:10 2014 +0000
+++ b/sys/net/if.c Sat Apr 26 11:16:22 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.272 2014/02/25 18:30:12 pooka Exp $ */
+/* $NetBSD: if.c,v 1.273 2014/04/26 11:16:22 pooka Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.272 2014/02/25 18:30:12 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.273 2014/04/26 11:16:22 pooka Exp $");
#include "opt_inet.h"
@@ -168,6 +168,7 @@
static kauth_listener_t if_listener;
+static int doifioctl(struct socket *, u_long, void *, struct lwp *);
static int ifioctl_attach(struct ifnet *);
static void ifioctl_detach(struct ifnet *);
static void ifnet_lock_enter(struct ifnet_lock *);
@@ -226,6 +227,9 @@
if_listener = kauth_listen_scope(KAUTH_SCOPE_NETWORK,
if_listener_cb, NULL);
+
+ /* interfaces are available, inform socket code */
+ ifioctl = doifioctl;
}
/*
@@ -1788,8 +1792,8 @@
/*
* Interface ioctls.
*/
-int
-ifioctl(struct socket *so, u_long cmd, void *data, struct lwp *l)
+static int
+doifioctl(struct socket *so, u_long cmd, void *data, struct lwp *l)
{
struct ifnet *ifp;
struct ifreq *ifr;
diff -r 2b51e09889c4 -r 958737c72a2e sys/net/if.h
--- a/sys/net/if.h Sat Apr 26 11:10:10 2014 +0000
+++ b/sys/net/if.h Sat Apr 26 11:16:22 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.h,v 1.162 2014/04/17 15:45:39 christos Exp $ */
+/* $NetBSD: if.h,v 1.163 2014/04/26 11:16:22 pooka Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -885,7 +885,7 @@
void ifinit1(void);
int ifaddrpref_ioctl(struct socket *, u_long, void *, struct ifnet *,
lwp_t *);
-int ifioctl(struct socket *, u_long, void *, struct lwp *);
+extern int (*ifioctl)(struct socket *, u_long, void *, struct lwp *);
int ifioctl_common(struct ifnet *, u_long, void *);
int ifpromisc(struct ifnet *, int);
struct ifnet *ifunit(const char *);
Home |
Main Index |
Thread Index |
Old Index