File: migrate.c

package info (click to toggle)
ndctl 82-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,460 kB
  • sloc: ansic: 42,027; sh: 3,974; makefile: 28
file content (40 lines) | stat: -rw-r--r-- 974 bytes parent folder | download | duplicates (3)
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
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2019-2020 Intel Corporation. All rights reserved. */
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <daxctl/libdaxctl.h>
#include <util/parse-options.h>
#include <ccan/array_size/array_size.h>

int cmd_migrate(int argc, const char **argv, struct daxctl_ctx *ctx)
{
	int i;
	static const struct option options[] = {
		OPT_END(),
	};
	const char * const u[] = {
		"daxctl migrate-device-model",
		NULL
	};

	argc = parse_options(argc, argv, options, u, 0);
	for (i = 0; i < argc; i++)
		error("unknown parameter \"%s\"\n", argv[i]);

	if (argc)
		usage_with_options(u, options);

	if (symlink(DAXCTL_MODPROBE_DATA, DAXCTL_MODPROBE_INSTALL) == 0) {
		fprintf(stderr, " success: installed %s\n",
				DAXCTL_MODPROBE_INSTALL);
		return EXIT_SUCCESS;
	}

	error("failed to install %s: %s\n", DAXCTL_MODPROBE_INSTALL,
			strerror(errno));

	return EXIT_FAILURE;
}