1 /*        $NetBSD: clvm.h,v 1.1.1.2 2009/12/02 00:27:01 haad Exp $    */
2 
3 /*
4  * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
5  * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
6  *
7  * This file is part of LVM2.
8  *
9  * This copyrighted material is made available to anyone wishing to use,
10  * modify, copy, or redistribute it subject to the terms and conditions
11  * of the GNU General Public License v.2.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software Foundation,
15  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16  */
17 
18 /* Definitions for CLVMD server and clients */
19 
20 /*
21  * The protocol spoken over the cluster and across the local socket.
22  */
23 
24 #ifndef _CLVM_H
25 #define _CLVM_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 libclvm and clvmd */
51 //static const char CLVMD_SOCKNAME[]="/var/run/clvmd";
52 static const char CLVMD_SOCKNAME[] = "\0clvmd";
53 
54 /* Internal commands & replies */
55 #define CLVMD_CMD_REPLY    1
56 #define CLVMD_CMD_VERSION  2  /* Send version around cluster when we start */
57 #define CLVMD_CMD_GOAWAY   3  /* Die if received this - we are running
58                                            an incompatible version */
59 #define CLVMD_CMD_TEST     4  /* Just for mucking about */
60 
61 #define CLVMD_CMD_LOCK              30
62 #define CLVMD_CMD_UNLOCK            31
63 
64 /* Lock/Unlock commands */
65 #define CLVMD_CMD_LOCK_LV           50
66 #define CLVMD_CMD_LOCK_VG           51
67 #define CLVMD_CMD_LOCK_QUERY      52
68 
69 /* Misc functions */
70 #define CLVMD_CMD_REFRESH         40
71 #define CLVMD_CMD_GET_CLUSTERNAME   41
72 #define CLVMD_CMD_SET_DEBUG       42
73 #define CLVMD_CMD_VG_BACKUP       43
74 #endif
75