Make storage backend selectable via environment variable.
[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 BlueSkyStore *store;
28
29 int main(int argc, char *argv[])
30 {
31     int i;
32     bluesky_init();
33     g_set_prgname("nfsd");
34     register_rpc();
35
36     const char *target = getenv("BLUESKY_TARGET");
37     if (target == NULL)
38         target = "s3";
39
40     store = bluesky_store_new(target);
41     fs = bluesky_init_fs("export", store);
42
43     bluesky_debug_dump(fs);
44
45     svc_run();
46     fprintf(stderr, "%s", "svc_run returned");
47     exit(1);
48 }