summaryrefslogtreecommitdiff
path: root/fd.c
diff options
context:
space:
mode:
authorkaashoek <kaashoek>2006-08-09 16:04:04 +0000
committerkaashoek <kaashoek>2006-08-09 16:04:04 +0000
commit6fa5ffb56ffdbe5a37bfc04d063fbff2bf929c27 (patch)
tree7a06e4e145812109fcec97aec32c135632481edf /fd.c
parent6c0e444fcdf7ba21442513acbc69c7fca9def06b (diff)
downloadxv6-labs-6fa5ffb56ffdbe5a37bfc04d063fbff2bf929c27.tar.gz
xv6-labs-6fa5ffb56ffdbe5a37bfc04d063fbff2bf929c27.tar.bz2
xv6-labs-6fa5ffb56ffdbe5a37bfc04d063fbff2bf929c27.zip
devsw
checkpoint: write(fd,"hello\n",6) where fd is a console dev almost works
Diffstat (limited to 'fd.c')
-rw-r--r--fd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fd.c b/fd.c
index 8332454..47b0f20 100644
--- a/fd.c
+++ b/fd.c
@@ -6,8 +6,10 @@
#include "defs.h"
#include "fd.h"
#include "spinlock.h"
+#include "dev.h"
struct spinlock fd_table_lock;
+struct devsw devsw[NDEV];
struct fd fds[NFD];
@@ -56,6 +58,8 @@ fd_write(struct fd *fd, char *addr, int n)
return -1;
if(fd->type == FD_PIPE){
return pipe_write(fd->pipe, addr, n);
+ } else if (fd->type == FD_FILE) {
+ return writei (fd->ip, addr, n);
} else {
panic("fd_write");
return -1;