Set ENOENT for failed 9ns lookups
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 15 Oct 2015 15:21:53 +0000 (11:21 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 15 Oct 2015 16:02:11 +0000 (12:02 -0400)
In the changes from error() taking just an errstr to also taking errno,
some of the times we set_errno(ENOENT) were getting clobbered with
ENODEV.

This commit fixed any recent changes to ENOENT that I could find.  There
might be more, but there are no set_errno(ENOENT)s remaining in the 9ns
code.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/net/netif.c
kern/src/ns/dev.c
kern/src/ns/devtab.c

index 0ac853c..0509090 100644 (file)
@@ -425,10 +425,8 @@ int netifwstat(struct ether *nif, struct chan *c, uint8_t * db, int n)
        int m;
 
        f = nif->f[NETID(c->qid.path)];
-       if (f == 0) {
-               set_errno(ENOENT);
-               error(ENODEV, NULL);
-       }
+       if (f == 0)
+               error(ENOENT, NULL);
 
        if (netown(f, current->user, O_WRITE) < 0)
                error(EPERM, NULL);
index a2db8bf..d819506 100644 (file)
@@ -217,7 +217,7 @@ Accept:
                                                   c->qid.path);
 Notfound:
                                        if (j == 0)
-                                               error(ENODEV, NULL);
+                                               error(ENOENT, NULL);
                                        set_error(ENOENT, NULL);
                                        goto Done;
                                case 0:
@@ -283,8 +283,7 @@ devstat(struct chan *c, uint8_t * db, int n,
                                }
                                printd("DEVSTAT fails:%s %llu\n", devtab[c->type].name,
                                           c->qid.path);
-                               set_errno(ENOENT);
-                               error(ENODEV, NULL);
+                               error(ENOENT, NULL);
                        case 0:
                                printd("DEVSTAT got 0\n");
                                break;
index 9a0412b..40ef1e3 100644 (file)
@@ -55,8 +55,7 @@ struct dev *devtabget(const char *name, int user)
                return &devtab[i];
 
        printk("devtabget FAILED %s\n", name);
-       set_errno(ENOENT);
-       error(ENODEV, NULL);
+       error(ENOENT, NULL);
 }
 
 long devtabread(struct chan *c, void *buf, long n, int64_t off)