1 /* Blue Sky: File Systems in the Cloud
3 * Copyright (C) 2009 The Regents of the University of California
4 * Written by Michael Vrable <mvrable@cs.ucsd.edu>
9 /* Main entry point for an NFSv3 server which will proxy requests to a cloud
12 #include "mount_prot.h"
13 #include "nfs3_prot.h"
16 #include <rpc/pmap_clnt.h>
19 #include <sys/socket.h>
20 #include <netinet/in.h>
30 /* A cookie value returned for uncommitted writes and verified by commits; this
31 * should be a unique value each time the server is started. */
32 char nfsd_instance_verf_cookie[NFS3_WRITEVERFSIZE];
34 static void shutdown_handler(int num)
36 g_print("SIGINT caught, shutting down...\n");
37 g_print("Proxy statistics:\n");
38 bluesky_stats_dump_all();
42 int main(int argc, char *argv[])
46 signal(SIGPIPE, SIG_IGN);
47 signal(SIGINT, shutdown_handler);
50 g_set_prgname("nfsd");
52 const char *target = getenv("BLUESKY_TARGET");
56 const char *key = getenv("BLUESKY_KEY");
60 const char *profile_output = getenv("BLUESKY_PROFILE_OUT");
61 if (profile_output != NULL)
62 bluesky_profile_set_output(fopen(profile_output, "a"));
64 store = bluesky_store_new(target);
65 fs = bluesky_init_fs("export", store, key);
67 bluesky_crypt_random_bytes(nfsd_instance_verf_cookie,
68 sizeof(nfsd_instance_verf_cookie));
73 fprintf(stderr, "%s", "svc_run returned");