M pc/devvga.c => pc/devvga.c +6 -6
@@ 59,7 59,7 @@ static Vgac vga = {
};
static Vgac *vgactlr = &vga; /* available VGA ctlrs */
-static Vgac *vgac; /* current VGA ctlr */
+static Vgac *vgac = &vga; /* current VGA ctlr */
static Hwgc *hwgctlr; /* available HWGC's */
Hwgc *hwgc; /* current HWGC */
@@ 183,10 183,9 @@ vgaread(Chan *c, void *buf, long n, ulong offset)
case Qdir:
return devdirread(c, buf, n, vgadir, Nvga, devgen);
case Qvgactl:
- if(vgac == 0)
- vgacp = &vga;
- else
- vgacp = vgac;
+ if(cga)
+ return readstr(offset, buf, n, "type: cga\n");
+ vgacp = vgac;
port = sprint(cbuf, "type: %s\n", vgacp->name);
port += sprint(cbuf+port, "size: %dx%dx%d%s\n",
gscreen.r.max.x, gscreen.r.max.y,
@@ 291,7 290,8 @@ vgactl(char *arg)
error(Ebadarg);
interlaced[0] = *cp;
- cursoroff(1);
+ if(cga == 0)
+ cursoroff(1);
setscreen(x, y, z);
cursoron(1);
return;
M port/devmnt.c => port/devmnt.c +15 -7
@@ 494,11 494,18 @@ mntread9p(Chan *c, void *buf, long n, ulong offset)
long
mntread(Chan *c, void *buf, long n, ulong offset)
{
- int nc;
uchar *p, *e;
+ int nc, cache, isdir;
+
+ isdir = 0;
+ cache = c->flag & CCACHE;
+ if(c->qid.path & CHDIR) {
+ cache = 0;
+ isdir = 1;
+ }
p = buf;
- if(c->flag & CCACHE) {
+ if(cache) {
nc = cread(c, buf, n, offset);
if(nc > 0) {
n -= nc;
@@ 513,11 520,10 @@ mntread(Chan *c, void *buf, long n, ulong offset)
}
n = mntrdwr(Tread, c, buf, n, offset);
- if((c->qid.path & CHDIR) == 0)
- return n;
-
- for(e = &p[n]; p < e; p += DIRLEN)
- mntdirfix(p, c);
+ if(isdir) {
+ for(e = &p[n]; p < e; p += DIRLEN)
+ mntdirfix(p, c);
+ }
return n;
}
@@ 596,6 602,8 @@ mntrdwr(int type, Chan *c, void *buf, long n, ulong offset)
uba = buf;
cnt = 0;
cache = c->flag & CCACHE;
+ if(c->path & CHDIR)
+ cache = 0;
for(;;) {
r = mntralloc(c);
if(waserror()) {