File: dm-generic.c

package info (click to toggle)
multipath-tools 0.14.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,088 kB
  • sloc: ansic: 64,885; perl: 1,622; makefile: 742; sh: 732; pascal: 155
file content (58 lines) | stat: -rw-r--r-- 1,390 bytes parent folder | download
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
// SPDX-License-Identifier: GPL-2.0-or-later
/*
  Copyright (c) 2018 Martin Wilck, SUSE Linux GmbH
 */

#include <stdint.h>
#include <sys/types.h>
#include "generic.h"
#include "dm-generic.h"
#include "structs.h"
#include "structs_vec.h"
#include "config.h"
#include "print.h"

static const struct vector_s*
dm_mp_get_pgs(const struct gen_multipath *gmp)
{
	return vector_convert(NULL, gen_multipath_to_dm(gmp)->pg,
			      struct pathgroup, dm_pathgroup_to_gen);
}

static void dm_mp_rel_pgs(__attribute__((unused))
			  const struct gen_multipath *gmp,
			  const struct vector_s* v)
{
	vector_free_const(v);
}

static const struct vector_s*
dm_pg_get_paths(const struct gen_pathgroup *gpg)
{
	return vector_convert(NULL, gen_pathgroup_to_dm(gpg)->paths,
			      struct path, dm_path_to_gen);
}

static void dm_mp_rel_paths(__attribute__((unused))
			    const struct gen_pathgroup *gpg,
			    const struct vector_s* v)
{
	vector_free_const(v);
}

const struct gen_multipath_ops dm_gen_multipath_ops = {
	.get_pathgroups = dm_mp_get_pgs,
	.rel_pathgroups = dm_mp_rel_pgs,
	.snprint = snprint_multipath_attr,
	.style = snprint_multipath_style,
};

const struct gen_pathgroup_ops dm_gen_pathgroup_ops = {
	.get_paths = dm_pg_get_paths,
	.rel_paths = dm_mp_rel_paths,
	.snprint = snprint_pathgroup_attr,
};

const struct gen_path_ops dm_gen_path_ops = {
	.snprint = snprint_path_attr,
};