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