Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/newsmips/stand/boot Remove remaining uses of libsa/...



details:   https://anonhg.NetBSD.org/src/rev/9279c9306ab7
branches:  trunk
changeset: 544170:9279c9306ab7
user:      drochner <drochner%NetBSD.org@localhost>
date:      Thu Mar 13 14:49:12 2003 +0000

description:
Remove remaining uses of libsa/netif -- the "netif" structure was only
used to lookup a "struct romdev", everything else was ballast.
Do it straightforward now and assign the romdev directly to io_netif.

diffstat:

 sys/arch/newsmips/stand/boot/net.c        |   9 +++--
 sys/arch/newsmips/stand/boot/netif_news.c |  42 ++++++++++--------------------
 sys/arch/newsmips/stand/boot/netif_news.h |   4 ++
 3 files changed, 23 insertions(+), 32 deletions(-)

diffs (164 lines):

diff -r d62833baf5eb -r 9279c9306ab7 sys/arch/newsmips/stand/boot/net.c
--- a/sys/arch/newsmips/stand/boot/net.c        Thu Mar 13 14:37:36 2003 +0000
+++ b/sys/arch/newsmips/stand/boot/net.c        Thu Mar 13 14:49:12 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.1 1999/12/22 05:54:41 tsubai Exp $   */
+/*     $NetBSD: net.c,v 1.2 2003/03/13 14:49:12 drochner Exp $ */
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -56,7 +56,6 @@
 
 #include <lib/libsa/stand.h>
 #include <lib/libsa/net.h>
-#include <lib/libsa/netif.h>
 #include <lib/libsa/bootparam.h>
 #include <lib/libsa/nfs.h>
 
@@ -64,6 +63,8 @@
 
 #include <promdev.h>
 
+#include "netif_news.h"
+
 char rootpath[FNAME_SIZE];
 
 int    netdev_sock = -1;
@@ -82,7 +83,7 @@
        /* On first open, do netif open, mount, etc. */
        if (open_count == 0) {
                /* Find network interface. */
-               if ((netdev_sock = netif_open(pd)) < 0) {
+               if ((netdev_sock = netif_news_open(pd)) < 0) {
                        error = errno;
                        goto bad;
                }
@@ -103,7 +104,7 @@
                return (0);
 
        if (--open_count == 0)
-               return (netif_close(netdev_sock));
+               netif_news_close(netdev_sock);
 
        return (0);
 }
diff -r d62833baf5eb -r 9279c9306ab7 sys/arch/newsmips/stand/boot/netif_news.c
--- a/sys/arch/newsmips/stand/boot/netif_news.c Thu Mar 13 14:37:36 2003 +0000
+++ b/sys/arch/newsmips/stand/boot/netif_news.c Thu Mar 13 14:49:12 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netif_news.c,v 1.3 2002/04/13 07:34:18 tsutsui Exp $   */
+/*     $NetBSD: netif_news.c,v 1.4 2003/03/13 14:49:12 drochner Exp $  */
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -47,19 +47,18 @@
 
 #include <lib/libsa/stand.h>
 #include <lib/libsa/net.h>
-#include <lib/libsa/netif.h>
 #include <lib/libkern/libkern.h>
 
 #include <machine/apcall.h>
 #include <promdev.h>
 
-static struct netif netif_prom;
+#include "netif_news.h"
 
 #ifdef NETIF_DEBUG
 int netif_debug;
 #endif
 
-struct iodesc sockets[SOPEN_MAX];
+static struct iodesc sdesc;
 
 struct iodesc *
 socktodesc(sock)
@@ -68,18 +67,17 @@
        if (sock != 0) {
                return(NULL);
        }
-       return (sockets);
+       return (&sdesc);
 }
 
 int
-netif_open(machdep_hint)
-       void *machdep_hint;
+netif_news_open(pd)
+       struct romdev *pd;
 {
-       struct romdev *pd = machdep_hint;
        struct iodesc *io;
 
        /* find a free socket */
-       io = sockets;
+       io = &sdesc;
        if (io->io_netif) {
 #ifdef DEBUG
                printf("netif_open: device busy\n");
@@ -89,8 +87,7 @@
        }
        memset(io, 0, sizeof(*io));
 
-       netif_prom.nif_devdata = pd;
-       io->io_netif = &netif_prom;
+       io->io_netif = pd;
 
        /* Put our ethernet address in io->myea */
        prom_getether(pd, io->myea);
@@ -98,25 +95,14 @@
        return(0);
 }
 
-int
-netif_close(fd)
+void
+netif_news_close(fd)
        int fd;
 {
        struct iodesc *io;
-       struct netif *ni;
 
-       if (fd != 0) {
-               errno = EBADF;
-               return(-1);
-       }
-
-       io = &sockets[fd];
-       ni = io->io_netif;
-       if (ni != NULL) {
-               ni->nif_devdata = NULL;
-               io->io_netif = NULL;
-       }
-       return(0);
+       io = &sdesc;
+       io->io_netif = NULL;
 }
 
 /*
@@ -133,7 +119,7 @@
        ssize_t rv;
        size_t sendlen;
 
-       pd = (struct romdev *)desc->io_netif->nif_devdata;
+       pd = (struct romdev *)desc->io_netif;
 
 #ifdef NETIF_DEBUG
        if (netif_debug) {
@@ -181,7 +167,7 @@
        int tick0;
        ssize_t len;
 
-       pd = (struct romdev *)desc->io_netif->nif_devdata;
+       pd = (struct romdev *)desc->io_netif;
 
 #ifdef NETIF_DEBUG
        if (netif_debug)
diff -r d62833baf5eb -r 9279c9306ab7 sys/arch/newsmips/stand/boot/netif_news.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/newsmips/stand/boot/netif_news.h Thu Mar 13 14:49:12 2003 +0000
@@ -0,0 +1,4 @@
+/* $NetBSD: netif_news.h,v 1.1 2003/03/13 14:49:12 drochner Exp $ */
+
+int netif_news_open(struct romdev *);
+void netif_news_close(int);



Home | Main Index | Thread Index | Old Index