summaryrefslogtreecommitdiff
path: root/daemons/lvmlockd/lvmlockd-client.h
blob: 539ee5cd8b3614048deb1a0139217d730929feff (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
/*
 * Copyright (C) 2014-2015 Red Hat, Inc.
 *
 * This file is part of LVM2.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU Lesser General Public License v.2.1.
 */

#ifndef _LVM_LVMLOCKD_CLIENT_H
#define _LVM_LVMLOCKD_CLIENT_H

#include "libdaemon/client/daemon-client.h"

#define LVMLOCKD_SOCKET DEFAULT_RUN_DIR "/lvmlockd.socket"
#define LVMLOCKD_ADOPT_FILE DEFAULT_RUN_DIR "/lvmlockd.adopt"

/* Wrappers to open/close connection */

static inline daemon_handle lvmlockd_open(const char *sock)
{
	daemon_info lvmlockd_info = {
		.path = "lvmlockd",
		.socket = sock ?: LVMLOCKD_SOCKET,
		.autostart = 0,
		.protocol = "lvmlockd",
		.protocol_version = 1,
	};

	return daemon_open(lvmlockd_info);
}

static inline void lvmlockd_close(daemon_handle h)
{
	daemon_close(h);
}

/*
 * Errors returned as the lvmlockd result value.
 */
#define ENOLS     210 /* lockspace not found */
#define ESTARTING 211 /* lockspace is starting */
#define EARGS     212
#define EHOSTID   213
#define EMANAGER  214
#define EPREPARE  215
#define ELOCKD    216
#define EVGKILLED 217 /* sanlock lost access to leases and VG is killed. */
#define ELOCKIO   218 /* sanlock io errors during lock op, may be transient. */
#define EREMOVED  219
#define EDEVOPEN  220 /* sanlock failed to open lvmlock LV */
#define ELMERR    221

#endif	/* _LVM_LVMLOCKD_CLIENT_H */