wm: macfs

ref: ed9d4c8df8a8272b191b6ed0fa53457302752b4f
dir: /macfs.c/

View raw version
#include <u.h>
#include <libc.h>
#include <fcall.h>
#include <thread.h>
#include <9p.h>
#include <stdio.h>
#include <libsec.h>

void
fsread(Req *r)
{
	char addr[13];
	for( int i = 0; i < 12 ; i++)
			sprintf(&addr[i], "%x", ntruerand(16));
	readstr(r, addr);
	respond(r, nil);
}

Srv fs = {
	.read = fsread,
};

void
main(void)
{
	Tree *tree;

	tree = alloctree(nil, nil, DMDIR|0555, nil);
	fs.tree = tree;
	createfile(tree->root, "addr", nil, 0555, nil);
	postmountsrv(&fs, nil, "/mnt/macfs", MREPL | MCREATE);
}