Fixes devnix's V lookup The issue was that the QID for chans that were genned from a Qnixdir had a bad nixid. We were passing either 0 (for ctl) or 1 (for image) (which is what you get when you take (s - Qctl). This happened to work okay for ctl, since we usually have a nix0. But image thought its struct v was for nix1. I think we only need to do this for "state machine genned" entries, meaning the entries under Qnixdir. The "directly genned" entries should come in to gen with a properly filled out QID (which came from a previous gen).
diff --git a/kern/drivers/dev/nix.c b/kern/drivers/dev/nix.c index c1cb598..7ed4386 100644 --- a/kern/drivers/dev/nix.c +++ b/kern/drivers/dev/nix.c
@@ -130,6 +130,11 @@ return ((index << INDEX_SHIFT) | type); } +static inline int QID2ID(struct qid q) +{ + return q.path >> INDEX_SHIFT; +} + /* TODO: (MGMT) not called yet. -- we have to unlink the nix */ static void nix_release(struct kref *kref) { @@ -205,11 +210,11 @@ s += Qctl; /* first time through, start on Qctl */ switch (s) { case Qctl: - mkqid(&q, QID(s-Qctl, Qctl), 0, QTFILE); + mkqid(&q, QID(QID2ID(c->qid), Qctl), 0, QTFILE); devdir(c, q, "ctl", 0, eve, 0666, dp); return 1; case Qimage: - mkqid(&q, QID(s-Qctl, Qimage), 0, QTFILE); + mkqid(&q, QID(QID2ID(c->qid), Qimage), 0, QTFILE); devdir(c, q, "image", 0, eve, 0666, dp); return 1; }