1 /* This file contains the implementation of the VBFS file system server. */
3 * The architecture of VBFS can be sketched as follows:
10 * | libsffs | Shared Folder File System library
14 * | libvboxfs | VirtualBox File System library
18 * | libsys/vbox | VBOX driver interfacing library
20 * -------- | -------- (process boundary)
22 * | VBOX driver | VirtualBox backdoor driver
24 * ======== | ======== (system boundary)
26 * | VirtualBox | The host system
29 * The interfaces between the layers are defined in the following header files:
30 * minix/sffs.h: shared between VBFS, libsffs, and libvboxfs
31 * minix/vboxfs.h: shared between VBFS and libvboxfs
32 * minix/vbox.h: shared between libvboxfs and libsys/vbox
33 * minix/vboxtype.h: shared between libvboxfs, libsys/vbox, and VBOX
34 * minix/vboxif.h: shared between libsys/vbox and VBOX
37 #include <minix/drivers.h>
38 #include <minix/sffs.h>
39 #include <minix/vboxfs.h>
40 #include <minix/optset.h>
42 static char share
[PATH_MAX
];
43 static struct sffs_params params
;
45 static struct optset optset_table
[] = {
46 { "share", OPT_STRING
, share
, sizeof(share
) },
47 { "prefix", OPT_STRING
, params
.p_prefix
, sizeof(params
.p_prefix
) },
48 { "uid", OPT_INT
, ¶ms
.p_uid
, 10 },
49 { "gid", OPT_INT
, ¶ms
.p_gid
, 10 },
50 { "fmask", OPT_INT
, ¶ms
.p_file_mask
, 8 },
51 { "dmask", OPT_INT
, ¶ms
.p_dir_mask
, 8 },
56 * Initialize this file server. Called at startup time.
59 init(int UNUSED(type
), sef_init_info_t
*UNUSED(info
))
61 const struct sffs_table
*table
;
66 params
.p_prefix
[0] = 0;
69 params
.p_file_mask
= 0755;
70 params
.p_dir_mask
= 0755;
71 params
.p_case_insens
= FALSE
;
73 /* We must have been given an options string. Parse the options. */
74 for (i
= 1; i
< env_argc
- 1; i
++)
75 if (!strcmp(env_argv
[i
], "-o"))
76 optset_parse(optset_table
, env_argv
[++i
]);
78 /* A share name is required. */
80 printf("VBFS: no shared folder share name specified\n");
85 /* Initialize the VBOXFS library. If this fails, exit immediately. */
86 r
= vboxfs_init(share
, &table
, ¶ms
.p_case_insens
, &roflag
);
90 printf("VBFS: the given share does not exist\n");
92 printf("VBFS: unable to initialize VBOXFS (%d)\n", r
);
97 /* Now initialize the SFFS library. */
98 if ((r
= sffs_init("VBFS", table
, ¶ms
)) != OK
) {
108 * Local SEF initialization.
111 sef_local_startup(void)
114 /* Register initialization callback. */
115 sef_setcb_init_fresh(init
);
117 /* Register signal callback. SFFS handles this. */
118 sef_setcb_signal_handler(sffs_signal
);
124 * The main function of this file server.
127 main(int argc
, char **argv
)
131 env_setargs(argc
, argv
);
134 /* Let SFFS do the actual work. */