Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libsa separate the netif interface from the rest of ...



details:   https://anonhg.NetBSD.org/src/rev/7066f189c40a
branches:  trunk
changeset: 544125:7066f189c40a
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Mar 12 14:49:19 2003 +0000

description:
separate the netif interface from the rest of the networking code,
so that it can be replaced easily in md code

diffstat:

 sys/lib/libsa/iodesc.h |   8 ++++++--
 sys/lib/libsa/netif.c  |  11 +++--------
 sys/lib/libsa/netif.h  |   9 +++------
 3 files changed, 12 insertions(+), 16 deletions(-)

diffs (93 lines):

diff -r a2073fcdeb7f -r 7066f189c40a sys/lib/libsa/iodesc.h
--- a/sys/lib/libsa/iodesc.h    Wed Mar 12 13:36:22 2003 +0000
+++ b/sys/lib/libsa/iodesc.h    Wed Mar 12 14:49:19 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iodesc.h,v 1.4 1995/09/23 03:31:50 gwr Exp $   */
+/*     $NetBSD: iodesc.h,v 1.5 2003/03/12 14:49:19 drochner Exp $      */
 
 /*
  * Copyright (c) 1993 Adam Glass 
@@ -48,7 +48,11 @@
        u_short myport;                 /* local port, net order */
        u_long  xid;                    /* transaction identification */
        u_char  myea[6];                /* my ethernet address */
-       struct netif *io_netif;
+       void    *io_netif;
 };
 
+struct iodesc  *socktodesc __P((int));
+ssize_t                netif_get __P((struct iodesc *, void *, size_t, time_t));
+ssize_t                netif_put __P((struct iodesc *, void *, size_t));
+
 #endif /* __SYS_LIBNETBOOT_IODESC_H */
diff -r a2073fcdeb7f -r 7066f189c40a sys/lib/libsa/netif.c
--- a/sys/lib/libsa/netif.c     Wed Mar 12 13:36:22 2003 +0000
+++ b/sys/lib/libsa/netif.c     Wed Mar 12 14:49:19 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netif.c,v 1.17 2002/09/27 15:37:48 provos Exp $        */
+/*     $NetBSD: netif.c,v 1.18 2003/03/12 14:49:19 drochner Exp $      */
 
 /*
  * Copyright (c) 1993 Adam Glass
@@ -44,7 +44,6 @@
 #include <netinet/in_systm.h>
 
 #include "stand.h"
-#include "net.h"
 #include "netif.h"
 
 struct iodesc sockets[SOPEN_MAX];
@@ -230,10 +229,8 @@
        size_t len;
        time_t timo;
 {
-#ifdef NETIF_DEBUG
        struct netif *nif = desc->io_netif;
-#endif
-       struct netif_driver *drv = desc->io_netif->nif_driver;
+       struct netif_driver *drv = nif->nif_driver;
        ssize_t rv;
 
 #ifdef NETIF_DEBUG
@@ -260,10 +257,8 @@
        void *pkt;
        size_t len;
 {
-#ifdef NETIF_DEBUG
        struct netif *nif = desc->io_netif;
-#endif
-       struct netif_driver *drv = desc->io_netif->nif_driver;
+       struct netif_driver *drv = nif->nif_driver;
        ssize_t rv;
 
 #ifdef NETIF_DEBUG
diff -r a2073fcdeb7f -r 7066f189c40a sys/lib/libsa/netif.h
--- a/sys/lib/libsa/netif.h     Wed Mar 12 13:36:22 2003 +0000
+++ b/sys/lib/libsa/netif.h     Wed Mar 12 14:49:19 2003 +0000
@@ -1,10 +1,11 @@
-/*     $NetBSD: netif.h,v 1.4 1995/09/14 23:45:30 pk Exp $     */
+/*     $NetBSD: netif.h,v 1.5 2003/03/12 14:49:19 drochner Exp $       */
 
 #ifndef __SYS_LIBNETBOOT_NETIF_H
 #define __SYS_LIBNETBOOT_NETIF_H
+
 #include "iodesc.h"
 
-#define NENTS(x)       sizeof(x)/sizeof(x[0])
+struct netif; /* forward */
 
 struct netif_driver {
        char    *netif_bname;
@@ -54,12 +55,8 @@
 int            netif_probe __P((struct netif *, void *));
 void           netif_attach __P((struct netif *, struct iodesc *, void *));
 void           netif_detach __P((struct netif *));
-ssize_t                netif_get __P((struct iodesc *, void *, size_t, time_t));
-ssize_t                netif_put __P((struct iodesc *, void *, size_t));
 
 int            netif_open __P((void *));
 int            netif_close __P((int));
 
-struct iodesc  *socktodesc __P((int));
-       
 #endif /* __SYS_LIBNETBOOT_NETIF_H */



Home | Main Index | Thread Index | Old Index