File: uml_mount.c

package info (click to toggle)
uml-utilities 20070815.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 728 kB
  • sloc: ansic: 3,391; perl: 1,277; makefile: 239; exp: 129; sh: 122
file content (36 lines) | stat: -rw-r--r-- 732 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <fuse/fuse_lowlevel.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>

static int init_fuse(int argc, char **argv)
{
	struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
	char *mountpoint;

	if (fuse_parse_cmdline(&args, &mountpoint, NULL, NULL) == -1)
		return -EINVAL;
        return fuse_mount(mountpoint, &args);
}

int main(int argc, char **argv)
{
	char *umid, fd_arg[sizeof("1234567890\0")];
	int fd;

	umid = argv[1];
	argv[1] = argv[0];
	argv++;
	argc--;
	fd = init_fuse(argc, argv);
	if(fd < 0)
		return 1;

	snprintf(fd_arg, sizeof(fd_arg), "%d", fd);
	execlp("uml_mconsole", "uml_mconsole", umid, "umlfs",  fd_arg, NULL);

	perror("Failed to exec uml_mconsole\n");
	
	return 1;
}