pktmedium builds.
authorRonald G. Minnich <rminnich@google.com>
Thu, 16 Jan 2014 23:29:54 +0000 (15:29 -0800)
committerRonald G. Minnich <rminnich@google.com>
Thu, 16 Jan 2014 23:29:54 +0000 (15:29 -0800)
Signed-off-by: Ronald G. Minnich <rminnich@google.com>
kern/src/net/Kbuild
kern/src/net/pktmedium.c

index a337394..1a2b399 100644 (file)
@@ -1,4 +1,5 @@
 obj-y                                          += nullmedium.o
 obj-y                                          += loopbackmedium.o
 obj-y                                          += netdevmedium.o
+obj-y                                          += pktmedium.o
 
index 6bba1a4..4613460 100644 (file)
@@ -1,19 +1,24 @@
-#include "u.h"
-#include "../port/lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-#include "../port/error.h"
+// INFERNO
+#include <vfs.h>
+#include <kfs.h>
+#include <slab.h>
+#include <kmalloc.h>
+#include <kref.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <error.h>
+#include <cpio.h>
+#include <pmap.h>
+#include <smp.h>
+#include <ip.h>
 
-#include "ip.h"
+static void    pktbind(struct Ipifc*i, int unused_int, char **unused_char_pp_t);
+static void    pktunbind(struct Ipifc* i);
+static void    pktbwrite(struct Ipifc*i, struct block*, int unused_int, uint8_t *unused_uint8_p_t);
+static void    pktin(struct Fs*f, struct Ipifc*i, struct block*b);
 
-
-static void    pktbind(Ipifc*, int, char**);
-static void    pktunbind(Ipifc*);
-static void    pktbwrite(Ipifc*, Block*, int, uchar*);
-static void    pktin(Fs*, Ipifc*, Block*);
-
-Medium pktmedium =
+struct medium pktmedium =
 {
 .name=         "pkt",
 .hsize=                14,
@@ -32,7 +37,7 @@ Medium pktmedium =
  *  called with ifc wlock'd
  */
 static void
-pktbind(Ipifc*, int, char**)
+pktbind(struct Ipifc*i, int unused_int, char **unused_char_pp_t)
 {
 }
 
@@ -40,7 +45,7 @@ pktbind(Ipifc*, int, char**)
  *  called with ifc wlock'd
  */
 static void
-pktunbind(Ipifc*)
+pktunbind(struct Ipifc*i)
 {
 }
 
@@ -48,11 +53,11 @@ pktunbind(Ipifc*)
  *  called by ipoput with a single packet to write
  */
 static void
-pktbwrite(Ipifc *ifc, Block *bp, int, uchar*)
+pktbwrite(struct Ipifc *ifc, struct block *bp, int unused_int, uint8_t *unused_uint8_p_t)
 {
        /* enqueue onto the conversation's rq */
        bp = concatblock(bp);
-       if(ifc->conv->snoopers.ref > 0)
+       if(kref_refcnt(&ifc->conv->snoopers) > 0)
                qpass(ifc->conv->sq, copyblock(bp, BLEN(bp)));
        qpass(ifc->conv->rq, bp);
 }
@@ -61,12 +66,12 @@ pktbwrite(Ipifc *ifc, Block *bp, int, uchar*)
  *  called with ifc rlocked when someone write's to 'data'
  */
 static void
-pktin(Fs *f, Ipifc *ifc, Block *bp)
+pktin(struct Fs *f, struct Ipifc *ifc, struct block *bp)
 {
-       if(ifc->lifc == nil)
+       if(ifc->lifc == NULL)
                freeb(bp);
        else {
-               if(ifc->conv->snoopers.ref > 0)
+               if(kref_refcnt(&ifc->conv->snoopers) > 0)
                        qpass(ifc->conv->sq, copyblock(bp, BLEN(bp)));
                ipiput4(f, ifc, bp);
        }