~foura/midifs

880e6926d46f6ccb297ae25704de8afcf6f9f28c — james palmer 2 months ago d084b72
nicer error message for unimplemented reads and writes
1 files changed, 10 insertions(+), 10 deletions(-)

M main.c
M main.c => main.c +10 -10
@@ 90,26 90,26 @@ fsread(Req *r)
	case Qroot:
		dirread9p(r, rootgen, r);
		respond(r, nil);
		break;
		return;
	case Qctl:
		snprint(buf, sizeof buf, "channel %d\ncable %d\n", dev->chan, dev->cable);
		readstr(r, buf);
		respond(r, nil);
		break;
		return;
	case Qraw:
		/* FIXME: this may block the srv loop */
		count = read(dev->fd, r->ofcall.data, r->ifcall.count);
		if(count < 0) {
			respond(r, "couldn't read from device");
			break;
			return;
		}

		r->ofcall.count = count;
		respond(r, nil);
		break;
	default:
		respond(r, "no.");
		return;
	}

	respond(r, "not implemented");
}

void


@@ 125,15 125,15 @@ fswrite(Req *r)
		count = write(dev->fd, r->ifcall.data, r->ifcall.count);
		if(count < 0) {
			respond(r, "couldn't write to device");
			break;
			return;
		}

		r->ofcall.count = count;
		respond(r, nil);
		break;
	default:
		respond(r, "no.");
		return;
	}

	respond(r, "not implemented");
}

void