> The stats files in connection directories was stupid, because I > originally had a simple structure and that was the easy place to > put the stats files. I really should move it up but never get > around to it... > > In general, stats is meant for generic info common to all types of > interfaces and ifstats for interface specific stuff. I would say > that link is generic; even the 802.11's have something you might > construe as link (i.e. a base station to talk to). OK, tonight I got bored with the other project I was working on and made the requisite changes to move the 'link:' line to stats and move stats and ifstats up out of the connection directories. I haven't tested this very rigorously, but the changes are generally so inconsequential that I can't foresee any major problems. I also changed the ether(3) man page to bring it in line with the current state of affairs. I'm not convinced that the wording I've used is the best, but I can't think of how to say things better without being long winded. Diffs below: term% diff /sys/src/9/port/netif.h port/netif.h 77a78 > int link; /* link status */ term% diff /sys/src/9/port/netif.c port/netif.c 81a82,89 > case 2: > q.path = Nstatqid; > devdir(c, q, "stats", 0, eve, 0444, dp); > break; > case 3: > q.path = Nifstatqid; > devdir(c, q, "ifstats", 0, eve, 0444, dp); > break; 83c91 < i -= 2; --- > i -= 4; 124,127d131 < q.path = NETQID(NETID(c->qid.path), Nstatqid); < devdir(c, q, "stats", 0, eve, 0444, dp); < break; < case 3: 131,134d134 < case 4: < q.path = NETQID(NETID(c->qid.path), Nifstatqid); < devdir(c, q, "ifstats", 0, eve, 0444, dp); < break; 215a216 > j += snprint(p+j, READSTR-j, "link: %d\n", nif->link); term% diff /sys/src/9/ip/ethermedium.c ip/ethermedium.c 166c166 < snprint(addr, sizeof(addr), "%s/stats", dir); --- > snprint(addr, sizeof(addr), "%s/stats", argv[2]); term% diff /sys/src/9/pc/ether82557.c pc/ether82557.c 38a39 > Gstatus = 0x1D, /* General status register */ 426a428,429 > > ether->link = csr8r(ctlr, Gstatus) & 0x1; term% diff /sys/src/libip/myetheraddr.c myetheraddr.c 21c21 < sprint(buf, "%s/0/stats", dev); --- > sprint(buf, "%s/stats", dev); 23c23 < sprint(buf, "/net/%s/0/stats", dev); --- > sprint(buf, "/net/%s/stats", dev); term% diff /sys/src/cmd/stats.c stats.c 46c46 < /* /net/ether0/0/stats */ --- > /* /net/ether0/stats */ 628c628 < snprint(buf, sizeof buf, "%s/net/ether0/0/stats", mpt); --- > snprint(buf, sizeof buf, "%s/net/ether0/stats", mpt); 633c633 < snprint(buf, sizeof buf, "%s/net/ether0/0/ifstats", mpt); --- > snprint(buf, sizeof buf, "%s/net/ether0/ifstats", mpt); The changes to ether(3) are more than just a couple of lines, so I'm just attaching the whole file. It looks to me like the only binaries that need to be recompiled as a result of the libip change are ip/ipconfig, ip/rarpd and ndb/cs. One thing I didn't attempt was to modify the other ethernet controllers to put link info in the stats. Maybe what could be done temporarily is to have them set link to -1 to mean 'unknown'. Then as people have time/interest, they can update the individual drivers. Thanks for all your work, and thanks in advance for incorporating this stuff. I know you guys are busy; I will understand if it doesn't make the distro for a while. Micah