Add the no op cache.c for devmnt.
authorRonald G. Minnich <rminnich@google.com>
Fri, 17 Jan 2014 19:03:22 +0000 (11:03 -0800)
committerRonald G. Minnich <rminnich@google.com>
Fri, 17 Jan 2014 19:03:22 +0000 (11:03 -0800)
We might want devmnt to cache someday, so just leave it
as is for now.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
kern/drivers/dev/mnt.c
kern/include/assert.h
kern/include/ns.h
kern/src/ns/Kbuild
kern/src/ns/cache.c [new file with mode: 0644]

index 37ec096..8ea815f 100644 (file)
@@ -825,7 +825,7 @@ mountio(struct mnt *m, struct mntrpc *r)
                if(m->rip == 0)
                        break;
                spin_unlock(&m->lock);
                if(m->rip == 0)
                        break;
                spin_unlock(&m->lock);
-               Sleep(&r->r, rpcattn, r);
+               sleep(&r->r, rpcattn, r);
                if(r->done){
                        poperror();
                        mntflushfree(m, r);
                if(r->done){
                        poperror();
                        mntflushfree(m, r);
@@ -943,7 +943,7 @@ mntgate(struct mnt *m)
        m->rip = 0;
        for(q = m->queue; q; q = q->list) {
                if(q->done == 0)
        m->rip = 0;
        for(q = m->queue; q; q = q->list) {
                if(q->done == 0)
-               if(Wakeup(&q->r))
+               if(wakeup(&q->r))
                        break;
        }
        spin_unlock(&m->lock);
                        break;
        }
        spin_unlock(&m->lock);
@@ -976,7 +976,7 @@ mountmux(struct mnt *m, struct mntrpc *r)
                                        m->c, q->stime,
                                        q->reqlen + r->replen);
                        if(q != r)
                                        m->c, q->stime,
                                        q->reqlen + r->replen);
                        if(q != r)
-                               Wakeup(&q->r);
+                               wakeup(&q->r);
                        return;
                }
                l = &q->list;
                        return;
                }
                l = &q->list;
index b765dbe..b79cbfc 100644 (file)
@@ -9,6 +9,8 @@ void ( _panic)(const char* NTS, int, const char* NTS, ...)
 
 #define warn(...) _warn(__FILE__, __LINE__, __VA_ARGS__)
 #define panic(...) _panic(__FILE__, __LINE__, __VA_ARGS__)
 
 #define warn(...) _warn(__FILE__, __LINE__, __VA_ARGS__)
 #define panic(...) _panic(__FILE__, __LINE__, __VA_ARGS__)
+#define exhausted(...) _panic(__FILE__, __LINE__, __VA_ARGS__)
+
 
 #define check(x)               \
        do { if (!(x)) warn("warning failed: %s", #x); } while (0)
 
 #define check(x)               \
        do { if (!(x)) warn("warning failed: %s", #x); } while (0)
index ed8cf5e..695abde 100644 (file)
@@ -695,7 +695,6 @@ int         eqqid(struct qid, struct qid);
 void           errorf( char *unused_char_p_t, ...);
 void           errstr( char *unused_char_p_t, int);
 void           excinit(void);
 void           errorf( char *unused_char_p_t, ...);
 void           errstr( char *unused_char_p_t, int);
 void           excinit(void);
-void           exhausted( char *unused_char_p_t);
 void           exit(int);
 void           reboot(void);
 void           halt(void);
 void           exit(int);
 void           reboot(void);
 void           halt(void);
index 54d4e7f..9d75717 100644 (file)
@@ -1,4 +1,5 @@
 obj-y                                          += allocb.o
 obj-y                                          += allocb.o
+obj-y                                          += cache.o
 obj-y                                          += chan.o
 obj-y                                          += convD2M.o
 obj-y                                          += convM2D.o
 obj-y                                          += chan.o
 obj-y                                          += convD2M.o
 obj-y                                          += convM2D.o
diff --git a/kern/src/ns/cache.c b/kern/src/ns/cache.c
new file mode 100644 (file)
index 0000000..e3c2278
--- /dev/null
@@ -0,0 +1,45 @@
+// 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>
+
+/*
+ * no cache in hosted mode
+ */
+void
+cinit(void)
+{
+}
+
+void
+copen(struct chan *c)
+{
+       c->flag &= ~CCACHE;
+}
+
+int
+cread(struct chan *c, uint8_t *b, int n, int64_t off)
+{
+       return 0;
+}
+
+void
+cwrite(struct chan *c, uint8_t *buf, int n, int64_t off)
+{
+}
+
+void
+cupdate(struct chan *c, uint8_t *buf,  int n, int64_t off)
+{
+}
+