Whamcloud - gitweb
033b325ce9ab328727a16ddf8d22cb1e32b7e4b1
[fs/lustre-release.git] / libsysio / tests / startup.c
1 #include <stdlib.h>
2 #include <string.h>
3 #include <errno.h>
4 #include <sys/types.h>
5 #include <sys/queue.h>
6
7 #include "test.h"
8
9 #include "sysio.h"
10 #include "xtio.h"
11
12 int
13 _test_sysio_startup()
14 {
15         int     err;
16         char    *arg;
17
18         err = _sysio_init();
19         if (err)
20                 return err;
21         err = drv_init_all();
22         if (err)
23                 return err;
24 #ifdef SYSIO_TRACING
25         /*
26          * tracing
27          */
28         arg = getenv("SYSIO_TRACING");
29         err = _sysio_boot("trace", arg);
30         if (err)
31                 return err;
32 #endif
33         /*
34          * namespace
35          */
36         arg = getenv("SYSIO_NAMESPACE");
37         if (!(arg || (arg = getenv("SYSIO_MANUAL")))) {
38                 /*
39                  * Assume a native mount at root with automounts enabled.
40                  */
41                 arg = "{mnt,dev=\"native:/\",dir=/,fl=2}";
42         }
43         err = _sysio_boot("namespace", arg);
44         if (err)
45                 return err;
46 #ifdef DEFER_INIT_CWD
47         /*
48          * Current working directory.
49          */
50         arg = getenv("SYSIO_CWD");
51         if (!arg)
52                 arg = "/";
53         err = _sysio_boot("cwd", arg);
54         if (err)
55                 return err;
56 #endif
57         return 0;
58 }
59
60 void
61 _test_sysio_shutdown()
62 {
63
64         _sysio_shutdown();
65 }