File: test-lib.h

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 (68 lines) | stat: -rw-r--r-- 2,021 bytes parent folder | download | duplicates (2)
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
64
65
66
67
68
#ifndef TEST_LIB_H_INCLUDED
#define TEST_LIB_H_INCLUDED

extern const int default_mask;
extern const char default_devnode[];
extern const char default_wwid[];
extern const char default_wwid_1[];

enum {
	BL_BY_DEVNODE	= (1 << 0),
	BL_BY_DEVICE	= (1 << 1),
	BL_BY_WWID	= (1 << 2),
	BL_BY_PROPERTY	= (1 << 3),
	BL_MASK = BL_BY_DEVNODE|BL_BY_DEVICE|BL_BY_WWID|BL_BY_PROPERTY,
	NEED_SELECT_PRIO = (1 << 8),
	NEED_FD		= (1 << 9),
	USE_VPD_VND	= (1 << 10),
	DEV_HIDDEN	= (1 << 11),
};

struct mocked_path {
	const char *vendor;
	const char *product;
	const char *rev;
	const char *wwid;
	const char *devnode;
	unsigned int flags;
};

struct mocked_path *fill_mocked_path(struct mocked_path *mp,
				     const char *vendor,
				     const char *product,
				     const char *rev,
				     const char *wwid,
				     const char *devnode,
				     unsigned int flags);

struct mocked_path *mocked_path_from_path(struct mocked_path *mp,
					  const struct path *pp);

void mock_pathinfo(int mask, const struct mocked_path *mp);
void mock_store_pathinfo(int mask, const struct mocked_path *mp);
struct path *mock_path__(vector pathvec,
			 const char *vnd, const char *prd,
			 const char *rev, const char *wwid,
			 const char *dev,
			 unsigned int flags, int mask);

#define mock_path(v, p) \
	mock_path__(hwt->vecs->pathvec,	(v), (p), "0", NULL, NULL,	\
		    0, default_mask)
#define mock_path_flags(v, p, f) \
	mock_path__(hwt->vecs->pathvec,	(v), (p), "0", NULL, NULL, \
		    (f), default_mask)
#define mock_path_blacklisted(v, p) \
	mock_path__(hwt->vecs->pathvec,	(v), (p), "0", NULL, NULL, \
		    BL_BY_DEVICE, default_mask)
#define mock_path_wwid(v, p, w) \
	mock_path__(hwt->vecs->pathvec,	(v), (p), "0", (w), NULL,	\
		    0, default_mask)
#define mock_path_wwid_flags(v, p, w, f) \
	mock_path__(hwt->vecs->pathvec,	(v), (p), "0", (w),		\
		    NULL, (f), default_mask)

struct multipath *mock_multipath__(struct vectors *vecs, struct path *pp);
#define mock_multipath(pp) mock_multipath__(hwt->vecs, (pp))

#endif