summaryrefslogtreecommitdiffstats
path: root/devices/parser-test.c
blob: 4b134d0e5bd4eba470322a83eaa6c3f94c5a2b81 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>

#include "parser.h"

void pb_log(const char *fmt, ...)
{
	va_list ap;

	va_start(ap, fmt);
	vfprintf(stderr, fmt, ap);
	va_end(ap);
}


int mount_device(const char *dev_path, char *mount_path)
{
	pb_log("attempt to mount device (%s) not supported\n", dev_path);
	return -1;
}

int add_device(const struct device *dev)
{
	printf("device added:\n");
	printf("\tid: %s\n", dev->id);
	printf("\tname: %s\n", dev->name);
	printf("\tdescription: %s\n", dev->description);
	printf("\tboot_image: %s\n", dev->icon_file);
	return 0;
}

int add_boot_option(const struct boot_option *opt)
{
	printf("option added:\n");
	printf("\tname: %s\n", opt->name);
	printf("\tdescription: %s\n", opt->description);
	printf("\tboot_image: %s\n", opt->boot_image_file);
	printf("\tinitrd: %s\n", opt->initrd_file);
	printf("\tboot_args: %s\n", opt->boot_args);
	return 0;
}

enum generic_icon_type guess_device_type(void)
{
	return ICON_TYPE_UNKNOWN;
}

int main(int argc, char **argv)
{
	const char *dev = "/dev/null";

	if (argc != 2) {
		fprintf(stderr, "usage: %s <fake-mountpoint>\n", argv[0]);
		return EXIT_FAILURE;
	}

	iterate_parsers(dev, argv[1]);

	return EXIT_SUCCESS;
}
OpenPOWER on IntegriCloud