import source from lvm2 2.02.79
[external/device-mapper.git] / daemons / clvmd / clvm.h
1 /*
2  * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
3  * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
4  *
5  * This file is part of LVM2.
6  *
7  * This copyrighted material is made available to anyone wishing to use,
8  * modify, copy, or redistribute it subject to the terms and conditions
9  * of the GNU General Public License v.2.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program; if not, write to the Free Software Foundation,
13  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
14  */
15
16 /* Definitions for CLVMD server and clients */
17
18 /*
19  * The protocol spoken over the cluster and across the local socket.
20  */
21
22 #ifndef _CLVM_H
23 #define _CLVM_H
24
25 #include "configure.h"
26
27 struct clvm_header {
28         uint8_t  cmd;           /* See below */
29         uint8_t  flags;         /* See below */
30         uint16_t xid;           /* Transaction ID */
31         uint32_t clientid;      /* Only used in Daemon->Daemon comms */
32         int32_t  status;        /* For replies, whether request succeeded */
33         uint32_t arglen;        /* Length of argument below. 
34                                    If >1500 then it will be passed 
35                                    around the cluster in the system LV */
36         char node[1];           /* Actually a NUL-terminated string, node name.
37                                    If this is empty then the command is 
38                                    forwarded to all cluster nodes unless 
39                                    FLAG_LOCAL is also set. */
40         char args[1];           /* Arguments for the command follow the 
41                                    node name, This member is only
42                                    valid if the node name is empty */
43 } __attribute__ ((packed));
44
45 /* Flags */
46 #define CLVMD_FLAG_LOCAL        1       /* Only do this on the local node */
47 #define CLVMD_FLAG_SYSTEMLV     2       /* Data in system LV under my node name */
48 #define CLVMD_FLAG_NODEERRS     4       /* Reply has errors in node-specific portion */
49
50 /* Name of the local socket to communicate between lvm and clvmd */
51 static const char CLVMD_SOCKNAME[]= DEFAULT_RUN_DIR "/clvmd.sock";
52
53 /* Internal commands & replies */
54 #define CLVMD_CMD_REPLY    1
55 #define CLVMD_CMD_VERSION  2    /* Send version around cluster when we start */
56 #define CLVMD_CMD_GOAWAY   3    /* Die if received this - we are running 
57                                    an incompatible version */
58 #define CLVMD_CMD_TEST     4    /* Just for mucking about */
59
60 #define CLVMD_CMD_LOCK              30
61 #define CLVMD_CMD_UNLOCK            31
62
63 /* Lock/Unlock commands */
64 #define CLVMD_CMD_LOCK_LV           50
65 #define CLVMD_CMD_LOCK_VG           51
66 #define CLVMD_CMD_LOCK_QUERY        52
67
68 /* Misc functions */
69 #define CLVMD_CMD_REFRESH           40
70 #define CLVMD_CMD_GET_CLUSTERNAME   41
71 #define CLVMD_CMD_SET_DEBUG         42
72 #define CLVMD_CMD_VG_BACKUP         43
73 #define CLVMD_CMD_RESTART           44
74 #endif