abd10509814f19f02ac598e6ddfc1282a940b7ba
[bluesky.git] / nfs3 / nfsd.c
1 /* Blue Sky: File Systems in the Cloud
2  *
3  * Copyright (C) 2009  The Regents of the University of California
4  * Written by Michael Vrable <mvrable@cs.ucsd.edu>
5  *
6  * TODO: Licensing
7  */
8
9 /* Main entry point for an NFSv3 server which will proxy requests to a cloud
10  * filesystem. */
11
12 #include "mount_prot.h"
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <rpc/pmap_clnt.h>
16 #include <string.h>
17 #include <memory.h>
18 #include <sys/socket.h>
19 #include <netinet/in.h>
20 #include <glib.h>
21
22 #include "bluesky.h"
23
24 void register_rpc();
25
26 BlueSkyFS *fs;
27
28 int main(int argc, char *argv[])
29 {
30     g_thread_init(NULL);
31     register_rpc();
32
33     fs = bluesky_new_fs("export");
34
35     BlueSkyInode *root;
36     root = bluesky_new_inode(BLUESKY_ROOT_INUM, BLUESKY_DIRECTORY);
37     root->nlink = 1;
38     root->mode = 0755;
39     bluesky_insert_inode(fs, root);
40
41     BlueSkyInode *file;
42     file = bluesky_new_inode(bluesky_fs_alloc_inode(fs), BLUESKY_REGULAR);
43     file->nlink = 1;
44     file->mode = 0755;
45     bluesky_insert_inode(fs, file);
46     bluesky_directory_insert(root, "demo", file->inum);
47
48     svc_run();
49     fprintf(stderr, "%s", "svc_run returned");
50     exit(1);
51 }