xref: /netbsd-src/external/gpl2/lvm2/dist/include/clvm.h (revision 7c604eea85b4f330dc75ffe65e947f4d73758aa0)
1*7c604eeaShaad /*	$NetBSD: clvm.h,v 1.1.1.2 2009/12/02 00:25:39 haad Exp $	*/
256a34939Shaad 
356a34939Shaad /*
456a34939Shaad  * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
556a34939Shaad  * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
656a34939Shaad  *
756a34939Shaad  * This file is part of LVM2.
856a34939Shaad  *
956a34939Shaad  * This copyrighted material is made available to anyone wishing to use,
1056a34939Shaad  * modify, copy, or redistribute it subject to the terms and conditions
1156a34939Shaad  * of the GNU General Public License v.2.
1256a34939Shaad  *
1356a34939Shaad  * You should have received a copy of the GNU General Public License
1456a34939Shaad  * along with this program; if not, write to the Free Software Foundation,
1556a34939Shaad  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1656a34939Shaad  */
1756a34939Shaad 
1856a34939Shaad /* Definitions for CLVMD server and clients */
1956a34939Shaad 
2056a34939Shaad /*
2156a34939Shaad  * The protocol spoken over the cluster and across the local socket.
2256a34939Shaad  */
2356a34939Shaad 
2456a34939Shaad #ifndef _CLVM_H
2556a34939Shaad #define _CLVM_H
2656a34939Shaad 
2756a34939Shaad struct clvm_header {
2856a34939Shaad 	uint8_t  cmd;	        /* See below */
2956a34939Shaad 	uint8_t  flags;	        /* See below */
3056a34939Shaad 	uint16_t xid;	        /* Transaction ID */
3156a34939Shaad 	uint32_t clientid;	/* Only used in Daemon->Daemon comms */
3256a34939Shaad 	int32_t  status;	/* For replies, whether request succeeded */
3356a34939Shaad 	uint32_t arglen;	/* Length of argument below.
3456a34939Shaad 				   If >1500 then it will be passed
3556a34939Shaad 				   around the cluster in the system LV */
3656a34939Shaad 	char node[1];		/* Actually a NUL-terminated string, node name.
3756a34939Shaad 				   If this is empty then the command is
3856a34939Shaad 				   forwarded to all cluster nodes unless
3956a34939Shaad 				   FLAG_LOCAL is also set. */
4056a34939Shaad 	char args[1];		/* Arguments for the command follow the
4156a34939Shaad 				   node name, This member is only
4256a34939Shaad 				   valid if the node name is empty */
4356a34939Shaad } __attribute__ ((packed));
4456a34939Shaad 
4556a34939Shaad /* Flags */
4656a34939Shaad #define CLVMD_FLAG_LOCAL        1	/* Only do this on the local node */
4756a34939Shaad #define CLVMD_FLAG_SYSTEMLV     2	/* Data in system LV under my node name */
4856a34939Shaad #define CLVMD_FLAG_NODEERRS     4       /* Reply has errors in node-specific portion */
4956a34939Shaad 
5056a34939Shaad /* Name of the local socket to communicate between libclvm and clvmd */
5156a34939Shaad //static const char CLVMD_SOCKNAME[]="/var/run/clvmd";
5256a34939Shaad static const char CLVMD_SOCKNAME[] = "\0clvmd";
5356a34939Shaad 
5456a34939Shaad /* Internal commands & replies */
5556a34939Shaad #define CLVMD_CMD_REPLY    1
5656a34939Shaad #define CLVMD_CMD_VERSION  2	/* Send version around cluster when we start */
5756a34939Shaad #define CLVMD_CMD_GOAWAY   3	/* Die if received this - we are running
5856a34939Shaad 				   an incompatible version */
5956a34939Shaad #define CLVMD_CMD_TEST     4	/* Just for mucking about */
6056a34939Shaad 
6156a34939Shaad #define CLVMD_CMD_LOCK              30
6256a34939Shaad #define CLVMD_CMD_UNLOCK            31
6356a34939Shaad 
6456a34939Shaad /* Lock/Unlock commands */
6556a34939Shaad #define CLVMD_CMD_LOCK_LV           50
6656a34939Shaad #define CLVMD_CMD_LOCK_VG           51
67*7c604eeaShaad #define CLVMD_CMD_LOCK_QUERY	    52
6856a34939Shaad 
6956a34939Shaad /* Misc functions */
7056a34939Shaad #define CLVMD_CMD_REFRESH	    40
7156a34939Shaad #define CLVMD_CMD_GET_CLUSTERNAME   41
7256a34939Shaad #define CLVMD_CMD_SET_DEBUG	    42
7356a34939Shaad #define CLVMD_CMD_VG_BACKUP	    43
7456a34939Shaad #endif
75