9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 89d0d7f2bbd2db22c9bde244e6be1890969c7d61
parent 68547e656cc3bfd615d84911dca5a8ecd2c03845
Author: Dimitris Papastamos <dimitris.papastamos@arm.com>
Date:   Tue, 11 Dec 2018 16:16:45 +0000

Merge "[drivers] Small fixes for drivers"
Diffstat:
Mdrivers/dev.c | 12+++++++++---
Mdrivers/dev.h | 2+-
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/dev.c b/drivers/dev.c @@ -172,7 +172,7 @@ Chan * devclone(Chan *c, Chan *nc) { if (!nc && (nc = newchan()) == NULL) - return NULL; + return NULL; nc->qid = c->qid; nc->type = c->type; @@ -191,7 +191,8 @@ devattach(const char *spec, int id) if ((type = devtype(id)) < 0) return NULL; - c = newchan(); + if ((c = newchan()) == NULL) + return NULL; c->qid = CHDIR; c->type = devtype(id); return c; @@ -361,11 +362,16 @@ void idev(void) { struct devdata *dinfo; - Chan *c; + Chan *c, *lim; + int i; dinfo = alloc(sizeof(*dinfo)); bss->devinfo = dinfo; + lim = &dinfo->fds[NR_CHANS]; + for (c = dinfo->fds; c < lim; c++) + c->type = NODEV; + if ((c = devattach(NULL, '/')) == NULL) panic("idev:attach"); diff --git a/drivers/dev.h b/drivers/dev.h @@ -1,7 +1,7 @@ #include <stddef.h> #define NR_CHANS 4 -#define NODEV -1 +#define NODEV 255 #define NAMELEN 8 #define DIRLEN sizeof(Dir) #define CHDIR (1 << 15)