Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/macppc/stand/ofwboot Remove remaining uses of libsa...



details:   https://anonhg.NetBSD.org/src/rev/db25038eb41b
branches:  trunk
changeset: 544154:db25038eb41b
user:      drochner <drochner%NetBSD.org@localhost>
date:      Thu Mar 13 11:35:54 2003 +0000

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

diffstat:

 sys/arch/macppc/stand/ofwboot/net.c      |  14 ++++++++------
 sys/arch/macppc/stand/ofwboot/netif_of.c |  29 +++++++++++------------------
 sys/arch/macppc/stand/ofwboot/netif_of.h |   4 ++++
 3 files changed, 23 insertions(+), 24 deletions(-)

diffs (161 lines):

diff -r 582ceeb32078 -r db25038eb41b sys/arch/macppc/stand/ofwboot/net.c
--- a/sys/arch/macppc/stand/ofwboot/net.c       Thu Mar 13 10:24:38 2003 +0000
+++ b/sys/arch/macppc/stand/ofwboot/net.c       Thu Mar 13 11:35:54 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.3 2002/03/29 15:15:07 tsutsui Exp $  */
+/*     $NetBSD: net.c,v 1.4 2003/03/13 11:35:54 drochner Exp $ */
 
 /*
  * Copyright (C) 1995 Wolfgang Solfrank.
@@ -40,7 +40,7 @@
  *
  * At open time, this does:
  *
- * find interface      - netif_open()
+ * find interface      - netif_of_open()
  * BOOTP               - bootp()
  * RPC/mountd          - nfs_mount()
  *
@@ -59,10 +59,12 @@
 
 #include <lib/libsa/stand.h>
 #include <lib/libsa/net.h>
-#include <lib/libsa/netif.h>
 
 #include <lib/libkern/libkern.h>
 
+#include "ofdev.h"
+#include "netif_of.h"
+
 char   rootpath[FNAME_SIZE];
 
 static int netdev_sock = -1;
@@ -83,7 +85,7 @@
         */
        if (open_count == 0) {
                /* Find network interface. */
-               if ((netdev_sock = netif_open(op)) < 0) {
+               if ((netdev_sock = netif_of_open(op)) < 0) {
                        error = errno;
                        goto bad;
                }
@@ -93,7 +95,7 @@
        open_count++;
 bad:
        if (netdev_sock >= 0 && open_count == 0) {
-               netif_close(netdev_sock);
+               netif_of_close(netdev_sock);
                netdev_sock = -1;
        }
        return error;
@@ -108,7 +110,7 @@
         */
        if (open_count > 0)
                if (--open_count == 0) {
-                       netif_close(netdev_sock);
+                       netif_of_close(netdev_sock);
                        netdev_sock = -1;
                }
 }
diff -r 582ceeb32078 -r db25038eb41b sys/arch/macppc/stand/ofwboot/netif_of.c
--- a/sys/arch/macppc/stand/ofwboot/netif_of.c  Thu Mar 13 10:24:38 2003 +0000
+++ b/sys/arch/macppc/stand/ofwboot/netif_of.c  Thu Mar 13 11:35:54 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netif_of.c,v 1.5 2002/03/29 15:15:07 tsutsui Exp $     */
+/*     $NetBSD: netif_of.c,v 1.6 2003/03/13 11:35:55 drochner Exp $    */
 
 /*
  * Copyright (C) 1995 Wolfgang Solfrank.
@@ -50,14 +50,13 @@
 
 #include <lib/libsa/stand.h>
 #include <lib/libsa/net.h>
-#include <lib/libsa/netif.h>
 
 #include "ofdev.h"
 #include "openfirm.h"
 
-static struct netif netif_of;
+#include "netif_of.h"
 
-struct iodesc sockets[SOPEN_MAX];
+struct iodesc sockets[1];
 
 struct iodesc *
 socktodesc(sock)
@@ -69,10 +68,9 @@
 }
 
 int
-netif_open(machdep_hint)
-       void *machdep_hint;
+netif_of_open(op)
+       struct of_dev *op;
 {
-       struct of_dev *op = machdep_hint;
        struct iodesc *io;
        int fd, error;
        char addr[32];
@@ -91,8 +89,7 @@
        }
        memset(io, 0, sizeof *io);
 
-       netif_of.nif_devdata = op;
-       io->io_netif = &netif_of;
+       io->io_netif = op;
 
        /* Put our ethernet address in io->myea */
        OF_getprop(OF_instance_to_package(op->handle),
@@ -107,11 +104,10 @@
 }
 
 int
-netif_close(fd)
+netif_of_close(fd)
        int fd;
 {
        struct iodesc *io;
-       struct netif *ni;
 
 #ifdef NETIF_DEBUG
        printf("netif_close(%x)...", fd);
@@ -125,11 +121,8 @@
        }
 
        io = &sockets[fd];
-       ni = io->io_netif;
-       if (ni != NULL) {
-               ni->nif_devdata = NULL;
-               io->io_netif = NULL;
-       }
+       io->io_netif = NULL;
+
 #ifdef NETIF_DEBUG
        printf("OK\n");
 #endif
@@ -150,7 +143,7 @@
        ssize_t rv;
        size_t sendlen;
 
-       op = desc->io_netif->nif_devdata;
+       op = desc->io_netif;
 
 #ifdef NETIF_DEBUG
        {
@@ -201,7 +194,7 @@
        int tick0, tmo_ms;
        int len;
 
-       op = desc->io_netif->nif_devdata;
+       op = desc->io_netif;
 
 #ifdef NETIF_DEBUG
        printf("netif_get: pkt=0x%x, maxlen=%d, tmo=%d\n",
diff -r 582ceeb32078 -r db25038eb41b sys/arch/macppc/stand/ofwboot/netif_of.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/macppc/stand/ofwboot/netif_of.h  Thu Mar 13 11:35:54 2003 +0000
@@ -0,0 +1,4 @@
+/* $NetBSD: netif_of.h,v 1.1 2003/03/13 11:35:55 drochner Exp $ */
+
+int netif_of_open(struct of_dev *);
+void netif_of_close(void);



Home | Main Index | Thread Index | Old Index