summaryrefslogtreecommitdiffstats
path: root/utils/capabilities.h
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2018-01-10 23:48:38 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2018-01-18 10:11:39 +0000
commit46f460fa669ce9f7b9f2de9e54cefc3726dcd029 (patch)
tree54a22636bc90649186e4b3001d13f861df75c61f /utils/capabilities.h
parent5d98272c53816813872aaa807e4ccc1ee2ad1bfc (diff)
versioning: add capabilities support
Change-Id: Ic63f7c9fa169ee37b796093554c59016fbbfaa46 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'utils/capabilities.h')
-rw-r--r--utils/capabilities.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/utils/capabilities.h b/utils/capabilities.h
new file mode 100644
index 0000000..b157d80
--- /dev/null
+++ b/utils/capabilities.h
@@ -0,0 +1,65 @@
+/*
+ Copyright (c) 2018 Red Hat, Inc. <http://www.redhat.com>
+ This file is part of gluster-block.
+
+ This file is licensed to you under your choice of the GNU Lesser
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
+*/
+
+
+# include "block.h"
+# include "common.h"
+
+
+typedef struct gbCapObj {
+ char cap[256];
+ bool status;
+} gbCapObj;
+
+
+typedef struct gbCapResp {
+ int capMax;
+ gbCapObj *response;
+} gbCapResp;
+
+
+enum gbCapabilities {
+ GB_CREATE_CAP,
+ GB_CREATE_HA_CAP,
+ GB_CREATE_PREALLOC_CAP,
+ GB_CREATE_AUTH_CAP,
+
+ GB_DELETE_CAP,
+ GB_DELETE_FORCE_CAP,
+
+ GB_MODIFY_CAP,
+ GB_MODIFY_AUTH_CAP,
+
+ GB_JSON_CAP,
+
+ GB_CAP_MAX
+};
+
+
+static const char *const gbCapabilitiesLookup[] = {
+ [GB_CREATE_CAP] = "create",
+ [GB_CREATE_HA_CAP] = "create_ha",
+ [GB_CREATE_PREALLOC_CAP] = "create_prealloc",
+ [GB_CREATE_AUTH_CAP] = "create_auth",
+
+ [GB_DELETE_CAP] = "delete",
+ [GB_DELETE_FORCE_CAP] = "delete_force",
+
+ [GB_MODIFY_CAP] = "modify",
+ [GB_MODIFY_AUTH_CAP] = "modify_auth",
+
+ [GB_JSON_CAP] = "json",
+
+ [GB_CAP_MAX] = NULL
+};
+
+
+int gbCapabilitiesEnumParse(const char *cap);
+int gbSetCapabilties (blockResponse **c);