9ns: Fix devtab function pointer signatures
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 1 Mar 2018 04:07:39 +0000 (23:07 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 30 Apr 2018 18:29:20 +0000 (14:29 -0400)
commit398998fd7bba66d80584f5bc98ecb34d4a457f0c
tree6a73ddb5e5f0df1e5aae587c4c5be8f4d8aeeadb
parent270779b34f0d7b03d2df4b57da7665a4b59cecf3
9ns: Fix devtab function pointer signatures

The signatures had the wrong signedness for some of the types.  It had
been an ongoing annoyance for every new device we create.  I pulled off
the bandaid.

Returning negative values for e.g. dev.read() will decrement the chan's
offset!  See rread() for details.  It's unlikely, but we shouldn't be
propagating errors like that, and the type ought to tell us what the
function should do.

Note that SYS_read returns an ssize_t.  dev.read() does not.  It should
throw for errors.

When I noticed device-internal functions with similar problems, for
instance helper functions like mntrdwr() or some of the functions in
sd.c, I fixed those too.  But this was far from exhaustive.

I did notice that pipebwrite() returns the retval from qio functions, but
ipbwrite() just returns n.  Those qio functions could return -1, maybe,
since they are ssize_t.  That needs some work still.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
23 files changed:
kern/arch/x86/devarch.c
kern/drivers/dev/acpi.c
kern/drivers/dev/alarm.c
kern/drivers/dev/capability.c
kern/drivers/dev/cons.c
kern/drivers/dev/ether.c
kern/drivers/dev/eventfd.c
kern/drivers/dev/kprof.c
kern/drivers/dev/mem.c
kern/drivers/dev/mnt.c
kern/drivers/dev/pci.c
kern/drivers/dev/pipe.c
kern/drivers/dev/proc.c
kern/drivers/dev/random.c
kern/drivers/dev/regress.c
kern/drivers/dev/root.c
kern/drivers/dev/sd.c
kern/drivers/dev/srv.c
kern/drivers/dev/vars.c
kern/drivers/dev/version.c
kern/include/ns.h
kern/src/net/devip.c
kern/src/ns/dev.c