Not very good implementation of root file system

mkdir sort of works. A lot else doesn't but I need to tend
to some other fires. If you don't agree with my bias against
linked lists then feel free to redo.

Sorry, wish this were better.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Less braindead root. I'm about half way through.

Just sat back, made some rules that seem to make sense,
added the opcodes, and the bits that are finished work as expected.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
rootdev with a bit fewer errors.

mkdir '#r/srv' followed by 'ls '#r/srv' panics akaros.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Closer.

File creation kind of works. Turns out the ptr struct member
in the table is the child pointer for directories, which I
should have realized. The translation from NIX to Inferno
keeps bollixing me up.

No more kernel panics, things seem to be right, but
mkdir #r/srv/x
cat #r/srv
shows x there, but 'ls '#r/srv' gets an error that x is not
there.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Lindent pass

Downside: it messes up git's history for specific lines.

Here's a useful command (from the last time we did this):

git diff --name-status master..HEAD | grep '^A' | cut -f 2 | grep
'^kern' | grep -v Kbuild | xargs ./scripts/lindent
Finally! at least the hierarchy is right

There were some issues due to the changed use of this code.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
mkdir works.

Was checking in the wrong place.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
File creation working but ... broken

try cp /root '#r/srv/root'

The error is
rootcreate: c 0xffff80007fff8850, name root, omode 1101, perm 81ed
kernel warning at kern/src/ns/sysfile.c:113, from core 0: Trunc mode issue: mode 1, mode minus trunc 1, chan mode 0

So somehow the chan mode is getting set wrong.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Fixes mkdir

I think.  We should be passing DMDIR in the perms argument.  Also, this
tries to catch issues with nasty "mode"/permissions from userspace.
Fixes remove bug

Inferno has this annoying habit of assuming a dev type == 0 means "do a
noop on close".  Devroot used to be the first in the devtab, but we
can't guarantee that since devtab is built by the linker.
QTFILE isn't 0...

This might cause some bugs, but I can't stand when we use the value 0
for a bit.  You can't tell the difference between no type and QTFILE.
Devroot fixup

There's a lot of changes, especially with gen.  There are also some bug
fixes that aren't as big of a deal.  Gen is usually the hard part.
Properly extract errno from p9 rpc; fix incorrect mkdir error

mkdir /mnt/tmp/xxx would fail with the wrong errno (EEXIST)
because we could not properly get errno from the Plan 9 RPC.

I've fixed my version of go9p (github.com/rminnich/go9p) to
return Rerror strings in the form 'XXXX error message'
(space after XXXX is important) where XXXX is the hex-encoded
errno (this is how I did it for the original Linux 9p in 1998).
This format has the advantage of being all text; later implementations
(e.g. 9p2000.[ul]) break the rule and embed binary data in the string
and were a backward step IMHO.

I've fixed Akaros 9p parsing to look for a string at least 5 bytes long,
with the first 4 bytes being hex digits, and if that is the case to
set_errno using those digits.

I added get_errno to allow code to save the current errno value.

Finally, in the namec create case, I save errno as well as errstr
and restore them on the errpath.

mkdir /mnt/tmp/xxx now returns the correct errno/error message.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Sample chmod implementation.

You'll need this sort of thing for rename, chown, etc.
Anything that does a wstat.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
chmod() touchups

Mode sanitization, t_path memory, and syswstat doesn't throw errors.