Discussion:
[PATCH 0/3] Code tidy up.
Gris Ge
2015-06-10 11:57:53 UTC
Permalink
* Update Python codes to enforce PEP8.

* Update C/C++ codes to enforce K&R code style.

Gris Ge (3):
PEP8 Clean up.
C Library: Replace tab with spaces.
C Library: Use K&R code style.

c_binding/include/libstoragemgmt/libstoragemgmt.h | 1599 ++++++++++----------
.../libstoragemgmt/libstoragemgmt_accessgroups.h | 22 +-
.../libstoragemgmt/libstoragemgmt_blockrange.h | 25 +-
.../libstoragemgmt/libstoragemgmt_capabilities.h | 225 ++-
.../include/libstoragemgmt/libstoragemgmt_common.h | 47 +-
.../include/libstoragemgmt/libstoragemgmt_disk.h | 15 +-
.../include/libstoragemgmt/libstoragemgmt_error.h | 163 +-
.../include/libstoragemgmt/libstoragemgmt_fs.h | 7 +-
.../include/libstoragemgmt/libstoragemgmt_hash.h | 17 +-
.../libstoragemgmt/libstoragemgmt_nfsexport.h | 99 +-
.../libstoragemgmt/libstoragemgmt_plug_interface.h | 846 ++++++-----
.../include/libstoragemgmt/libstoragemgmt_pool.h | 25 +-
.../libstoragemgmt/libstoragemgmt_snapshot.h | 6 +-
.../libstoragemgmt/libstoragemgmt_systems.h | 5 +-
.../libstoragemgmt/libstoragemgmt_targetport.h | 25 +-
.../include/libstoragemgmt/libstoragemgmt_types.h | 98 +-
.../libstoragemgmt/libstoragemgmt_volumes.h | 10 +-
c_binding/lsm_convert.cpp | 420 ++---
c_binding/lsm_convert.hpp | 68 +-
c_binding/lsm_datatypes.cpp | 913 +++++------
c_binding/lsm_datatypes.hpp | 121 +-
c_binding/lsm_ipc.cpp | 464 +++---
c_binding/lsm_ipc.hpp | 100 +-
c_binding/lsm_mgmt.cpp | 1578 +++++++++----------
c_binding/lsm_plugin_ipc.cpp | 1430 ++++++++---------
c_binding/lsm_plugin_ipc.hpp | 21 +-
c_binding/test.cpp | 20 +-
plugin/hpsa/hpsa.py | 2 +-
plugin/megaraid/megaraid.py | 2 +-
plugin/megaraid/utils.py | 1 +
plugin/nstor/nstor.py | 2 +-
plugin/sim/simarray.py | 47 +-
plugin/smispy/smis.py | 2 +-
plugin/smispy/smis_ag.py | 2 +-
plugin/smispy/smis_common.py | 7 +-
python_binding/lsm/_data.py | 4 +-
test/cmdtest.py | 5 +-
test/plugin_test.py | 6 +-
test/webtest/test_automated.py | 8 +-
test/webtest/test_hardware.py | 3 +-
test/webtest/test_results.py | 21 +-
tools/lsmcli/cmdline.py | 7 +-
tools/lsmcli/data_display.py | 2 +
tools/netapp/netapp.py | 6 +-
tools/utility/public_symbols.py | 6 +-
45 files changed, 4458 insertions(+), 4044 deletions(-)
--
1.8.3.1
Gris Ge
2015-06-10 11:57:55 UTC
Permalink
Signed-off-by: Gris Ge <***@redhat.com>
---
c_binding/include/libstoragemgmt/libstoragemgmt.h | 16 ++++++++--------
c_binding/include/libstoragemgmt/libstoragemgmt_disk.h | 8 ++++----
c_binding/include/libstoragemgmt/libstoragemgmt_hash.h | 8 ++++----
c_binding/include/libstoragemgmt/libstoragemgmt_types.h | 4 ++--
c_binding/lsm_convert.cpp | 4 ++--
c_binding/lsm_datatypes.hpp | 2 +-
6 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt.h b/c_binding/include/libstoragemgmt/libstoragemgmt.h
index 869d5fd..35ce600 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt.h
@@ -89,15 +89,15 @@ extern "C" {
int LSM_DLL_EXPORT lsm_plugin_info_get(lsm_connect *conn, char **desc,
char **version, lsm_flag flags);

- /**
- * Retrieve a list of available plug-ins.
- * @param[in] sep Return data separator
- * @param[out] plugins String list of plug-ins with the form
- * desc<sep>version
+ /**
+ * Retrieve a list of available plug-ins.
+ * @param[in] sep Return data separator
+ * @param[out] plugins String list of plug-ins with the form
+ * desc<sep>version
* @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error code @see lsm_error_number
- */
- int LSM_DLL_EXPORT lsm_available_plugins_list(const char *sep,
+ * @return LSM_ERR_OK on success, else error code @see lsm_error_number
+ */
+ int LSM_DLL_EXPORT lsm_available_plugins_list(const char *sep,
lsm_string_list **plugins,
lsm_flag flags);

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_disk.h b/c_binding/include/libstoragemgmt/libstoragemgmt_disk.h
index f59c302..b8aaaa2 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_disk.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_disk.h
@@ -19,11 +19,11 @@
*/

#ifndef LIBSTORAGEMGMT_DISK_H
-#define LIBSTORAGEMGMT_DISK_H
+#define LIBSTORAGEMGMT_DISK_H

#include "libstoragemgmt_common.h"

-#ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif

@@ -112,8 +112,8 @@ uint64_t LSM_DLL_EXPORT lsm_disk_status_get(lsm_disk *d);
*/
const char LSM_DLL_EXPORT *lsm_disk_system_id_get(lsm_disk *d);

-#ifdef __cplusplus
+#ifdef __cplusplus
}
#endif

-#endif /* LIBSTORAGEMGMT_DISK_H */
+#endif /* LIBSTORAGEMGMT_DISK_H */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_hash.h b/c_binding/include/libstoragemgmt/libstoragemgmt_hash.h
index b9f11bf..1b7e161 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_hash.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_hash.h
@@ -19,11 +19,11 @@
*/

#ifndef LIBSTORAGEMGMT_HASH_H
-#define LIBSTORAGEMGMT_HASH_H
+#define LIBSTORAGEMGMT_HASH_H

#include "libstoragemgmt_common.h"

-#ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif

@@ -82,8 +82,8 @@ int LSM_DLL_EXPORT lsm_hash_string_set(lsm_hash *op,
*/
lsm_hash LSM_DLL_EXPORT *lsm_hash_copy(lsm_hash *src);

-#ifdef __cplusplus
+#ifdef __cplusplus
}
#endif

-#endif /* LIBSTORAGEMGMT_HASH_H */
+#endif /* LIBSTORAGEMGMT_HASH_H */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_types.h b/c_binding/include/libstoragemgmt/libstoragemgmt_types.h
index 667c320..be2acf9 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_types.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_types.h
@@ -287,8 +287,8 @@ typedef enum {
#define LSM_POOL_ELEMENT_TYPE_VOLUME_THIN 0x0000000000000040
#define LSM_POOL_ELEMENT_TYPE_SYS_RESERVED 0x0000000000000400

-#define LSM_POOL_UNSUPPORTED_VOLUME_GROW 0x0000000000000001
-#define LSM_POOL_UNSUPPORTED_VOLUME_SHRINK 0x0000000000000002
+#define LSM_POOL_UNSUPPORTED_VOLUME_GROW 0x0000000000000001
+#define LSM_POOL_UNSUPPORTED_VOLUME_SHRINK 0x0000000000000002

typedef enum {
LSM_TARGET_PORT_TYPE_OTHER = 1,
diff --git a/c_binding/lsm_convert.cpp b/c_binding/lsm_convert.cpp
index 69c9820..f39406c 100644
--- a/c_binding/lsm_convert.cpp
+++ b/c_binding/lsm_convert.cpp
@@ -218,7 +218,7 @@ lsm_pool *value_to_pool(Value &pool)
i["total_space"].asUint64_t(),
i["free_space"].asUint64_t(),
i["status"].asUint64_t(),
- i["status_info"].asString().c_str(),
+ i["status_info"].asString().c_str(),
i["system_id"].asString().c_str(),
i["plugin_data"].asC_str());
} else {
@@ -239,7 +239,7 @@ Value pool_to_value(lsm_pool *pool)
p["total_space"] = Value(pool->total_space);
p["free_space"] = Value(pool->free_space);
p["status"] = Value(pool->status);
- p["status_info"] = Value(pool->status_info);
+ p["status_info"] = Value(pool->status_info);
p["system_id"] = Value(pool->system_id);
p["plugin_data"] = Value(pool->plugin_data);
return Value(p);
diff --git a/c_binding/lsm_datatypes.hpp b/c_binding/lsm_datatypes.hpp
index 6a6271f..75f308a 100644
--- a/c_binding/lsm_datatypes.hpp
+++ b/c_binding/lsm_datatypes.hpp
@@ -80,7 +80,7 @@ struct LSM_DLL_LOCAL _lsm_pool {
uint32_t magic; /**< Used for verfication */
char *id; /**< System wide unique identifier */
char *name; /**< Human recognizeable name */
- uint64_t element_type; /**< What the pool can be used for */
+ uint64_t element_type; /**< What the pool can be used for */
uint64_t unsupported_actions; /**< What pool cannot be used for */
uint64_t total_space; /**< Total size */
uint64_t free_space; /**< Free space available */
--
1.8.3.1
Gris Ge
2015-06-10 11:57:54 UTC
Permalink
* Fix all PEP8 errors except the html 79 text width limit in
/test/webtest/test_results.py
/tools/utility/web_cap.py

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/hpsa/hpsa.py | 2 +-
plugin/megaraid/megaraid.py | 2 +-
plugin/megaraid/utils.py | 1 +
plugin/nstor/nstor.py | 2 +-
plugin/sim/simarray.py | 47 ++++++++++++++++++++---------------------
plugin/smispy/smis.py | 2 +-
plugin/smispy/smis_ag.py | 2 +-
plugin/smispy/smis_common.py | 7 +++---
python_binding/lsm/_data.py | 4 ++--
test/cmdtest.py | 5 ++++-
test/plugin_test.py | 6 +++---
test/webtest/test_automated.py | 8 +++----
test/webtest/test_hardware.py | 3 +--
test/webtest/test_results.py | 21 +++++++++---------
tools/lsmcli/cmdline.py | 7 +++---
tools/lsmcli/data_display.py | 2 ++
tools/netapp/netapp.py | 6 +++---
tools/utility/public_symbols.py | 6 +++---
18 files changed, 70 insertions(+), 63 deletions(-)

diff --git a/plugin/hpsa/hpsa.py b/plugin/hpsa/hpsa.py
index d1a580e..e31bb65 100644
--- a/plugin/hpsa/hpsa.py
+++ b/plugin/hpsa/hpsa.py
@@ -88,7 +88,7 @@ def _parse_hpssacli_output(output):
output_lines = [
l for l in output.split("\n")
if l and not l.startswith('Note:') and
- not l.strip() == 'Physical Drives']
+ not l.strip() == 'Physical Drives']

data = {}

diff --git a/plugin/megaraid/megaraid.py b/plugin/megaraid/megaraid.py
index 62ad028..bf928f9 100644
--- a/plugin/megaraid/megaraid.py
+++ b/plugin/megaraid/megaraid.py
@@ -577,7 +577,7 @@ def pool_member_info(self, pool, flags=Client.FLAG_RSVD):
# Check whether pool exists.
try:
dg_show_all_output = self._storcli_exec(
- [lsi_dg_path , "show", "all"])
+ [lsi_dg_path, "show", "all"])
except ExecError as exec_error:
try:
json_output = json.loads(exec_error.stdout)
diff --git a/plugin/megaraid/utils.py b/plugin/megaraid/utils.py
index 4290b39..67734b0 100644
--- a/plugin/megaraid/utils.py
+++ b/plugin/megaraid/utils.py
@@ -18,6 +18,7 @@
import subprocess
import os

+
def cmd_exec(cmds):
"""
Execute provided command and return the STDOUT as string.
diff --git a/plugin/nstor/nstor.py b/plugin/nstor/nstor.py
index 0705534..5fc2bba 100644
--- a/plugin/nstor/nstor.py
+++ b/plugin/nstor/nstor.py
@@ -760,7 +760,7 @@ def access_group_delete(self, access_group, flags=0):
vols = self.volumes_accessible_by_access_group(access_group)
if len(vols):
raise LsmError(ErrorNumber.IS_MASKED,
- "Access Group has volume(s) masked")
+ "Access Group has volume(s) masked")

self._request("destroy_hostgroup", "stmf", [access_group.name])
return
diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index 11ee667..8153ab6 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -133,7 +133,7 @@ class BackStore(object):
SYS_ID = "sim-01"
SYS_NAME = "LSM simulated storage plug-in"
BLK_SIZE = 512
- DEFAULT_STRIP_SIZE = 128 * 1024 # 128 KiB
+ DEFAULT_STRIP_SIZE = 128 * 1024 # 128 KiB

_LIST_SPLITTER = '#'

@@ -206,7 +206,7 @@ def __init__(self, statefile, timeout):
status_info TEXT,
version TEXT NOT NULL);
""")
- # version hold the signature of data
+ # ^ version hold the signature of data

sql_cmd += (
"CREATE TABLE tgts ("
@@ -226,12 +226,12 @@ def __init__(self, statefile, timeout):
"element_type INTEGER NOT NULL, "
"unsupported_actions INTEGER, "
"raid_type INTEGER NOT NULL, "
- "parent_pool_id INTEGER, " # Indicate this pool is allocated from
- # other pool
+ "parent_pool_id INTEGER, "
+ # ^ Indicate this pool is allocated from # other pool
"member_type INTEGER, "
"strip_size INTEGER, "
- "total_space LONG);\n") # total_space here is only for
- # sub-pool (pool from pool)
+ "total_space LONG);\n")
+ # ^ total_space here is only for sub-pool (pool from pool)

sql_cmd += (
"CREATE TABLE disks ("
@@ -240,8 +240,8 @@ def __init__(self, statefile, timeout):
"disk_type INTEGER NOT NULL, "
"status INTEGER NOT NULL, "
"disk_prefix TEXT NOT NULL, "
- "owner_pool_id INTEGER, " # Indicate this disk is used to
- # assemble a pool
+ "owner_pool_id INTEGER, "
+ # ^ Indicate this disk is used to assemble a pool
"role TEXT,"
"FOREIGN KEY(owner_pool_id) "
"REFERENCES pools(id) ON DELETE CASCADE );\n")
@@ -252,13 +252,13 @@ def __init__(self, statefile, timeout):
"vpd83 TEXT NOT NULL, "
"name TEXT UNIQUE NOT NULL, "
"total_space LONG NOT NULL, "
- "consumed_size LONG NOT NULL, " # Reserved for future thinp
- # support.
+ "consumed_size LONG NOT NULL, "
+ # ^ Reserved for future thinp support.
"admin_state INTEGER, "
"thinp INTEGER NOT NULL, "
- "is_hw_raid_vol INTEGER, " # Once its volume deleted, pool will
- # be delete also. For HW RAID
- # simulation only.
+ "is_hw_raid_vol INTEGER, "
+ # ^ Once its volume deleted, pool will be delete also.
+ # For HW RAID simulation only.

"pool_id INTEGER NOT NULL, "
"FOREIGN KEY(pool_id) "
@@ -835,8 +835,8 @@ def _data_add(self, table_name, data_dict):

sql_cmd = "INSERT INTO %s (%s) VALUES (%s);" % \
(table_name,
- "'%s'" % ("', '".join(keys)),
- "'%s'" % ("', '".join(values)))
+ "'%s'" % ("', '".join(keys)),
+ "'%s'" % ("', '".join(values)))
self._sql_exec(sql_cmd)

def _data_find(self, table, condition, key_list, flag_unique=False):
@@ -2339,7 +2339,7 @@ def volume_raid_create(self, name, raid_type, disks, strip_size):
"Provided 'strip_size' is not supported")

self.bs_obj.trans_begin()
- pool_name = "Pool for volume %s" % name
+ pool_name = "Pool for volume %s" % name
sim_disk_ids = [
SimArray._lsm_id_to_sim_id(
d.id,
@@ -2353,19 +2353,18 @@ def volume_raid_create(self, name, raid_type, disks, strip_size):
"Disk %s is not in DISK.STATUS_FREE mode" % disk.id)
try:
sim_pool_id = self.bs_obj.sim_pool_create_from_disk(
- name=pool_name,
- raid_type=raid_type,
- sim_disk_ids=sim_disk_ids,
- element_type=Pool.ELEMENT_TYPE_VOLUME,
- unsupported_actions=Pool.UNSUPPORTED_VOLUME_GROW |
- Pool.UNSUPPORTED_VOLUME_SHRINK,
- strip_size=strip_size)
+ name=pool_name,
+ raid_type=raid_type,
+ sim_disk_ids=sim_disk_ids,
+ element_type=Pool.ELEMENT_TYPE_VOLUME,
+ unsupported_actions=Pool.UNSUPPORTED_VOLUME_GROW |
+ Pool.UNSUPPORTED_VOLUME_SHRINK,
+ strip_size=strip_size)
except sqlite3.IntegrityError as sql_error:
raise LsmError(
ErrorNumber.NAME_CONFLICT,
"Name '%s' is already in use by other volume" % name)

-
sim_pool = self.bs_obj.sim_pool_of_id(sim_pool_id)
sim_vol_id = self.volume_create(
SimArray._sim_id_to_lsm_id(sim_pool_id, 'POOL'), name,
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 4dc478c..1a9120a 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -1559,7 +1559,7 @@ def _iscsi_node_names_of(self, cim_iscsi_pg_path):

if len(cim_iscsi_nodes) == 0:
return []
- return [n['Name'] for n in cim_iscsi_nodes]
+ return [n['Name'] for n in cim_iscsi_nodes]

def _cim_iscsi_pg_of(self, cim_sys_path, property_list=None):
"""
diff --git a/plugin/smispy/smis_ag.py b/plugin/smispy/smis_ag.py
index 5ac1d20..f222630 100644
--- a/plugin/smispy/smis_ag.py
+++ b/plugin/smispy/smis_ag.py
@@ -265,7 +265,7 @@ def cim_init_path_check_or_create(smis_common, system_id, init_id, init_type):


def cim_vols_masked_to_cim_spc_path(smis_common, cim_spc_path,
- property_list=None):
+ property_list=None):
"""
Use this association to find out masked volume for certain cim_spc:
CIM_SCSIProtocolController
diff --git a/plugin/smispy/smis_common.py b/plugin/smispy/smis_common.py
index f4bd024..6044192 100644
--- a/plugin/smispy/smis_common.py
+++ b/plugin/smispy/smis_common.py
@@ -503,8 +503,8 @@ def invoke_method_wait(self, cmd, cim_path, in_params,
return out[out_key]
else:
raise LsmError(ErrorNumber.PLUGIN_BUG,
- "invoke_method_wait(), %s not exist in out %s" %
- (out_key, out.items()))
+ "invoke_method_wait(), %s not exist "
+ "in out %s" % (out_key, out.items()))

elif rc == SmisCommon.SNIA_INVOKE_ASYNC:
cim_job_path = out['Job']
@@ -516,7 +516,8 @@ def invoke_method_wait(self, cmd, cim_path, in_params,
cim_job = self.GetInstance(cim_job_path,
PropertyList=job_pros)
job_state = cim_job['JobState']
- if job_state in (dmtf.JOB_STATE_NEW, dmtf.JOB_STATE_STARTING,
+ if job_state in (dmtf.JOB_STATE_NEW,
+ dmtf.JOB_STATE_STARTING,
dmtf.JOB_STATE_RUNNING):
loop_counter += 1
time.sleep(SmisCommon._INVOKE_CHECK_INTERVAL)
diff --git a/python_binding/lsm/_data.py b/python_binding/lsm/_data.py
index ce133a2..6448303 100644
--- a/python_binding/lsm/_data.py
+++ b/python_binding/lsm/_data.py
@@ -576,8 +576,8 @@ def initiator_id_verify(init_id, init_type=None, raise_exception=False):
if AccessGroup._regex_wwpn.match(str(init_id)):
if init_type is None or \
init_type == AccessGroup.INIT_TYPE_WWPN:
- return True, AccessGroup.INIT_TYPE_WWPN, \
- AccessGroup._wwpn_to_lsm_type(init_id)
+ return (True, AccessGroup.INIT_TYPE_WWPN,
+ AccessGroup._wwpn_to_lsm_type(init_id))

if raise_exception:
raise LsmError(ErrorNumber.INVALID_ARGUMENT,
diff --git a/test/cmdtest.py b/test/cmdtest.py
index 247a291..4b8de83 100755
--- a/test/cmdtest.py
+++ b/test/cmdtest.py
@@ -676,6 +676,7 @@ def search_test(cap, system_id):
volume_delete(vol_id)
return

+
def volume_raid_info_test(cap, system_id):
if cap['VOLUME_RAID_INFO'] and cap['VOLUME_CREATE']:
test_pool_id = name_to_id(OP_POOL, test_pool_name)
@@ -696,6 +697,7 @@ def volume_raid_info_test(cap, system_id):
exit(10)
return

+
def pool_member_info_test(cap, system_id):
if cap['POOL_MEMBER_INFO']:
out = call([cmd, '-t' + sep, 'list', '--type', 'POOLS'])[1]
@@ -713,6 +715,7 @@ def pool_member_info_test(cap, system_id):
exit(10)
return

+
def volume_raid_create_test(cap, system_id):
if cap['VOLUME_RAID_CREATE']:
out = call(
@@ -780,7 +783,7 @@ def run_all_tests(cap, system_id):

volume_raid_info_test(cap, system_id)

- pool_member_info_test(cap,system_id)
+ pool_member_info_test(cap, system_id)

volume_raid_create_test(cap, system_id)

diff --git a/test/plugin_test.py b/test/plugin_test.py
index df78243..3e43fff 100755
--- a/test/plugin_test.py
+++ b/test/plugin_test.py
@@ -388,7 +388,7 @@ def _fs_create(self, system_id):
if system_id in self.pool_by_sys_id:
fs = None
pool = self._get_pool_by_usage(system_id,
- lsm.Pool.ELEMENT_TYPE_FS)
+ lsm.Pool.ELEMENT_TYPE_FS)

self.assertTrue(pool is not None, "Unable to find a suitable pool "
"for fs creation")
@@ -842,8 +842,7 @@ def _test_ag_create_delete(self, cap, s):
self._test_ag_create_dup(ag, s)
self._delete_access_group(ag)

- if supported(cap, [Cap.ACCESS_GROUPS,
- Cap.ACCESS_GROUP_CREATE_WWPN]):
+ if supported(cap, [Cap.ACCESS_GROUPS, Cap.ACCESS_GROUP_CREATE_WWPN]):
ag = self._create_access_group(
cap, rs('ag'), s, lsm.AccessGroup.INIT_TYPE_WWPN)
if ag is not None and \
@@ -1346,6 +1345,7 @@ def test_volume_raid_create(self):
self._skip_current_test(
"Skip test: not support of VOLUME_RAID_CREATE")

+
def dump_results():
"""
unittest.main exits when done so we need to register this handler to
diff --git a/test/webtest/test_automated.py b/test/webtest/test_automated.py
index 11cae40..7a38e57 100755
--- a/test/webtest/test_automated.py
+++ b/test/webtest/test_automated.py
@@ -39,10 +39,9 @@ def call(command):
return process.returncode, out[0], out[1]


-def run_test(cmdline, output_dir, sys_id, uri, password ):
+def run_test(cmdline, output_dir, sys_id, uri, password):

- exec_array = [cmdline, '-q', '--uri', uri,
- '--password', password]
+ exec_array = [cmdline, '-q', '--uri', uri, '--password', password]

(ec, out, error) = call(exec_array)

@@ -68,7 +67,8 @@ def run_test(cmdline, output_dir, sys_id, uri, password ):


if __name__ == '__main__':
- time_limit_seconds = long(os.getenv('LSM_TEST_TMO_SECS', 90 * 60)) # 90 minutes
+ time_limit_seconds = long(
+ os.getenv('LSM_TEST_TMO_SECS', 90 * 60)) # 90 minutes

if len(sys.argv) != 4:
print('Syntax: %s <array_file> <plugin unit test> <output directory>'
diff --git a/test/webtest/test_hardware.py b/test/webtest/test_hardware.py
index bb523af..d960f19 100755
--- a/test/webtest/test_hardware.py
+++ b/test/webtest/test_hardware.py
@@ -51,8 +51,7 @@ def uri_password_get(d):
uri += "://%s@%s:%s/?no_ssl_verify=yes" % \
(d["PRINCIPAL"], d["IP"], port)
else:
- uri += "://%s@%s:%s" % (d["PRINCIPAL"], d["IP"],
- port)
+ uri += "://%s@%s:%s" % (d["PRINCIPAL"], d["IP"], port)

return uri, d['PASSWORD']

diff --git a/test/webtest/test_results.py b/test/webtest/test_results.py
index b0ed9a8..30ad876 100755
--- a/test/webtest/test_results.py
+++ b/test/webtest/test_results.py
@@ -187,19 +187,20 @@ def to_html(results):
text += str(html(
head(link(rel="stylesheet", type="text/css",
href="../../test.css"),
- title("libStorageMgmt test results"), ),
+ title("libStorageMgmt test results"), ),
body(
- HTML(h1("%s Results generated @ %s") % (preamble, time.strftime("%c"))),
+ HTML(h1("%s Results generated @ %s") %
+ (preamble, time.strftime("%c"))),
div(table(_table_header(ch), _table_body(row_data)),
- _class="angled_table"),
+ _class="angled_table"),
div(pre(
- " Legend\n"
- " P = Pass (Method called and returned without error)\n"
- " F = Fail (Method call returned an error)\n"
- " U = Unsupported or unable to test due to other errors\n"
- " * = Unable to connect to array or provider totally unsupported\n"
- " + = hyper link to error log\n\n\n",
- HTML(' Source code for plug-in for this test run <a href=./smis.py.html>is here. </a>'))))
+ " Legend\n"
+ " P = Pass (Method called and returned without error)\n"
+ " F = Fail (Method call returned an error)\n"
+ " U = Unsupported or unable to test due to other errors\n"
+ " * = Unable to connect to array or provider totally unsupported\n"
+ " + = hyper link to error log\n\n\n",
+ HTML(' Source code for plug-in for this test run <a href=./smis.py.html>is here. </a>'))))
))

return bs(text).prettify()
diff --git a/tools/lsmcli/cmdline.py b/tools/lsmcli/cmdline.py
index cf0f3d6..81a9482 100644
--- a/tools/lsmcli/cmdline.py
+++ b/tools/lsmcli/cmdline.py
@@ -253,8 +253,8 @@ def _get_item(l, the_id, friendly_name='item', raise_error=True):
dict(name="--raid-type",
help="RAID type for the new RAID group. "
"Should be one of these:\n %s" %
- "\n ".join(
- VolumeRAIDInfo.VOL_CREATE_RAID_TYPES_STR),
+ "\n ".
+ join(VolumeRAIDInfo.VOL_CREATE_RAID_TYPES_STR),
choices=VolumeRAIDInfo.VOL_CREATE_RAID_TYPES_STR,
type=str.upper),
],
@@ -1395,7 +1395,8 @@ def volume_raid_create(self, args):
"Disk ID %s not found" %
', '.join(set(args.disk) - set(d.id for d in all_lsm_disks)))

- busy_disks = [d.id for d in lsm_disks if not d.status & Disk.STATUS_FREE]
+ busy_disks = [d.id for d in lsm_disks
+ if not d.status & Disk.STATUS_FREE]

if len(busy_disks) >= 1:
raise LsmError(
diff --git a/tools/lsmcli/data_display.py b/tools/lsmcli/data_display.py
index b9edf68..b628c9f 100644
--- a/tools/lsmcli/data_display.py
+++ b/tools/lsmcli/data_display.py
@@ -305,12 +305,14 @@ def member_type_to_str(member_type):
return _enum_type_to_str(
member_type, PoolRAIDInfo._MEMBER_TYPE_MAP)

+
class VcrCap(object):
def __init__(self, system_id, raid_types, strip_sizes):
self.system_id = system_id
self.raid_types = raid_types
self.strip_sizes = strip_sizes

+
class DisplayData(object):

def __init__(self):
diff --git a/tools/netapp/netapp.py b/tools/netapp/netapp.py
index a219a28..76e4133 100755
--- a/tools/netapp/netapp.py
+++ b/tools/netapp/netapp.py
@@ -64,9 +64,9 @@ def process_params(p):
lsm.plugin.ontap.na.xml_debug = options.xmlfile

result = netapp_filer(options.host, user, password, 30,
- options.command,
- process_params(options.params),
- options.ssl)
+ options.command,
+ process_params(options.params),
+ options.ssl)
pp.pprint(result)
else:
parser.error("host and command are required")
diff --git a/tools/utility/public_symbols.py b/tools/utility/public_symbols.py
index e030f0a..450be3a 100755
--- a/tools/utility/public_symbols.py
+++ b/tools/utility/public_symbols.py
@@ -88,13 +88,13 @@ def h_module(mod):
visited_module[str(mod.__name__)] = True

class_list = [x for x in inspect.getmembers(mod, inspect.isclass)
- if not x[0].startswith('_')]
+ if not x[0].startswith('_')]

function_list = [x for x in inspect.getmembers(mod, inspect.isfunction)
- if not x[0].startswith('_')]
+ if not x[0].startswith('_')]

module_list = [x for x in inspect.getmembers(mod, inspect.ismodule)
- if not x[0].startswith('_')]
+ if not x[0].startswith('_')]

print '%sModule: %s' % (' ' * nesting, str(mod.__name__))
nesting += 4
--
1.8.3.1
Gris Ge
2015-06-10 11:57:56 UTC
Permalink
* We are following this code style:
* K&R
* Line width 80
* No tab
* Indent with 4 spaces.

* Initially, use this command to tidy C/C++ codes up:

indent -kr --no-tabs --tab-size4 -l80

* Manually update codes after above command.

Signed-off-by: Gris Ge <***@redhat.com>
---
c_binding/include/libstoragemgmt/libstoragemgmt.h | 1599 ++++++++++----------
.../libstoragemgmt/libstoragemgmt_accessgroups.h | 22 +-
.../libstoragemgmt/libstoragemgmt_blockrange.h | 25 +-
.../libstoragemgmt/libstoragemgmt_capabilities.h | 225 ++-
.../include/libstoragemgmt/libstoragemgmt_common.h | 47 +-
.../include/libstoragemgmt/libstoragemgmt_disk.h | 9 +-
.../include/libstoragemgmt/libstoragemgmt_error.h | 163 +-
.../include/libstoragemgmt/libstoragemgmt_fs.h | 7 +-
.../include/libstoragemgmt/libstoragemgmt_hash.h | 11 +-
.../libstoragemgmt/libstoragemgmt_nfsexport.h | 99 +-
.../libstoragemgmt/libstoragemgmt_plug_interface.h | 846 ++++++-----
.../include/libstoragemgmt/libstoragemgmt_pool.h | 25 +-
.../libstoragemgmt/libstoragemgmt_snapshot.h | 6 +-
.../libstoragemgmt/libstoragemgmt_systems.h | 5 +-
.../libstoragemgmt/libstoragemgmt_targetport.h | 25 +-
.../include/libstoragemgmt/libstoragemgmt_types.h | 94 +-
.../libstoragemgmt/libstoragemgmt_volumes.h | 10 +-
c_binding/lsm_convert.cpp | 418 ++---
c_binding/lsm_convert.hpp | 68 +-
c_binding/lsm_datatypes.cpp | 913 +++++------
c_binding/lsm_datatypes.hpp | 121 +-
c_binding/lsm_ipc.cpp | 464 +++---
c_binding/lsm_ipc.hpp | 100 +-
c_binding/lsm_mgmt.cpp | 1578 +++++++++----------
c_binding/lsm_plugin_ipc.cpp | 1430 ++++++++---------
c_binding/lsm_plugin_ipc.hpp | 21 +-
c_binding/test.cpp | 20 +-
27 files changed, 4379 insertions(+), 3972 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt.h b/c_binding/include/libstoragemgmt/libstoragemgmt.h
index 35ce600..7a84376 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt.h
@@ -12,7 +12,8 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
*
* Author: tasleson
*/
@@ -57,775 +58,818 @@
extern "C" {
#endif

- /**
- * Get a connection to a storage provider.
- * @param[in] uri Uniform Resource Identifier (see URI documentation)
- * @param[in] password Password for the storage array (optional, can be NULL)
- * @param[out] conn The connection to use for all the other library calls
- * @param[in] timeout Time-out in milliseconds, (initial value).
- * @param[out] e Error data if connection failed.
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error code @see lsm_error_number
- */
- int LSM_DLL_EXPORT lsm_connect_password(const char* uri, const char *password,
- lsm_connect **conn, uint32_t timeout, lsm_error_ptr *e, lsm_flag flags);
- /**
- * Closes a connection to a storage provider.
- * @param[in] conn Valid connection to close
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error code @see lsm_error_number
- */
- int LSM_DLL_EXPORT lsm_connect_close(lsm_connect *conn, lsm_flag flags);
-
- /**
- * Retrieve information about the plug-in
- * NOTE: Caller needs to free desc and version!
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[out] desc Plug-in description
- * @param[out] version Plug-in version
- * @param [in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error code @see lsm_error_number
- */
- int LSM_DLL_EXPORT lsm_plugin_info_get(lsm_connect *conn, char **desc,
- char **version, lsm_flag flags);
-
- /**
- * Retrieve a list of available plug-ins.
- * @param[in] sep Return data separator
- * @param[out] plugins String list of plug-ins with the form
- * desc<sep>version
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error code @see lsm_error_number
- */
- int LSM_DLL_EXPORT lsm_available_plugins_list(const char *sep,
- lsm_string_list **plugins,
- lsm_flag flags);
-
- /**
- * Sets the time-out for this connection.
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] timeout Time-out (in ms)
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason
- */
- int LSM_DLL_EXPORT lsm_connect_timeout_set(lsm_connect *conn,
- uint32_t timeout, lsm_flag flags);
-
- /**
- * Gets the time-out for this connection.
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[out] timeout Time-out (in ms)
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason
- */
- int LSM_DLL_EXPORT lsm_connect_timeout_get(lsm_connect *conn,
- uint32_t *timeout, lsm_flag flags);
-
- /**
- * Check on the status of a job, no data to return on completion.
- * @param[in] conn Valid connection
- * @param[in] job_id Job id
- * @param[out] status Job Status
- * @param[out] percent_complete Percent job complete
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason
- */
- int LSM_DLL_EXPORT lsm_job_status_get(lsm_connect *conn, const char *job_id,
- lsm_job_status *status, uint8_t *percent_complete,
- lsm_flag flags);
+/**
+ * Get a connection to a storage provider.
+ * @param[in] uri Uniform Resource Identifier (see URI documentation)
+ * @param[in] password Password for the storage array (optional, can be NULL)
+ * @param[out] conn The connection to use for all the other library calls
+ * @param[in] timeout Time-out in milliseconds, (initial value).
+ * @param[out] e Error data if connection failed.
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error
+ * code @see lsm_error_number
+ */
+int LSM_DLL_EXPORT lsm_connect_password(const char *uri,
+ const char *password,
+ lsm_connect **conn,
+ uint32_t timeout,
+ lsm_error_ptr *e, lsm_flag flags);
+/**
+ * Closes a connection to a storage provider.
+ * @param[in] conn Valid connection to close
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error
+ * code @see lsm_error_number
+ */
+int LSM_DLL_EXPORT lsm_connect_close(lsm_connect *conn, lsm_flag flags);

- /**
- * Check on the status of a job and return the pool information when
- * complete
- * @param[in] conn Valid connection pointer
- * @param[in] job_id Job to check status on
- * @param[out] status What is the job status
- * @param[out] percent_complete Domain 0..100
- * @param[out] pool lsm_pool for completed operation
- * @param[in] flags Reserved for future use, must be zero
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_job_status_pool_get(lsm_connect *conn,
- const char *job_id, lsm_job_status *status,
- uint8_t *percent_complete, lsm_pool **pool,
- lsm_flag flags);
+/**
+ * Retrieve information about the plug-in
+ * NOTE: Caller needs to free desc and version!
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[out] desc Plug-in description
+ * @param[out] version Plug-in version
+ * @param [in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error
+ * code @see lsm_error_number
+ */
+int LSM_DLL_EXPORT lsm_plugin_info_get(lsm_connect *conn, char **desc,
+ char **version, lsm_flag flags);

- /**
- * Check on the status of a job and returns the volume information when
- * complete.
- * @param[in] conn Valid connection pointer.
- * @param[in] job_id Job to check status on
- * @param[out] status What is the job status
- * @param[out] percent_complete Domain 0..100
- * @param[out] vol lsm_volume for completed operation.
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_job_status_volume_get(lsm_connect *conn,
- const char *job_id, lsm_job_status *status,
- uint8_t *percent_complete, lsm_volume **vol,
- lsm_flag flags);
+/**
+ * Retrieve a list of available plug-ins.
+ * @param[in] sep Return data separator
+ * @param[out] plugins String list of plug-ins with the form
+ * desc<sep>version
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error
+ * code @see lsm_error_number
+ */
+int LSM_DLL_EXPORT lsm_available_plugins_list(const char *sep,
+ lsm_string_list ** plugins,
+ lsm_flag flags);

+/**
+ * Sets the time-out for this connection.
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] timeout Time-out (in ms)
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason
+ */
+int LSM_DLL_EXPORT lsm_connect_timeout_set(lsm_connect *conn,
+ uint32_t timeout,
+ lsm_flag flags);
+
+/**
+ * Gets the time-out for this connection.
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[out] timeout Time-out (in ms)
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason
+ */
+int LSM_DLL_EXPORT lsm_connect_timeout_get(lsm_connect *conn,
+ uint32_t *timeout,
+ lsm_flag flags);

- /**
- * Check on the status of a job and return the fs information when complete.
- * @param[in] conn Valid connection pointer
- * @param[in] job_id Job to check
- * @param[out] status What is the job status
- * @param[out] percent_complete Percent of job complete
- * @param[out] fs lsm_fs * for the completed operation
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_job_status_fs_get(lsm_connect *conn, const char *job_id,
- lsm_job_status *status, uint8_t *percent_complete,
- lsm_fs **fs, lsm_flag flags);
-
- /**
- * Check on the status of a job and return the snapshot information when
- * compete.
- * @param[in] c Valid connection pointer
- * @param[in] job Job id to check
- * @param[out] status Job status
- * @param[out] percent_complete Percent complete
- * @param[out] ss Snap shot information
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason
- */
- int LSM_DLL_EXPORT lsm_job_status_ss_get(lsm_connect *c, const char *job,
- lsm_job_status *status, uint8_t *percent_complete,
- lsm_fs_ss **ss, lsm_flag flags);
-
- /**
- * Frees the resources used by a job.
- * @param[in] conn Valid connection pointer
- * @param[in] job_id Job ID
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK, else error reason.
- */
- int LSM_DLL_EXPORT lsm_job_free(lsm_connect *conn, char **job_id,
+/**
+ * Check on the status of a job, no data to return on completion.
+ * @param[in] conn Valid connection
+ * @param[in] job_id Job id
+ * @param[out] status Job Status
+ * @param[out] percent_complete Percent job complete
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason
+ */
+int LSM_DLL_EXPORT lsm_job_status_get(lsm_connect *conn,
+ const char *job_id,
+ lsm_job_status *status,
+ uint8_t *percent_complete,
+ lsm_flag flags);
+
+/**
+ * Check on the status of a job and return the pool information when
+ * complete
+ * @param[in] conn Valid connection pointer
+ * @param[in] job_id Job to check status on
+ * @param[out] status What is the job status
+ * @param[out] percent_complete Domain 0..100
+ * @param[out] pool lsm_pool for completed operation
+ * @param[in] flags Reserved for future use, must be zero
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT lsm_job_status_pool_get(lsm_connect *conn,
+ const char *job_id,
+ lsm_job_status *status,
+ uint8_t *percent_complete,
+ lsm_pool **pool,
+ lsm_flag flags);
+
+/**
+ * Check on the status of a job and returns the volume information when
+ * complete.
+ * @param[in] conn Valid connection pointer.
+ * @param[in] job_id Job to check status on
+ * @param[out] status What is the job status
+ * @param[out] percent_complete Domain 0..100
+ * @param[out] vol lsm_volume for completed operation.
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT lsm_job_status_volume_get(lsm_connect *conn,
+ const char *job_id,
+ lsm_job_status *status,
+ uint8_t *percent_complete,
+ lsm_volume **vol,
+ lsm_flag flags);
+
+
+/**
+ * Check on the status of a job and return the fs information when complete.
+ * @param[in] conn Valid connection pointer
+ * @param[in] job_id Job to check
+ * @param[out] status What is the job status
+ * @param[out] percent_complete Percent of job complete
+ * @param[out] fs lsm_fs * for the completed operation
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT lsm_job_status_fs_get(lsm_connect *conn,
+ const char *job_id,
+ lsm_job_status *status,
+ uint8_t *percent_complete,
+ lsm_fs **fs, lsm_flag flags);
+
+/**
+ * Check on the status of a job and return the snapshot information when
+ * compete.
+ * @param[in] c Valid connection pointer
+ * @param[in] job Job id to check
+ * @param[out] status Job status
+ * @param[out] percent_complete Percent complete
+ * @param[out] ss Snap shot information
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason
+ */
+int LSM_DLL_EXPORT lsm_job_status_ss_get(lsm_connect *c,
+ const char *job,
+ lsm_job_status * status,
+ uint8_t * percent_complete,
+ lsm_fs_ss ** ss, lsm_flag flags);
+
+/**
+ * Frees the resources used by a job.
+ * @param[in] conn Valid connection pointer
+ * @param[in] job_id Job ID
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK, else error reason.
+ */
+int LSM_DLL_EXPORT lsm_job_free(lsm_connect *conn, char **job_id,
+ lsm_flag flags);
+/**
+ * Storage system query functions
+ */
+
+/**
+ * Query the capabilities of the storage array.
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] system System of interest
+ * @param[out] cap The storage array capabilities
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success else error reason
+ */
+int LSM_DLL_EXPORT lsm_capabilities(lsm_connect *conn,
+ lsm_system *system,
+ lsm_storage_capabilities **cap,
lsm_flag flags);
- /**
- * Storage system query functions
- */
-
- /**
- * Query the capabilities of the storage array.
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] system System of interest
- * @param[out] cap The storage array capabilities
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success else error reason
- */
- int LSM_DLL_EXPORT lsm_capabilities(lsm_connect *conn,
- lsm_system *system,
- lsm_storage_capabilities **cap,
- lsm_flag flags);

- /**
- * Query the list of storage pools on the array.
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] search_key Search key (NULL for all)
- * @param[in] search_value Search value
- * @param[out] pool_array Array of storage pools
- * @param[out] count Number of storage pools
- * @param[in] flags Reserved, set to 0
- * @return LSM_ERR_OK on success else error reason
- */
- int LSM_DLL_EXPORT lsm_pool_list(lsm_connect *conn, char *search_key,
- char *search_value, lsm_pool **pool_array[],
- uint32_t *count, lsm_flag flags);
-
- /**
- * Volume management functions
- */
-
- /**
- * Gets a list of logical units for this array.
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] search_key Search key (NULL for all)
- * @param[in] search_value Search value
- * @param[out] volumes An array of lsm_volume
- * @param[out] count Number of elements in the lsm_volume array
- * @param[in] flags Reserved set to 0
- * @return LSM_ERR_OK on success else error reason
- */
- int LSM_DLL_EXPORT lsm_volume_list(lsm_connect *conn,
- const char *search_key,
- const char *search_value,
- lsm_volume **volumes[],
- uint32_t *count, lsm_flag flags);
+/**
+ * Query the list of storage pools on the array.
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] search_key Search key (NULL for all)
+ * @param[in] search_value Search value
+ * @param[out] pool_array Array of storage pools
+ * @param[out] count Number of storage pools
+ * @param[in] flags Reserved, set to 0
+ * @return LSM_ERR_OK on success else error reason
+ */
+int LSM_DLL_EXPORT lsm_pool_list(lsm_connect *conn, char *search_key,
+ char *search_value,
+ lsm_pool **pool_array[],
+ uint32_t *count, lsm_flag flags);

- /**
- * Get a list of disk for this array.
- * @param [in] conn Valid connection @see
- * lsm_connect_password
- * @param[in] search_key Search key (NULL for all)
- * @param[in] search_value Search value
- * @param [out] disks An array of lsm_disk types
- * @param [out] count Number of disks
- * @param [in] flags Reserved set to zero
- * @return LSM_ERR_OK on success else error reason
- */
- int LSM_DLL_EXPORT lsm_disk_list(lsm_connect *conn, const char * search_key,
- const char *search_value,
- lsm_disk **disks[], uint32_t *count,
- lsm_flag flags);
+/**
+ * Volume management functions
+ */

- /**
- * Creates a new volume (aka. LUN).
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] pool Valid pool @see lsm_pool (OPTIONAL, use NULL for plug-in choice)
- * @param[in] volume_name Human recognizable name (not all arrays support)
- * @param[in] size Size of new volume in bytes (actual size will
- * be based on array rounding to block size)
- * @param[in] provisioning Type of volume provisioning to use
- * @param[out] new_volume Valid volume @see lsm_volume
- * @param[out] job Indicates job id
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. , else error code
- */
- int LSM_DLL_EXPORT lsm_volume_create(lsm_connect *conn, lsm_pool *pool,
- const char *volume_name, uint64_t size,
- lsm_volume_provision_type provisioning,
- lsm_volume **new_volume, char **job,
- lsm_flag flags);
+/**
+ * Gets a list of logical units for this array.
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] search_key Search key (NULL for all)
+ * @param[in] search_value Search value
+ * @param[out] volumes An array of lsm_volume
+ * @param[out] count Number of elements in the lsm_volume array
+ * @param[in] flags Reserved set to 0
+ * @return LSM_ERR_OK on success else error reason
+ */
+int LSM_DLL_EXPORT lsm_volume_list(lsm_connect *conn,
+ const char *search_key,
+ const char *search_value,
+ lsm_volume ** volumes[],
+ uint32_t *count, lsm_flag flags);

- /**
- * Resize an existing volume.
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] volume volume to re-size
- * @param[in] new_size New size of volume
- * @param[out] resized_volume Pointer to newly re-sized lun.
- * @param[out] job Indicates job id
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. , else error code
- */
- int LSM_DLL_EXPORT lsm_volume_resize(lsm_connect *conn, lsm_volume *volume,
- uint64_t new_size, lsm_volume **resized_volume,
- char **job, lsm_flag flags);
-
- /**
- * Replicates a volume
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] pool Valid pool
- * @param[in] rep_type Type of replication lsm_replication_type
- * @param[in] volume_src Which volume to replicate
- * @param[in] name Human recognizable name (not all arrays support)
- * @param[out] new_replicant New replicated volume lsm_volume_t
- * @param[out] job Indicates job id
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. , else error code
- */
- int LSM_DLL_EXPORT lsm_volume_replicate(lsm_connect *conn, lsm_pool *pool,
- lsm_replication_type rep_type, lsm_volume *volume_src,
- const char *name, lsm_volume **new_replicant,
- char **job, lsm_flag flags);
-
- /**
- * Unit of block size for the replicate range method.
- * @param[in] conn Valid connection
- * @param[in] system Valid lsm_system
- * @param[out] bs Block size
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_volume_replicate_range_block_size(lsm_connect *conn,
- lsm_system *system,
- uint32_t *bs,
- lsm_flag flags);
-
- /**
- * Replicates a portion of a volume to a volume.
- * @param[in] conn Valid connection
- * @param[in] rep_type Replication type
- * @param[in] source Source volume
- * @param[in] dest Destination volume (can be same as source)
- * @param[in] ranges An array of block ranges
- * @param[in] num_ranges Number of entries in ranges.
- * @param[out] job Indicates job id
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async., else error code
- */
- int LSM_DLL_EXPORT lsm_volume_replicate_range(lsm_connect *conn,
- lsm_replication_type rep_type,
- lsm_volume *source,
- lsm_volume *dest,
- lsm_block_range **ranges,
- uint32_t num_ranges, char **job,
- lsm_flag flags);
-
- /**
- * Deletes a logical unit and data is lost!
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] volume Volume that is to be deleted.
- * @param[out] job Indicates job id
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. , else error code
- */
- int LSM_DLL_EXPORT lsm_volume_delete(lsm_connect *conn, lsm_volume *volume,
+/**
+ * Get a list of disk for this array.
+ * @param [in] conn Valid connection @see
+ * lsm_connect_password
+ * @param[in] search_key Search key (NULL for all)
+ * @param[in] search_value Search value
+ * @param [out] disks An array of lsm_disk types
+ * @param [out] count Number of disks
+ * @param [in] flags Reserved set to zero
+ * @return LSM_ERR_OK on success else error reason
+ */
+int LSM_DLL_EXPORT lsm_disk_list(lsm_connect *conn,
+ const char *search_key,
+ const char *search_value,
+ lsm_disk **disks[], uint32_t *count,
+ lsm_flag flags);
+
+/**
+ * Creates a new volume (aka. LUN).
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] pool Valid pool @see lsm_pool (OPTIONAL, use NULL
+ * for plug-in choice)
+ * @param[in] volume_name Human recognizable name (not all arrays
+ * support)
+ * @param[in] size Size of new volume in bytes (actual size will
+ * be based on array rounding to block size)
+ * @param[in] provisioning Type of volume provisioning to use
+ * @param[out] new_volume Valid volume @see lsm_volume
+ * @param[out] job Indicates job id
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. , else error
+ * code
+ */
+int LSM_DLL_EXPORT lsm_volume_create(lsm_connect *conn,
+ lsm_pool * pool,
+ const char *volume_name,
+ uint64_t size,
+ lsm_volume_provision_type provisioning,
+ lsm_volume **new_volume,
+ char **job, lsm_flag flags);
+
+/**
+ * Resize an existing volume.
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] volume volume to re-size
+ * @param[in] new_size New size of volume
+ * @param[out] resized_volume Pointer to newly re-sized lun.
+ * @param[out] job Indicates job id
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. , else error
+ * code
+ */
+int LSM_DLL_EXPORT lsm_volume_resize(lsm_connect *conn,
+ lsm_volume * volume,
+ uint64_t new_size,
+ lsm_volume **resized_volume,
+ char **job, lsm_flag flags);
+
+/**
+ * Replicates a volume
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] pool Valid pool
+ * @param[in] rep_type Type of replication lsm_replication_type
+ * @param[in] volume_src Which volume to replicate
+ * @param[in] name Human recognizable name (not all arrays
+ * support)
+ * @param[out] new_replicant New replicated volume lsm_volume_t
+ * @param[out] job Indicates job id
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. , else error
+ * code
+ */
+int LSM_DLL_EXPORT lsm_volume_replicate(lsm_connect *conn,
+ lsm_pool *pool,
+ lsm_replication_type rep_type,
+ lsm_volume *volume_src,
+ const char *name,
+ lsm_volume **new_replicant,
char **job, lsm_flag flags);

- /**
- * Set a Volume to online
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] volume Volume that is to be placed online
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error code
- */
- int LSM_DLL_EXPORT lsm_volume_enable(lsm_connect *conn, lsm_volume *volume,
+/**
+ * Unit of block size for the replicate range method.
+ * @param[in] conn Valid connection
+ * @param[in] system Valid lsm_system
+ * @param[out] bs Block size
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT
+ lsm_volume_replicate_range_block_size(lsm_connect *conn,
+ lsm_system *system,
+ uint32_t *bs,
+ lsm_flag flags);
+
+/**
+ * Replicates a portion of a volume to a volume.
+ * @param[in] conn Valid connection
+ * @param[in] rep_type Replication type
+ * @param[in] source Source volume
+ * @param[in] dest Destination volume (can be same as source)
+ * @param[in] ranges An array of block ranges
+ * @param[in] num_ranges Number of entries in ranges.
+ * @param[out] job Indicates job id
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async., else error
+ * code
+ */
+int LSM_DLL_EXPORT lsm_volume_replicate_range(lsm_connect *conn,
+ lsm_replication_type rep_type,
+ lsm_volume *source,
+ lsm_volume *dest,
+ lsm_block_range **ranges,
+ uint32_t num_ranges,
+ char **job, lsm_flag flags);
+
+/**
+ * Deletes a logical unit and data is lost!
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] volume Volume that is to be deleted.
+ * @param[out] job Indicates job id
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. , else error
+ * code
+ */
+int LSM_DLL_EXPORT lsm_volume_delete(lsm_connect *conn,
+ lsm_volume *volume, char **job,
+ lsm_flag flags);
+
+/**
+ * Set a Volume to online
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] volume Volume that is to be placed online
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error
+ * code
+ */
+int LSM_DLL_EXPORT lsm_volume_enable(lsm_connect *conn, lsm_volume *volume,
+ lsm_flag flags);
+
+/**
+ * Set a Volume to offline
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] volume Volume that is to be placed online
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error
+ * code
+ */
+int LSM_DLL_EXPORT lsm_volume_disable(lsm_connect *conn,
+ lsm_volume * volume, lsm_flag flags);
+
+/**
+ * Set the username password for CHAP authentication, inbound and outbound.
+ * @param conn Valid connection pointer
+ * @param init_id Initiator ID
+ * @param in_user inbound user name
+ * @param in_password inbound password
+ * @param out_user outbound user name
+ * @param out_password outbound password
+ * @param flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error
+ * code.
+ */
+int LSM_DLL_EXPORT lsm_iscsi_chap_auth(lsm_connect *conn,
+ const char *init_id,
+ const char *in_user,
+ const char *in_password,
+ const char *out_user,
+ const char *out_password,
+ lsm_flag flags);
+
+/**
+ * Retrieves a list of access groups.
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] search_key Search key (NULL for all)
+ * @param[in] search_value Search value
+ * @param[out] groups Array of access groups
+ * @param[out] group_count Size of array
+ * @param[in] flags Reserved set to zero
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT lsm_access_group_list(lsm_connect *conn,
+ const char *search_key,
+ const char *search_value,
+ lsm_access_group **groups[],
+ uint32_t *group_count,
+ lsm_flag flags);
+
+/**
+ * Creates a new access group with one initiator in it.
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] name Name of access group
+ * @param[in] init_id Initiator id to be added to group
+ * @param[in] init_type Initiator type
+ * @param[in] system System to create access group for
+ * @param[out] access_group Returned access group
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason
+ */
+int LSM_DLL_EXPORT
+ lsm_access_group_create(lsm_connect *conn, const char *name,
+ const char *init_id,
+ lsm_access_group_init_type init_type,
+ lsm_system * system,
+ lsm_access_group **access_group, lsm_flag flags);
+
+/**
+ * Deletes an access group.
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] access_group Group to delete
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT lsm_access_group_delete(lsm_connect *conn,
+ lsm_access_group *
+ access_group, lsm_flag flags);
+
+/**
+ * Adds an initiator to the access group
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] access_group Group to modify
+ * @param[in] init_id Initiator to add to group
+ * @param[in] init_type Type of initiator
+ * @param[out] updated_access_group Updated access group
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT \
+ lsm_access_group_initiator_add(lsm_connect *conn,
+ lsm_access_group *access_group,
+ const char *init_id,
+ lsm_access_group_init_type init_type,
+ lsm_access_group **updated_access_group,
+ lsm_flag flags);
+
+/**
+ * Removes an initiator from an access group.
+ * @param[in] conn Valid connection @see lsm_connect_password
+ * @param[in] access_group Group to modify
+ * @param[in] initiator_id Initiator to delete from group
+ * @param[in] init_type Type of initiator, enumerated type
+ * @param[out] updated_access_group Updated access group
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return[in] LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT
+ lsm_access_group_initiator_delete(lsm_connect *conn,
+ lsm_access_group *access_group,
+ const char *initiator_id,
+ lsm_access_group_init_type init_type,
+ lsm_access_group **updated_access_group,
+ lsm_flag flags);
+
+/**
+ * Grants access to a volume for the specified group
+ * @param[in] conn Valid connection
+ * @param[in] access_group Valid group pointer
+ * @param[in] volume Valid volume pointer
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT lsm_volume_mask(lsm_connect *conn,
+ lsm_access_group *access_group,
+ lsm_volume *volume, lsm_flag flags);
+
+/**
+ * Revokes access to a volume for the specified group
+ * @param[in] conn Valid connection
+ * @param[in] access_group Valid group pointer
+ * @param[in] volume Valid volume pointer
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT lsm_volume_unmask(lsm_connect *conn,
+ lsm_access_group *access_group,
+ lsm_volume *volume, lsm_flag flags);
+
+/**
+ * Returns those volumes that the specified group has access to.
+ * @param[in] conn Valid connection
+ * @param[in] group Valid group
+ * @param[out] volumes An array of volumes
+ * @param[out] count Number of volumes
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT
+ lsm_volumes_accessible_by_access_group(lsm_connect *conn,
+ lsm_access_group *group,
+ lsm_volume **volumes[],
+ uint32_t *count, lsm_flag flags);
+
+/**
+ * Retrieves the access groups that have access to the specified volume.
+ * @param[in] conn Valid connection
+ * @param[in] volume Valid volume
+ * @param[out] groups An array of access groups
+ * @param[out] group_count Number of access groups
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT
+ lsm_access_groups_granted_to_volume(lsm_connect *conn,
+ lsm_volume *volume,
+ lsm_access_group **groups[],
+ uint32_t *group_count,
lsm_flag flags);

- /**
- * Set a Volume to offline
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] volume Volume that is to be placed online
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error code
- */
- int LSM_DLL_EXPORT lsm_volume_disable(lsm_connect *conn,
- lsm_volume *volume, lsm_flag flags);
-
- /**
- * Set the username password for CHAP authentication, inbound and outbound.
- * @param conn Valid connection pointer
- * @param init_id Initiator ID
- * @param in_user inbound user name
- * @param in_password inbound password
- * @param out_user outbound user name
- * @param out_password outbound password
- * @param flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error code.
- */
- int LSM_DLL_EXPORT lsm_iscsi_chap_auth(lsm_connect *conn,
- const char *init_id,
- const char *in_user,
- const char *in_password,
- const char *out_user,
- const char *out_password,
- lsm_flag flags);
-
- /**
- * Retrieves a list of access groups.
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] search_key Search key (NULL for all)
- * @param[in] search_value Search value
- * @param[out] groups Array of access groups
- * @param[out] group_count Size of array
- * @param[in] flags Reserved set to zero
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_access_group_list(lsm_connect *conn,
- const char *search_key,
- const char *search_value,
- lsm_access_group **groups[],
- uint32_t *group_count,
- lsm_flag flags);
-
- /**
- * Creates a new access group with one initiator in it.
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] name Name of access group
- * @param[in] init_id Initiator id to be added to group
- * @param[in] init_type Initiator type
- * @param[in] system System to create access group for
- * @param[out] access_group Returned access group
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason
- */
- int LSM_DLL_EXPORT lsm_access_group_create(lsm_connect *conn,
- const char *name,
- const char *init_id,
- lsm_access_group_init_type init_type,
- lsm_system *system,
- lsm_access_group **access_group,
- lsm_flag flags);
-
- /**
- * Deletes an access group.
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] access_group Group to delete
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_access_group_delete(lsm_connect *conn,
- lsm_access_group *access_group,
- lsm_flag flags);
-
- /**
- * Adds an initiator to the access group
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] access_group Group to modify
- * @param[in] init_id Initiator to add to group
- * @param[in] init_type Type of initiator
- * @param[out] updated_access_group Updated access group
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_access_group_initiator_add(lsm_connect *conn,
- lsm_access_group *access_group,
- const char *init_id,
- lsm_access_group_init_type init_type,
- lsm_access_group **updated_access_group,
+/**
+ * Returns 1 if the specified volume has child dependencies.
+ * @param[in] conn Valid connection
+ * @param[in] volume Valid volume
+ * @param[out] yes 1 == Yes, 0 == No
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT lsm_volume_child_dependency(lsm_connect *conn,
+ lsm_volume *volume,
+ uint8_t *yes,
+ lsm_flag flags);
+
+/**
+ * Instructs the array to remove all child dependencies by replicating
+ * required storage.
+ * @param[in] conn Valid connection
+ * @param[in] volume Valid volume
+ * @param[out] job Job id
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT \
+ lsm_volume_child_dependency_delete(lsm_connect *conn, lsm_volume *volume,
+ char **job, lsm_flag flags);
+
+/**
+ * Retrieves information about the different arrays accessible.
+ * NOTE: Free returned systems by calling to lsm
+ * @param[in] conn Valid connection
+ * @param[out] systems Array of lsm_system
+ * @param[out] system_count Number of systems
+ * @param[in] flags Reserved set to zero
+ * @return LSM_ERR_OK on success, else error reason
+ */
+int LSM_DLL_EXPORT lsm_system_list(lsm_connect *conn,
+ lsm_system ** systems[],
+ uint32_t * system_count, lsm_flag flags);
+
+/**
+ * Retrieves information about the available file systems.
+ * @param[in] conn Valid connection
+ * @param[in] search_key Search key (NULL for all)
+ * @param[in] search_value Search value
+ * @param[out] fs Array of lsm_fs
+ * @param[out] fs_count Number of file systems
+ * @param[in] flags Reserved set to zero
+ * @return LSM_ERR_OK on success, else error reason
+ */
+int LSM_DLL_EXPORT lsm_fs_list(lsm_connect *conn, const char *search_key,
+ const char *search_value, lsm_fs **fs[],
+ uint32_t *fs_count, lsm_flag flags);
+
+/**
+ * Creates a new file system from the specified pool
+ * @param[in] conn Valid connection
+ * @param[in] pool Valid pool
+ * @param[in] name File system name
+ * @param[in] size_bytes Size of file system in bytes
+ * @param[out] fs Newly created fs
+ * @param[out] job Job id if job is async.
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. ,
+ * else error code
+ */
+int LSM_DLL_EXPORT lsm_fs_create(lsm_connect *conn, lsm_pool * pool,
+ const char *name, uint64_t size_bytes,
+ lsm_fs **fs, char **job, lsm_flag flags);
+
+/**
+ * Deletes a file system
+ * @param[in] conn Valid connection
+ * @param fs File system to delete
+ * @param job Job id if job is created async.
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. ,
+ * else error code
+ */
+int LSM_DLL_EXPORT lsm_fs_delete(lsm_connect *conn, lsm_fs *fs,
+ char **job, lsm_flag flags);
+
+/**
+ * Clones an existing file system
+ * @param conn Valid connection
+ * @param src_fs Source file system
+ * @param name Name of new file system
+ * @param optional_ss Optional snapshot to base clone from
+ * @param cloned_fs Newly cloned file system record
+ * @param job Job id if operation is async.
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on succees, LSM_ERR_JOB_STARTED if async., else
+ * error code.
+ */
+int LSM_DLL_EXPORT lsm_fs_clone(lsm_connect *conn, lsm_fs *src_fs,
+ const char *name, lsm_fs_ss *optional_ss,
+ lsm_fs **cloned_fs, char **job,
lsm_flag flags);

- /**
- * Removes an initiator from an access group.
- * @param[in] conn Valid connection @see lsm_connect_password
- * @param[in] access_group Group to modify
- * @param[in] initiator_id Initiator to delete from group
- * @param[in] init_type Type of initiator, enumerated type
- * @param[out] updated_access_group Updated access group
- * @param[in] flags Reserved for future use, must be zero.
- * @return[in] LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_access_group_initiator_delete(lsm_connect *conn,
- lsm_access_group *access_group,
- const char *initiator_id,
- lsm_access_group_init_type init_type,
- lsm_access_group **updated_access_group,
- lsm_flag flags);
+/**
+ * Checks to see if the specified file system has a child dependency.
+ * @param[in] conn Valid connection
+ * @param[in] fs Specific file system
+ * @param[in] files Specific files to check (NULL OK)
+ * @param[out] yes Zero indicates no, else yes
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error
+ * code.
+ */
+int LSM_DLL_EXPORT lsm_fs_child_dependency(lsm_connect *conn, lsm_fs *fs,
+ lsm_string_list *files,
+ uint8_t *yes, lsm_flag flags);

- /**
- * Grants access to a volume for the specified group
- * @param[in] conn Valid connection
- * @param[in] access_group Valid group pointer
- * @param[in] volume Valid volume pointer
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_volume_mask(lsm_connect *conn,
- lsm_access_group *access_group,
- lsm_volume *volume,
- lsm_flag flags);
-
- /**
- * Revokes access to a volume for the specified group
- * @param[in] conn Valid connection
- * @param[in] access_group Valid group pointer
- * @param[in] volume Valid volume pointer
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_volume_unmask(lsm_connect *conn,
- lsm_access_group *access_group,
- lsm_volume *volume,
- lsm_flag flags);
-
- /**
- * Returns those volumes that the specified group has access to.
- * @param[in] conn Valid connection
- * @param[in] group Valid group
- * @param[out] volumes An array of volumes
- * @param[out] count Number of volumes
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_volumes_accessible_by_access_group(lsm_connect *conn,
- lsm_access_group *group,
- lsm_volume **volumes[],
- uint32_t *count,
- lsm_flag flags);
-
- /**
- * Retrieves the access groups that have access to the specified volume.
- * @param[in] conn Valid connection
- * @param[in] volume Valid volume
- * @param[out] groups An array of access groups
- * @param[out] group_count Number of access groups
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_access_groups_granted_to_volume(lsm_connect *conn,
- lsm_volume *volume,
- lsm_access_group **groups[],
- uint32_t *group_count,
- lsm_flag flags);
-
- /**
- * Returns 1 if the specified volume has child dependencies.
- * @param[in] conn Valid connection
- * @param[in] volume Valid volume
- * @param[out] yes 1 == Yes, 0 == No
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_volume_child_dependency(lsm_connect *conn,
- lsm_volume *volume,
- uint8_t *yes,
- lsm_flag flags);
-
- /**
- * Instructs the array to remove all child dependencies by replicating
- * required storage.
- * @param[in] conn Valid connection
- * @param[in] volume Valid volume
- * @param[out] job Job id
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_volume_child_dependency_delete(lsm_connect *conn,
- lsm_volume *volume,
- char **job, lsm_flag flags);
-
- /**
- * Retrieves information about the different arrays accessible.
- * NOTE: Free returned systems by calling to lsm
- * @param[in] conn Valid connection
- * @param[out] systems Array of lsm_system
- * @param[out] system_count Number of systems
- * @param[in] flags Reserved set to zero
- * @return LSM_ERR_OK on success, else error reason
- */
- int LSM_DLL_EXPORT lsm_system_list(lsm_connect *conn, lsm_system **systems[],
- uint32_t *system_count, lsm_flag flags);
-
- /**
- * Retrieves information about the available file systems.
- * @param[in] conn Valid connection
- * @param[in] search_key Search key (NULL for all)
- * @param[in] search_value Search value
- * @param[out] fs Array of lsm_fs
- * @param[out] fs_count Number of file systems
- * @param[in] flags Reserved set to zero
- * @return LSM_ERR_OK on success, else error reason
- */
- int LSM_DLL_EXPORT lsm_fs_list(lsm_connect *conn, const char *search_key,
- const char *search_value, lsm_fs **fs[],
- uint32_t *fs_count, lsm_flag flags);
-
- /**
- * Creates a new file system from the specified pool
- * @param[in] conn Valid connection
- * @param[in] pool Valid pool
- * @param[in] name File system name
- * @param[in] size_bytes Size of file system in bytes
- * @param[out] fs Newly created fs
- * @param[out] job Job id if job is async.
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. ,
- * else error code
- */
- int LSM_DLL_EXPORT lsm_fs_create(lsm_connect *conn, lsm_pool *pool,
- const char *name, uint64_t size_bytes,
- lsm_fs **fs, char **job, lsm_flag flags);
-
- /**
- * Deletes a file system
- * @param[in] conn Valid connection
- * @param fs File system to delete
- * @param job Job id if job is created async.
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. ,
- * else error code
- */
- int LSM_DLL_EXPORT lsm_fs_delete(lsm_connect *conn, lsm_fs *fs, char **job,
- lsm_flag flags);
+/**
+ * Removes child dependencies by duplicating the required storage to remove.
+ * Note: This could take a long time to complete based on dependencies.
+ * @param[in] conn Valid connection
+ * @param[in] fs File system to remove dependencies for
+ * @param[in] files Specific files to check (NULL OK)
+ * @param[out] job Job id for async. identification
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. ,
+ * else error code
+ */
+int LSM_DLL_EXPORT
+ lsm_fs_child_dependency_delete(lsm_connect *conn, lsm_fs *fs,
+ lsm_string_list *files, char **job,
+ lsm_flag flags);
+
+/**
+ * Resizes a file system
+ * @param[in] conn Valid connection
+ * @param[in] fs File system to re-size
+ * @param[in] new_size_bytes New size of fs
+ * @param[out] rfs File system information for re-sized fs
+ * @param[out] job_id Job id for async. identification
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. ,
+ * else error code
+ */
+int LSM_DLL_EXPORT lsm_fs_resize(lsm_connect *conn, lsm_fs *fs,
+ uint64_t new_size_bytes, lsm_fs **rfs,
+ char **job_id, lsm_flag flags);
+
+/**
+ * Clones a file on a file system.
+ * @param[in] conn Valid connection
+ * @param[in] fs File system which file resides
+ * @param[in] src_file_name Source file relative name & path
+ * @param[in] dest_file_name Dest. file relative name & path
+ * @param[in] snapshot Optional backing snapshot
+ * @param[out] job Job id for async. operation
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. ,
+ * else error code
+ */
+int LSM_DLL_EXPORT lsm_fs_file_clone(lsm_connect *conn, lsm_fs *fs,
+ const char *src_file_name,
+ const char *dest_file_name,
+ lsm_fs_ss *snapshot, char **job,
+ lsm_flag flags);
+
+/**
+ * Return a list of snapshots
+ * @param[in] conn Valid connection
+ * @param[in] fs File system to check for snapshots
+ * @param[out] ss An array of snapshot pointers
+ * @param[out] ss_count Number of elements in the array
+ * @param[in] flags Reserved set to zero
+ * @return LSM_ERR_OK on success, else error reason
+ */
+int LSM_DLL_EXPORT lsm_fs_ss_list(lsm_connect *conn, lsm_fs *fs,
+ lsm_fs_ss ** ss[], uint32_t * ss_count,
+ lsm_flag flags);

- /**
- * Clones an existing file system
- * @param conn Valid connection
- * @param src_fs Source file system
- * @param name Name of new file system
- * @param optional_ss Optional snapshot to base clone from
- * @param cloned_fs Newly cloned file system record
- * @param job Job id if operation is async.
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on succees, LSM_ERR_JOB_STARTED if async., else
- * error code.
- */
- int LSM_DLL_EXPORT lsm_fs_clone(lsm_connect *conn, lsm_fs *src_fs,
- const char *name, lsm_fs_ss *optional_ss,
- lsm_fs **cloned_fs,
+/**
+ * Creates a snapshot
+ * @param[in] c Valid connection
+ * @param[in] fs File system to snapshot
+ * @param[in] name Name of snap shot
+ * @param[out] snapshot Snapshot that was created
+ * @param[out] job Job id if the operation is async.
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async.,
+ * else error code
+ */
+int LSM_DLL_EXPORT lsm_fs_ss_create(lsm_connect *c, lsm_fs *fs,
+ const char *name, lsm_fs_ss **snapshot,
char **job, lsm_flag flags);

- /**
- * Checks to see if the specified file system has a child dependency.
- * @param[in] conn Valid connection
- * @param[in] fs Specific file system
- * @param[in] files Specific files to check (NULL OK)
- * @param[out] yes Zero indicates no, else yes
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error code.
- */
- int LSM_DLL_EXPORT lsm_fs_child_dependency( lsm_connect *conn, lsm_fs *fs,
- lsm_string_list *files,
- uint8_t *yes, lsm_flag flags);
-
- /**
- * Removes child dependencies by duplicating the required storage to remove.
- * Note: This could take a long time to complete based on dependencies.
- * @param[in] conn Valid connection
- * @param[in] fs File system to remove dependencies for
- * @param[in] files Specific files to check (NULL OK)
- * @param[out] job Job id for async. identification
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. ,
- * else error code
- */
- int LSM_DLL_EXPORT lsm_fs_child_dependency_delete( lsm_connect *conn, lsm_fs *fs,
- lsm_string_list *files,
- char **job, lsm_flag flags);
-
- /**
- * Resizes a file system
- * @param[in] conn Valid connection
- * @param[in] fs File system to re-size
- * @param[in] new_size_bytes New size of fs
- * @param[out] rfs File system information for re-sized fs
- * @param[out] job_id Job id for async. identification
- * @param[in] flags Reserved for future use, must be zero.
- * @return @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. ,
- * else error code
- */
- int LSM_DLL_EXPORT lsm_fs_resize(lsm_connect *conn, lsm_fs *fs,
- uint64_t new_size_bytes, lsm_fs **rfs,
- char **job_id, lsm_flag flags);
-
- /**
- * Clones a file on a file system.
- * @param[in] conn Valid connection
- * @param[in] fs File system which file resides
- * @param[in] src_file_name Source file relative name & path
- * @param[in] dest_file_name Dest. file relative name & path
- * @param[in] snapshot Optional backing snapshot
- * @param[out] job Job id for async. operation
- * @param[in] flags Reserved for future use, must be zero.
- * @return @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async. ,
- * else error code
- */
- int LSM_DLL_EXPORT lsm_fs_file_clone(lsm_connect *conn, lsm_fs *fs,
- const char *src_file_name,
- const char *dest_file_name,
- lsm_fs_ss *snapshot, char **job,
- lsm_flag flags);
+/**
+ * Deletes a snapshot
+ * @param[in] c Valid connection
+ * @param[in] fs File system
+ * @param[in] ss Snapshot to delete
+ * @param[out] job Job id if the operation is async.
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async., else error
+ * code.
+ */
+int LSM_DLL_EXPORT lsm_fs_ss_delete(lsm_connect *c, lsm_fs *fs,
+ lsm_fs_ss *ss, char **job, lsm_flag flags);

- /**
- * Return a list of snapshots
- * @param[in] conn Valid connection
- * @param[in] fs File system to check for snapshots
- * @param[out] ss An array of snapshot pointers
- * @param[out] ss_count Number of elements in the array
- * @param[in] flags Reserved set to zero
- * @return LSM_ERR_OK on success, else error reason
- */
- int LSM_DLL_EXPORT lsm_fs_ss_list(lsm_connect *conn, lsm_fs *fs,
- lsm_fs_ss **ss[], uint32_t *ss_count,
- lsm_flag flags);
+/**
+ * Restores a file system or files to a previous state as specified in the
+ * snapshot.
+ * @param c Valid connection
+ * @param fs File system which contains the snapshot
+ * @param ss Snapshot to restore to
+ * @param files Optional list of files to restore
+ * @param restore_files Optional list of file names to restore to
+ * @param all_files 0 = False else True
+ * @param job Job id if operation is async.
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async., else error
+ * code
+ */
+int LSM_DLL_EXPORT lsm_fs_ss_restore(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss,
+ lsm_string_list *files,
+ lsm_string_list *restore_files,
+ int all_files, char **job, lsm_flag flags);

- /**
- * Creates a snapshot
- * @param[in] c Valid connection
- * @param[in] fs File system to snapshot
- * @param[in] name Name of snap shot
- * @param[out] snapshot Snapshot that was created
- * @param[out] job Job id if the operation is async.
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async.,
- * else error code
- */
- int LSM_DLL_EXPORT lsm_fs_ss_create(lsm_connect *c, lsm_fs *fs,
- const char *name,
- lsm_fs_ss **snapshot, char **job,
- lsm_flag flags);
+/**
+ * Returns the types of NFS client authentication the array supports.
+ * @param[in] c Valid connection
+ * @param[out] types List of types
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error code.
+ */
+int LSM_DLL_EXPORT lsm_nfs_auth_types(lsm_connect *c, lsm_string_list **types,
+ lsm_flag flags);

- /**
- * Deletes a snapshot
- * @param[in] c Valid connection
- * @param[in] fs File system
- * @param[in] ss Snapshot to delete
- * @param[out] job Job id if the operation is async.
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async., else error
- * code.
- */
- int LSM_DLL_EXPORT lsm_fs_ss_delete(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss,
- char **job, lsm_flag flags);
+/**
+ * Lists the nfs exports on the specified array.
+ * @param[in] c Valid connection
+ * @param[in] search_key Search key (NULL for all)
+ * @param[in] search_value Search value
+ * @param[out] exports An array of lsm_nfs_export
+ * @param[out] count Number of items in array
+ * @param[in] flags Reserved set to zero
+ * @return LSM_ERR_OK on success else error code.
+ */
+int LSM_DLL_EXPORT lsm_nfs_list(lsm_connect *c,
+ const char *search_key,
+ const char *search_value,
+ lsm_nfs_export **exports[],
+ uint32_t *count, lsm_flag flags);
+
+/**
+ * Creates or modifies an NFS export.
+ * @param[in] c Valid connection
+ * @param[in] fs_id File system ID to export via NFS
+ * @param[in] export_path Export path
+ * @param[in] root_list List of hosts that have root access
+ * @param[in] rw_list List of hosts that have read/write access
+ * @param[in] ro_list List of hosts that have read only access
+ * @param[in] anon_uid UID to map to anonymous
+ * @param[in] anon_gid GID to map to anonymous
+ * @param[in] auth_type Array specific authentication types
+ * @param[in] options Array specific options
+ * @param[out] exported Export record
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success, else error reason.
+ */
+int LSM_DLL_EXPORT lsm_nfs_export_fs(lsm_connect *c,
+ const char *fs_id,
+ const char *export_path,
+ lsm_string_list *root_list,
+ lsm_string_list *rw_list,
+ lsm_string_list *ro_list,
+ uint64_t anon_uid,
+ uint64_t anon_gid,
+ const char *auth_type,
+ const char *options,
+ lsm_nfs_export **exported,
+ lsm_flag flags);

- /**
- * Restores a file system or files to a previous state as specified in the
- * snapshot.
- * @param c Valid connection
- * @param fs File system which contains the snapshot
- * @param ss Snapshot to restore to
- * @param files Optional list of files to restore
- * @param restore_files Optional list of file names to restore to
- * @param all_files 0 = False else True
- * @param job Job id if operation is async.
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async.,
- * else error code
- */
- int LSM_DLL_EXPORT lsm_fs_ss_restore(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss,
- lsm_string_list *files,
- lsm_string_list *restore_files,
- int all_files, char **job, lsm_flag flags);
-
- /**
- * Returns the types of NFS client authentication the array supports.
- * @param[in] c Valid connection
- * @param[out] types List of types
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error code.
- */
- int LSM_DLL_EXPORT lsm_nfs_auth_types( lsm_connect *c,
- lsm_string_list **types,
- lsm_flag flags);
-
- /**
- * Lists the nfs exports on the specified array.
- * @param[in] c Valid connection
- * @param[in] search_key Search key (NULL for all)
- * @param[in] search_value Search value
- * @param[out] exports An array of lsm_nfs_export
- * @param[out] count Number of items in array
- * @param[in] flags Reserved set to zero
- * @return LSM_ERR_OK on success else error code.
- */
- int LSM_DLL_EXPORT lsm_nfs_list(lsm_connect *c, const char *search_key,
- const char *search_value,
- lsm_nfs_export **exports[],
- uint32_t *count, lsm_flag flags);
-
- /**
- * Creates or modifies an NFS export.
- * @param[in] c Valid connection
- * @param[in] fs_id File system ID to export via NFS
- * @param[in] export_path Export path
- * @param[in] root_list List of hosts that have root access
- * @param[in] rw_list List of hosts that have read/write access
- * @param[in] ro_list List of hosts that have read only access
- * @param[in] anon_uid UID to map to anonymous
- * @param[in] anon_gid GID to map to anonymous
- * @param[in] auth_type Array specific authentication types
- * @param[in] options Array specific options
- * @param[out] exported Export record
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success, else error reason.
- */
- int LSM_DLL_EXPORT lsm_nfs_export_fs( lsm_connect *c,
- const char *fs_id,
- const char *export_path,
- lsm_string_list *root_list,
- lsm_string_list *rw_list,
- lsm_string_list *ro_list,
- uint64_t anon_uid,
- uint64_t anon_gid,
- const char *auth_type,
- const char *options,
- lsm_nfs_export **exported,
- lsm_flag flags
- );
-
- /**
- * Delete the export.
- * @param[in] c Valid connection
- * @param[in] e NFS export to remove
- * @param[in] flags Reserved for future use, must be zero.
- * @return LSM_ERR_OK on success else error code.
- */
- int LSM_DLL_EXPORT lsm_nfs_export_delete( lsm_connect *c, lsm_nfs_export *e,
- lsm_flag flags );
+/**
+ * Delete the export.
+ * @param[in] c Valid connection
+ * @param[in] e NFS export to remove
+ * @param[in] flags Reserved for future use, must be zero.
+ * @return LSM_ERR_OK on success else error code.
+ */
+int LSM_DLL_EXPORT lsm_nfs_export_delete(lsm_connect *c,
+ lsm_nfs_export * e,
+ lsm_flag flags);

/**
* Retrieve a list of target ports
@@ -837,12 +881,11 @@ extern "C" {
* @param[in] flags Reserved, set to 0
* @return LSM_ERR_OK on success else error reason
*/
- int LSM_DLL_EXPORT lsm_target_port_list(lsm_connect *c,
- const char *search_key,
- const char *search_value,
- lsm_target_port **target_ports[],
- uint32_t *count,
- lsm_flag flags);
+int LSM_DLL_EXPORT lsm_target_port_list(lsm_connect *c,
+ const char *search_key,
+ const char *search_value,
+ lsm_target_port **target_ports[],
+ uint32_t *count, lsm_flag flags);

/**
* Retrieves the pool id that the volume is derived from. New in version 1.2.
@@ -859,10 +902,14 @@ extern "C" {
* @param[in] flags Reserved, set to 0
* @return LSM_ERR_OK on success else error reason.
*/
-int LSM_DLL_EXPORT lsm_volume_raid_info(
- lsm_connect *c, lsm_volume *volume, lsm_volume_raid_type *raid_type,
- uint32_t *strip_size, uint32_t *disk_count,
- uint32_t *min_io_size, uint32_t *opt_io_size, lsm_flag flags);
+int LSM_DLL_EXPORT lsm_volume_raid_info(lsm_connect *c,
+ lsm_volume *volume,
+ lsm_volume_raid_type *raid_type,
+ uint32_t *strip_size,
+ uint32_t *disk_count,
+ uint32_t *min_io_size,
+ uint32_t *opt_io_size,
+ lsm_flag flags);

/**
* Retrieves the membership of given pool. New in version 1.2.
@@ -886,10 +933,12 @@ int LSM_DLL_EXPORT lsm_volume_raid_info(
* @param[in] flags Reserved, set to 0
* @return LSM_ERR_OK on success else error reason.
*/
-int LSM_DLL_EXPORT lsm_pool_member_info(
- lsm_connect *c, lsm_pool *pool, lsm_volume_raid_type *raid_type,
- lsm_pool_member_type *member_type, lsm_string_list **member_ids,
- lsm_flag flags);
+int LSM_DLL_EXPORT lsm_pool_member_info(lsm_connect *c,
+ lsm_pool *pool,
+ lsm_volume_raid_type *raid_type,
+ lsm_pool_member_type *member_type,
+ lsm_string_list **member_ids,
+ lsm_flag flags);

/**
* Query all supported RAID types and strip sizes which could be used
@@ -915,11 +964,13 @@ int LSM_DLL_EXPORT lsm_pool_member_info(
* @param[in] flags Reserved, set to 0
* @return LSM_ERR_OK on success else error reason.
*/
-int LSM_DLL_EXPORT lsm_volume_raid_create_cap_get(
- lsm_connect *c, lsm_system *system,
- uint32_t **supported_raid_types, uint32_t *supported_raid_type_count,
- uint32_t **supported_strip_sizes, uint32_t *supported_strip_size_count,
- lsm_flag flags);
+int LSM_DLL_EXPORT
+ lsm_volume_raid_create_cap_get(lsm_connect *c, lsm_system *system,
+ uint32_t **supported_raid_types,
+ uint32_t *supported_raid_type_count,
+ uint32_t **supported_strip_sizes,
+ uint32_t *supported_strip_size_count,
+ lsm_flag flags);

/**
* Create a disk RAID pool and allocate entire full space to new volume.
@@ -947,14 +998,16 @@ int LSM_DLL_EXPORT lsm_volume_raid_create_cap_get(
* @param[in] flags Reserved, set to 0
* @return LSM_ERR_OK on success else error reason.
*/
-int LSM_DLL_EXPORT lsm_volume_raid_create(
- lsm_connect *c, const char *name, lsm_volume_raid_type raid_type,
- lsm_disk *disks[], uint32_t disk_count,
- uint32_t strip_size, lsm_volume **new_volume,
- lsm_flag flags);
+int LSM_DLL_EXPORT lsm_volume_raid_create(lsm_connect *c,
+ const char *name,
+ lsm_volume_raid_type raid_type,
+ lsm_disk *disks[],
+ uint32_t disk_count,
+ uint32_t strip_size,
+ lsm_volume **new_volume,
+ lsm_flag flags);

#ifdef __cplusplus
}
#endif
-
-#endif /* LIBSTORAGEMGMT_H */
+#endif /* LIBSTORAGEMGMT_H */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_accessgroups.h b/c_binding/include/libstoragemgmt/libstoragemgmt_accessgroups.h
index d26a2eb..becef5d 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_accessgroups.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_accessgroups.h
@@ -12,7 +12,8 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
*
* Author: tasleson
*/
@@ -33,7 +34,7 @@ extern "C" {
* @param group Group to free
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_access_group_record_free( lsm_access_group *group );
+int LSM_DLL_EXPORT lsm_access_group_record_free(lsm_access_group * group);

/**
* Frees the resources for an array of access groups.
@@ -41,14 +42,16 @@ int LSM_DLL_EXPORT lsm_access_group_record_free( lsm_access_group *group );
* @param size Number of elements in the array.
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_access_group_record_array_free( lsm_access_group *ag[], uint32_t size );
+int LSM_DLL_EXPORT lsm_access_group_record_array_free(lsm_access_group *ag[],
+ uint32_t size);

/**
* Copies an access group.
* @param ag Access group to copy
* @return NULL on error, else copied access group.
*/
-lsm_access_group LSM_DLL_EXPORT *lsm_access_group_record_copy( lsm_access_group *ag );
+lsm_access_group LSM_DLL_EXPORT *
+ lsm_access_group_record_copy(lsm_access_group * ag);

/**
* Returns a pointer to the id.
@@ -57,7 +60,7 @@ lsm_access_group LSM_DLL_EXPORT *lsm_access_group_record_copy( lsm_access_group
* @param group Access group to retrieve id for.
* @return Null on error (not an access group), else value of group.
*/
-const char LSM_DLL_EXPORT *lsm_access_group_id_get( lsm_access_group *group );
+const char LSM_DLL_EXPORT *lsm_access_group_id_get(lsm_access_group *group);

/**
* Returns a pointer to the name.
@@ -66,7 +69,7 @@ const char LSM_DLL_EXPORT *lsm_access_group_id_get( lsm_access_group *group );
* @param group Access group to retrieve id for.
* @return Null on error (not an access group), else value of name.
*/
-const char LSM_DLL_EXPORT *lsm_access_group_name_get( lsm_access_group *group );
+const char LSM_DLL_EXPORT *lsm_access_group_name_get(lsm_access_group *group);

/**
* Returns a pointer to the system id.
@@ -75,7 +78,8 @@ const char LSM_DLL_EXPORT *lsm_access_group_name_get( lsm_access_group *group );
* @param group Access group to retrieve id for.
* @return Null on error (not an access group), else value of system id.
*/
-const char LSM_DLL_EXPORT *lsm_access_group_system_id_get( lsm_access_group *group );
+const char LSM_DLL_EXPORT *
+ lsm_access_group_system_id_get(lsm_access_group *group);

/**
* Returns a pointer to the initiator list.
@@ -84,11 +88,11 @@ const char LSM_DLL_EXPORT *lsm_access_group_system_id_get( lsm_access_group *gro
* @param group Access group to retrieve id for.
* @return Null on error (not an access group), else value of initiator list.
*/
-lsm_string_list LSM_DLL_EXPORT *lsm_access_group_initiator_id_get( lsm_access_group *group );
+lsm_string_list LSM_DLL_EXPORT *
+ lsm_access_group_initiator_id_get(lsm_access_group * group);


#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_blockrange.h b/c_binding/include/libstoragemgmt/libstoragemgmt_blockrange.h
index a45a05e..c8bddcc 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_blockrange.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_blockrange.h
@@ -12,7 +12,8 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
*
* Author: tasleson
*/
@@ -33,16 +34,16 @@ extern "C" {
* @param block_count Number of blocks to replicate
* @return Valid block range ptr, otherwise NULL
*/
-lsm_block_range LSM_DLL_EXPORT *lsm_block_range_record_alloc(uint64_t source_start,
- uint64_t dest_start,
- uint64_t block_count);
+lsm_block_range LSM_DLL_EXPORT *
+ lsm_block_range_record_alloc(uint64_t source_start, uint64_t dest_start,
+ uint64_t block_count);

/**
* Frees a block range record.
* @param br Block range to free
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_block_range_record_free( lsm_block_range *br);
+int LSM_DLL_EXPORT lsm_block_range_record_free(lsm_block_range * br);


/**
@@ -50,7 +51,8 @@ int LSM_DLL_EXPORT lsm_block_range_record_free( lsm_block_range *br);
* @param source Source of the copy
* @return copy of source
*/
-lsm_block_range LSM_DLL_EXPORT *lsm_block_range_record_copy( lsm_block_range *source );
+lsm_block_range LSM_DLL_EXPORT *
+ lsm_block_range_record_copy(lsm_block_range * source);


/**
@@ -58,7 +60,8 @@ lsm_block_range LSM_DLL_EXPORT *lsm_block_range_record_copy( lsm_block_range *so
* @param size Number of elements to store.
* @return Pointer to memory for array of block ranges.
*/
-lsm_block_range LSM_DLL_EXPORT **lsm_block_range_record_array_alloc( uint32_t size );
+lsm_block_range LSM_DLL_EXPORT **
+ lsm_block_range_record_array_alloc(uint32_t size);


/**
@@ -67,15 +70,16 @@ lsm_block_range LSM_DLL_EXPORT **lsm_block_range_record_array_alloc( uint32_t si
* @param size Number of elements in array.
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_block_range_record_array_free( lsm_block_range *br[],
- uint32_t size );
+int LSM_DLL_EXPORT lsm_block_range_record_array_free(lsm_block_range *br[],
+ uint32_t size);

/**
* Retrieves the source block address.
* @param br Valid block range pointer
* @return value of source start.
*/
-uint64_t LSM_DLL_EXPORT lsm_block_range_source_start_get(lsm_block_range *br);
+uint64_t LSM_DLL_EXPORT
+ lsm_block_range_source_start_get(lsm_block_range *br);

/**
* Retrieves the dest block address.
@@ -94,5 +98,4 @@ uint64_t LSM_DLL_EXPORT lsm_block_range_block_count_get(lsm_block_range *br);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
index 07bf8b0..e8c1079 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
@@ -31,93 +31,153 @@ extern "C" {
/*Note: Domain is 0..255 */
/** \enum lsm_capability_value_type Possible values for supported feature*/
typedef enum {
- LSM_CAP_UNSUPPORTED = 0, /**< Feature is not supported */
- LSM_CAP_SUPPORTED = 1 /**< Feature is supported */
+ LSM_CAP_UNSUPPORTED = 0, /**< Feature is not supported */
+ LSM_CAP_SUPPORTED = 1 /**< Feature is supported */
} lsm_capability_value_type;

/** \enum lsm_capability_value_type Capabilities supported by array */
typedef enum {

- LSM_CAP_VOLUMES = 20, /**< List volumes */
- LSM_CAP_VOLUME_CREATE = 21, /**< Create volumes */
- LSM_CAP_VOLUME_RESIZE = 22, /**< Resize volumes */
-
- LSM_CAP_VOLUME_REPLICATE = 23, /**< Replication is supported */
- LSM_CAP_VOLUME_REPLICATE_CLONE = 24, /**< Can make a space efficient copy of volume */
- LSM_CAP_VOLUME_REPLICATE_COPY = 25, /**< Can make a bitwise copy of volume */
- LSM_CAP_VOLUME_REPLICATE_MIRROR_ASYNC = 26, /**< Mirror data with delay */
- LSM_CAP_VOLUME_REPLICATE_MIRROR_SYNC = 27, /**< Mirror data and always in sync */
-
- LSM_CAP_VOLUME_COPY_RANGE_BLOCK_SIZE = 28, /**< Size of a block for range operations */
- LSM_CAP_VOLUME_COPY_RANGE = 29, /**< Sub volume replication support */
- LSM_CAP_VOLUME_COPY_RANGE_CLONE = 30, /**< Can space efficient copy a region(s) of a volume*/
- LSM_CAP_VOLUME_COPY_RANGE_COPY = 31, /**< Can copy a region(s) of a volume */
-
- LSM_CAP_VOLUME_DELETE = 33, /**< Can delete a volume */
-
- LSM_CAP_VOLUME_ENABLE = 34, /**< Enable volume*/
- LSM_CAP_VOLUME_DISABLE = 35, /**< Disable volume*/
-
- LSM_CAP_VOLUME_MASK = 36, /**< Grant an access group to a volume */
- LSM_CAP_VOLUME_UNMASK = 37, /**< Revoke access for an access group */
- LSM_CAP_ACCESS_GROUPS = 38, /**< List access groups */
- LSM_CAP_ACCESS_GROUP_CREATE_WWPN = 39, /**< Create an access group */
- LSM_CAP_ACCESS_GROUP_DELETE = 40, /**< Delete an access group */
- LSM_CAP_ACCESS_GROUP_INITIATOR_ADD_WWPN = 41, /**< Add an initiator to an access group */
- LSM_CAP_ACCESS_GROUP_INITIATOR_DELETE = 42, /**< Remove an initiator from an access group */
-
- LSM_CAP_VOLUMES_ACCESSIBLE_BY_ACCESS_GROUP = 43, /**< Retrieve a list of volumes accessible by an access group */
- LSM_CAP_ACCESS_GROUPS_GRANTED_TO_VOLUME = 44, /**< Retrieve a list of what access groups are accessible for a given volume */
-
- LSM_CAP_VOLUME_CHILD_DEPENDENCY = 45, /**< Used to determine if a volume has any dependencies */
- LSM_CAP_VOLUME_CHILD_DEPENDENCY_RM = 46, /**< Removes dependendies */
-
- LSM_CAP_ACCESS_GROUP_CREATE_ISCSI_IQN = 47, /**< Create iSCSI access group */
- LSM_CAP_ACCESS_GROUP_INITIATOR_ADD_ISCSI_IQN = 48, /**< For empty access group, this indicates it can add iSCSI IQN to it */
-
- LSM_CAP_VOLUME_ISCSI_CHAP_AUTHENTICATION = 53, /**< If you can configure iSCSI chap authentication */
-
- LSM_CAP_VOLUME_RAID_INFO = 54,
+ LSM_CAP_VOLUMES = 20,
+ /**^ List volumes */
+ LSM_CAP_VOLUME_CREATE = 21,
+ /**^ Create volumes */
+ LSM_CAP_VOLUME_RESIZE = 22,
+ /**^ Resize volumes */
+
+ LSM_CAP_VOLUME_REPLICATE = 23,
+ /**^ Replication is supported */
+ LSM_CAP_VOLUME_REPLICATE_CLONE = 24,
+ /**^ Can make a space efficient copy of volume */
+ LSM_CAP_VOLUME_REPLICATE_COPY = 25,
+ /**^ Can make a bitwise copy of volume */
+ LSM_CAP_VOLUME_REPLICATE_MIRROR_ASYNC = 26,
+ /**^ Mirror data with delay */
+ LSM_CAP_VOLUME_REPLICATE_MIRROR_SYNC = 27,
+ /**^ Mirror data and always in sync */
+
+ LSM_CAP_VOLUME_COPY_RANGE_BLOCK_SIZE = 28,
+ /**^ Size of a block for range operations */
+ LSM_CAP_VOLUME_COPY_RANGE = 29,
+ /**^ Sub volume replication support */
+ LSM_CAP_VOLUME_COPY_RANGE_CLONE = 30,
+ /**^ Can space efficient copy a region(s) of a volume*/
+ LSM_CAP_VOLUME_COPY_RANGE_COPY = 31,
+ /**^ Can copy a region(s) of a volume */
+
+ LSM_CAP_VOLUME_DELETE = 33,
+ /**^ Can delete a volume */
+
+ LSM_CAP_VOLUME_ENABLE = 34,
+ /**^ Enable volume*/
+ LSM_CAP_VOLUME_DISABLE = 35,
+ /**^ Disable volume*/
+
+ LSM_CAP_VOLUME_MASK = 36,
+ /**^ Grant an access group to a volume */
+ LSM_CAP_VOLUME_UNMASK = 37,
+ /**^ Revoke access for an access group */
+ LSM_CAP_ACCESS_GROUPS = 38,
+ /**^ List access groups */
+ LSM_CAP_ACCESS_GROUP_CREATE_WWPN = 39,
+ /**^ Create an access group */
+ LSM_CAP_ACCESS_GROUP_DELETE = 40,
+ /**^ Delete an access group */
+ LSM_CAP_ACCESS_GROUP_INITIATOR_ADD_WWPN = 41,
+ /**^ Add an initiator to an access group */
+ LSM_CAP_ACCESS_GROUP_INITIATOR_DELETE = 42,
+ /**^ Remove an initiator from an access group */
+
+ LSM_CAP_VOLUMES_ACCESSIBLE_BY_ACCESS_GROUP = 43,
+ /**^ Retrieve a list of volumes accessible by an access group */
+ LSM_CAP_ACCESS_GROUPS_GRANTED_TO_VOLUME = 44,
+ /**^ Retrieve a list of what access groups are accessible for a given
+ * volume */
+
+ LSM_CAP_VOLUME_CHILD_DEPENDENCY = 45,
+ /**^ Used to determine if a volume has any dependencies */
+ LSM_CAP_VOLUME_CHILD_DEPENDENCY_RM = 46,
+ /**^ Removes dependendies */
+
+ LSM_CAP_ACCESS_GROUP_CREATE_ISCSI_IQN = 47,
+ /**^ Create iSCSI access group */
+ LSM_CAP_ACCESS_GROUP_INITIATOR_ADD_ISCSI_IQN = 48,
+ /**^ For empty access group, this indicates it can add iSCSI IQN to it */
+
+ LSM_CAP_VOLUME_ISCSI_CHAP_AUTHENTICATION = 53,
+ /**^ If you can configure iSCSI chap authentication */
+
+ LSM_CAP_VOLUME_RAID_INFO = 54,
/** ^ If you can query RAID information from volume */

- LSM_CAP_VOLUME_THIN = 55, /**< Thin provisioned volumes are supported */
-
- LSM_CAP_FS = 100, /**< List file systems */
- LSM_CAP_FS_DELETE = 101, /**< Delete a file system */
- LSM_CAP_FS_RESIZE = 102, /**< Resize a file system */
- LSM_CAP_FS_CREATE = 103, /**< Create a file system */
- LSM_CAP_FS_CLONE = 104, /**< Clone a file system */
- LSM_CAP_FILE_CLONE = 105, /**< Clone a file on a file system */
- LSM_CAP_FS_SNAPSHOTS = 106, /**< List FS snapshots */
- LSM_CAP_FS_SNAPSHOT_CREATE = 107, /**< Create a snapshot */
- LSM_CAP_FS_SNAPSHOT_DELETE = 109, /**< Delete a snapshot */
- LSM_CAP_FS_SNAPSHOT_RESTORE = 110, /**< Revert the state of a FS to the specified snapshot */
- LSM_CAP_FS_SNAPSHOT_RESTORE_SPECIFIC_FILES = 111, /**< Revert the state of a list of files to a specified snapshot */
- LSM_CAP_FS_CHILD_DEPENDENCY = 112, /**< Determine if a child dependency exists for the specified file */
- LSM_CAP_FS_CHILD_DEPENDENCY_RM = 113, /**< Remove any dependencies the file system may have */
- LSM_CAP_FS_CHILD_DEPENDENCY_RM_SPECIFIC_FILES = 114, /**< Remove any dependencies for specific files */
-
- LSM_CAP_EXPORT_AUTH = 120, /**< Get a list of supported client authentication types */
- LSM_CAP_EXPORTS = 121, /**< List exported file systems */
- LSM_CAP_EXPORT_FS = 122, /**< Export a file system */
- LSM_CAP_EXPORT_REMOVE = 123, /**< Remove an export */
- LSM_CAP_EXPORT_CUSTOM_PATH = 124, /**< Plug-in allows user to define custome export path */
-
- LSM_CAP_POOLS_QUICK_SEARCH = 210, /**< Seach occurs on array */
- LSM_CAP_VOLUMES_QUICK_SEARCH = 211, /**< Seach occurs on array */
- LSM_CAP_DISKS_QUICK_SEARCH = 212, /**< Seach occurs on array */
- LSM_CAP_ACCESS_GROUPS_QUICK_SEARCH = 213, /**< Seach occurs on array */
- LSM_CAP_FS_QUICK_SEARCH = 214, /**< Seach occurs on array */
- LSM_CAP_NFS_EXPORTS_QUICK_SEARCH = 215, /**< Seach occurs on array */
-
- LSM_CAP_TARGET_PORTS = 216, /**< List target ports */
- LSM_CAP_TARGET_PORTS_QUICK_SEARCH = 217, /**< Filtering occurs on array */
-
- LSM_CAP_DISKS = 220, /**< List disk drives */
- LSM_CAP_POOL_MEMBER_INFO = 221,
+ LSM_CAP_VOLUME_THIN = 55,
+ /**^ Thin provisioned volumes are supported */
+
+ LSM_CAP_FS = 100,
+ /**^ List file systems */
+ LSM_CAP_FS_DELETE = 101,
+ /**^ Delete a file system */
+ LSM_CAP_FS_RESIZE = 102,
+ /**^ Resize a file system */
+ LSM_CAP_FS_CREATE = 103,
+ /**^ Create a file system */
+ LSM_CAP_FS_CLONE = 104,
+ /**^ Clone a file system */
+ LSM_CAP_FILE_CLONE = 105,
+ /**^ Clone a file on a file system */
+ LSM_CAP_FS_SNAPSHOTS = 106,
+ /**^ List FS snapshots */
+ LSM_CAP_FS_SNAPSHOT_CREATE = 107,
+ /**^ Create a snapshot */
+ LSM_CAP_FS_SNAPSHOT_DELETE = 109,
+ /**^ Delete a snapshot */
+ LSM_CAP_FS_SNAPSHOT_RESTORE = 110,
+ /**^ Revert the state of a FS to the specified snapshot */
+ LSM_CAP_FS_SNAPSHOT_RESTORE_SPECIFIC_FILES = 111,
+ /**^ Revert the state of a list of files to a specified snapshot */
+ LSM_CAP_FS_CHILD_DEPENDENCY = 112,
+ /**^ Determine if a child dependency exists for the specified file */
+ LSM_CAP_FS_CHILD_DEPENDENCY_RM = 113,
+ /**^ Remove any dependencies the file system may have */
+ LSM_CAP_FS_CHILD_DEPENDENCY_RM_SPECIFIC_FILES = 114,
+ /**^ Remove any dependencies for specific files */
+
+ LSM_CAP_EXPORT_AUTH = 120,
+ /**^ Get a list of supported client authentication types */
+ LSM_CAP_EXPORTS = 121,
+ /**^ List exported file systems */
+ LSM_CAP_EXPORT_FS = 122,
+ /**^ Export a file system */
+ LSM_CAP_EXPORT_REMOVE = 123,
+ /**^ Remove an export */
+ LSM_CAP_EXPORT_CUSTOM_PATH = 124,
+ /**^ Plug-in allows user to define custome export path */
+
+ LSM_CAP_POOLS_QUICK_SEARCH = 210,
+ /**^ Seach occurs on array */
+ LSM_CAP_VOLUMES_QUICK_SEARCH = 211,
+ /**^ Seach occurs on array */
+ LSM_CAP_DISKS_QUICK_SEARCH = 212,
+ /**^ Seach occurs on array */
+ LSM_CAP_ACCESS_GROUPS_QUICK_SEARCH = 213,
+ /**^ Seach occurs on array */
+ LSM_CAP_FS_QUICK_SEARCH = 214,
+ /**^ Seach occurs on array */
+ LSM_CAP_NFS_EXPORTS_QUICK_SEARCH = 215,
+ /**^ Seach occurs on array */
+
+ LSM_CAP_TARGET_PORTS = 216,
+ /**^ List target ports */
+ LSM_CAP_TARGET_PORTS_QUICK_SEARCH = 217,
+ /**^ Filtering occurs on array */
+
+ LSM_CAP_DISKS = 220,
+ /**^ List disk drives */
+ LSM_CAP_POOL_MEMBER_INFO = 221,
/**^ Query pool member information */

- LSM_CAP_VOLUME_RAID_CREATE = 222,
+ LSM_CAP_VOLUME_RAID_CREATE = 222,
+ /**^ Create RAID volume */
} lsm_capability_type;

/**
@@ -133,9 +193,9 @@ int LSM_DLL_EXPORT lsm_capability_record_free(lsm_storage_capabilities *cap);
* @param t Which capability you are interested in
* @return Value of supported enumerated type.
*/
-lsm_capability_value_type LSM_DLL_EXPORT lsm_capability_get(
- lsm_storage_capabilities *cap,
- lsm_capability_type t);
+lsm_capability_value_type LSM_DLL_EXPORT
+ lsm_capability_get(lsm_storage_capabilities * cap,
+ lsm_capability_type t);

/**
* Boolean version of capability support
@@ -144,11 +204,10 @@ lsm_capability_value_type LSM_DLL_EXPORT lsm_capability_get(
* @return Non-zero if supported, 0 if not supported
*/
int LSM_DLL_EXPORT lsm_capability_supported(lsm_storage_capabilities *cap,
- lsm_capability_type t);
+ lsm_capability_type t);


#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_common.h b/c_binding/include/libstoragemgmt/libstoragemgmt_common.h
index 64404bb..e1284de 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_common.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_common.h
@@ -28,19 +28,19 @@ extern "C" {
#endif

#if defined _WIN32 || defined __CYGWIN__
- #define LSM_DLL_IMPORT __declspec(dllimport)
- #define LSM_DLL_EXPORT __declspec(dllexport)
- #define LSM_DLL_LOCAL
+#define LSM_DLL_IMPORT __declspec(dllimport)
+#define LSM_DLL_EXPORT __declspec(dllexport)
+#define LSM_DLL_LOCAL
#else
- #if __GNUC__ >= 4
- #define LSM_DLL_IMPORT __attribute__ ((visibility ("default")))
- #define LSM_DLL_EXPORT __attribute__ ((visibility ("default")))
- #define LSM_DLL_LOCAL __attribute__ ((visibility ("hidden")))
- #else
- #define LSM_DLL_IMPORT
- #define LSM_DLL_EXPORT
- #define LSM_DLL_LOCAL
- #endif
+#if __GNUC__ >= 4
+#define LSM_DLL_IMPORT __attribute__ ((visibility ("default")))
+#define LSM_DLL_EXPORT __attribute__ ((visibility ("default")))
+#define LSM_DLL_LOCAL __attribute__ ((visibility ("hidden")))
+#else
+#define LSM_DLL_IMPORT
+#define LSM_DLL_EXPORT
+#define LSM_DLL_LOCAL
+#endif
#endif

/**
@@ -71,8 +71,9 @@ lsm_string_list LSM_DLL_EXPORT *lsm_string_list_copy(lsm_string_list *src);
* @param value Value to use for assignment
* @return LSM_ERR_OK on success, else error reason
*/
-int LSM_DLL_EXPORT lsm_string_list_elem_set(lsm_string_list *sl, uint32_t index,
- const char* value);
+int LSM_DLL_EXPORT lsm_string_list_elem_set(lsm_string_list *sl,
+ uint32_t index,
+ const char *value);

/**
* Returns the value at the specified elem index
@@ -81,7 +82,7 @@ int LSM_DLL_EXPORT lsm_string_list_elem_set(lsm_string_list *sl, uint32_t index,
* @return Value at that index position.
*/
const char LSM_DLL_EXPORT *lsm_string_list_elem_get(lsm_string_list *sl,
- uint32_t index);
+ uint32_t index);

/**
* Returns the size of the list
@@ -98,7 +99,8 @@ uint32_t LSM_DLL_EXPORT lsm_string_list_size(lsm_string_list *sl);
* @param add Character string to add
* @return LSM_ERR_OK on success, else error reason
*/
-int LSM_DLL_EXPORT lsm_string_list_append(lsm_string_list *sl, const char* add);
+int LSM_DLL_EXPORT lsm_string_list_append(lsm_string_list *sl,
+ const char *add);

/**
* Deletes the string at the specified index.
@@ -109,7 +111,8 @@ int LSM_DLL_EXPORT lsm_string_list_append(lsm_string_list *sl, const char* add);
* @param index Specified index
* @return LSM_ERR_OK on success, else error reason
*/
-int LSM_DLL_EXPORT lsm_string_list_delete(lsm_string_list *sl, uint32_t index);
+int LSM_DLL_EXPORT lsm_string_list_delete(lsm_string_list *sl,
+ uint32_t index);

/**
* Checks to see if initiator id is valid
@@ -118,8 +121,9 @@ int LSM_DLL_EXPORT lsm_string_list_delete(lsm_string_list *sl, uint32_t index);
* to determined if type passed in is UNKNOWN
* @return LSM_ERR_OK if initiator id is OK, else LSM_INVALID_ARGUMENT
*/
-int LSM_DLL_EXPORT lsm_initiator_id_verify( const char *init_id,
- lsm_access_group_init_type *init_type);
+int LSM_DLL_EXPORT
+ lsm_initiator_id_verify(const char *init_id,
+ lsm_access_group_init_type *init_type);


/**
@@ -127,10 +131,9 @@ int LSM_DLL_EXPORT lsm_initiator_id_verify( const char *init_id,
* @param vpd83 VPD string to check
* @return LSM_ERR_OK if vpd is OK, else LSM_INVALID_ARGUMENT
*/
-int LSM_DLL_EXPORT lsm_volume_vpd83_verify( const char *vpd83 );
+int LSM_DLL_EXPORT lsm_volume_vpd83_verify(const char *vpd83);

#ifdef __cplusplus
}
#endif
-
-#endif /* LSM_COMMON_H */
+#endif /* LSM_COMMON_H */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_disk.h b/c_binding/include/libstoragemgmt/libstoragemgmt_disk.h
index b8aaaa2..10ed30f 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_disk.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_disk.h
@@ -12,7 +12,8 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
*
* Author: tasleson
*
@@ -47,7 +48,8 @@ lsm_disk LSM_DLL_EXPORT *lsm_disk_record_copy(lsm_disk *d);
* @param size Size of disk array
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_disk_record_array_free( lsm_disk *disk[], uint32_t size);
+int LSM_DLL_EXPORT lsm_disk_record_array_free(lsm_disk *disk[],
+ uint32_t size);

/**
* Returns the disk id
@@ -115,5 +117,4 @@ const char LSM_DLL_EXPORT *lsm_disk_system_id_get(lsm_disk *d);
#ifdef __cplusplus
}
#endif
-
-#endif /* LIBSTORAGEMGMT_DISK_H */
+#endif /* LIBSTORAGEMGMT_DISK_H */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
index 29c460a..9344354 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_error.h
@@ -12,7 +12,8 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
*
* Author: tasleson
*/
@@ -32,62 +33,102 @@ extern "C" {

/**< \enum lsm_error_number Possible enumerated return codes from library */
typedef enum {
- LSM_ERR_OK = 0, /**< OK */
- LSM_ERR_LIB_BUG = 1, /**< Library BUG */
- LSM_ERR_PLUGIN_BUG = 2, /**< Plugin BUG */
- LSM_ERR_JOB_STARTED = 7, /**< Operation has started */
- LSM_ERR_TIMEOUT = 11, /**< Plug-in is un-responsive */
- LSM_ERR_DAEMON_NOT_RUNNING = 12, /**< Daemon is not running */
-
- LSM_ERR_NAME_CONFLICT = 50, /**< Name exists */
- LSM_ERR_EXISTS_INITIATOR = 52, /**< Initiator exists in another access group */
-
- LSM_ERR_INVALID_ARGUMENT = 101, /**< Precondition checks failed */
-
- LSM_ERR_NO_STATE_CHANGE = 125, /**< Operation completed with no change in array state */
-
- LSM_ERR_NETWORK_CONNREFUSED = 140, /**< Host on network, but not allowing connection */
- LSM_ERR_NETWORK_HOSTDOWN = 141, /**< Host unreachable on network */
- LSM_ERR_NETWORK_ERROR = 142, /**< Generic network error */
-
- LSM_ERR_NO_MEMORY = 152, /**< Memory allocation failure */
- LSM_ERR_NO_SUPPORT = 153, /**< Feature not supported */
+ LSM_ERR_OK = 0,
+ /**^ OK */
+ LSM_ERR_LIB_BUG = 1,
+ /**^ Library BUG */
+ LSM_ERR_PLUGIN_BUG = 2,
+ /**^ Plugin BUG */
+ LSM_ERR_JOB_STARTED = 7,
+ /**^ Operation has started */
+ LSM_ERR_TIMEOUT = 11,
+ /**^ Plug-in is un-responsive */
+ LSM_ERR_DAEMON_NOT_RUNNING = 12,
+ /**^ Daemon is not running */
+
+ LSM_ERR_NAME_CONFLICT = 50,
+ /**^ Name exists */
+ LSM_ERR_EXISTS_INITIATOR = 52,
+ /**^ Initiator exists in another access group */
+
+ LSM_ERR_INVALID_ARGUMENT = 101,
+ /**^ Precondition checks failed */
+
+ LSM_ERR_NO_STATE_CHANGE = 125,
+ /**^ Operation completed with no change in array state */
+
+ LSM_ERR_NETWORK_CONNREFUSED = 140,
+
+ /**^ Host on network, but not allowing connection */
+ LSM_ERR_NETWORK_HOSTDOWN = 141,
+ /**^ Host unreachable on network */
+ LSM_ERR_NETWORK_ERROR = 142,
+ /**^ Generic network error */
+
+ LSM_ERR_NO_MEMORY = 152,
+ /**^ Memory allocation failure */
+ LSM_ERR_NO_SUPPORT = 153,
+ /**^ Feature not supported */
+
+ LSM_ERR_IS_MASKED = 160,
+ /**^ Volume masked to Access Group*/
+
+ LSM_ERR_NOT_FOUND_ACCESS_GROUP = 200,
+
+ /**^ Specified access group not found */
+ LSM_ERR_NOT_FOUND_FS = 201,
+ /**^ Specified FS not found */
+ LSM_ERR_NOT_FOUND_JOB = 202,
+ /**^ Specified JOB not found */
+ LSM_ERR_NOT_FOUND_POOL = 203,
+ /**^ Specified POOL not found */
+ LSM_ERR_NOT_FOUND_FS_SS = 204,
+ /**^ Specified snap shot not found */
+ LSM_ERR_NOT_FOUND_VOLUME = 205,
+ /**^ Specified volume not found */
+ LSM_ERR_NOT_FOUND_NFS_EXPORT = 206,
+
+ /**^ NFS export not found */
+ LSM_ERR_NOT_FOUND_SYSTEM = 208,
+ /**^ System not found */
+ LSM_ERR_NOT_FOUND_DISK = 209,

- LSM_ERR_IS_MASKED = 160, /**< Volume masked to Access Group*/
+ LSM_ERR_NOT_LICENSED = 226,
+ /**^ Need license for feature */

- LSM_ERR_NOT_FOUND_ACCESS_GROUP = 200, /**< Specified access group not found */
- LSM_ERR_NOT_FOUND_FS = 201, /**< Specified FS not found */
- LSM_ERR_NOT_FOUND_JOB = 202, /**< Specified JOB not found */
- LSM_ERR_NOT_FOUND_POOL = 203, /**< Specified POOL not found */
- LSM_ERR_NOT_FOUND_FS_SS = 204, /**< Specified snap shot not found */
- LSM_ERR_NOT_FOUND_VOLUME = 205, /**< Specified volume not found */
- LSM_ERR_NOT_FOUND_NFS_EXPORT = 206, /**< NFS export not found */
- LSM_ERR_NOT_FOUND_SYSTEM = 208, /**< System not found */
- LSM_ERR_NOT_FOUND_DISK = 209,
+ LSM_ERR_NO_SUPPORT_ONLINE_CHANGE = 250,
+ /**^ Take offline before performing operation */
+ LSM_ERR_NO_SUPPORT_OFFLINE_CHANGE = 251,
+ /**^ Needs to be online to perform operation */

- LSM_ERR_NOT_LICENSED = 226, /**< Need license for feature */
+ LSM_ERR_PLUGIN_AUTH_FAILED = 300,

- LSM_ERR_NO_SUPPORT_ONLINE_CHANGE = 250, /**< Take offline before performing operation */
- LSM_ERR_NO_SUPPORT_OFFLINE_CHANGE = 251, /**< Needs to be online to perform operation */
+ /**^ Authorization failed */
+ LSM_ERR_PLUGIN_IPC_FAIL = 301,
+ /**^ Inter-process communication between client &
+ out of process plug-in encountered connection errors.**/

- LSM_ERR_PLUGIN_AUTH_FAILED = 300, /**< Authorization failed */
- LSM_ERR_PLUGIN_IPC_FAIL = 301, /**< Inter-process communication between client &
- out of process plug-in encountered connection
- errors.**/
+ LSM_ERR_PLUGIN_SOCKET_PERMISSION = 307,

- LSM_ERR_PLUGIN_SOCKET_PERMISSION = 307, /**< Incorrect permission on UNIX domain socket used for IPC */
- LSM_ERR_PLUGIN_NOT_EXIST = 311, /**< Plug-in does not appear to exist */
+ /**^ Incorrect permission on UNIX domain socket used for IPC */
+ LSM_ERR_PLUGIN_NOT_EXIST = 311,
+ /**^ Plug-in does not appear to exist */

- LSM_ERR_NOT_ENOUGH_SPACE = 350, /**< Insufficient space */
+ LSM_ERR_NOT_ENOUGH_SPACE = 350,
+ /**^ Insufficient space */

- LSM_ERR_TRANSPORT_COMMUNICATION = 400, /**< Error comunicating with plug-in */
- LSM_ERR_TRANSPORT_SERIALIZATION = 401, /**< Transport serialization error */
- LSM_ERR_TRANSPORT_INVALID_ARG = 402, /**< Parameter transported over IPC is invalid */
+ LSM_ERR_TRANSPORT_COMMUNICATION = 400,
+ /**^ Error comunicating with plug-in */
+ LSM_ERR_TRANSPORT_SERIALIZATION = 401,
+ /**^ Transport serialization error */
+ LSM_ERR_TRANSPORT_INVALID_ARG = 402,
+ /**^ Parameter transported over IPC is invalid */

LSM_ERR_LAST_INIT_IN_ACCESS_GROUP = 502,


- LSM_ERR_UNSUPPORTED_SEARCH_KEY = 510, /**< Unsupport search key */
+ LSM_ERR_UNSUPPORTED_SEARCH_KEY = 510,
+ /**^ Unsupport search key */

LSM_ERR_EMPTY_ACCESS_GROUP = 511,
LSM_ERR_POOL_NOT_READY = 512,
@@ -104,7 +145,7 @@ typedef lsm_error *lsm_error_ptr;
* @param c Connection pointer.
* @return Error pointer, Null if no error exists!
*/
-lsm_error_ptr LSM_DLL_EXPORT lsm_error_last_get(lsm_connect *c);
+lsm_error_ptr LSM_DLL_EXPORT lsm_error_last_get(lsm_connect * c);

/**
* Frees the error record!
@@ -122,9 +163,9 @@ lsm_error_number LSM_DLL_EXPORT lsm_error_number_get(lsm_error_ptr e);

/**
* Retrieves the error message from the error.
- * Note: The returned value is only valid as long as the e is valid, in addition
- * the function will return NULL if e is invalid. To remove the ambiguity call
- * lsm_error_number_get and check return code.
+ * Note: The returned value is only valid as long as the e is valid, in
+ * addition the function will return NULL if e is invalid. To remove the
+ * ambiguity call lsm_error_number_get and check return code.
* @param e The lsm_error_ptr
* @return NULL if message data does not exist, else error message.
*/
@@ -132,9 +173,9 @@ char LSM_DLL_EXPORT *lsm_error_message_get(lsm_error_ptr e);

/**
* Retrieves the exception message from the error.
- * Note: The returned value is only valid as long as the e is valid, in addition
- * the function will return NULL if e is invalid. To remove the ambiguity call
- * lsm_error_number_get and check return code.
+ * Note: The returned value is only valid as long as the e is valid, in
+ * addition the function will return NULL if e is invalid. To remove the
+ * ambiguity call lsm_error_number_get and check return code.
* @param e The lsm_error_ptr
* @return NULL if exception does not exist, else error exception.
*/
@@ -142,9 +183,9 @@ char LSM_DLL_EXPORT *lsm_error_exception_get(lsm_error_ptr e);

/**
* Retrieves the error message from the error.
- * Note: The returned value is only valid as long as the e is valid, in addition
- * the function will return NULL if e is invalid. To remove the ambiguity call
- * lsm_error_number_get and check return code.
+ * Note: The returned value is only valid as long as the e is valid, in
+ * addition the function will return NULL if e is invalid. To remove the
+ * ambiguity call lsm_error_number_get and check return code.
* @param e The lsm_error_ptr
* @return NULL if does not exist, else debug message.
*/
@@ -152,17 +193,17 @@ char LSM_DLL_EXPORT *lsm_error_debug_get(lsm_error_ptr e);

/**
* Retrieves the debug data from the error.
- * Note: The returned value is only valid as long as the e is valid, in addition
- * the function will return NULL if e is invalid. To remove the ambiguity call
- * lsm_error_number_get and check return code.
+ * Note: The returned value is only valid as long as the e is valid, in
+ * addition the function will return NULL if e is invalid. To remove the
+ * ambiguity call lsm_error_number_get and check return code.
* @param e The lsm_error_ptr
* @param[out] size Number of bytes of data returned.
* @return NULL if does not exist, else debug message.
*/
-void LSM_DLL_EXPORT *lsm_error_debug_data_get(lsm_error_ptr e, uint32_t *size);
+void LSM_DLL_EXPORT *lsm_error_debug_data_get(lsm_error_ptr e,
+ uint32_t * size);

#ifdef __cplusplus
}
#endif
-
-#endif /* LIBSTORAGEMGMTERROR_H */
+#endif /* LIBSTORAGEMGMTERROR_H */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_fs.h b/c_binding/include/libstoragemgmt/libstoragemgmt_fs.h
index b400453..1f10010 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_fs.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_fs.h
@@ -38,7 +38,7 @@ int LSM_DLL_EXPORT lsm_fs_record_free(lsm_fs *fs);
* @param source File system record to copy.
* @return Pointer to copy of file system record
*/
-lsm_fs LSM_DLL_EXPORT *lsm_fs_record_copy(lsm_fs *source);
+lsm_fs LSM_DLL_EXPORT *lsm_fs_record_copy(lsm_fs * source);

/**
* Frees an array of file system records
@@ -46,7 +46,7 @@ lsm_fs LSM_DLL_EXPORT *lsm_fs_record_copy(lsm_fs *source);
* @param size Number in array to free
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_fs_record_array_free(lsm_fs * fs[], uint32_t size);
+int LSM_DLL_EXPORT lsm_fs_record_array_free(lsm_fs *fs[], uint32_t size);

/**
* Returns the id of the file system.
@@ -93,5 +93,4 @@ uint64_t LSM_DLL_EXPORT lsm_fs_free_space_get(lsm_fs *fs);
#ifdef __cplusplus
}
#endif
-
-#endif
\ No newline at end of file
+#endif
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_hash.h b/c_binding/include/libstoragemgmt/libstoragemgmt_hash.h
index 1b7e161..5f435ff 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_hash.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_hash.h
@@ -50,8 +50,7 @@ int LSM_DLL_EXPORT lsm_hash_free(lsm_hash *op);
* @param [out] l String list pointer
* @return LSM_ERR_OK on success, else error reason
*/
-int LSM_DLL_EXPORT lsm_hash_keys(lsm_hash *op,
- lsm_string_list **l);
+int LSM_DLL_EXPORT lsm_hash_keys(lsm_hash *op, lsm_string_list **l);

/**
* Get the value of a key (string)
@@ -61,7 +60,7 @@ int LSM_DLL_EXPORT lsm_hash_keys(lsm_hash *op,
* gets released.
*/
const char LSM_DLL_EXPORT *lsm_hash_string_get(lsm_hash *op,
- const char *key);
+ const char *key);

/**
* Set the value of a key.
@@ -72,8 +71,7 @@ const char LSM_DLL_EXPORT *lsm_hash_string_get(lsm_hash *op,
* @return LSM_ERR_OK on success, else error reason
*/
int LSM_DLL_EXPORT lsm_hash_string_set(lsm_hash *op,
- const char *key,
- const char *value);
+ const char *key, const char *value);

/**
* Does a copy of an lsm_hash
@@ -85,5 +83,4 @@ lsm_hash LSM_DLL_EXPORT *lsm_hash_copy(lsm_hash *src);
#ifdef __cplusplus
}
#endif
-
-#endif /* LIBSTORAGEMGMT_HASH_H */
+#endif /* LIBSTORAGEMGMT_HASH_H */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_nfsexport.h b/c_binding/include/libstoragemgmt/libstoragemgmt_nfsexport.h
index 5e3076d..927d739 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_nfsexport.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_nfsexport.h
@@ -51,24 +51,21 @@ extern "C" {
* @param plugin_data Reserved for plug-in use
* @return Valid export pointer, else NULL on error.
*/
-lsm_nfs_export LSM_DLL_EXPORT * lsm_nfs_export_record_alloc(const char *id,
- const char *fs_id,
- const char *export_path,
- const char *auth,
- lsm_string_list *root,
- lsm_string_list *rw,
- lsm_string_list *ro,
- uint64_t anonuid,
- uint64_t anongid,
- const char *options,
- const char * plugin_data);
+lsm_nfs_export LSM_DLL_EXPORT *
+ lsm_nfs_export_record_alloc(const char *id, const char *fs_id,
+ const char *export_path, const char *auth,
+ lsm_string_list *root, lsm_string_list *rw,
+ lsm_string_list *ro, uint64_t anonuid,
+ uint64_t anongid, const char *options,
+ const char *plugin_data);

/**
* Allocated the memory for an array of NFS export records.
* @param size Number of elements
* @return Allocated memory, NULL on error
*/
-lsm_nfs_export LSM_DLL_EXPORT **lsm_nfs_export_record_array_alloc( uint32_t size );
+lsm_nfs_export LSM_DLL_EXPORT **
+ lsm_nfs_export_record_array_alloc(uint32_t size);


/**
@@ -76,7 +73,7 @@ lsm_nfs_export LSM_DLL_EXPORT **lsm_nfs_export_record_array_alloc( uint32_t size
* @param exp
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_nfs_export_record_free( lsm_nfs_export *exp );
+int LSM_DLL_EXPORT lsm_nfs_export_record_free(lsm_nfs_export *exp);

/**
* Frees the memory for the NFS export array and the memory for each entry
@@ -84,7 +81,7 @@ int LSM_DLL_EXPORT lsm_nfs_export_record_free( lsm_nfs_export *exp );
* @param size Number of entries
* @return LSM_ERR_OK on success, else error reason.
* */
-int LSM_DLL_EXPORT lsm_nfs_export_record_array_free( lsm_nfs_export *exps[],
+int LSM_DLL_EXPORT lsm_nfs_export_record_array_free(lsm_nfs_export * exps[],
uint32_t size);

/**
@@ -92,68 +89,80 @@ int LSM_DLL_EXPORT lsm_nfs_export_record_array_free( lsm_nfs_export *exps[],
* @param source Source record to copy
* @return Copy of source, else NULL one error.
*/
-lsm_nfs_export LSM_DLL_EXPORT *lsm_nfs_export_record_copy( lsm_nfs_export *source );
+lsm_nfs_export LSM_DLL_EXPORT *
+ lsm_nfs_export_record_copy(lsm_nfs_export *source);

/**
* Returns the ID
* @param exp Valid nfs export record
* @return Pointer to ID
*/
-const char LSM_DLL_EXPORT *lsm_nfs_export_id_get( lsm_nfs_export *exp );
-int LSM_DLL_EXPORT lsm_nfs_export_id_set(lsm_nfs_export *exp, const char *ep );
+const char LSM_DLL_EXPORT *lsm_nfs_export_id_get(lsm_nfs_export *exp);
+int LSM_DLL_EXPORT lsm_nfs_export_id_set(lsm_nfs_export *exp,
+ const char *ep);

/**
* Returns the file system id
* @param exp Valid nfs export record
* @return Pointer to file system id
*/
-const char LSM_DLL_EXPORT *lsm_nfs_export_fs_id_get( lsm_nfs_export *exp );
-int LSM_DLL_EXPORT lsm_nfs_export_fs_id_set(lsm_nfs_export *exp, const char *fs_id);
+const char LSM_DLL_EXPORT *lsm_nfs_export_fs_id_get(lsm_nfs_export *exp);
+int LSM_DLL_EXPORT lsm_nfs_export_fs_id_set(lsm_nfs_export *exp,
+ const char *fs_id);

/**
* Returns the export path
* @param exp Valid nfs export record
* @return Pointer to export path
*/
-const char LSM_DLL_EXPORT *lsm_nfs_export_export_path_get( lsm_nfs_export *exp );
-int LSM_DLL_EXPORT lsm_nfs_export_export_path_set( lsm_nfs_export *exp,
- const char *export_path);
+const char LSM_DLL_EXPORT *
+ lsm_nfs_export_export_path_get(lsm_nfs_export *exp);
+
+int LSM_DLL_EXPORT lsm_nfs_export_export_path_set(lsm_nfs_export *exp,
+ const char *export_path);

/**
* Returns the client authentication type
* @param exp Valid nfs export record
* @return Pointer to authentication type
*/
-const char LSM_DLL_EXPORT *lsm_nfs_export_auth_type_get( lsm_nfs_export * exp );
-int LSM_DLL_EXPORT lsm_nfs_export_auth_type_set( lsm_nfs_export * exp,
- const char *value );
+const char LSM_DLL_EXPORT *lsm_nfs_export_auth_type_get(lsm_nfs_export
+ * exp);
+int LSM_DLL_EXPORT lsm_nfs_export_auth_type_set(lsm_nfs_export *exp,
+ const char *value);

/**
* Returns the list of hosts that have root access
* @param exp Valid nfs export record
* @return list of hosts.
*/
-lsm_string_list LSM_DLL_EXPORT * lsm_nfs_export_root_get( lsm_nfs_export * exp);
-int LSM_DLL_EXPORT lsm_nfs_export_root_set(lsm_nfs_export * exp,
- lsm_string_list * value);
+lsm_string_list LSM_DLL_EXPORT *
+ lsm_nfs_export_root_get(lsm_nfs_export * exp);
+
+int LSM_DLL_EXPORT lsm_nfs_export_root_set(lsm_nfs_export *exp,
+ lsm_string_list *value);

/**
* Returns the list of hosts that have read/write access to export.
* @param exp Valid nfs export record
* @return list of hosts.
*/
-lsm_string_list LSM_DLL_EXPORT *lsm_nfs_export_read_write_get( lsm_nfs_export *exp);
-int LSM_DLL_EXPORT lsm_nfs_export_read_write_set( lsm_nfs_export *exp,
- lsm_string_list *value);
+lsm_string_list LSM_DLL_EXPORT *
+ lsm_nfs_export_read_write_get(lsm_nfs_export *exp);
+
+int LSM_DLL_EXPORT lsm_nfs_export_read_write_set(lsm_nfs_export *exp,
+ lsm_string_list *value);

/**
* Returns the list of hosts that have read only access to export.
* @param exp Valid nfs export record
* @return list of hosts
*/
-lsm_string_list LSM_DLL_EXPORT *lsm_nfs_export_read_only_get( lsm_nfs_export *exp );
-int LSM_DLL_EXPORT lsm_nfs_export_read_only_set( lsm_nfs_export *exp,
- lsm_string_list *value);
+lsm_string_list LSM_DLL_EXPORT *
+ lsm_nfs_export_read_only_get(lsm_nfs_export *exp);
+
+int LSM_DLL_EXPORT lsm_nfs_export_read_only_set(lsm_nfs_export *exp,
+ lsm_string_list *value);

/**
* Returns the id which is to be mapped to anonymous id
@@ -161,8 +170,10 @@ int LSM_DLL_EXPORT lsm_nfs_export_read_only_set( lsm_nfs_export *exp,
* @return ANON_UID_GID_NA value is returned when this isn't set, else value
* mapped to anonymous group id. For errors ANON_UID_GID_ERROR is returned.
*/
-uint64_t LSM_DLL_EXPORT lsm_nfs_export_anon_uid_get( lsm_nfs_export * exp );
-int LSM_DLL_EXPORT lsm_nfs_export_anon_uid_set( lsm_nfs_export * exp, uint64_t value);
+uint64_t LSM_DLL_EXPORT lsm_nfs_export_anon_uid_get(lsm_nfs_export *exp);
+
+int LSM_DLL_EXPORT lsm_nfs_export_anon_uid_set(lsm_nfs_export *exp,
+ uint64_t value);

/**
* Returns the group id which is to be mapped to anonymous group
@@ -170,20 +181,22 @@ int LSM_DLL_EXPORT lsm_nfs_export_anon_uid_set( lsm_nfs_export * exp, uint64_t v
* @return ANON_UID_GID_NA value is returned when this isn't set, else value
* mapped to anonymous group id. For errors ANON_UID_GID_ERROR is returned.
*/
-uint64_t LSM_DLL_EXPORT lsm_nfs_export_anon_gid_get( lsm_nfs_export *exp );
-int LSM_DLL_EXPORT lsm_nfs_export_anon_gid_set( lsm_nfs_export *exp, uint64_t value);
+uint64_t LSM_DLL_EXPORT lsm_nfs_export_anon_gid_get(lsm_nfs_export *exp);
+
+int LSM_DLL_EXPORT lsm_nfs_export_anon_gid_set(lsm_nfs_export *exp,
+ uint64_t value);

/**
* Returns the options for this export.
* @param exp Valid nfs export record
* @return Options value, NULL if not applicable.
*/
-const char LSM_DLL_EXPORT *lsm_nfs_export_options_get( lsm_nfs_export *exp);
-int LSM_DLL_EXPORT lsm_nfs_export_options_set( lsm_nfs_export *exp,
- const char *value);
+const char LSM_DLL_EXPORT *lsm_nfs_export_options_get(lsm_nfs_export *exp);
+
+int LSM_DLL_EXPORT lsm_nfs_export_options_set(lsm_nfs_export *exp,
+ const char *value);

#ifdef __cplusplus
}
#endif
-
-#endif
\ No newline at end of file
+#endif
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
index 460054d..d122d92 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
@@ -43,18 +43,18 @@ extern "C" {

/** \enum lsm_data_type What type of data structure we have */
typedef enum {
- LSM_DATA_TYPE_UNKNOWN = -1, /**< Unknown */
- LSM_DATA_TYPE_NONE, /**< None */
- LSM_DATA_TYPE_ACCESS_GROUP, /**< Access group */
- LSM_DATA_TYPE_BLOCK_RANGE, /**< Block range */
- LSM_DATA_TYPE_FS, /**< File system */
- LSM_DATA_TYPE_NFS_EXPORT, /**< NFS export */
- LSM_DATA_TYPE_POOL, /**< Pool */
- LSM_DATA_TYPE_SS, /**< Snap shot */
- LSM_DATA_TYPE_STRING_LIST, /**< String list */
- LSM_DATA_TYPE_SYSTEM, /**< System */
- LSM_DATA_TYPE_VOLUME, /**< Volume */
- LSM_DATA_TYPE_DISK /**< Disk */
+ LSM_DATA_TYPE_UNKNOWN = -1, /**< Unknown */
+ LSM_DATA_TYPE_NONE, /**< None */
+ LSM_DATA_TYPE_ACCESS_GROUP, /**< Access group */
+ LSM_DATA_TYPE_BLOCK_RANGE, /**< Block range */
+ LSM_DATA_TYPE_FS, /**< File system */
+ LSM_DATA_TYPE_NFS_EXPORT, /**< NFS export */
+ LSM_DATA_TYPE_POOL, /**< Pool */
+ LSM_DATA_TYPE_SS, /**< Snap shot */
+ LSM_DATA_TYPE_STRING_LIST, /**< String list */
+ LSM_DATA_TYPE_SYSTEM, /**< System */
+ LSM_DATA_TYPE_VOLUME, /**< Volume */
+ LSM_DATA_TYPE_DISK /**< Disk */
} lsm_data_type;

/**
@@ -76,8 +76,9 @@ typedef lsm_plugin *lsm_plugin_ptr;
* @param flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plugin_register)( lsm_plugin_ptr c, const char *uri,
- const char *password, uint32_t timeout, lsm_flag flags);
+typedef int (*lsm_plugin_register) (lsm_plugin_ptr c, const char *uri,
+ const char *password,
+ uint32_t timeout, lsm_flag flags);

/**
* Plug-in unregister callback function signature
@@ -85,7 +86,7 @@ typedef int (*lsm_plugin_register)( lsm_plugin_ptr c, const char *uri,
* @param flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plugin_unregister)( lsm_plugin_ptr c, lsm_flag flags );
+typedef int (*lsm_plugin_unregister) (lsm_plugin_ptr c, lsm_flag flags);

/**
* Set plug-in time-out value callback function signature
@@ -94,8 +95,8 @@ typedef int (*lsm_plugin_unregister)( lsm_plugin_ptr c, lsm_flag flags );
* @param flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_tmo_set)( lsm_plugin_ptr c, uint32_t timeout,
- lsm_flag flags );
+typedef int (*lsm_plug_tmo_set) (lsm_plugin_ptr c, uint32_t timeout,
+ lsm_flag flags);

/**
* Get the plug-in time-out value callback function signature
@@ -104,8 +105,8 @@ typedef int (*lsm_plug_tmo_set)( lsm_plugin_ptr c, uint32_t timeout,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_tmo_get)( lsm_plugin_ptr c, uint32_t *timeout,
- lsm_flag flags );
+typedef int (*lsm_plug_tmo_get) (lsm_plugin_ptr c, uint32_t *timeout,
+ lsm_flag flags);

/**
* Retrieve the plug-in capabilities callback function signature
@@ -115,9 +116,10 @@ typedef int (*lsm_plug_tmo_get)( lsm_plugin_ptr c, uint32_t *timeout,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_capabilities)(lsm_plugin_ptr c, lsm_system *sys,
- lsm_storage_capabilities **cap,
- lsm_flag flags);
+typedef int (*lsm_plug_capabilities) (lsm_plugin_ptr c,
+ lsm_system *sys,
+ lsm_storage_capabilities **cap,
+ lsm_flag flags);
/**
* Retrieve the job status callback function signature
* @param[in] c Valid lsm plug-in pointer
@@ -130,11 +132,11 @@ typedef int (*lsm_plug_capabilities)(lsm_plugin_ptr c, lsm_system *sys,
* @return LSM_ERR_OK, else error reason
*/

-typedef int (*lsm_plug_Job_status)(lsm_plugin_ptr c, const char *job,
- lsm_job_status *status,
- uint8_t *percent_complete,
- lsm_data_type *type,
- void **value, lsm_flag flags);
+typedef int (*lsm_plug_Job_status) (lsm_plugin_ptr c, const char *job,
+ lsm_job_status *status,
+ uint8_t *percent_complete,
+ lsm_data_type *type, void **value,
+ lsm_flag flags);
/**
* Instructs the plug-in to release the memory for the specified job id,
* callback function signature
@@ -143,7 +145,8 @@ typedef int (*lsm_plug_Job_status)(lsm_plugin_ptr c, const char *job,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_job_free)(lsm_plugin_ptr c, char *job_id, lsm_flag flags);
+typedef int (*lsm_plug_job_free) (lsm_plugin_ptr c, char *job_id,
+ lsm_flag flags);

/**
* Retrieves a list of pools callback function signature
@@ -155,10 +158,11 @@ typedef int (*lsm_plug_job_free)(lsm_plugin_ptr c, char *job_id, lsm_flag flags)
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_pool_list)( lsm_plugin_ptr c, const char *search_key,
- const char *search_value,
- lsm_pool **pool_array[],
- uint32_t *count, lsm_flag flags);
+typedef int (*lsm_plug_pool_list) (lsm_plugin_ptr c,
+ const char *search_key,
+ const char *search_value,
+ lsm_pool **pool_array[],
+ uint32_t *count, lsm_flag flags);

/**
* Retrieve a list of systems, callback function signature
@@ -168,19 +172,21 @@ typedef int (*lsm_plug_pool_list)( lsm_plugin_ptr c, const char *search_key,
* @param[out] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_system_list)(lsm_plugin_ptr c, lsm_system **systems[],
- uint32_t *system_count, lsm_flag flags);
+typedef int (*lsm_plug_system_list) (lsm_plugin_ptr c,
+ lsm_system **systems[],
+ uint32_t *system_count,
+ lsm_flag flags);

/** \struct lsm_mgmt_ops_v1
* \brief Callback functions for management operations */
struct lsm_mgmt_ops_v1 {
- lsm_plug_tmo_set tmo_set; /**< tmo set callback */
- lsm_plug_tmo_get tmo_get; /**< tmo get callback */
- lsm_plug_capabilities capablities; /**< capabilities callback */
- lsm_plug_Job_status job_status; /**< status of job */
- lsm_plug_job_free job_free; /**< Free a job */
- lsm_plug_pool_list pool_list; /**< List of pools */
- lsm_plug_system_list system_list; /**< List of systems */
+ lsm_plug_tmo_set tmo_set; /**< tmo set callback */
+ lsm_plug_tmo_get tmo_get; /**< tmo get callback */
+ lsm_plug_capabilities capablities; /**< capabilities callback */
+ lsm_plug_Job_status job_status; /**< status of job */
+ lsm_plug_job_free job_free; /**< Free a job */
+ lsm_plug_pool_list pool_list; /**< List of pools */
+ lsm_plug_system_list system_list; /**< List of systems */
};

/**
@@ -193,10 +199,11 @@ struct lsm_mgmt_ops_v1 {
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_list)( lsm_plugin_ptr c, const char *search_key,
- const char *search_val,
- lsm_volume **vol_array[],
- uint32_t *count, lsm_flag flags);
+typedef int (*lsm_plug_volume_list) (lsm_plugin_ptr c,
+ const char *search_key,
+ const char *search_val,
+ lsm_volume **vol_array[],
+ uint32_t *count, lsm_flag flags);

/**
* Retrieve a list of volumes.
@@ -208,10 +215,11 @@ typedef int (*lsm_plug_volume_list)( lsm_plugin_ptr c, const char *search_key,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_disk_list)( lsm_plugin_ptr c, const char *search_key,
- const char *search_value,
- lsm_disk **disk_array[],
- uint32_t *count, lsm_flag flags);
+typedef int (*lsm_plug_disk_list) (lsm_plugin_ptr c,
+ const char *search_key,
+ const char *search_value,
+ lsm_disk **disk_array[],
+ uint32_t *count, lsm_flag flags);

/**
* Retrieve a list of target ports.
@@ -223,11 +231,9 @@ typedef int (*lsm_plug_disk_list)( lsm_plugin_ptr c, const char *search_key,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_target_port_list)( lsm_plugin_ptr c,
- const char *search_key,
- const char *search_value,
- lsm_target_port **target_port_array[],
- uint32_t *count, lsm_flag flags);
+typedef int (*lsm_plug_target_port_list)
+ (lsm_plugin_ptr c, const char *search_key, const char *search_value,
+ lsm_target_port **target_port_array[], uint32_t *count, lsm_flag flags);

/**
* Creates a volume, callback function signature
@@ -241,10 +247,13 @@ typedef int (*lsm_plug_target_port_list)( lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_create)(lsm_plugin_ptr c, lsm_pool *pool,
- const char *volume_name, uint64_t size,
- lsm_volume_provision_type provisioning, lsm_volume **new_volume,
- char **job, lsm_flag flags);
+typedef int (*lsm_plug_volume_create) (lsm_plugin_ptr c,
+ lsm_pool *pool,
+ const char *volume_name,
+ uint64_t size,
+ lsm_volume_provision_type provisioning,
+ lsm_volume **new_volume,
+ char **job, lsm_flag flags);

/**
* Volume replicate, callback function signature
@@ -258,10 +267,13 @@ typedef int (*lsm_plug_volume_create)(lsm_plugin_ptr c, lsm_pool *pool,
* @param flags
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_replicate)(lsm_plugin_ptr c, lsm_pool *pool,
- lsm_replication_type rep_type, lsm_volume *volume_src,
- const char *name, lsm_volume **new_replicant,
- char **job, lsm_flag flags);
+typedef int (*lsm_plug_volume_replicate) (lsm_plugin_ptr c,
+ lsm_pool *pool,
+ lsm_replication_type rep_type,
+ lsm_volume *volume_src,
+ const char *name,
+ lsm_volume **new_replicant,
+ char **job, lsm_flag flags);

/**
* Return the block size of a replicated block range.
@@ -271,8 +283,8 @@ typedef int (*lsm_plug_volume_replicate)(lsm_plugin_ptr c, lsm_pool *pool,
* @param[out] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_replicate_range_block_size)(lsm_plugin_ptr c,
- lsm_system *system, uint32_t *bs, lsm_flag flags);
+typedef int (*lsm_plug_volume_replicate_range_block_size)
+ (lsm_plugin_ptr c, lsm_system * system, uint32_t *bs, lsm_flag flags);

/**
* Replicate a range of a volume to the same volume or different volume.
@@ -287,13 +299,13 @@ typedef int (*lsm_plug_volume_replicate_range_block_size)(lsm_plugin_ptr c,
* @param flags
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_replicate_range)(lsm_plugin_ptr c,
+typedef int (*lsm_plug_volume_replicate_range) (lsm_plugin_ptr c,
lsm_replication_type rep_type,
lsm_volume *source,
lsm_volume *dest,
lsm_block_range **ranges,
- uint32_t num_ranges, char **job,
- lsm_flag flags);
+ uint32_t num_ranges,
+ char **job, lsm_flag flags);

/**
* Re-size a volume, callback function signature
@@ -305,9 +317,11 @@ typedef int (*lsm_plug_volume_replicate_range)(lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_resize)(lsm_plugin_ptr c, lsm_volume *volume,
- uint64_t new_size, lsm_volume **resized_volume,
- char **job, lsm_flag flags);
+typedef int (*lsm_plug_volume_resize) (lsm_plugin_ptr c,
+ lsm_volume *volume,
+ uint64_t new_size,
+ lsm_volume **resized_volume,
+ char **job, lsm_flag flags);

/**
* Delete a volume, callback function signature
@@ -317,8 +331,9 @@ typedef int (*lsm_plug_volume_resize)(lsm_plugin_ptr c, lsm_volume *volume,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_delete)(lsm_plugin_ptr c, lsm_volume *volume,
- char **job, lsm_flag flags);
+typedef int (*lsm_plug_volume_delete) (lsm_plugin_ptr c,
+ lsm_volume *volume, char **job,
+ lsm_flag flags);
/**
* Place a volume online, callback function signature.
* @param[in] c Valid lsm plug-in pointer
@@ -326,8 +341,8 @@ typedef int (*lsm_plug_volume_delete)(lsm_plugin_ptr c, lsm_volume *volume,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_enable)(lsm_plugin_ptr c, lsm_volume *v,
- lsm_flag flags);
+typedef int (*lsm_plug_volume_enable) (lsm_plugin_ptr c,
+ lsm_volume *v, lsm_flag flags);

/**
* Take a volume offline, callback function signature.
@@ -336,8 +351,8 @@ typedef int (*lsm_plug_volume_enable)(lsm_plugin_ptr c, lsm_volume *v,
* @param flags
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_disable)(lsm_plugin_ptr c, lsm_volume *v,
- lsm_flag flags);
+typedef int (*lsm_plug_volume_disable) (lsm_plugin_ptr c,
+ lsm_volume *v, lsm_flag flags);

/**
* Setup the cap authentication for the specified initiator, callback
@@ -351,13 +366,13 @@ typedef int (*lsm_plug_volume_disable)(lsm_plugin_ptr c, lsm_volume *v,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_iscsi_chap_auth)(lsm_plugin_ptr c,
- const char *init_id,
- const char *in_user,
- const char *in_password,
- const char *out_user,
- const char *out_password,
- lsm_flag flags);
+typedef int (*lsm_plug_iscsi_chap_auth) (lsm_plugin_ptr c,
+ const char *init_id,
+ const char *in_user,
+ const char *in_password,
+ const char *out_user,
+ const char *out_password,
+ lsm_flag flags);

/**
* Retrieve a list of access groups, callback function signature
@@ -369,11 +384,12 @@ typedef int (*lsm_plug_iscsi_chap_auth)(lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_access_group_list)(lsm_plugin_ptr c,
- const char *search_key,
- const char *search_value,
- lsm_access_group **groups[],
- uint32_t *group_count, lsm_flag flags);
+typedef int (*lsm_plug_access_group_list) (lsm_plugin_ptr c,
+ const char *search_key,
+ const char *search_value,
+ lsm_access_group **groups[],
+ uint32_t *group_count,
+ lsm_flag flags);
/**
* Creates an access group, callback function signature
* @param[in] c Valid lsm plug-in pointer
@@ -385,13 +401,10 @@ typedef int (*lsm_plug_access_group_list)(lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_access_group_create)(lsm_plugin_ptr c,
- const char *name,
- const char *initiator_id,
- lsm_access_group_init_type init_type,
- lsm_system *system,
- lsm_access_group **access_group,
- lsm_flag flags);
+typedef int (*lsm_plug_access_group_create)
+ (lsm_plugin_ptr c, const char *name, const char *initiator_id,
+ lsm_access_group_init_type init_type, lsm_system *system,
+ lsm_access_group **access_group, lsm_flag flags);

/**
* Deletes an access group, callback function signature
@@ -400,8 +413,9 @@ typedef int (*lsm_plug_access_group_create)(lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_access_group_delete)(lsm_plugin_ptr c,
- lsm_access_group *group, lsm_flag flags);
+typedef int (*lsm_plug_access_group_delete) (lsm_plugin_ptr c,
+ lsm_access_group *group,
+ lsm_flag flags);

/**
* Add an initiator to an access group, callback function signature
@@ -413,12 +427,10 @@ typedef int (*lsm_plug_access_group_delete)(lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_access_group_initiator_add)(lsm_plugin_ptr c,
- lsm_access_group *access_group,
- const char *initiator_id,
- lsm_access_group_init_type id_type,
- lsm_access_group **updated_access_group,
- lsm_flag flags);
+typedef int (*lsm_plug_access_group_initiator_add)
+ (lsm_plugin_ptr c, lsm_access_group *access_group,
+ const char *initiator_id, lsm_access_group_init_type id_type,
+ lsm_access_group **updated_access_group, lsm_flag flags);

/**
* Remove an initiator from an access group, callback function signature
@@ -430,40 +442,41 @@ typedef int (*lsm_plug_access_group_initiator_add)(lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_access_group_initiator_delete)(lsm_plugin_ptr c,
- lsm_access_group *access_group,
- const char *initiator_id,
- lsm_access_group_init_type id_type,
- lsm_access_group **updated_access_group,
- lsm_flag flags);
+typedef int (*lsm_plug_access_group_initiator_delete)
+ (lsm_plugin_ptr c, lsm_access_group *access_group,
+ const char *initiator_id, lsm_access_group_init_type id_type,
+ lsm_access_group **updated_access_group, lsm_flag flags);

/**
- * Grants access to a volume for the specified access group, callback function signature
+ * Grants access to a volume for the specified access group, callback function
+ * signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] group Group to be granted access
* @param[in] volume Volume to be given access too
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_mask)(lsm_plugin_ptr c,
- lsm_access_group *group,
- lsm_volume *volume,
- lsm_flag flags);
+typedef int (*lsm_plug_volume_mask) (lsm_plugin_ptr c,
+ lsm_access_group *group,
+ lsm_volume *volume, lsm_flag flags);

/**
- * Revokes access to a volume for a specified access group, callback function signature
+ * Revokes access to a volume for a specified access group, callback function
+ * signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] group Group to revoke access for
- * @param[in] volume Volume to which will no longer be accessible by group
+ * @param[in] volume Volume to which will no longer be
+ * accessible by group
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_unmask)(lsm_plugin_ptr c,
- lsm_access_group *group,
- lsm_volume *volume, lsm_flag flags);
+typedef int (*lsm_plug_volume_unmask) (lsm_plugin_ptr c,
+ lsm_access_group * group,
+ lsm_volume *volume, lsm_flag flags);

/**
- * Retrieve an array of volumes which are accessible by access group, callback function signature
+ * Retrieve an array of volumes which are accessible by access group, callback
+ * function signature
* @param[in] c Valid lsm plug-in pointer
* @param[in] group Group to find volumes for
* @param[out] volumes Array of volumes
@@ -471,10 +484,9 @@ typedef int (*lsm_plug_volume_unmask)(lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volumes_accessible_by_access_group)(lsm_plugin_ptr c,
- lsm_access_group *group,
- lsm_volume **volumes[],
- uint32_t *count, lsm_flag flags);
+typedef int (*lsm_plug_volumes_accessible_by_access_group)
+ (lsm_plugin_ptr c, lsm_access_group *group, lsm_volume **volumes[],
+ uint32_t *count, lsm_flag flags);

/**
* Retrieve a list of access groups that have access to the specified volume,
@@ -486,10 +498,9 @@ typedef int (*lsm_plug_volumes_accessible_by_access_group)(lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
- typedef int (*lsm_plug_access_groups_granted_to_volume)(lsm_plugin_ptr c,
- lsm_volume *volume,
- lsm_access_group **groups[],
- uint32_t *group_count, lsm_flag flags);
+typedef int (*lsm_plug_access_groups_granted_to_volume)
+ (lsm_plugin_ptr c, lsm_volume *volume, lsm_access_group **groups[],
+ uint32_t *group_count, lsm_flag flags);

/**
* Determine if a volume has child dependencies, callback function signature
@@ -499,9 +510,8 @@ typedef int (*lsm_plug_volumes_accessible_by_access_group)(lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_child_dependency)(lsm_plugin_ptr c,
- lsm_volume *volume,
- uint8_t *yes, lsm_flag flags);
+typedef int (*lsm_plug_volume_child_dependency)
+ (lsm_plugin_ptr c, lsm_volume *volume, uint8_t *yes, lsm_flag flags);

/**
* Remove dependencies from a volume, callback function signature
@@ -511,9 +521,8 @@ typedef int (*lsm_plug_volume_child_dependency)(lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_child_dependency_delete)(lsm_plugin_ptr c,
- lsm_volume *volume,
- char **job, lsm_flag flags);
+typedef int (*lsm_plug_volume_child_dependency_delete)
+ (lsm_plugin_ptr c, lsm_volume *volume, char **job, lsm_flag flags);

/**
* File system list, callback function signature
@@ -525,9 +534,11 @@ typedef int (*lsm_plug_volume_child_dependency_delete)(lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_list)(lsm_plugin_ptr c, const char *search_key,
- const char *search_value, lsm_fs **fs[],
- uint32_t *fs_count, lsm_flag flags);
+typedef int (*lsm_plug_fs_list) (lsm_plugin_ptr c,
+ const char *search_key,
+ const char *search_value,
+ lsm_fs **fs[], uint32_t *fs_count,
+ lsm_flag flags);

/**
* Create a file system, callback function signature
@@ -540,9 +551,10 @@ typedef int (*lsm_plug_fs_list)(lsm_plugin_ptr c, const char *search_key,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_create)(lsm_plugin_ptr c, lsm_pool *pool,
- const char *name, uint64_t size_bytes,
- lsm_fs **fs, char **job, lsm_flag flags);
+typedef int (*lsm_plug_fs_create) (lsm_plugin_ptr c, lsm_pool *pool,
+ const char *name,
+ uint64_t size_bytes, lsm_fs **fs,
+ char **job, lsm_flag flags);

/**
* Delete a file system, callback function signature
@@ -552,7 +564,8 @@ typedef int (*lsm_plug_fs_create)(lsm_plugin_ptr c, lsm_pool *pool,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_delete)(lsm_plugin_ptr c, lsm_fs *fs, char **job, lsm_flag flags);
+typedef int (*lsm_plug_fs_delete) (lsm_plugin_ptr c, lsm_fs *fs,
+ char **job, lsm_flag flags);

/**
* Clone a file system, callback function signature
@@ -564,11 +577,11 @@ typedef int (*lsm_plug_fs_delete)(lsm_plugin_ptr c, lsm_fs *fs, char **job, lsm_
* @param[in] flags reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_clone)(lsm_plugin_ptr c, lsm_fs *src_fs,
- const char *dest_fs_name,
- lsm_fs **cloned_fs,
- lsm_fs_ss *optional_snapshot,
- char **job, lsm_flag flags);
+typedef int (*lsm_plug_fs_clone) (lsm_plugin_ptr c, lsm_fs *src_fs,
+ const char *dest_fs_name,
+ lsm_fs **cloned_fs,
+ lsm_fs_ss *optional_snapshot,
+ char **job, lsm_flag flags);
/**
* Determine if a file system has child dependencies, callback function signature
* @param[in] c Valid lsm plug-in pointer
@@ -577,9 +590,10 @@ typedef int (*lsm_plug_fs_clone)(lsm_plugin_ptr c, lsm_fs *src_fs,
* @param[out] yes Boolean
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_child_dependency)(lsm_plugin_ptr c, lsm_fs *fs,
- lsm_string_list *files,
- uint8_t *yes);
+typedef int (*lsm_plug_fs_child_dependency) (lsm_plugin_ptr c,
+ lsm_fs *fs,
+ lsm_string_list *files,
+ uint8_t *yes);

/**
* Remove dependencies from a file system, callback function signature
@@ -590,9 +604,11 @@ typedef int (*lsm_plug_fs_child_dependency)(lsm_plugin_ptr c, lsm_fs *fs,
* @param[out] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_child_dependency_delete)( lsm_plugin_ptr c, lsm_fs *fs,
- lsm_string_list *files,
- char **job, lsm_flag flags);
+typedef int (*lsm_plug_fs_child_dependency_delete) (lsm_plugin_ptr c,
+ lsm_fs *fs,
+ lsm_string_list * files,
+ char **job,
+ lsm_flag flags);

/**
* Re-size a file system, callback function signature
@@ -604,9 +620,10 @@ typedef int (*lsm_plug_fs_child_dependency_delete)( lsm_plugin_ptr c, lsm_fs *fs
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_resize)(lsm_plugin_ptr c, lsm_fs *fs,
- uint64_t new_size_bytes, lsm_fs **rfs,
- char **job, lsm_flag flags);
+typedef int (*lsm_plug_fs_resize) (lsm_plugin_ptr c, lsm_fs *fs,
+ uint64_t new_size_bytes,
+ lsm_fs ** rfs, char **job,
+ lsm_flag flags);

/**
* Clone an individual file on a file system, callback function signature
@@ -619,10 +636,11 @@ typedef int (*lsm_plug_fs_resize)(lsm_plugin_ptr c, lsm_fs *fs,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_file_clone)(lsm_plugin_ptr c, lsm_fs *fs,
- const char *src_file_name,
- const char *dest_file_name,
- lsm_fs_ss *snapshot, char **job, lsm_flag flags);
+typedef int (*lsm_plug_fs_file_clone) (lsm_plugin_ptr c, lsm_fs *fs,
+ const char *src_file_name,
+ const char *dest_file_name,
+ lsm_fs_ss *snapshot,
+ char **job, lsm_flag flags);

/**
* Retrieve a list of fs snapshots for a file system, callback function
@@ -634,8 +652,9 @@ typedef int (*lsm_plug_fs_file_clone)(lsm_plugin_ptr c, lsm_fs *fs,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_ss_list)(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss **ss[],
- uint32_t *ss_count, lsm_flag flags);
+typedef int (*lsm_plug_fs_ss_list) (lsm_plugin_ptr c, lsm_fs *fs,
+ lsm_fs_ss **ss[],
+ uint32_t *ss_count, lsm_flag flags);

/**
* Create a fs snapshot of the specified file system and optionally constrain
@@ -647,10 +666,10 @@ typedef int (*lsm_plug_fs_ss_list)(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss **ss[
* @param[out] job Job ID
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_ss_create)(lsm_plugin_ptr c, lsm_fs *fs,
- const char *name,
- lsm_fs_ss **snapshot, char **job,
- lsm_flag flags);
+typedef int (*lsm_plug_fs_ss_create) (lsm_plugin_ptr c, lsm_fs *fs,
+ const char *name,
+ lsm_fs_ss **snapshot,
+ char **job, lsm_flag flags);
/**
* Delete a fs snapshot, callback function signature, callback function
* signature
@@ -661,8 +680,9 @@ typedef int (*lsm_plug_fs_ss_create)(lsm_plugin_ptr c, lsm_fs *fs,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_ss_delete)(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss *ss,
- char **job, lsm_flag flags);
+typedef int (*lsm_plug_fs_ss_delete) (lsm_plugin_ptr c, lsm_fs *fs,
+ lsm_fs_ss *ss, char **job,
+ lsm_flag flags);

/**
* Revert the state of a file system or specific files to a previous state,
@@ -671,14 +691,17 @@ typedef int (*lsm_plug_fs_ss_delete)(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss *ss
* @param[in] fs File system of interest
* @param[in] files Optional list of files
* @param[in] restore_files Optional path and name of restored files
- * @param[in] all_files boolean to indicate all files should be restored
+ * @param[in] all_files boolean to indicate all files should be
+ * restored
* @param[out] job Job ID
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_ss_restore)(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss *ss,
- lsm_string_list *files,
- lsm_string_list *restore_files,
- int all_files, char **job, lsm_flag flags);
+typedef int (*lsm_plug_fs_ss_restore) (lsm_plugin_ptr c, lsm_fs *fs,
+ lsm_fs_ss *ss,
+ lsm_string_list *files,
+ lsm_string_list *restore_files,
+ int all_files, char **job,
+ lsm_flag flags);

/**
* Get a list of NFS client authentication types, callback function signature
@@ -687,8 +710,9 @@ typedef int (*lsm_plug_fs_ss_restore)(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss *s
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_nfs_auth_types)( lsm_plugin_ptr c,
- lsm_string_list **types, lsm_flag flags);
+typedef int (*lsm_plug_nfs_auth_types) (lsm_plugin_ptr c,
+ lsm_string_list **types,
+ lsm_flag flags);

/**
* Retrieve a list of NFS exports, callback function signature
@@ -700,10 +724,11 @@ typedef int (*lsm_plug_nfs_auth_types)( lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_nfs_list)( lsm_plugin_ptr c, const char *search_key,
- const char *search_value,
- lsm_nfs_export **exports[],
- uint32_t *count, lsm_flag flags);
+typedef int (*lsm_plug_nfs_list) (lsm_plugin_ptr c,
+ const char *search_key,
+ const char *search_value,
+ lsm_nfs_export **exports[],
+ uint32_t *count, lsm_flag flags);
/**
* Exports a file system via NFS, callback function signature
* @param[in] c Valid lsm plug-in pointer
@@ -720,19 +745,18 @@ typedef int (*lsm_plug_nfs_list)( lsm_plugin_ptr c, const char *search_key,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_nfs_export_fs)( lsm_plugin_ptr c,
- const char *fs_id,
- const char *export_path,
- lsm_string_list *root_list,
- lsm_string_list *rw_list,
- lsm_string_list *ro_list,
- uint64_t anon_uid,
- uint64_t anon_gid,
- const char *auth_type,
- const char *options,
- lsm_nfs_export **exported,
- lsm_flag flags
- );
+typedef int (*lsm_plug_nfs_export_fs) (lsm_plugin_ptr c,
+ const char *fs_id,
+ const char *export_path,
+ lsm_string_list *root_list,
+ lsm_string_list *rw_list,
+ lsm_string_list *ro_list,
+ uint64_t anon_uid,
+ uint64_t anon_gid,
+ const char *auth_type,
+ const char *options,
+ lsm_nfs_export **exported,
+ lsm_flag flags);

/**
* Removes a NFS export, callback function signature
@@ -741,37 +765,61 @@ typedef int (*lsm_plug_nfs_export_fs)( lsm_plugin_ptr c,
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_nfs_export_remove)( lsm_plugin_ptr c, lsm_nfs_export *e,
- lsm_flag flags);
+typedef int (*lsm_plug_nfs_export_remove) (lsm_plugin_ptr c,
+ lsm_nfs_export *e,
+ lsm_flag flags);
/** \struct lsm_san_ops_v1
* \brief Block array oriented functions (callback functions)
* NOTE: This structure cannot change as we need to maintain backwards
* compatibility
*/
struct lsm_san_ops_v1 {
- lsm_plug_volume_list vol_get; /**< retrieving volumes */
- lsm_plug_disk_list disk_get; /**< retrieve disks */
- lsm_plug_volume_create vol_create; /**< creating a lun */
- lsm_plug_volume_replicate vol_replicate; /**< replicating lun */
- lsm_plug_volume_replicate_range_block_size vol_rep_range_bs; /**< volume replication range block size */
- lsm_plug_volume_replicate_range vol_rep_range; /**< volume replication range */
- lsm_plug_volume_resize vol_resize; /**< resizing a volume */
- lsm_plug_volume_delete vol_delete; /**< deleting a volume */
- lsm_plug_volume_enable vol_enable; /**< volume is accessible */
- lsm_plug_volume_disable vol_disable; /**< volume is unaccessible */
- lsm_plug_iscsi_chap_auth iscsi_chap_auth; /**< iscsi chap authentication */
- lsm_plug_access_group_list ag_list; /**< access groups */
- lsm_plug_access_group_create ag_create; /**< access group create */
- lsm_plug_access_group_delete ag_delete; /**< access group delete */
- lsm_plug_access_group_initiator_add ag_add_initiator; /**< adding an initiator to an access group */
- lsm_plug_access_group_initiator_delete ag_del_initiator; /**< deleting an initiator from an access group */
- lsm_plug_volume_mask ag_grant; /**< acess group grant */
- lsm_plug_volume_unmask ag_revoke; /**< access group revoke */
- lsm_plug_volumes_accessible_by_access_group vol_accessible_by_ag; /**< volumes accessible by access group */
- lsm_plug_access_groups_granted_to_volume ag_granted_to_vol; /**< access groups granted to a volume */
- lsm_plug_volume_child_dependency vol_child_depends; /**< volume child dependencies */
- lsm_plug_volume_child_dependency_delete vol_child_depends_rm; /**<Callback to remove volume child dependencies */
- lsm_plug_target_port_list target_port_list; /**< Callback to get list of target ports */
+ lsm_plug_volume_list vol_get;
+ /**^ retrieving volumes */
+ lsm_plug_disk_list disk_get;
+ /**^ retrieve disks */
+ lsm_plug_volume_create vol_create;
+ /**^ creating a lun */
+ lsm_plug_volume_replicate vol_replicate;
+ /**^ replicating lun */
+ lsm_plug_volume_replicate_range_block_size vol_rep_range_bs;
+ /**^ volume replication range block size */
+ lsm_plug_volume_replicate_range vol_rep_range;
+ /**^ volume replication range */
+ lsm_plug_volume_resize vol_resize;
+ /**^ resizing a volume */
+ lsm_plug_volume_delete vol_delete;
+ /**^ deleting a volume */
+ lsm_plug_volume_enable vol_enable;
+ /**^ volume is accessible */
+ lsm_plug_volume_disable vol_disable;
+ /**^ volume is unaccessible */
+ lsm_plug_iscsi_chap_auth iscsi_chap_auth;
+ /**^ iscsi chap authentication */
+ lsm_plug_access_group_list ag_list;
+ /**^ access groups */
+ lsm_plug_access_group_create ag_create;
+ /**^ access group create */
+ lsm_plug_access_group_delete ag_delete;
+ /**^ access group delete */
+ lsm_plug_access_group_initiator_add ag_add_initiator;
+ /**^ adding an initiator to an access group */
+ lsm_plug_access_group_initiator_delete ag_del_initiator;
+ /**^ deleting an initiator from an access group */
+ lsm_plug_volume_mask ag_grant;
+ /**^ acess group grant */
+ lsm_plug_volume_unmask ag_revoke;
+ /**^ access group revoke */
+ lsm_plug_volumes_accessible_by_access_group vol_accessible_by_ag;
+ /**^ volumes accessible by access group */
+ lsm_plug_access_groups_granted_to_volume ag_granted_to_vol;
+ /**^ access groups granted to a volume */
+ lsm_plug_volume_child_dependency vol_child_depends;
+ /**^ volume child dependencies */
+ lsm_plug_volume_child_dependency_delete vol_child_depends_rm;
+ /**^Callback to remove volume child dependencies */
+ lsm_plug_target_port_list target_port_list;
+ /**^ Callback to get list of target ports */
};

/** \struct lsm_fs_ops_v1
@@ -780,18 +828,30 @@ struct lsm_san_ops_v1 {
* compatibility
*/
struct lsm_fs_ops_v1 {
- lsm_plug_fs_list fs_list; /**< list file systems */
- lsm_plug_fs_create fs_create; /**< create a file system */
- lsm_plug_fs_delete fs_delete; /**< delete a file system */
- lsm_plug_fs_resize fs_resize; /**< resize a file system */
- lsm_plug_fs_clone fs_clone; /**< clone a file system */
- lsm_plug_fs_file_clone fs_file_clone; /**< clone files on a file system */
- lsm_plug_fs_child_dependency fs_child_dependency; /**< check file system child dependencies */
- lsm_plug_fs_child_dependency_delete fs_child_dependency_rm; /**< remove file system child dependencies */
- lsm_plug_fs_ss_list fs_ss_list; /**< list snapshots */
- lsm_plug_fs_ss_create fs_ss_create; /**< create a snapshot */
- lsm_plug_fs_ss_delete fs_ss_delete; /**< delete a snapshot */
- lsm_plug_fs_ss_restore fs_ss_restore; /**< restore a snapshot */
+ lsm_plug_fs_list fs_list;
+ /**^ list file systems */
+ lsm_plug_fs_create fs_create;
+ /**^ create a file system */
+ lsm_plug_fs_delete fs_delete;
+ /**^ delete a file system */
+ lsm_plug_fs_resize fs_resize;
+ /**^ resize a file system */
+ lsm_plug_fs_clone fs_clone;
+ /**^ clone a file system */
+ lsm_plug_fs_file_clone fs_file_clone;
+ /**^ clone files on a file system */
+ lsm_plug_fs_child_dependency fs_child_dependency;
+ /**^ check file system child dependencies */
+ lsm_plug_fs_child_dependency_delete fs_child_dependency_rm;
+ /**^ remove file system child dependencies */
+ lsm_plug_fs_ss_list fs_ss_list;
+ /**^ list snapshots */
+ lsm_plug_fs_ss_create fs_ss_create;
+ /**^ create a snapshot */
+ lsm_plug_fs_ss_delete fs_ss_delete;
+ /**^ delete a snapshot */
+ lsm_plug_fs_ss_restore fs_ss_restore;
+ /**^ restore a snapshot */
};

/** \struct lsm_nas_ops_v1
@@ -800,10 +860,14 @@ struct lsm_fs_ops_v1 {
* compatibility
*/
struct lsm_nas_ops_v1 {
- lsm_plug_nfs_auth_types nfs_auth_types; /**< List nfs authentication types */
- lsm_plug_nfs_list nfs_list; /**< List nfs exports */
- lsm_plug_nfs_export_fs nfs_export; /**< Export a file system */
- lsm_plug_nfs_export_remove nfs_export_remove; /**< Remove a file export */
+ lsm_plug_nfs_auth_types nfs_auth_types;
+ /**^ List nfs authentication types */
+ lsm_plug_nfs_list nfs_list;
+ /**^ List nfs exports */
+ lsm_plug_nfs_export_fs nfs_export;
+ /**^ Export a file system */
+ lsm_plug_nfs_export_remove nfs_export_remove;
+ /**^ Remove a file export */
};

/**
@@ -822,10 +886,14 @@ struct lsm_nas_ops_v1 {
* @param[in] flags Reserved
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_volume_raid_info)(lsm_plugin_ptr c, lsm_volume *volume,
- lsm_volume_raid_type *raid_type, uint32_t *strip_size,
- uint32_t *disk_count, uint32_t *min_io_size, uint32_t *opt_io_size,
- lsm_flag flags);
+typedef int (*lsm_plug_volume_raid_info) (lsm_plugin_ptr c,
+ lsm_volume *volume,
+ lsm_volume_raid_type *raid_type,
+ uint32_t *strip_size,
+ uint32_t *disk_count,
+ uint32_t *min_io_size,
+ uint32_t *opt_io_size,
+ lsm_flag flags);

/**
* Retrieves the membership of given pool. New in version 1.2.
@@ -848,10 +916,11 @@ typedef int (*lsm_plug_volume_raid_info)(lsm_plugin_ptr c, lsm_volume *volume,
* @param[in] flags Reserved, set to 0
* @return LSM_ERR_OK on success else error reason.
*/
-typedef int (*lsm_plug_pool_member_info)(
- lsm_plugin_ptr c, lsm_pool *pool, lsm_volume_raid_type *raid_type,
- lsm_pool_member_type *member_type, lsm_string_list **member_ids,
- lsm_flag flags);
+typedef int (*lsm_plug_pool_member_info) (lsm_plugin_ptr c, lsm_pool *pool,
+ lsm_volume_raid_type *raid_type,
+ lsm_pool_member_type *member_type,
+ lsm_string_list **member_ids,
+ lsm_flag flags);

/**
* Query all supported RAID types and strip sizes which could be used
@@ -875,11 +944,10 @@ typedef int (*lsm_plug_pool_member_info)(
* @param[in] flags Reserved, set to 0
* @return LSM_ERR_OK on success else error reason.
*/
-typedef int (*lsm_plug_volume_raid_create_cap_get)(
- lsm_plugin_ptr c, lsm_system *system,
- uint32_t **supported_raid_types, uint32_t *supported_raid_type_count,
- uint32_t **supported_strip_sizes, uint32_t *supported_strip_size_count,
- lsm_flag flags);
+typedef int (*lsm_plug_volume_raid_create_cap_get)
+ (lsm_plugin_ptr c, lsm_system *system, uint32_t **supported_raid_types,
+ uint32_t *supported_raid_type_count, uint32_t **supported_strip_sizes,
+ uint32_t *supported_strip_size_count, lsm_flag flags);

/**
* Create a disk RAID pool and allocate entire full space to new volume.
@@ -902,11 +970,14 @@ typedef int (*lsm_plug_volume_raid_create_cap_get)(
* @param[in] flags Reserved, set to 0
* @return LSM_ERR_OK on success else error reason.
*/
-typedef int (*lsm_plug_volume_raid_create)(
- lsm_plugin_ptr c, const char *name, lsm_volume_raid_type raid_type,
- lsm_disk *disks[], uint32_t disk_count,
- uint32_t strip_size, lsm_volume **new_volume,
- lsm_flag flags);
+typedef int (*lsm_plug_volume_raid_create) (lsm_plugin_ptr c,
+ const char *name,
+ lsm_volume_raid_type raid_type,
+ lsm_disk * disks[],
+ uint32_t disk_count,
+ uint32_t strip_size,
+ lsm_volume ** new_volume,
+ lsm_flag flags);

/** \struct lsm_ops_v1_2
* \brief Functions added in version 1.2
@@ -927,7 +998,7 @@ struct lsm_ops_v1_2 {
* @param item Pointer to src
* @return Null, else copy of item.
*/
-void LSM_DLL_EXPORT * lsm_data_type_copy(lsm_data_type t, void *item);
+void LSM_DLL_EXPORT *lsm_data_type_copy(lsm_data_type t, void *item);

/**
* Initializes the plug-in.
@@ -939,9 +1010,11 @@ void LSM_DLL_EXPORT * lsm_data_type_copy(lsm_data_type t, void *item);
* @param version Plug-in version
* @return exit code for plug-in
*/
-int LSM_DLL_EXPORT lsm_plugin_init_v1( int argc, char *argv[], lsm_plugin_register reg,
- lsm_plugin_unregister unreg,
- const char *desc, const char *version);
+int LSM_DLL_EXPORT lsm_plugin_init_v1(int argc, char *argv[],
+ lsm_plugin_register reg,
+ lsm_plugin_unregister unreg,
+ const char *desc,
+ const char *version);


/**
@@ -954,10 +1027,12 @@ int LSM_DLL_EXPORT lsm_plugin_init_v1( int argc, char *argv[], lsm_plugin_regist
* @param nas_ops Function pointers for NAS operations
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_register_plugin_v1( lsm_plugin_ptr plug,
- void * private_data, struct lsm_mgmt_ops_v1 *mgm_ops,
- struct lsm_san_ops_v1 *san_ops, struct lsm_fs_ops_v1 *fs_ops,
- struct lsm_nas_ops_v1 *nas_ops );
+int LSM_DLL_EXPORT lsm_register_plugin_v1(lsm_plugin_ptr plug,
+ void *private_data,
+ struct lsm_mgmt_ops_v1 *mgm_ops,
+ struct lsm_san_ops_v1 *san_ops,
+ struct lsm_fs_ops_v1 *fs_ops,
+ struct lsm_nas_ops_v1 *nas_ops);

/**
* Used to register version 1.2 APIs plug-in operation.
@@ -971,17 +1046,19 @@ int LSM_DLL_EXPORT lsm_register_plugin_v1( lsm_plugin_ptr plug,
* @param ops_v1_2 Function pointers for struct lsm_ops_v1_2
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_register_plugin_v1_2(
- lsm_plugin_ptr plug,
- void * private_data, struct lsm_mgmt_ops_v1 *mgm_ops,
- struct lsm_san_ops_v1 *san_ops, struct lsm_fs_ops_v1 *fs_ops,
- struct lsm_nas_ops_v1 *nas_ops, struct lsm_ops_v1_2 *ops_v1_2);
+int LSM_DLL_EXPORT lsm_register_plugin_v1_2(lsm_plugin_ptr plug,
+ void *private_data,
+ struct lsm_mgmt_ops_v1 *mgm_ops,
+ struct lsm_san_ops_v1 *san_ops,
+ struct lsm_fs_ops_v1 *fs_ops,
+ struct lsm_nas_ops_v1 *nas_ops,
+ struct lsm_ops_v1_2 *ops_v1_2);

/**
* Used to retrieve private data for plug-in operation.
* @param plug Opaque plug-in pointer.
*/
-void LSM_DLL_EXPORT *lsm_private_data_get( lsm_plugin_ptr plug );
+void LSM_DLL_EXPORT *lsm_private_data_get(lsm_plugin_ptr plug);


/**
@@ -991,8 +1068,9 @@ void LSM_DLL_EXPORT *lsm_private_data_get( lsm_plugin_ptr plug );
* @param msg String message
* @return returns code
*/
-int LSM_DLL_EXPORT lsm_log_error_basic( lsm_plugin_ptr plug, lsm_error_number code,
- const char* msg );
+int LSM_DLL_EXPORT lsm_log_error_basic(lsm_plugin_ptr plug,
+ lsm_error_number code,
+ const char *msg);

/**
* Return an error with the plug-in
@@ -1000,7 +1078,8 @@ int LSM_DLL_EXPORT lsm_log_error_basic( lsm_plugin_ptr plug, lsm_error_number co
* @param error Error to associate.
* @return LSM_ERR_OK, else error reason.
*/
-int LSM_DLL_EXPORT lsm_plugin_error_log( lsm_plugin_ptr plug, lsm_error_ptr error);
+int LSM_DLL_EXPORT lsm_plugin_error_log(lsm_plugin_ptr plug,
+ lsm_error_ptr error);

/**
* Creates an error record.
@@ -1012,36 +1091,42 @@ int LSM_DLL_EXPORT lsm_plugin_error_log( lsm_plugin_ptr plug, lsm_error_ptr erro
* @param debug_data_size
* @return Null on error, else valid error error record.
*/
-lsm_error_ptr LSM_DLL_EXPORT lsm_error_create(lsm_error_number code, const char* msg,
- const char *exception, const char *debug,
- const void *debug_data, uint32_t debug_data_size);
+lsm_error_ptr LSM_DLL_EXPORT lsm_error_create(lsm_error_number code,
+ const char *msg,
+ const char *exception,
+ const char *debug,
+ const void *debug_data,
+ uint32_t debug_data_size);


/**
* Plug-in macros for creating errors
*/
-#define LSM_ERROR_CREATE_PLUGIN_MSG( code, msg ) \
- lsm_error_create(code, msg, NULL, NULL, NULL, 0)
+#define LSM_ERROR_CREATE_PLUGIN_MSG(code, msg) \
+ lsm_error_create(code, msg, NULL, NULL, NULL, 0)

-#define LSM_ERROR_CREATE_PLUGIN_EXCEPTION( code, msg, exception) \
- lsm_error_create((code), (msg), (exception), NULL, NULL, 0)
+#define LSM_ERROR_CREATE_PLUGIN_EXCEPTION(code, msg, exception) \
+ lsm_error_create((code), (msg), (exception), NULL, NULL, 0)

-#define LSM_ERROR_CREATE_PLUGIN_DEBUG( code, msg, exception, debug, debug_data, debug_len) \
- lsm_error_create((code), (msg), (exception), (debug), (debug_data), debug_len))
+#define LSM_ERROR_CREATE_PLUGIN_DEBUG(code, msg, exception, debug, \
+ debug_data, debug_len) \
+ lsm_error_create((code), (msg), (exception), (debug), \
+ (debug_data), debug_len)

/**
* Helper function to create an array of lsm_pool *
* @param size Number of elements
* @return Valid pointer or NULL on error.
*/
-lsm_pool LSM_DLL_EXPORT **lsm_pool_record_array_alloc( uint32_t size );
+lsm_pool LSM_DLL_EXPORT **lsm_pool_record_array_alloc(uint32_t size);

/**
* Used to set the free space on a pool record
* @param p Pool to modify
* @param free_space New free space value
*/
-void LSM_DLL_EXPORT lsm_pool_free_space_set(lsm_pool *p, uint64_t free_space);
+void LSM_DLL_EXPORT lsm_pool_free_space_set(lsm_pool *p,
+ uint64_t free_space);

/**
* Helper function to allocate a pool record.
@@ -1052,20 +1137,23 @@ void LSM_DLL_EXPORT lsm_pool_free_space_set(lsm_pool *p, uint64_t free_space);
* @param unsupported_actions Things you cannot do with this pool
* @param total_space Total space
* @param free_space Space available
- * @param status Pool status, bit field (See LSM_POOL_STATUS_XXXX constants)
+ * @param status Pool status, bit field (See LSM_POOL_STATUS_XXXX
+ * constants)
* @param status_info Additional textual information on status
* @param system_id System id
* @param plugin_data Reserved for plugin writer use
* @return LSM_ERR_OK on success, else error reason.
*/
-lsm_pool LSM_DLL_EXPORT *lsm_pool_record_alloc(const char *id, const char *name,
- uint64_t element_type,
- uint64_t unsupported_actions,
- uint64_t total_space,
- uint64_t free_space,
- uint64_t status, const char* status_info,
- const char *system_id,
- const char * plugin_data);
+lsm_pool LSM_DLL_EXPORT *lsm_pool_record_alloc(const char *id,
+ const char *name,
+ uint64_t element_type,
+ uint64_t unsupported_actions,
+ uint64_t total_space,
+ uint64_t free_space,
+ uint64_t status,
+ const char *status_info,
+ const char *system_id,
+ const char *plugin_data);

/**
* Used to retrieve the plugin-private data for a specfic pool
@@ -1079,7 +1167,7 @@ const char LSM_DLL_EXPORT *lsm_pool_plugin_data_get(lsm_pool *p);
* @param size Number of elements.
* @return Allocated memory or NULL on error.
*/
-lsm_volume LSM_DLL_EXPORT **lsm_volume_record_array_alloc( uint32_t size);
+lsm_volume LSM_DLL_EXPORT **lsm_volume_record_array_alloc(uint32_t size);


/**
@@ -1087,7 +1175,7 @@ lsm_volume LSM_DLL_EXPORT **lsm_volume_record_array_alloc( uint32_t size);
* @param size Number of elements
* @return Allocated memory or null on error.
*/
-lsm_disk LSM_DLL_EXPORT **lsm_disk_record_array_alloc( uint32_t size );
+lsm_disk LSM_DLL_EXPORT **lsm_disk_record_array_alloc(uint32_t size);


/**
@@ -1101,9 +1189,13 @@ lsm_disk LSM_DLL_EXPORT **lsm_disk_record_array_alloc( uint32_t size );
* @param system_id System id this disk resides in
* @return Pointer to allocated disk record or NULL on memory error.
*/
-lsm_disk LSM_DLL_EXPORT *lsm_disk_record_alloc(const char *id, const char *name,
- lsm_disk_type disk_type, uint64_t block_size, uint64_t block_count,
- uint64_t disk_status, const char *system_id);
+lsm_disk LSM_DLL_EXPORT *lsm_disk_record_alloc(const char *id,
+ const char *name,
+ lsm_disk_type disk_type,
+ uint64_t block_size,
+ uint64_t block_count,
+ uint64_t disk_status,
+ const char *system_id);

/**
* Allocated the storage needed for one volume record.
@@ -1119,27 +1211,28 @@ lsm_disk LSM_DLL_EXPORT *lsm_disk_record_alloc(const char *id, const char *name,
* @return Allocated memory or NULL on error.
*/
lsm_volume LSM_DLL_EXPORT *lsm_volume_record_alloc(const char *id,
- const char *name, const char *vpd83,
- uint64_t block_size,
- uint64_t number_of_blocks,
- uint32_t status,
- const char *system_id,
- const char *pool_id,
- const char* plugin_data);
+ const char *name,
+ const char *vpd83,
+ uint64_t block_size,
+ uint64_t number_of_blocks,
+ uint32_t status,
+ const char *system_id,
+ const char *pool_id,
+ const char *plugin_data);

/**
* Retrieve the private plug-in data from the volume record.
* @param v Volume pointer
* @return Private data, else NULL if it doesn't exist.
*/
-const char LSM_DLL_EXPORT *lsm_volume_plugin_data_get( lsm_volume *v);
+const char LSM_DLL_EXPORT *lsm_volume_plugin_data_get(lsm_volume *v);

/**
* Allocate the storage needed for and array of System records.
* @param size Number of elements.
* @return Allocated memory or NULL on error.
*/
-lsm_system LSM_DLL_EXPORT **lsm_system_record_array_alloc( uint32_t size );
+lsm_system LSM_DLL_EXPORT **lsm_system_record_array_alloc(uint32_t size);

/**
* Allocates the storage for one system record.
@@ -1151,24 +1244,25 @@ lsm_system LSM_DLL_EXPORT **lsm_system_record_array_alloc( uint32_t size );
* @return Allocated memory or NULL on error.
*/
lsm_system LSM_DLL_EXPORT *lsm_system_record_alloc(const char *id,
- const char *name,
- uint32_t status,
- const char *status_info,
- const char* plugin_data);
+ const char *name,
+ uint32_t status,
+ const char *status_info,
+ const char *plugin_data);

/**
* Retrieve plugin private data
* @param s System
* @return Optional data, NULL if none exist
*/
-const char LSM_DLL_EXPORT *lsm_system_plugin_data_get( lsm_system *s);
+const char LSM_DLL_EXPORT *lsm_system_plugin_data_get(lsm_system *s);

/**
* Allocates storage for Access_group array
* @param size Number of elements to store.
* @return NULL on error, else pointer to array for use.
*/
-lsm_access_group LSM_DLL_EXPORT **lsm_access_group_record_array_alloc( uint32_t size);
+lsm_access_group LSM_DLL_EXPORT **
+ lsm_access_group_record_array_alloc(uint32_t size);


/**
@@ -1181,12 +1275,12 @@ lsm_access_group LSM_DLL_EXPORT **lsm_access_group_record_array_alloc( uint32_t
* @param plugin_data Reserved for plug-in use only
* @return NULL on error, else valid lsm_access_group pointer.
*/
-lsm_access_group LSM_DLL_EXPORT * lsm_access_group_record_alloc(const char *id,
- const char *name,
- lsm_string_list *initiators,
- lsm_access_group_init_type init_type,
- const char *system_id,
- const char *plugin_data);
+lsm_access_group LSM_DLL_EXPORT *
+ lsm_access_group_record_alloc(const char *id, const char *name,
+ lsm_string_list *initiators,
+ lsm_access_group_init_type init_type,
+ const char *system_id,
+ const char *plugin_data);


/**
@@ -1194,8 +1288,8 @@ lsm_access_group LSM_DLL_EXPORT * lsm_access_group_record_alloc(const char *id,
* @param group Access group to change initiators for
* @param il String list of initiators.
*/
-void LSM_DLL_EXPORT lsm_access_group_initiator_id_set( lsm_access_group *group,
- lsm_string_list *il);
+void LSM_DLL_EXPORT lsm_access_group_initiator_id_set(lsm_access_group *group,
+ lsm_string_list *il);

/**
* Allocates memory for a file system record
@@ -1208,19 +1302,20 @@ void LSM_DLL_EXPORT lsm_access_group_initiator_id_set( lsm_access_group *group,
* @param plugin_data Reserved for plug-in use only
* @return lsm_fs, NULL on error
*/
-lsm_fs LSM_DLL_EXPORT *lsm_fs_record_alloc(const char *id, const char *name,
- uint64_t total_space,
- uint64_t free_space,
- const char *pool_id,
- const char *system_id,
- const char* plugin_data);
+lsm_fs LSM_DLL_EXPORT *lsm_fs_record_alloc(const char *id,
+ const char *name,
+ uint64_t total_space,
+ uint64_t free_space,
+ const char *pool_id,
+ const char *system_id,
+ const char *plugin_data);

/**
* Allocates the memory for the array of file system records.
* @param size Number of elements
* @return Allocated memory, NULL on error
*/
-lsm_fs LSM_DLL_EXPORT **lsm_fs_record_array_alloc( uint32_t size );
+lsm_fs LSM_DLL_EXPORT **lsm_fs_record_array_alloc(uint32_t size);

/**
* Used to retrieve the plug-in private data for a specific pool
@@ -1238,23 +1333,23 @@ const char LSM_DLL_EXPORT *lsm_fs_plugin_data_get(lsm_fs *fs);
* @return Allocated memory, NULL on error
*/
lsm_fs_ss LSM_DLL_EXPORT *lsm_fs_ss_record_alloc(const char *id,
- const char *name,
- uint64_t ts,
- const char * plugin_data);
+ const char *name,
+ uint64_t ts,
+ const char *plugin_data);

/**
* Allocates the memory for an array of snapshot records.
* @param size Number of elements
* @return Allocated memory, NULL on error
*/
-lsm_fs_ss LSM_DLL_EXPORT **lsm_fs_ss_record_array_alloc( uint32_t size );
+lsm_fs_ss LSM_DLL_EXPORT **lsm_fs_ss_record_array_alloc(uint32_t size);

/**
* Retrieve private data from fs_ss.
* @param fs_ss Valid fs_ss record
* @return Private data, else NULL
*/
-const char LSM_DLL_EXPORT *lsm_fs_ss_plugin_data_get( lsm_fs_ss *fs_ss );
+const char LSM_DLL_EXPORT *lsm_fs_ss_plugin_data_get(lsm_fs_ss * fs_ss);

/**
* Set a capability
@@ -1263,8 +1358,9 @@ const char LSM_DLL_EXPORT *lsm_fs_ss_plugin_data_get( lsm_fs_ss *fs_ss );
* @param v Value of the capability
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_capability_set(lsm_storage_capabilities *cap, lsm_capability_type t,
- lsm_capability_value_type v);
+int LSM_DLL_EXPORT lsm_capability_set(lsm_storage_capabilities * cap,
+ lsm_capability_type t,
+ lsm_capability_value_type v);

/**
* Sets 1 or more capabilities with the same value v
@@ -1274,15 +1370,16 @@ int LSM_DLL_EXPORT lsm_capability_set(lsm_storage_capabilities *cap, lsm_capabil
* with a -1)
* @return LSM_ERR_OK on success, else error reason
*/
-int LSM_DLL_EXPORT lsm_capability_set_n( lsm_storage_capabilities *cap,
- lsm_capability_value_type v, ... );
+int LSM_DLL_EXPORT lsm_capability_set_n(lsm_storage_capabilities * cap,
+ lsm_capability_value_type v, ...);

/**
* Allocated storage for capabilities
* @param value Set to NULL, used during serialization otherwise.
* @return Allocated record, or NULL on memory allocation failure.
*/
-lsm_storage_capabilities LSM_DLL_EXPORT *lsm_capability_record_alloc(char const *value);
+lsm_storage_capabilities LSM_DLL_EXPORT
+ * lsm_capability_record_alloc(char const *value);

/**
* Convenience function for plug-in writer.
@@ -1296,9 +1393,9 @@ lsm_storage_capabilities LSM_DLL_EXPORT *lsm_capability_record_alloc(char const
* @param[out] query_params returned query params
* @return LSM_ERR_OK on successful parse, else error reason.
*/
-int LSM_DLL_EXPORT lsm_uri_parse(const char *uri, char **scheme, char **user,
- char **server, int *port, char **path,
- lsm_hash **query_params);
+int LSM_DLL_EXPORT lsm_uri_parse(const char *uri, char **scheme,
+ char **user, char **server, int *port,
+ char **path, lsm_hash **query_params);

/**
* Provides for volume filtering when an array doesn't support this natively.
@@ -1309,9 +1406,9 @@ int LSM_DLL_EXPORT lsm_uri_parse(const char *uri, char **scheme, char **user,
* @param[in,out] count Number of volumes to filter, number remain
*/
void LSM_DLL_EXPORT lsm_plug_volume_search_filter(const char *search_key,
- const char *search_value,
- lsm_volume *vols[],
- uint32_t *count);
+ const char *search_value,
+ lsm_volume *vols[],
+ uint32_t *count);

/**
* Provides for pool filtering when an array doesn't support this natively.
@@ -1321,9 +1418,10 @@ void LSM_DLL_EXPORT lsm_plug_volume_search_filter(const char *search_key,
* @param[in,out] pools Array to filter
* @param[in,out] count Number of pools to filter, number remain
*/
-void LSM_DLL_EXPORT lsm_plug_pool_search_filter( const char *search_key,
- const char *search_value,
- lsm_pool *pools[], uint32_t *count);
+void LSM_DLL_EXPORT lsm_plug_pool_search_filter(const char *search_key,
+ const char *search_value,
+ lsm_pool *pools[],
+ uint32_t *count);

/**
* Provides for disk filtering when an array doesn't support this natively.
@@ -1334,8 +1432,9 @@ void LSM_DLL_EXPORT lsm_plug_pool_search_filter( const char *search_key,
* @param[in,out] count Number of disks to filter, number remain
*/
void LSM_DLL_EXPORT lsm_plug_disk_search_filter(const char *search_key,
- const char *search_value,
- lsm_disk *disks[], uint32_t *count);
+ const char *search_value,
+ lsm_disk *disks[],
+ uint32_t *count);

/**
* Provides for access group filtering when an array doesn't support this
@@ -1346,9 +1445,11 @@ void LSM_DLL_EXPORT lsm_plug_disk_search_filter(const char *search_key,
* @param[in,out] ag Array to filter
* @param[in,out] count Number of access groups to filter, number remain
*/
-void LSM_DLL_EXPORT lsm_plug_access_group_search_filter(const char *search_key,
- const char *search_value,
- lsm_access_group *ag[], uint32_t *count);
+void LSM_DLL_EXPORT
+ lsm_plug_access_group_search_filter(const char *search_key,
+ const char *search_value,
+ lsm_access_group *ag[],
+ uint32_t *count);

/**
* Provides for fs filtering when an array doesn't support this natively.
@@ -1359,8 +1460,8 @@ void LSM_DLL_EXPORT lsm_plug_access_group_search_filter(const char *search_key,
* @param[in,out] count Number of file systems to filter, number remain
*/
void LSM_DLL_EXPORT lsm_plug_fs_search_filter(const char *search_key,
- const char *search_value,
- lsm_fs *fs[], uint32_t *count);
+ const char *search_value,
+ lsm_fs *fs[], uint32_t *count);

/**
* Provides for nfs filtering when an array doesn't support this natively.
@@ -1370,17 +1471,19 @@ void LSM_DLL_EXPORT lsm_plug_fs_search_filter(const char *search_key,
* @param[in,out] exports Array to filter
* @param[in,out] count Number of nfs exports to filter, number remain
*/
-void LSM_DLL_EXPORT lsm_plug_nfs_export_search_filter(const char *search_key,
- const char *search_value,
- lsm_nfs_export *exports[],
- uint32_t *count);
+void LSM_DLL_EXPORT
+ lsm_plug_nfs_export_search_filter(const char *search_key,
+ const char *search_value,
+ lsm_nfs_export *exports[],
+ uint32_t *count);

/**
* Retrieve private data from nfs export record.
* @param exp Valid nfs export record
* @return Private data, else NULL
*/
-const char LSM_DLL_EXPORT *lsm_nfs_export_plugin_data_get( lsm_nfs_export *exp);
+const char LSM_DLL_EXPORT *
+ lsm_nfs_export_plugin_data_get(lsm_nfs_export *exp);


/**
@@ -1395,30 +1498,31 @@ const char LSM_DLL_EXPORT *lsm_nfs_export_plugin_data_get( lsm_nfs_export *exp);
* @param plugin_data Plug-in data
* @return valid lsm_target_port, else NULL on memory allocation failure
*/
-lsm_target_port LSM_DLL_EXPORT *lsm_target_port_record_alloc(
- const char *id,
- lsm_target_port_type port_type,
- const char *service_address,
- const char *network_address,
- const char *physical_address,
- const char *physical_name,
- const char *system_id,
- const char *plugin_data);
+lsm_target_port LSM_DLL_EXPORT *
+ lsm_target_port_record_alloc(const char *id,
+ lsm_target_port_type port_type,
+ const char *service_address,
+ const char *network_address,
+ const char *physical_address,
+ const char *physical_name,
+ const char *system_id,
+ const char *plugin_data);

/**
* Retrieve the plug-in private data pointer
* @param tp Valid target port pointer
* @return Character pointer to string, NULL on error
*/
-const char LSM_DLL_EXPORT *lsm_target_port_plugin_data_get(lsm_target_port *tp);
+const char LSM_DLL_EXPORT *
+ lsm_target_port_plugin_data_get(lsm_target_port *tp);

/**
* Allocated an array of target pointers
* @param size Number of pointers to store
* @return Allocated memory, NULL on allocation errors
*/
-lsm_target_port LSM_DLL_EXPORT **lsm_target_port_record_array_alloc(
- uint32_t size );
+lsm_target_port LSM_DLL_EXPORT **
+ lsm_target_port_record_array_alloc(uint32_t size);


/**
@@ -1430,13 +1534,13 @@ lsm_target_port LSM_DLL_EXPORT **lsm_target_port_record_array_alloc(
* @param[in,out] tp Array to filter
* @param[in,out] count Number of target ports to filter, number remain
*/
-void LSM_DLL_EXPORT lsm_plug_target_port_search_filter(const char *search_key,
- const char *search_value,
- lsm_target_port *tp[],
- uint32_t *count);
+void LSM_DLL_EXPORT
+ lsm_plug_target_port_search_filter(const char *search_key,
+ const char *search_value,
+ lsm_target_port *tp[],
+ uint32_t *count);

#ifdef __cplusplus
}
#endif
-
-#endif /* LIBSTORAGEMGMT_PLUG_INTERFACE_H */
+#endif /* LIBSTORAGEMGMT_PLUG_INTERFACE_H */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_pool.h b/c_binding/include/libstoragemgmt/libstoragemgmt_pool.h
index 6ddfed0..7a82078 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_pool.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_pool.h
@@ -32,7 +32,7 @@ extern "C" {
* @param size Size of the pool array.
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_pool_record_array_free( lsm_pool *pa[], uint32_t size );
+int LSM_DLL_EXPORT lsm_pool_record_array_free(lsm_pool *pa[], uint32_t size);

/**
* Frees the memory for an individual pool
@@ -46,7 +46,7 @@ int LSM_DLL_EXPORT lsm_pool_record_free(lsm_pool *p);
* @param to_be_copied Record to be copied
* @return NULL on memory exhaustion, else copy.
*/
-lsm_pool LSM_DLL_EXPORT *lsm_pool_record_copy( lsm_pool *to_be_copied);
+lsm_pool LSM_DLL_EXPORT *lsm_pool_record_copy(lsm_pool *to_be_copied);

/**
* Retrieves the name from the pool.
@@ -54,7 +54,7 @@ lsm_pool LSM_DLL_EXPORT *lsm_pool_record_copy( lsm_pool *to_be_copied);
* @param p Pool
* @return The name of the pool.
*/
-char LSM_DLL_EXPORT *lsm_pool_name_get( lsm_pool *p );
+char LSM_DLL_EXPORT *lsm_pool_name_get(lsm_pool *p);

/**
* Retrieves the system wide unique identifier for the pool.
@@ -62,21 +62,21 @@ char LSM_DLL_EXPORT *lsm_pool_name_get( lsm_pool *p );
* @param p Pool
* @return The System wide unique identifier.
*/
-char LSM_DLL_EXPORT *lsm_pool_id_get( lsm_pool *p );
+char LSM_DLL_EXPORT *lsm_pool_id_get(lsm_pool *p);

/**
* Retrieves the total space for the pool.
* @param p Pool
* @return Total space of the pool.
*/
-uint64_t LSM_DLL_EXPORT lsm_pool_total_space_get( lsm_pool *p );
+uint64_t LSM_DLL_EXPORT lsm_pool_total_space_get(lsm_pool *p);

/**
* Retrieves the remaining free space in the pool.
* @param p Pool
* @return The amount of free space.
*/
-uint64_t LSM_DLL_EXPORT lsm_pool_free_space_get( lsm_pool *p );
+uint64_t LSM_DLL_EXPORT lsm_pool_free_space_get(lsm_pool *p);

/**
* Retrieve the status for the Pool.
@@ -84,38 +84,37 @@ uint64_t LSM_DLL_EXPORT lsm_pool_free_space_get( lsm_pool *p );
* @return Pool status which is a bit sensitive field, returns UINT64_MAX on
* bad pool pointer.
*/
-uint64_t LSM_DLL_EXPORT lsm_pool_status_get( lsm_pool *s );
+uint64_t LSM_DLL_EXPORT lsm_pool_status_get(lsm_pool *s);

/**
* Retrieve the status info for the Pool.
* @param s Pool to retrieve status for
* @return Pool status info which is a character string.
*/
-const char LSM_DLL_EXPORT *lsm_pool_status_info_get( lsm_pool *s );
+const char LSM_DLL_EXPORT *lsm_pool_status_info_get(lsm_pool *s);

/**
* Retrieve the system id for the specified pool.
* @param p Pool pointer
* @return System ID
*/
-char LSM_DLL_EXPORT *lsm_pool_system_id_get( lsm_pool *p );
+char LSM_DLL_EXPORT *lsm_pool_system_id_get(lsm_pool *p);

/**
* Retrieve what the pool can be used to create
* @param p Pool pointer
* @return Usage value
*/
-uint64_t LSM_DLL_EXPORT lsm_pool_element_type_get( lsm_pool *p );
+uint64_t LSM_DLL_EXPORT lsm_pool_element_type_get(lsm_pool *p);

/**
* Retrieve what the pool cannot be used for.
* @param p Pool pointer
* @return bitmap of actions not supported.
*/
-uint64_t LSM_DLL_EXPORT lsm_pool_unsupported_actions_get( lsm_pool *p);
+uint64_t LSM_DLL_EXPORT lsm_pool_unsupported_actions_get(lsm_pool *p);

#ifdef __cplusplus
}
#endif
-
-#endif /* LIBSTORAGEMGMT_POOL_H */
+#endif /* LIBSTORAGEMGMT_POOL_H */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_snapshot.h b/c_binding/include/libstoragemgmt/libstoragemgmt_snapshot.h
index 393596b..5e3b3ba 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_snapshot.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_snapshot.h
@@ -12,7 +12,8 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
*
* Author: tasleson
*/
@@ -72,5 +73,4 @@ uint64_t LSM_DLL_EXPORT lsm_fs_ss_time_stamp_get(lsm_fs_ss *ss);
#ifdef __cplusplus
}
#endif
-
-#endif
\ No newline at end of file
+#endif
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h b/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
index 9c59062..3785a45 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
@@ -47,7 +47,7 @@ int LSM_DLL_EXPORT lsm_system_record_free(lsm_system *s);
* @param size Number of elements.
* @return LSM_ERR_OK on success, else error reason.
* */
-int LSM_DLL_EXPORT lsm_system_record_array_free(lsm_system *s[], uint32_t size );
+int LSM_DLL_EXPORT lsm_system_record_array_free(lsm_system *s[], uint32_t size);

/**
* Retrieve the Id for the system.
@@ -79,5 +79,4 @@ uint32_t LSM_DLL_EXPORT lsm_system_status_get(lsm_system *s);
#ifdef __cplusplus
}
#endif
-
-#endif
\ No newline at end of file
+#endif
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_targetport.h b/c_binding/include/libstoragemgmt/libstoragemgmt_targetport.h
index a392ed4..c14d0d0 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_targetport.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_targetport.h
@@ -48,8 +48,8 @@ int LSM_DLL_EXPORT lsm_target_port_record_free(lsm_target_port *tp);
* @param size Number of elements.
* @return LSM_ERR_OK on success, else error reason.
* */
-int LSM_DLL_EXPORT lsm_target_port_record_array_free(lsm_target_port *tp[],
- uint32_t size );
+int LSM_DLL_EXPORT lsm_target_port_record_array_free(lsm_target_port *
+ tp[], uint32_t size);

/**
* Returns the ID of the target port
@@ -63,45 +63,50 @@ const char LSM_DLL_EXPORT *lsm_target_port_id_get(lsm_target_port *tp);
* @param tp lsm_target_port record
* @return enumerated value
*/
-lsm_target_port_type LSM_DLL_EXPORT lsm_target_port_type_get(lsm_target_port *tp);
+lsm_target_port_type LSM_DLL_EXPORT
+ lsm_target_port_type_get(lsm_target_port *tp);

/**
* Returns the service address
* @param tp lsm_target_port record
* @return Service address, NULL on error
*/
-const char LSM_DLL_EXPORT *lsm_target_port_service_address_get(lsm_target_port *tp);
+const char LSM_DLL_EXPORT *
+ lsm_target_port_service_address_get(lsm_target_port *tp);

/**
* Returns the network address
* @param tp lsm_target_port record
* @return Network address, NULL on error
*/
-const char LSM_DLL_EXPORT *lsm_target_port_network_address_get(lsm_target_port *tp);
+const char LSM_DLL_EXPORT *
+ lsm_target_port_network_address_get(lsm_target_port *tp);

/**
* Returns the physical address
* @param tp lsm_target_port record
* @return Physical address, NULL on error
*/
-const char LSM_DLL_EXPORT *lsm_target_port_physical_address_get(lsm_target_port *tp);
+const char LSM_DLL_EXPORT *
+ lsm_target_port_physical_address_get(lsm_target_port *tp);

/**
* Returns the physical name
* @param tp lsm_target_port record
* @return Physical name, NULL on error
*/
-const char LSM_DLL_EXPORT *lsm_target_port_physical_name_get(lsm_target_port *tp);
+const char LSM_DLL_EXPORT *
+ lsm_target_port_physical_name_get(lsm_target_port *tp);

/**
* Returns the system_id
* @param tp lsm_target_port record
* @return System id, NULL on error
*/
-const char LSM_DLL_EXPORT *lsm_target_port_system_id_get(lsm_target_port *tp);
+const char LSM_DLL_EXPORT *
+ lsm_target_port_system_id_get(lsm_target_port *tp);

#ifdef __cplusplus
}
#endif
-
-#endif
\ No newline at end of file
+#endif
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_types.h b/c_binding/include/libstoragemgmt/libstoragemgmt_types.h
index be2acf9..17d8879 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_types.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_types.h
@@ -22,8 +22,8 @@


#ifdef __cplusplus
- #define __STDC_FORMAT_MACROS
- #define __STDC_LIMIT_MACROS
+#define __STDC_FORMAT_MACROS
+#define __STDC_LIMIT_MACROS
#endif
#include <inttypes.h>

@@ -114,24 +114,35 @@ typedef struct _lsm_hash lsm_hash;
*/
typedef struct _lsm_target_port lsm_target_port;

-/**< \enum lsm_replication_type Different types of replications that can be created */
+/**< \enum lsm_replication_type Different types of replications that can be
+ * created */
typedef enum {
- LSM_VOLUME_REPLICATE_UNKNOWN = -1, /**< Unknown replicate */
- LSM_VOLUME_REPLICATE_CLONE = 2, /**< Space efficient copy */
- LSM_VOLUME_REPLICATE_COPY = 3, /**< Full bitwise copy */
- LSM_VOLUME_REPLICATE_MIRROR_SYNC = 4, /**< Mirrors always in sync */
- LSM_VOLUME_REPLICATE_MIRROR_ASYNC = 5 /**< Mirror partner updated with delay */
+ LSM_VOLUME_REPLICATE_UNKNOWN = -1,
+ /**^ Unknown replicate */
+ LSM_VOLUME_REPLICATE_CLONE = 2,
+ /**^ Space efficient copy */
+ LSM_VOLUME_REPLICATE_COPY = 3,
+ /**^ Full bitwise copy */
+ LSM_VOLUME_REPLICATE_MIRROR_SYNC = 4,
+ /**^ Mirrors always in sync */
+ LSM_VOLUME_REPLICATE_MIRROR_ASYNC = 5
+ /**^ Mirror partner updated with delay */
} lsm_replication_type;

/**< \enum lsm_volume_provision_type Different types of provisioning */
typedef enum {
- LSM_VOLUME_PROVISION_UNKNOWN = -1, /**< Unknown */
- LSM_VOLUME_PROVISION_THIN = 1, /**< Thin provisioning */
- LSM_VOLUME_PROVISION_FULL = 2, /**< Thick provisioning */
- LSM_VOLUME_PROVISION_DEFAULT = 3 /**< Default provisioning */
+ LSM_VOLUME_PROVISION_UNKNOWN = -1,
+ /**^ Unknown */
+ LSM_VOLUME_PROVISION_THIN = 1,
+ /**^ Thin provisioning */
+ LSM_VOLUME_PROVISION_FULL = 2,
+ /**^ Thick provisioning */
+ LSM_VOLUME_PROVISION_DEFAULT = 3
+ /**^ Default provisioning */
} lsm_volume_provision_type;

-/**< \enum lsm_volume_raid_type Different types of RAID */
+
+ /**^ \enum lsm_volume_raid_type Different types of RAID */
typedef enum {
LSM_VOLUME_RAID_TYPE_UNKNOWN = -1,
/**^ Unknown */
@@ -169,7 +180,8 @@ typedef enum {
/**^ Vendor specific RAID type */
} lsm_volume_raid_type;

-/**< \enum lsm_pool_member_type Different types of Pool member*/
+
+ /**^ \enum lsm_pool_member_type Different types of Pool member*/
typedef enum {
LSM_POOL_MEMBER_TYPE_UNKNOWN = 0,
/**^ Plugin failed to detect the RAID member type. */
@@ -194,34 +206,51 @@ typedef enum {
/**
* Admin state for volume, enabled or disabled
*/
-#define LSM_VOLUME_ADMIN_STATE_ENABLED 0x1 /**< Volume accessible */
-#define LSM_VOLUME_ADMIN_STATE_DISABLED 0x0 /**< Volume unaccessible */
+#define LSM_VOLUME_ADMIN_STATE_ENABLED 0x1
+ /**^ Volume accessible */
+#define LSM_VOLUME_ADMIN_STATE_DISABLED 0x0
+ /**^ Volume unaccessible */

/**
* Different states a system status can be in.
* Bit field, can be in multiple states at the same time.
*/
-#define LSM_SYSTEM_STATUS_UNKNOWN 0x00000001 /**< Unknown */
-#define LSM_SYSTEM_STATUS_OK 0x00000002 /**< OK */
-#define LSM_SYSTEM_STATUS_ERROR 0x00000004 /**< Error(s) exist */
-#define LSM_SYSTEM_STATUS_DEGRADED 0x00000008 /**< Degraded */
-#define LSM_SYSTEM_STATUS_PREDICTIVE_FAILURE 0x00000010 /**< System has predictive failure(s) */
-#define LSM_SYSTEM_STATUS_OTHER 0x00000020 /**< Vendor specific */
+#define LSM_SYSTEM_STATUS_UNKNOWN 0x00000001
+ /**^ Unknown */
+#define LSM_SYSTEM_STATUS_OK 0x00000002
+ /**^ OK */
+#define LSM_SYSTEM_STATUS_ERROR 0x00000004
+ /**^ Error(s) exist */
+#define LSM_SYSTEM_STATUS_DEGRADED 0x00000008
+ /**^ Degraded */
+#define LSM_SYSTEM_STATUS_PREDICTIVE_FAILURE 0x00000010
+ /**^ System has predictive failure(s) */
+#define LSM_SYSTEM_STATUS_OTHER 0x00000020
+ /**^ Vendor specific */


typedef enum {
- LSM_ACCESS_GROUP_INIT_TYPE_UNKNOWN = 0, /**< Unknown */
- LSM_ACCESS_GROUP_INIT_TYPE_OTHER = 1, /**< Something not seen before */
- LSM_ACCESS_GROUP_INIT_TYPE_WWPN = 2, /**< Port name */
- LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_IQN = 5, /**< ISCSI IQN */
- LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_WWPN_MIXED = 7 /**< More than 1 type */
+ LSM_ACCESS_GROUP_INIT_TYPE_UNKNOWN = 0,
+ /**^ Unknown */
+ LSM_ACCESS_GROUP_INIT_TYPE_OTHER = 1,
+ /**^ Something not seen before */
+ LSM_ACCESS_GROUP_INIT_TYPE_WWPN = 2,
+ /**^ Port name */
+ LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_IQN = 5,
+ /**^ ISCSI IQN */
+ LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_WWPN_MIXED = 7
+ /**^ More than 1 type */
} lsm_access_group_init_type;

-/**< \enum lsm_job_status Job states */
+
+ /**^ \enum lsm_job_status Job states */
typedef enum {
- LSM_JOB_INPROGRESS = 1, /**< Job is in progress */
- LSM_JOB_COMPLETE = 2, /**< Job is complete */
- LSM_JOB_ERROR = 3 /**< Job has errored */
+ LSM_JOB_INPROGRESS = 1,
+ /**^ Job is in progress */
+ LSM_JOB_COMPLETE = 2,
+ /**^ Job is complete */
+ LSM_JOB_ERROR = 3
+ /**^ Job has errored */
} lsm_job_status;

typedef enum {
@@ -303,5 +332,4 @@ typedef enum {
#ifdef __cplusplus
}
#endif
-
-#endif /* LIBSTORAGEMGMT_TYPES_H */
+#endif /* LIBSTORAGEMGMT_TYPES_H */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_volumes.h b/c_binding/include/libstoragemgmt/libstoragemgmt_volumes.h
index ee03010..c7072cb 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_volumes.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_volumes.h
@@ -46,7 +46,8 @@ lsm_volume LSM_DLL_EXPORT *lsm_volume_record_copy(lsm_volume *vol);
* @param size Size of array.
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_EXPORT lsm_volume_record_array_free( lsm_volume *init[], uint32_t size);
+int LSM_DLL_EXPORT lsm_volume_record_array_free(lsm_volume *init[],
+ uint32_t size);

/**
* Retrieves the volume id.
@@ -100,17 +101,16 @@ uint32_t LSM_DLL_EXPORT lsm_volume_admin_state_get(lsm_volume *v);
* @param v Volume ptr.
* @return System id.
*/
-char LSM_DLL_EXPORT *lsm_volume_system_id_get( lsm_volume *v);
+char LSM_DLL_EXPORT *lsm_volume_system_id_get(lsm_volume *v);

/**
* Retrieves the pool id that the volume is derived from.
* @param v Volume ptr.
* @return Pool id.
*/
-char LSM_DLL_EXPORT *lsm_volume_pool_id_get( lsm_volume *v);
+char LSM_DLL_EXPORT *lsm_volume_pool_id_get(lsm_volume *v);

#ifdef __cplusplus
}
#endif
-
-#endif /* LIBSTORAGEMGMT_VOLUMES_H */
+#endif /* LIBSTORAGEMGMT_VOLUMES_H */
diff --git a/c_binding/lsm_convert.cpp b/c_binding/lsm_convert.cpp
index f39406c..4d9356c 100644
--- a/c_binding/lsm_convert.cpp
+++ b/c_binding/lsm_convert.cpp
@@ -12,7 +12,8 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
*
* Author: tasleson
*/
@@ -22,11 +23,11 @@
#include "libstoragemgmt/libstoragemgmt_blockrange.h"
#include "libstoragemgmt/libstoragemgmt_nfsexport.h"

-bool is_expected_object(Value &obj, std::string class_name)
+bool is_expected_object(Value & obj, std::string class_name)
{
if (obj.valueType() == Value::object_t) {
- std::map<std::string, Value> i = obj.asObject();
- std::map<std::string, Value>::iterator iter = i.find("class");
+ std::map < std::string, Value > i = obj.asObject();
+ std::map < std::string, Value >::iterator iter = i.find("class");
if (iter != i.end() && iter->second.asString() == class_name) {
return true;
}
@@ -34,22 +35,22 @@ bool is_expected_object(Value &obj, std::string class_name)
return false;
}

-lsm_volume *value_to_volume(Value &vol)
+lsm_volume *value_to_volume(Value & vol)
{
lsm_volume *rc = NULL;

if (is_expected_object(vol, CLASS_NAME_VOLUME)) {
- std::map<std::string, Value> v = vol.asObject();
+ std::map < std::string, Value > v = vol.asObject();

rc = lsm_volume_record_alloc(v["id"].asString().c_str(),
- v["name"].asString().c_str(),
- v["vpd83"].asString().c_str(),
- v["block_size"].asUint64_t(),
- v["num_of_blocks"].asUint64_t(),
- v["admin_state"].asUint32_t(),
- v["system_id"].asString().c_str(),
- v["pool_id"].asString().c_str(),
- v["plugin_data"].asC_str());
+ v["name"].asString().c_str(),
+ v["vpd83"].asString().c_str(),
+ v["block_size"].asUint64_t(),
+ v["num_of_blocks"].asUint64_t(),
+ v["admin_state"].asUint32_t(),
+ v["system_id"].asString().c_str(),
+ v["pool_id"].asString().c_str(),
+ v["plugin_data"].asC_str());
} else {
throw ValueException("value_to_volume: Not correct type");
}
@@ -57,10 +58,10 @@ lsm_volume *value_to_volume(Value &vol)
return rc;
}

-Value volume_to_value(lsm_volume *vol)
+Value volume_to_value(lsm_volume * vol)
{
- if( LSM_IS_VOL(vol) ) {
- std::map<std::string, Value> v;
+ if (LSM_IS_VOL(vol)) {
+ std::map < std::string, Value > v;
v["class"] = Value(CLASS_NAME_VOLUME);
v["id"] = Value(vol->id);
v["name"] = Value(vol->name);
@@ -76,25 +77,25 @@ Value volume_to_value(lsm_volume *vol)
return Value();
}

-int value_array_to_volumes(Value &volume_values, lsm_volume **volumes[],
- uint32_t *count)
+int value_array_to_volumes(Value & volume_values, lsm_volume ** volumes[],
+ uint32_t * count)
{
int rc = LSM_ERR_OK;
try {
*count = 0;

- if( Value::array_t == volume_values.valueType()) {
- std::vector<Value> vol = volume_values.asArray();
+ if (Value::array_t == volume_values.valueType()) {
+ std::vector < Value > vol = volume_values.asArray();

*count = vol.size();

- if( vol.size() ) {
+ if (vol.size()) {
*volumes = lsm_volume_record_array_alloc(vol.size());

- if( *volumes ){
- for( size_t i = 0; i < vol.size(); ++i ) {
+ if (*volumes) {
+ for (size_t i = 0; i < vol.size(); ++i) {
(*volumes)[i] = value_to_volume(vol[i]);
- if( !((*volumes)[i]) ) {
+ if (!((*volumes)[i])) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}
@@ -104,16 +105,17 @@ int value_array_to_volumes(Value &volume_values, lsm_volume **volumes[],
}
}
}
- } catch( const ValueException &ve) {
+ }
+ catch(const ValueException & ve) {
rc = LSM_ERR_LIB_BUG;
goto error;
}

-out:
+ out:
return rc;

-error:
- if( *volumes && *count ) {
+ error:
+ if (*volumes && *count) {
lsm_volume_record_array_free(*volumes, *count);
*volumes = NULL;
*count = 0;
@@ -121,19 +123,19 @@ error:
goto out;
}

-lsm_disk *value_to_disk(Value &disk)
+lsm_disk *value_to_disk(Value & disk)
{
lsm_disk *rc = NULL;
if (is_expected_object(disk, CLASS_NAME_DISK)) {
- std::map<std::string, Value> d = disk.asObject();
+ std::map < std::string, Value > d = disk.asObject();

rc = lsm_disk_record_alloc(d["id"].asString().c_str(),
- d["name"].asString().c_str(),
- (lsm_disk_type)d["disk_type"].asInt32_t(),
- d["block_size"].asUint64_t(),
- d["num_of_blocks"].asUint64_t(),
- d["status"].asUint64_t(),
- d["system_id"].asString().c_str()
+ d["name"].asString().c_str(),
+ (lsm_disk_type) d["disk_type"].asInt32_t(),
+ d["block_size"].asUint64_t(),
+ d["num_of_blocks"].asUint64_t(),
+ d["status"].asUint64_t(),
+ d["system_id"].asString().c_str()
);
} else {
throw ValueException("value_to_disk: Not correct type");
@@ -142,10 +144,10 @@ lsm_disk *value_to_disk(Value &disk)
}


-Value disk_to_value(lsm_disk *disk)
+Value disk_to_value(lsm_disk * disk)
{
- if ( LSM_IS_DISK(disk) ) {
- std::map<std::string, Value> d;
+ if (LSM_IS_DISK(disk)) {
+ std::map < std::string, Value > d;
d["class"] = Value(CLASS_NAME_DISK);
d["id"] = Value(disk->id);
d["name"] = Value(disk->name);
@@ -160,24 +162,25 @@ Value disk_to_value(lsm_disk *disk)
return Value();
}

-int value_array_to_disks(Value &disk_values, lsm_disk **disks[], uint32_t *count)
+int value_array_to_disks(Value & disk_values, lsm_disk ** disks[],
+ uint32_t * count)
{
int rc = LSM_ERR_OK;
try {
*count = 0;

- if( Value::array_t == disk_values.valueType()) {
- std::vector<Value> d = disk_values.asArray();
+ if (Value::array_t == disk_values.valueType()) {
+ std::vector < Value > d = disk_values.asArray();

*count = d.size();

- if( d.size() ) {
+ if (d.size()) {
*disks = lsm_disk_record_array_alloc(d.size());

- if( *disks ){
- for( size_t i = 0; i < d.size(); ++i ) {
+ if (*disks) {
+ for (size_t i = 0; i < d.size(); ++i) {
(*disks)[i] = value_to_disk(d[i]);
- if( !((*disks)[i]) ) {
+ if (!((*disks)[i])) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}
@@ -187,16 +190,17 @@ int value_array_to_disks(Value &disk_values, lsm_disk **disks[], uint32_t *count
}
}
}
- } catch( const ValueException &ve ) {
+ }
+ catch(const ValueException & ve) {
rc = LSM_ERR_LIB_BUG;
goto error;
}

-out:
+ out:
return rc;

-error:
- if( *disks && *count ) {
+ error:
+ if (*disks && *count) {
lsm_disk_record_array_free(*disks, *count);
*disks = NULL;
*count = 0;
@@ -204,33 +208,33 @@ error:
goto out;
}

-lsm_pool *value_to_pool(Value &pool)
+lsm_pool *value_to_pool(Value & pool)
{
lsm_pool *rc = NULL;

if (is_expected_object(pool, CLASS_NAME_POOL)) {
- std::map<std::string, Value> i = pool.asObject();
+ std::map < std::string, Value > i = pool.asObject();

rc = lsm_pool_record_alloc(i["id"].asString().c_str(),
- i["name"].asString().c_str(),
- i["element_type"].asUint64_t(),
- i["unsupported_actions"].asUint64_t(),
- i["total_space"].asUint64_t(),
- i["free_space"].asUint64_t(),
- i["status"].asUint64_t(),
- i["status_info"].asString().c_str(),
- i["system_id"].asString().c_str(),
- i["plugin_data"].asC_str());
+ i["name"].asString().c_str(),
+ i["element_type"].asUint64_t(),
+ i["unsupported_actions"].asUint64_t(),
+ i["total_space"].asUint64_t(),
+ i["free_space"].asUint64_t(),
+ i["status"].asUint64_t(),
+ i["status_info"].asString().c_str(),
+ i["system_id"].asString().c_str(),
+ i["plugin_data"].asC_str());
} else {
throw ValueException("value_to_pool: Not correct type");
}
return rc;
}

-Value pool_to_value(lsm_pool *pool)
+Value pool_to_value(lsm_pool * pool)
{
- if( LSM_IS_POOL(pool) ) {
- std::map<std::string, Value> p;
+ if (LSM_IS_POOL(pool)) {
+ std::map < std::string, Value > p;
p["class"] = Value(CLASS_NAME_POOL);
p["id"] = Value(pool->id);
p["name"] = Value(pool->name);
@@ -247,27 +251,27 @@ Value pool_to_value(lsm_pool *pool)
return Value();
}

-lsm_system *value_to_system(Value &system)
+lsm_system *value_to_system(Value & system)
{
lsm_system *rc = NULL;
if (is_expected_object(system, CLASS_NAME_SYSTEM)) {
- std::map<std::string, Value> i = system.asObject();
+ std::map < std::string, Value > i = system.asObject();

rc = lsm_system_record_alloc(i["id"].asString().c_str(),
- i["name"].asString().c_str(),
- i["status"].asUint32_t(),
- i["status_info"].asString().c_str(),
- i["plugin_data"].asC_str());
+ i["name"].asString().c_str(),
+ i["status"].asUint32_t(),
+ i["status_info"].asString().c_str(),
+ i["plugin_data"].asC_str());
} else {
throw ValueException("value_to_system: Not correct type");
}
return rc;
}

-Value system_to_value(lsm_system *system)
+Value system_to_value(lsm_system * system)
{
- if( LSM_IS_SYSTEM(system)) {
- std::map<std::string, Value> s;
+ if (LSM_IS_SYSTEM(system)) {
+ std::map < std::string, Value > s;
s["class"] = Value(CLASS_NAME_SYSTEM);
s["id"] = Value(system->id);
s["name"] = Value(system->name);
@@ -279,18 +283,19 @@ Value system_to_value(lsm_system *system)
return Value();
}

-lsm_string_list *value_to_string_list(Value &v)
+lsm_string_list *value_to_string_list(Value & v)
{
lsm_string_list *il = NULL;

- if( Value::array_t == v.valueType() ) {
- std::vector<Value> vl = v.asArray();
+ if (Value::array_t == v.valueType()) {
+ std::vector < Value > vl = v.asArray();
uint32_t size = vl.size();
il = lsm_string_list_alloc(size);

- if( il ) {
- for( uint32_t i = 0; i < size; ++i ) {
- if(LSM_ERR_OK != lsm_string_list_elem_set(il, i, vl[i].asC_str())){
+ if (il) {
+ for (uint32_t i = 0; i < size; ++i) {
+ if (LSM_ERR_OK !=
+ lsm_string_list_elem_set(il, i, vl[i].asC_str())) {
lsm_string_list_free(il);
il = NULL;
break;
@@ -303,36 +308,37 @@ lsm_string_list *value_to_string_list(Value &v)
return il;
}

-Value string_list_to_value( lsm_string_list *sl)
+Value string_list_to_value(lsm_string_list * sl)
{
- std::vector<Value> rc;
- if( LSM_IS_STRING_LIST(sl) ) {
+ std::vector < Value > rc;
+ if (LSM_IS_STRING_LIST(sl)) {
uint32_t size = lsm_string_list_size(sl);
rc.reserve(size);

- for(uint32_t i = 0; i < size; ++i ) {
+ for (uint32_t i = 0; i < size; ++i) {
rc.push_back(Value(lsm_string_list_elem_get(sl, i)));
}
}
return Value(rc);
}

-lsm_access_group *value_to_access_group( Value &group )
+lsm_access_group *value_to_access_group(Value & group)
{
lsm_string_list *il = NULL;
lsm_access_group *ag = NULL;

- if( is_expected_object(group, CLASS_NAME_ACCESS_GROUP)) {
- std::map<std::string, Value> vAg = group.asObject();
+ if (is_expected_object(group, CLASS_NAME_ACCESS_GROUP)) {
+ std::map < std::string, Value > vAg = group.asObject();
il = value_to_string_list(vAg["init_ids"]);

- if( il ) {
+ if (il) {
ag = lsm_access_group_record_alloc(vAg["id"].asString().c_str(),
- vAg["name"].asString().c_str(),
- il,
- (lsm_access_group_init_type)vAg["init_type"].asInt32_t(),
- vAg["system_id"].asString().c_str(),
- vAg["plugin_data"].asC_str());
+ vAg["name"].asString().c_str(),
+ il, (lsm_access_group_init_type)
+ vAg["init_type"].asInt32_t(),
+ vAg["system_id"].
+ asString().c_str(),
+ vAg["plugin_data"].asC_str());
}
/* This stuff is copied in lsm_access_group_record_alloc */
lsm_string_list_free(il);
@@ -342,10 +348,10 @@ lsm_access_group *value_to_access_group( Value &group )
return ag;
}

-Value access_group_to_value( lsm_access_group *group )
+Value access_group_to_value(lsm_access_group * group)
{
- if( LSM_IS_ACCESS_GROUP(group) ) {
- std::map<std::string, Value> ag;
+ if (LSM_IS_ACCESS_GROUP(group)) {
+ std::map < std::string, Value > ag;
ag["class"] = Value(CLASS_NAME_ACCESS_GROUP);
ag["id"] = Value(group->id);
ag["name"] = Value(group->name);
@@ -358,23 +364,23 @@ Value access_group_to_value( lsm_access_group *group )
return Value();
}

-int value_array_to_access_groups( Value &group,
- lsm_access_group **ag_list[],
- uint32_t *count )
+int value_array_to_access_groups(Value & group,
+ lsm_access_group ** ag_list[],
+ uint32_t * count)
{
int rc = LSM_ERR_OK;

try {
- std::vector<Value> ag = group.asArray();
+ std::vector < Value > ag = group.asArray();
*count = ag.size();

- if( *count ) {
+ if (*count) {
*ag_list = lsm_access_group_record_array_alloc(*count);
- if( *ag_list ) {
+ if (*ag_list) {
uint32_t i;
- for(i = 0; i < *count; ++i ) {
+ for (i = 0; i < *count; ++i) {
(*ag_list)[i] = value_to_access_group(ag[i]);
- if( !((*ag_list)[i]) ) {
+ if (!((*ag_list)[i])) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}
@@ -383,16 +389,17 @@ int value_array_to_access_groups( Value &group,
rc = LSM_ERR_NO_MEMORY;
}
}
- } catch( const ValueException &ve) {
+ }
+ catch(const ValueException & ve) {
rc = LSM_ERR_LIB_BUG;
goto error;
}

- out:
+ out:
return rc;

-error:
- if( *ag_list && *count ) {
+ error:
+ if (*ag_list && *count) {
lsm_access_group_record_array_free(*ag_list, *count);
*ag_list = NULL;
*count = 0;
@@ -400,39 +407,39 @@ error:
goto out;
}

-Value access_group_list_to_value( lsm_access_group **group, uint32_t count)
+Value access_group_list_to_value(lsm_access_group ** group, uint32_t count)
{
- std::vector<Value> rc;
+ std::vector < Value > rc;

- if( group && count ) {
+ if (group && count) {
uint32_t i;
rc.reserve(count);
- for( i = 0; i < count; ++i ) {
+ for (i = 0; i < count; ++i) {
rc.push_back(access_group_to_value(group[i]));
}
}
return Value(rc);
}

-lsm_block_range *value_to_block_range(Value &br)
+lsm_block_range *value_to_block_range(Value & br)
{
lsm_block_range *rc = NULL;
- if( is_expected_object(br, CLASS_NAME_BLOCK_RANGE) ) {
- std::map<std::string, Value> range = br.asObject();
+ if (is_expected_object(br, CLASS_NAME_BLOCK_RANGE)) {
+ std::map < std::string, Value > range = br.asObject();

rc = lsm_block_range_record_alloc(range["src_block"].asUint64_t(),
- range["dest_block"].asUint64_t(),
- range["block_count"].asUint64_t());
+ range["dest_block"].asUint64_t(),
+ range["block_count"].asUint64_t());
} else {
throw ValueException("value_to_block_range: Not correct type");
}
return rc;
}

-Value block_range_to_value(lsm_block_range *br)
+Value block_range_to_value(lsm_block_range * br)
{
- if( LSM_IS_BLOCK_RANGE(br) ) {
- std::map<std::string, Value> r;
+ if (LSM_IS_BLOCK_RANGE(br)) {
+ std::map < std::string, Value > r;
r["class"] = Value(CLASS_NAME_BLOCK_RANGE);
r["src_block"] = Value(br->source_start);
r["dest_block"] = Value(br->dest_start);
@@ -442,17 +449,17 @@ Value block_range_to_value(lsm_block_range *br)
return Value();
}

-lsm_block_range **value_to_block_range_list(Value &brl, uint32_t *count)
+lsm_block_range **value_to_block_range_list(Value & brl, uint32_t * count)
{
lsm_block_range **rc = NULL;
- std::vector<Value> r = brl.asArray();
+ std::vector < Value > r = brl.asArray();
*count = r.size();
- if( *count ) {
+ if (*count) {
rc = lsm_block_range_record_array_alloc(*count);
- if( rc ) {
- for( uint32_t i = 0; i < *count; ++i ) {
+ if (rc) {
+ for (uint32_t i = 0; i < *count; ++i) {
rc[i] = value_to_block_range(r[i]);
- if( !rc[i] ) {
+ if (!rc[i]) {
lsm_block_range_record_array_free(rc, i);
rc = NULL;
break;
@@ -463,42 +470,42 @@ lsm_block_range **value_to_block_range_list(Value &brl, uint32_t *count)
return rc;
}

-Value block_range_list_to_value( lsm_block_range **brl, uint32_t count )
+Value block_range_list_to_value(lsm_block_range ** brl, uint32_t count)
{
- std::vector<Value> r;
- if( brl && count) {
+ std::vector < Value > r;
+ if (brl && count) {
uint32_t i = 0;
r.reserve(count);
- for( i = 0; i < count; ++i ) {
+ for (i = 0; i < count; ++i) {
r.push_back(block_range_to_value(brl[i]));
}
}
return Value(r);
}

-lsm_fs *value_to_fs(Value &fs)
+lsm_fs *value_to_fs(Value & fs)
{
lsm_fs *rc = NULL;
- if( is_expected_object(fs, CLASS_NAME_FILE_SYSTEM) ) {
- std::map<std::string, Value> f = fs.asObject();
+ if (is_expected_object(fs, CLASS_NAME_FILE_SYSTEM)) {
+ std::map < std::string, Value > f = fs.asObject();

rc = lsm_fs_record_alloc(f["id"].asString().c_str(),
- f["name"].asString().c_str(),
- f["total_space"].asUint64_t(),
- f["free_space"].asUint64_t(),
- f["pool_id"].asString().c_str(),
- f["system_id"].asString().c_str(),
- f["plugin_data"].asC_str());
+ f["name"].asString().c_str(),
+ f["total_space"].asUint64_t(),
+ f["free_space"].asUint64_t(),
+ f["pool_id"].asString().c_str(),
+ f["system_id"].asString().c_str(),
+ f["plugin_data"].asC_str());
} else {
throw ValueException("value_to_fs: Not correct type");
}
return rc;
}

-Value fs_to_value(lsm_fs *fs)
+Value fs_to_value(lsm_fs * fs)
{
- if( LSM_IS_FS(fs) ) {
- std::map<std::string, Value> f;
+ if (LSM_IS_FS(fs)) {
+ std::map < std::string, Value > f;
f["class"] = Value(CLASS_NAME_FILE_SYSTEM);
f["id"] = Value(fs->id);
f["name"] = Value(fs->name);
@@ -513,26 +520,26 @@ Value fs_to_value(lsm_fs *fs)
}


-lsm_fs_ss *value_to_ss(Value &ss)
+lsm_fs_ss *value_to_ss(Value & ss)
{
lsm_fs_ss *rc = NULL;
- if( is_expected_object(ss, CLASS_NAME_FS_SNAPSHOT) ) {
- std::map<std::string, Value> f = ss.asObject();
+ if (is_expected_object(ss, CLASS_NAME_FS_SNAPSHOT)) {
+ std::map < std::string, Value > f = ss.asObject();

rc = lsm_fs_ss_record_alloc(f["id"].asString().c_str(),
- f["name"].asString().c_str(),
- f["ts"].asUint64_t(),
- f["plugin_data"].asC_str());
+ f["name"].asString().c_str(),
+ f["ts"].asUint64_t(),
+ f["plugin_data"].asC_str());
} else {
throw ValueException("value_to_ss: Not correct type");
}
return rc;
}

-Value ss_to_value(lsm_fs_ss *ss)
+Value ss_to_value(lsm_fs_ss * ss)
{
- if( LSM_IS_SS(ss) ) {
- std::map<std::string, Value> f;
+ if (LSM_IS_SS(ss)) {
+ std::map < std::string, Value > f;
f["class"] = Value(CLASS_NAME_FS_SNAPSHOT);
f["id"] = Value(ss->id);
f["name"] = Value(ss->name);
@@ -543,24 +550,24 @@ Value ss_to_value(lsm_fs_ss *ss)
return Value();
}

-lsm_nfs_export *value_to_nfs_export(Value &exp)
+lsm_nfs_export *value_to_nfs_export(Value & exp)
{
lsm_nfs_export *rc = NULL;
- if( is_expected_object(exp, CLASS_NAME_FS_EXPORT) ) {
+ if (is_expected_object(exp, CLASS_NAME_FS_EXPORT)) {
int ok = 0;
lsm_string_list *root = NULL;
lsm_string_list *rw = NULL;
lsm_string_list *ro = NULL;

- std::map<std::string, Value> i = exp.asObject();
+ std::map < std::string, Value > i = exp.asObject();

/* Check all the arrays for successful allocation */
root = value_to_string_list(i["root"]);
- if( root ) {
+ if (root) {
rw = value_to_string_list(i["rw"]);
- if( rw ) {
+ if (rw) {
ro = value_to_string_list(i["ro"]);
- if( !ro ) {
+ if (!ro) {
lsm_string_list_free(rw);
lsm_string_list_free(root);
rw = NULL;
@@ -574,18 +581,18 @@ lsm_nfs_export *value_to_nfs_export(Value &exp)
}
}

- if( ok ) {
+ if (ok) {
rc = lsm_nfs_export_record_alloc(i["id"].asC_str(),
- i["fs_id"].asC_str(),
- i["export_path"].asC_str(),
- i["auth"].asC_str(),
- root,
- rw,
- ro,
- i["anonuid"].asUint64_t(),
- i["anongid"].asUint64_t(),
- i["options"].asC_str(),
- i["plugin_data"].asC_str());
+ i["fs_id"].asC_str(),
+ i["export_path"].asC_str(),
+ i["auth"].asC_str(),
+ root,
+ rw,
+ ro,
+ i["anonuid"].asUint64_t(),
+ i["anongid"].asUint64_t(),
+ i["options"].asC_str(),
+ i["plugin_data"].asC_str());

lsm_string_list_free(root);
lsm_string_list_free(rw);
@@ -597,10 +604,10 @@ lsm_nfs_export *value_to_nfs_export(Value &exp)
return rc;
}

-Value nfs_export_to_value(lsm_nfs_export *exp)
+Value nfs_export_to_value(lsm_nfs_export * exp)
{
- if( LSM_IS_NFS_EXPORT(exp) ) {
- std::map<std::string, Value> f;
+ if (LSM_IS_NFS_EXPORT(exp)) {
+ std::map < std::string, Value > f;
f["class"] = Value(CLASS_NAME_FS_EXPORT);
f["id"] = Value(exp->id);
f["fs_id"] = Value(exp->fs_id);
@@ -619,10 +626,10 @@ Value nfs_export_to_value(lsm_nfs_export *exp)

}

-lsm_storage_capabilities *value_to_capabilities(Value &exp)
+lsm_storage_capabilities *value_to_capabilities(Value & exp)
{
lsm_storage_capabilities *rc = NULL;
- if( is_expected_object(exp, CLASS_NAME_CAPABILITIES) ) {
+ if (is_expected_object(exp, CLASS_NAME_CAPABILITIES)) {
const char *val = exp["cap"].asC_str();
rc = lsm_capability_record_alloc(val);
} else {
@@ -631,10 +638,10 @@ lsm_storage_capabilities *value_to_capabilities(Value &exp)
return rc;
}

-Value capabilities_to_value(lsm_storage_capabilities *cap)
+Value capabilities_to_value(lsm_storage_capabilities * cap)
{
- if( LSM_IS_CAPABILITIY(cap) ) {
- std::map<std::string, Value> c;
+ if (LSM_IS_CAPABILITIY(cap)) {
+ std::map < std::string, Value > c;
char *t = capability_string(cap);
c["class"] = Value(CLASS_NAME_CAPABILITIES);
c["cap"] = Value(t);
@@ -645,29 +652,29 @@ Value capabilities_to_value(lsm_storage_capabilities *cap)
}


-lsm_target_port *value_to_target_port(Value &tp)
+lsm_target_port *value_to_target_port(Value & tp)
{
- lsm_target_port *rc = NULL;
- if( is_expected_object(tp, CLASS_NAME_TARGET_PORT) ) {
- rc = lsm_target_port_record_alloc(
- tp["id"].asC_str(),
- (lsm_target_port_type)tp["port_type"].asInt32_t(),
- tp["service_address"].asC_str(),
- tp["network_address"].asC_str(),
- tp["physical_address"].asC_str(),
- tp["physical_name"].asC_str(),
- tp["system_id"].asC_str(),
- tp["plugin_data"].asC_str());
+ lsm_target_port *rc = NULL;
+ if (is_expected_object(tp, CLASS_NAME_TARGET_PORT)) {
+ rc = lsm_target_port_record_alloc(tp["id"].asC_str(),
+ (lsm_target_port_type)
+ tp["port_type"].asInt32_t(),
+ tp["service_address"].asC_str(),
+ tp["network_address"].asC_str(),
+ tp["physical_address"].asC_str(),
+ tp["physical_name"].asC_str(),
+ tp["system_id"].asC_str(),
+ tp["plugin_data"].asC_str());
} else {
throw ValueException("value_to_target_port: Not correct type");
}
return rc;
}

-Value target_port_to_value(lsm_target_port *tp)
+Value target_port_to_value(lsm_target_port * tp)
{
- if( LSM_IS_TARGET_PORT(tp) ) {
- std::map<std::string, Value> p;
+ if (LSM_IS_TARGET_PORT(tp)) {
+ std::map < std::string, Value > p;
p["class"] = Value(CLASS_NAME_TARGET_PORT);
p["id"] = Value(tp->id);
p["port_type"] = Value(tp->port_type);
@@ -682,27 +689,28 @@ Value target_port_to_value(lsm_target_port *tp)
return Value();
}

-int values_to_uint32_array(
- Value &value, uint32_t **uint32_array, uint32_t *count)
+int values_to_uint32_array(Value & value, uint32_t ** uint32_array,
+ uint32_t * count)
{
int rc = LSM_ERR_OK;
*count = 0;
try {
- std::vector<Value> data = value.asArray();
+ std::vector < Value > data = value.asArray();
*count = data.size();
- if (*count){
- *uint32_array = (uint32_t *)malloc(sizeof(uint32_t) * *count);
- if (*uint32_array){
+ if (*count) {
+ *uint32_array = (uint32_t *) malloc(sizeof(uint32_t) * *count);
+ if (*uint32_array) {
uint32_t i;
- for( i = 0; i < *count; i++ ){
+ for (i = 0; i < *count; i++) {
(*uint32_array)[i] = data[i].asUint32_t();
}
- }else{
+ } else {
rc = LSM_ERR_NO_MEMORY;
}
}
- } catch( const ValueException &ve) {
- if( *count ) {
+ }
+ catch(const ValueException & ve) {
+ if (*count) {
free(*uint32_array);
*uint32_array = NULL;
*count = 0;
@@ -712,13 +720,13 @@ int values_to_uint32_array(
return rc;
}

-Value uint32_array_to_value(uint32_t *uint32_array, uint32_t count)
+Value uint32_array_to_value(uint32_t * uint32_array, uint32_t count)
{
- std::vector<Value> rc;
- if( uint32_array && count ) {
+ std::vector < Value > rc;
+ if (uint32_array && count) {
uint32_t i;
rc.reserve(count);
- for( i = 0; i < count; i++ ) {
+ for (i = 0; i < count; i++) {
rc.push_back(uint32_array[i]);
}
}
diff --git a/c_binding/lsm_convert.hpp b/c_binding/lsm_convert.hpp
index 7236654..8947d85 100644
--- a/c_binding/lsm_convert.hpp
+++ b/c_binding/lsm_convert.hpp
@@ -58,31 +58,31 @@ const char CLASS_NAME_TARGET_PORT[] = "TargetPort";
* @param class_name Class name to check
* @return boolean, true if matches
*/
-bool LSM_DLL_LOCAL is_expected_object(Value &obj, std::string class_name);
+bool LSM_DLL_LOCAL is_expected_object(Value & obj, std::string class_name);

/**
* Converts an array of Values to a lsm_string_list
* @param list List represented as an vector of strings.
* @return lsm_string_list pointer, NULL on error.
*/
-lsm_string_list LSM_DLL_LOCAL *value_to_string_list( Value &list);
+lsm_string_list LSM_DLL_LOCAL *value_to_string_list(Value & list);

/**
* Converts a lsm_string_list to a Value
* @param sl String list to convert
* @return Value
*/
-Value LSM_DLL_LOCAL string_list_to_value( lsm_string_list *sl);
+Value LSM_DLL_LOCAL string_list_to_value(lsm_string_list *sl);

/**
* Converts a volume to a volume.
* @param vol Value to convert.
* @return lsm_volume *, else NULL on error
*/
-lsm_volume LSM_DLL_LOCAL *value_to_volume(Value &vol);
+lsm_volume LSM_DLL_LOCAL *value_to_volume(Value & vol);

/**
- * Converts a lsm_volume * to a Value
+ * Converts a lsm_volume *to a Value
* @param vol lsm_volume to convert
* @return Value
*/
@@ -96,22 +96,23 @@ Value LSM_DLL_LOCAL volume_to_value(lsm_volume *vol);
* @param count Number of volumes
* @return LSM_ERR_OK on success, else error reason
*/
-int LSM_DLL_LOCAL value_array_to_volumes(Value &volume_values, lsm_volume **volumes[],
- uint32_t *count);
+int LSM_DLL_LOCAL value_array_to_volumes(Value & volume_values,
+ lsm_volume **volumes[],
+ uint32_t * count);

/**
* Converts a Value to a lsm_disk
* @param disk Value representing a disk
* @return lsm_disk pointer, else NULL on error
*/
-lsm_disk LSM_DLL_LOCAL *value_to_disk(Value &disk);
+lsm_disk LSM_DLL_LOCAL *value_to_disk(Value & disk);

/**
* Converts a lsm_disk to a value
* @param disk lsm_disk to convert to value
* @return Value
*/
-Value LSM_DLL_LOCAL disk_to_value(lsm_disk *disk);
+Value LSM_DLL_LOCAL disk_to_value(lsm_disk * disk);

/**
* Converts a vector of disk values to an array.
@@ -120,15 +121,15 @@ Value LSM_DLL_LOCAL disk_to_value(lsm_disk *disk);
* @param[out] count Number of disks
* @return LSM_ERR_OK on success, else error reason.
*/
-int LSM_DLL_LOCAL value_array_to_disks(Value &disk_values, lsm_disk **disks[],
- uint32_t *count);
+int LSM_DLL_LOCAL value_array_to_disks(Value & disk_values,
+ lsm_disk **disks[], uint32_t * count);

/**
* Converts a value to a pool
* @param pool To convert to lsm_pool *
* @return lsm_pool *, else NULL on error.
*/
-lsm_pool LSM_DLL_LOCAL *value_to_pool(Value &pool);
+lsm_pool LSM_DLL_LOCAL *value_to_pool(Value & pool);

/**
* Converts a lsm_pool * to Value
@@ -142,7 +143,7 @@ Value LSM_DLL_LOCAL pool_to_value(lsm_pool *pool);
* @param system to convert to lsm_system *
* @return lsm_system pointer, else NULL on error
*/
-lsm_system LSM_DLL_LOCAL *value_to_system(Value &system);
+lsm_system LSM_DLL_LOCAL *value_to_system(Value & system);

/**
* Converts a lsm_system * to a Value
@@ -156,7 +157,7 @@ Value LSM_DLL_LOCAL system_to_value(lsm_system *system);
* @param group to convert to lsm_access_group*
* @return lsm_access_group *, NULL on error
*/
-lsm_access_group LSM_DLL_LOCAL *value_to_access_group(Value &group);
+lsm_access_group LSM_DLL_LOCAL *value_to_access_group(Value & group);

/**
* Converts a lsm_access_group to a Value
@@ -172,9 +173,9 @@ Value LSM_DLL_LOCAL access_group_to_value(lsm_access_group *group);
* @param[out] count Number of items in the returned array.
* @return LSM_ERR_OK on success, else error reason
*/
-int LSM_DLL_LOCAL value_array_to_access_groups( Value &group,
- lsm_access_group **ag_list[],
- uint32_t *count );
+int LSM_DLL_LOCAL value_array_to_access_groups(Value & group,
+ lsm_access_group **ag_list[],
+ uint32_t * count);

/**
* Converts an array of lsm_access_group to Value(s)
@@ -182,15 +183,15 @@ int LSM_DLL_LOCAL value_array_to_access_groups( Value &group,
* @param count Number of items in array.
* @return std::vector of Values representing access groups
*/
-Value LSM_DLL_LOCAL access_group_list_to_value( lsm_access_group **group,
- uint32_t count);
+Value LSM_DLL_LOCAL access_group_list_to_value(lsm_access_group **group,
+ uint32_t count);

/**
* Converts a Value to a lsm_block_range
* @param br Value representing a block range
* @return lsm_block_range *
*/
-lsm_block_range LSM_DLL_LOCAL *value_to_block_range(Value &br);
+lsm_block_range LSM_DLL_LOCAL *value_to_block_range(Value & br);

/**
* Converts a lsm_block_range to a Value
@@ -205,8 +206,8 @@ Value LSM_DLL_LOCAL block_range_to_value(lsm_block_range *br);
* @param[out] count Number of items in the resulting array
* @return NULL on memory allocation failure, else array of lsm_block_range
*/
-lsm_block_range LSM_DLL_LOCAL **value_to_block_range_list(Value &brl,
- uint32_t *count);
+lsm_block_range LSM_DLL_LOCAL **value_to_block_range_list(Value & brl,
+ uint32_t *count);

/**
* Converts an array of lsm_block_range to Value
@@ -214,15 +215,15 @@ lsm_block_range LSM_DLL_LOCAL **value_to_block_range_list(Value &brl,
* @param count Number of items in input
* @return Value
*/
-Value LSM_DLL_LOCAL block_range_list_to_value( lsm_block_range **brl,
- uint32_t count);
+Value LSM_DLL_LOCAL block_range_list_to_value(lsm_block_range **brl,
+ uint32_t count);

/**
* Converts a value to a lsm_fs *
* @param fs Value representing a FS to be converted
* @return lsm_fs pointer or NULL on error.
*/
-lsm_fs LSM_DLL_LOCAL *value_to_fs(Value &fs);
+lsm_fs LSM_DLL_LOCAL *value_to_fs(Value & fs);

/**
* Converts a lsm_fs pointer to a Value
@@ -236,7 +237,7 @@ Value LSM_DLL_LOCAL fs_to_value(lsm_fs *fs);
* @param ss Value representing a snapshot to be converted
* @return lsm_ss pointer or NULL on error.
*/
-lsm_fs_ss LSM_DLL_LOCAL *value_to_ss(Value &ss);
+lsm_fs_ss LSM_DLL_LOCAL *value_to_ss(Value & ss);

/**
* Converts a lsm_ss pointer to a Value
@@ -250,7 +251,7 @@ Value LSM_DLL_LOCAL ss_to_value(lsm_fs_ss *ss);
* @param exp Value representing a nfs export to be converted
* @return lsm_nfs_export pointer or NULL on error.
*/
-lsm_nfs_export LSM_DLL_LOCAL *value_to_nfs_export(Value &exp);
+lsm_nfs_export LSM_DLL_LOCAL *value_to_nfs_export(Value & exp);

/**
* Converts a lsm_nfs_export pointer to a Value
@@ -264,7 +265,7 @@ Value LSM_DLL_LOCAL nfs_export_to_value(lsm_nfs_export *exp);
* @param exp Value representing a storage capabilities
* @return lsm_storage_capabilities pointer or NULL on error
*/
-lsm_storage_capabilities LSM_DLL_LOCAL *value_to_capabilities(Value &exp);
+lsm_storage_capabilities LSM_DLL_LOCAL *value_to_capabilities(Value & exp);

/**
* Converts a lsm_storage_capabilities to a value
@@ -278,7 +279,7 @@ Value LSM_DLL_LOCAL capabilities_to_value(lsm_storage_capabilities *cap);
* @param tp Value to convert to lsm_target_port
* @return lsm_target_port pointer or NULL on errors
*/
-lsm_target_port LSM_DLL_LOCAL *value_to_target_port(Value &tp);
+lsm_target_port LSM_DLL_LOCAL *value_to_target_port(Value & tp);

/**
* Converts a lsm_target_port to a value
@@ -290,13 +291,14 @@ Value LSM_DLL_LOCAL target_port_to_value(lsm_target_port *tp);
/**
* Converts a value to array of uint32.
*/
-int LSM_DLL_LOCAL values_to_uint32_array(
- Value &value, uint32_t **uint32_array, uint32_t *count);
+int LSM_DLL_LOCAL values_to_uint32_array(Value & value,
+ uint32_t **uint32_array,
+ uint32_t *count);

/**
* Converts an array of uint32 to a value.
*/
-Value LSM_DLL_LOCAL uint32_array_to_value(
- uint32_t *uint32_array, uint32_t count);
+Value LSM_DLL_LOCAL uint32_array_to_value(uint32_t *uint32_array,
+ uint32_t count);

#endif
diff --git a/c_binding/lsm_datatypes.cpp b/c_binding/lsm_datatypes.cpp
index 4826a6b..a8f7070 100644
--- a/c_binding/lsm_datatypes.cpp
+++ b/c_binding/lsm_datatypes.cpp
@@ -49,9 +49,7 @@
#ifdef __cplusplus
extern "C" {
#endif
-
#define LSM_DEFAULT_PLUGIN_DIR "/var/run/lsm/ipc"
-
/* We would certainly expand this to encompass the entire function */
#define MEMBER_GET(x, validation, member, error) \
if( validation(x) ) { \
@@ -59,14 +57,13 @@ extern "C" {
} else { \
return error; \
}
-
-int lsm_string_list_append(lsm_string_list *sl, const char *value)
+int lsm_string_list_append(lsm_string_list * sl, const char *value)
{
int rc = LSM_ERR_INVALID_ARGUMENT;

- if( LSM_IS_STRING_LIST(sl) ) {
+ if (LSM_IS_STRING_LIST(sl)) {
char *d = strdup(value);
- if(d) {
+ if (d) {
g_ptr_array_add(sl->values, d);
rc = LSM_ERR_OK;
} else {
@@ -76,12 +73,12 @@ int lsm_string_list_append(lsm_string_list *sl, const char *value)
return rc;
}

-int lsm_string_list_delete(lsm_string_list *sl, uint32_t index)
+int lsm_string_list_delete(lsm_string_list * sl, uint32_t index)
{
int rc = LSM_ERR_INVALID_ARGUMENT;

- if( LSM_IS_STRING_LIST(sl) ) {
- if( index < sl->values->len ) {
+ if (LSM_IS_STRING_LIST(sl)) {
+ if (index < sl->values->len) {
g_ptr_array_remove_index(sl->values, index);
rc = LSM_ERR_OK;
}
@@ -90,29 +87,29 @@ int lsm_string_list_delete(lsm_string_list *sl, uint32_t index)
}


-int lsm_string_list_elem_set(lsm_string_list *sl, uint32_t index,
- const char* value)
+int lsm_string_list_elem_set(lsm_string_list * sl, uint32_t index,
+ const char *value)
{
int rc = LSM_ERR_OK;
- if( LSM_IS_STRING_LIST(sl) ) {
- if( index < sl->values->len ) {
+ if (LSM_IS_STRING_LIST(sl)) {
+ if (index < sl->values->len) {

- char *i = (char *)g_ptr_array_index(sl->values, index);
+ char *i = (char *) g_ptr_array_index(sl->values, index);

- if( i ) {
+ if (i) {
free(i);
}

g_ptr_array_index(sl->values, index) = strdup(value);

- if( !g_ptr_array_index(sl->values, index) ) {
+ if (!g_ptr_array_index(sl->values, index)) {
rc = LSM_ERR_NO_MEMORY;
}
} else {
g_ptr_array_set_size(sl->values, index + 1);
g_ptr_array_index(sl->values, index) = strdup(value);

- if( !g_ptr_array_index(sl->values, index) ) {
+ if (!g_ptr_array_index(sl->values, index)) {
rc = LSM_ERR_NO_MEMORY;
}
}
@@ -122,11 +119,11 @@ int lsm_string_list_elem_set(lsm_string_list *sl, uint32_t index,
return rc;
}

-const char *lsm_string_list_elem_get(lsm_string_list *sl, uint32_t index)
+const char *lsm_string_list_elem_get(lsm_string_list * sl, uint32_t index)
{
- if( LSM_IS_STRING_LIST(sl) ) {
- if( index < sl->values->len ) {
- return (const char*)g_ptr_array_index(sl->values, index);
+ if (LSM_IS_STRING_LIST(sl)) {
+ if (index < sl->values->len) {
+ return (const char *) g_ptr_array_index(sl->values, index);
}
}
return NULL;
@@ -136,11 +133,11 @@ lsm_string_list *lsm_string_list_alloc(uint32_t size)
{
lsm_string_list *rc = NULL;

- rc = (lsm_string_list *)malloc(sizeof(lsm_string_list));
- if( rc ) {
+ rc = (lsm_string_list *) malloc(sizeof(lsm_string_list));
+ if (rc) {
rc->magic = LSM_STRING_LIST_MAGIC;
rc->values = g_ptr_array_sized_new(size);
- if( !rc->values ) {
+ if (!rc->values) {
rc->magic = LSM_DEL_MAGIC(LSM_STRING_LIST_MAGIC);
free(rc);
rc = NULL;
@@ -153,9 +150,9 @@ lsm_string_list *lsm_string_list_alloc(uint32_t size)
return rc;
}

-int lsm_string_list_free(lsm_string_list *sl)
+int lsm_string_list_free(lsm_string_list * sl)
{
- if( LSM_IS_STRING_LIST(sl) ) {
+ if (LSM_IS_STRING_LIST(sl)) {
sl->magic = LSM_DEL_MAGIC(LSM_STRING_LIST_MAGIC);
g_ptr_array_free(sl->values, TRUE);
sl->values = NULL;
@@ -165,28 +162,30 @@ int lsm_string_list_free(lsm_string_list *sl)
return LSM_ERR_INVALID_ARGUMENT;
}

-uint32_t lsm_string_list_size(lsm_string_list *sl)
+uint32_t lsm_string_list_size(lsm_string_list * sl)
{
- if( LSM_IS_STRING_LIST(sl) ) {
- return (uint32_t)sl->values->len;
+ if (LSM_IS_STRING_LIST(sl)) {
+ return (uint32_t) sl->values->len;
}
return 0;
}

-lsm_string_list *lsm_string_list_copy(lsm_string_list *src)
+lsm_string_list *lsm_string_list_copy(lsm_string_list * src)
{
lsm_string_list *dest = NULL;

- if( LSM_IS_STRING_LIST(src) ) {
+ if (LSM_IS_STRING_LIST(src)) {
uint32_t size = lsm_string_list_size(src);
dest = lsm_string_list_alloc(size);

- if( dest ) {
+ if (dest) {
uint32_t i;

- for( i = 0; i < size ; ++i ) {
- if ( LSM_ERR_OK != lsm_string_list_elem_set(dest, i,
- lsm_string_list_elem_get(src, i))) {
+ for (i = 0; i < size; ++i) {
+ if (LSM_ERR_OK !=
+ lsm_string_list_elem_set(dest, i,
+ lsm_string_list_elem_get
+ (src, i))) {
/** We had an allocation failure setting an element item */
lsm_string_list_free(dest);
dest = NULL;
@@ -200,14 +199,14 @@ lsm_string_list *lsm_string_list_copy(lsm_string_list *src)

lsm_connect *connection_get()
{
- lsm_connect *c = (lsm_connect *)calloc(1, sizeof(lsm_connect));
+ lsm_connect *c = (lsm_connect *) calloc(1, sizeof(lsm_connect));
if (c) {
c->magic = LSM_CONNECT_MAGIC;
}
return c;
}

-void connection_free(lsm_connect *c)
+void connection_free(lsm_connect * c)
{
if (LSM_IS_CONNECT(c)) {

@@ -224,12 +223,12 @@ void connection_free(lsm_connect *c)
c->error = NULL;
}

- if( c->tp ) {
+ if (c->tp) {
delete(c->tp);
c->tp = NULL;
}

- if( c->raw_uri ) {
+ if (c->raw_uri) {
free(c->raw_uri);
c->raw_uri = NULL;
}
@@ -238,17 +237,17 @@ void connection_free(lsm_connect *c)
}
}

-static int connection_establish( lsm_connect *c, const char * password,
- uint32_t timeout, lsm_error_ptr *e,
+static int connection_establish(lsm_connect * c, const char *password,
+ uint32_t timeout, lsm_error_ptr * e,
lsm_flag flags)
{
int rc = LSM_ERR_OK;
- std::map<std::string, Value> params;
+ std::map < std::string, Value > params;

try {
params["uri"] = Value(c->raw_uri);

- if( password ) {
+ if (password) {
params["password"] = Value(password);
} else {
params["password"] = Value();
@@ -258,17 +257,20 @@ static int connection_establish( lsm_connect *c, const char * password,
Value p(params);

c->tp->rpc("plugin_register", p);
- } catch (const ValueException &ve) {
- *e = lsm_error_create(LSM_ERR_TRANSPORT_SERIALIZATION, "Error in serialization",
- ve.what(), NULL, NULL, 0 );
+ }
+ catch(const ValueException & ve) {
+ *e = lsm_error_create(LSM_ERR_TRANSPORT_SERIALIZATION,
+ "Error in serialization", ve.what(), NULL, NULL,
+ 0);
rc = LSM_ERR_TRANSPORT_SERIALIZATION;
- } catch (const LsmException &le) {
- *e = lsm_error_create(LSM_ERR_TRANSPORT_COMMUNICATION, "Error in communication",
- le.what(), NULL, NULL, 0 );
+ } catch(const LsmException & le) {
+ *e = lsm_error_create(LSM_ERR_TRANSPORT_COMMUNICATION,
+ "Error in communication", le.what(), NULL, NULL,
+ 0);
rc = LSM_ERR_TRANSPORT_COMMUNICATION;
- } catch (...) {
+ } catch( ...) {
*e = lsm_error_create(LSM_ERR_LIB_BUG, "Undefined exception",
- NULL, NULL, NULL, 0 );
+ NULL, NULL, NULL, 0);
rc = LSM_ERR_LIB_BUG;
}
return rc;
@@ -285,8 +287,9 @@ const char *uds_path(void)
}


-int driver_load(lsm_connect *c, const char *plugin_name, const char *password,
- uint32_t timeout, lsm_error_ptr *e, int startup, lsm_flag flags)
+int driver_load(lsm_connect * c, const char *plugin_name, const char *password,
+ uint32_t timeout, lsm_error_ptr * e, int startup,
+ lsm_flag flags)
{
int rc = LSM_ERR_OK;
char *plugin_file = NULL;
@@ -299,26 +302,28 @@ int driver_load(lsm_connect *c, const char *plugin_name, const char *password,
if (access(plugin_file, F_OK) != 0) {
rc = LSM_ERR_PLUGIN_NOT_EXIST;
} else {
- if (access(plugin_file, R_OK|W_OK) == 0) {
+ if (access(plugin_file, R_OK | W_OK) == 0) {
int ec;
int sd = Transport::socket_get(std::string(plugin_file), ec);

- if( sd >= 0 ) {
+ if (sd >= 0) {
c->tp = new Ipc(sd);
- if( startup ) {
- if( connection_establish(c, password, timeout, e, flags)) {
+ if (startup) {
+ if (connection_establish(c, password, timeout, e, flags)) {
rc = LSM_ERR_PLUGIN_IPC_FAIL;
}
}
} else {
- *e = lsm_error_create(LSM_ERR_PLUGIN_IPC_FAIL, "Unable to connect to plugin",
- NULL, dlerror(), NULL, 0 );
+ *e = lsm_error_create(LSM_ERR_PLUGIN_IPC_FAIL,
+ "Unable to connect to plugin", NULL,
+ dlerror(), NULL, 0);

rc = LSM_ERR_PLUGIN_IPC_FAIL;
}
} else {
- *e = lsm_error_create(LSM_ERR_PLUGIN_SOCKET_PERMISSION, "Unable to access plugin",
- NULL, NULL, NULL, 0 );
+ *e = lsm_error_create(LSM_ERR_PLUGIN_SOCKET_PERMISSION,
+ "Unable to access plugin", NULL, NULL, NULL,
+ 0);

rc = LSM_ERR_PLUGIN_SOCKET_PERMISSION;
}
@@ -328,17 +333,17 @@ int driver_load(lsm_connect *c, const char *plugin_name, const char *password,
return rc;
}

-lsm_error_ptr lsm_error_create(lsm_error_number code, const char* msg,
- const char *exception, const char *debug,
- const void *debug_data, uint32_t debug_data_size)
+lsm_error_ptr lsm_error_create(lsm_error_number code, const char *msg,
+ const char *exception, const char *debug,
+ const void *debug_data, uint32_t debug_data_size)
{
- lsm_error_ptr err = (lsm_error_ptr)calloc(1, sizeof(lsm_error));
+ lsm_error_ptr err = (lsm_error_ptr) calloc(1, sizeof(lsm_error));

if (err) {
err->magic = LSM_ERROR_MAGIC;
err->code = code;

- /* Any of these strdup calls could fail, but we will continue*/
+ /* Any of these strdup calls could fail, but we will continue */
if (msg) {
err->message = strdup(msg);
}
@@ -363,7 +368,7 @@ lsm_error_ptr lsm_error_create(lsm_error_number code, const char* msg,
}
}
}
- return(lsm_error_ptr) err;
+ return (lsm_error_ptr) err;
}

int lsm_error_free(lsm_error_ptr e)
@@ -411,22 +416,22 @@ lsm_error_number lsm_error_number_get(lsm_error_ptr e)
LSM_RETURN_ERR_VAL(lsm_error_number, e, code, -1);
}

-char* lsm_error_message_get( lsm_error_ptr e)
+char *lsm_error_message_get(lsm_error_ptr e)
{
- LSM_RETURN_ERR_VAL(char*, e, message, NULL);
+ LSM_RETURN_ERR_VAL(char *, e, message, NULL);
}

-char* lsm_error_exception_get(lsm_error_ptr e)
+char *lsm_error_exception_get(lsm_error_ptr e)
{
- LSM_RETURN_ERR_VAL(char*, e, exception, NULL);
+ LSM_RETURN_ERR_VAL(char *, e, exception, NULL);
}

-char* lsm_error_debug_get(lsm_error_ptr e)
+char *lsm_error_debug_get(lsm_error_ptr e)
{
- LSM_RETURN_ERR_VAL(char*, e, debug, NULL);
+ LSM_RETURN_ERR_VAL(char *, e, debug, NULL);
}

-void* lsm_error_debug_data_get(lsm_error_ptr e, uint32_t *size)
+void *lsm_error_debug_data_get(lsm_error_ptr e, uint32_t * size)
{
if (LSM_IS_ERROR(e) && size != NULL) {
if (e->debug_data) {
@@ -483,13 +488,13 @@ int name( record_type pa[], uint32_t size) \
CREATE_ALLOC_ARRAY_FUNC(lsm_pool_record_array_alloc, lsm_pool *)

lsm_pool *lsm_pool_record_alloc(const char *id, const char *name,
- uint64_t element_type,
- uint64_t unsupported_actions,
- uint64_t totalSpace, uint64_t freeSpace, uint64_t status,
- const char* status_info,
- const char *system_id, const char * plugin_data)
+ uint64_t element_type,
+ uint64_t unsupported_actions,
+ uint64_t totalSpace, uint64_t freeSpace,
+ uint64_t status, const char *status_info,
+ const char *system_id, const char *plugin_data)
{
- lsm_pool *rc = (lsm_pool *)calloc(1, sizeof(lsm_pool));
+ lsm_pool *rc = (lsm_pool *) calloc(1, sizeof(lsm_pool));
if (rc) {
rc->magic = LSM_POOL_MAGIC;
rc->id = strdup(id);
@@ -502,11 +507,11 @@ lsm_pool *lsm_pool_record_alloc(const char *id, const char *name,
rc->status_info = strdup(status_info);
rc->system_id = strdup(system_id);

- if( plugin_data ) {
+ if (plugin_data) {
rc->plugin_data = strdup(plugin_data);
}

- if( !rc->id || !rc->name || !rc->system_id || !rc->status_info ||
+ if (!rc->id || !rc->name || !rc->system_id || !rc->status_info ||
(plugin_data && !rc->plugin_data)) {
lsm_pool_record_free(rc);
rc = NULL;
@@ -515,30 +520,30 @@ lsm_pool *lsm_pool_record_alloc(const char *id, const char *name,
return rc;
}

-void lsm_pool_free_space_set(lsm_pool *p, uint64_t free_space)
+void lsm_pool_free_space_set(lsm_pool * p, uint64_t free_space)
{
- if( LSM_IS_POOL(p) ) {
+ if (LSM_IS_POOL(p)) {
p->free_space = free_space;
}
}

-lsm_pool * lsm_pool_record_copy( lsm_pool *toBeCopied)
+lsm_pool *lsm_pool_record_copy(lsm_pool * toBeCopied)
{
- if( LSM_IS_POOL(toBeCopied) ) {
+ if (LSM_IS_POOL(toBeCopied)) {
return lsm_pool_record_alloc(toBeCopied->id, toBeCopied->name,
- toBeCopied->element_type,
- toBeCopied->unsupported_actions,
- toBeCopied->total_space,
- toBeCopied->free_space,
- toBeCopied->status,
- toBeCopied->status_info,
- toBeCopied->system_id,
- toBeCopied->plugin_data);
+ toBeCopied->element_type,
+ toBeCopied->unsupported_actions,
+ toBeCopied->total_space,
+ toBeCopied->free_space,
+ toBeCopied->status,
+ toBeCopied->status_info,
+ toBeCopied->system_id,
+ toBeCopied->plugin_data);
}
return NULL;
}

-int lsm_pool_record_free(lsm_pool *p)
+int lsm_pool_record_free(lsm_pool * p)
{
if (LSM_IS_POOL(p)) {
p->magic = LSM_DEL_MAGIC(LSM_POOL_MAGIC);
@@ -547,7 +552,7 @@ int lsm_pool_record_free(lsm_pool *p)
p->name = NULL;
}

- if( p->status_info ) {
+ if (p->status_info) {
free(p->status_info);
p->status_info = NULL;
}
@@ -557,7 +562,7 @@ int lsm_pool_record_free(lsm_pool *p)
p->id = NULL;
}

- if( p->system_id) {
+ if (p->system_id) {
free(p->system_id);
p->system_id = NULL;
}
@@ -571,10 +576,10 @@ int lsm_pool_record_free(lsm_pool *p)
return LSM_ERR_INVALID_ARGUMENT;
}

-CREATE_FREE_ARRAY_FUNC(lsm_pool_record_array_free, lsm_pool_record_free, lsm_pool *,
- LSM_ERR_INVALID_ARGUMENT)
+CREATE_FREE_ARRAY_FUNC(lsm_pool_record_array_free, lsm_pool_record_free,
+ lsm_pool *, LSM_ERR_INVALID_ARGUMENT)

-char *lsm_pool_name_get(lsm_pool *p)
+char *lsm_pool_name_get(lsm_pool * p)
{
if (LSM_IS_POOL(p)) {
return p->name;
@@ -582,7 +587,7 @@ char *lsm_pool_name_get(lsm_pool *p)
return NULL;
}

-char *lsm_pool_id_get(lsm_pool *p)
+char *lsm_pool_id_get(lsm_pool * p)
{
if (LSM_IS_POOL(p)) {
return p->id;
@@ -590,7 +595,7 @@ char *lsm_pool_id_get(lsm_pool *p)
return NULL;
}

-uint64_t lsm_pool_total_space_get(lsm_pool *p)
+uint64_t lsm_pool_total_space_get(lsm_pool * p)
{
if (LSM_IS_POOL(p)) {
return p->total_space;
@@ -598,7 +603,7 @@ uint64_t lsm_pool_total_space_get(lsm_pool *p)
return 0;
}

-uint64_t lsm_pool_free_space_get(lsm_pool *p)
+uint64_t lsm_pool_free_space_get(lsm_pool * p)
{
if (LSM_IS_POOL(p)) {
return p->free_space;
@@ -606,7 +611,7 @@ uint64_t lsm_pool_free_space_get(lsm_pool *p)
return 0;
}

-uint64_t lsm_pool_status_get( lsm_pool *p )
+uint64_t lsm_pool_status_get(lsm_pool * p)
{
if (LSM_IS_POOL(p)) {
return p->status;
@@ -614,7 +619,7 @@ uint64_t lsm_pool_status_get( lsm_pool *p )
return UINT64_MAX;
}

-const char *lsm_pool_status_info_get( lsm_pool *p )
+const char *lsm_pool_status_info_get(lsm_pool * p)
{
if (LSM_IS_POOL(p)) {
return p->status_info;
@@ -622,7 +627,7 @@ const char *lsm_pool_status_info_get( lsm_pool *p )
return NULL;
}

-char *lsm_pool_system_id_get( lsm_pool *p )
+char *lsm_pool_system_id_get(lsm_pool * p)
{
if (LSM_IS_POOL(p)) {
return p->system_id;
@@ -630,34 +635,35 @@ char *lsm_pool_system_id_get( lsm_pool *p )
return NULL;
}

-MEMBER_FUNC_GET(const char *, lsm_pool_plugin_data_get, lsm_pool *p,
+MEMBER_FUNC_GET(const char *, lsm_pool_plugin_data_get, lsm_pool * p,
p, LSM_IS_POOL, plugin_data, NULL)

-MEMBER_FUNC_GET( uint64_t, lsm_pool_element_type_get, lsm_pool *p, p, LSM_IS_POOL,
- element_type, 0)
+ MEMBER_FUNC_GET(uint64_t, lsm_pool_element_type_get, lsm_pool * p, p,
+ LSM_IS_POOL, element_type, 0)

-MEMBER_FUNC_GET( uint64_t, lsm_pool_unsupported_actions_get, lsm_pool *p, p,
- LSM_IS_POOL, element_type, 0)
+ MEMBER_FUNC_GET(uint64_t, lsm_pool_unsupported_actions_get, lsm_pool * p, p,
+ LSM_IS_POOL, element_type, 0)

-CREATE_ALLOC_ARRAY_FUNC(lsm_volume_record_array_alloc, lsm_volume *)
+ CREATE_ALLOC_ARRAY_FUNC(lsm_volume_record_array_alloc, lsm_volume *)

-lsm_volume * lsm_volume_record_alloc(const char *id, const char *name,
- const char *vpd83, uint64_t blockSize,
- uint64_t numberOfBlocks,
- uint32_t status, const char *system_id, const char *pool_id,
- const char* plugin_data)
+lsm_volume *lsm_volume_record_alloc(const char *id, const char *name,
+ const char *vpd83, uint64_t blockSize,
+ uint64_t numberOfBlocks,
+ uint32_t status, const char *system_id,
+ const char *pool_id,
+ const char *plugin_data)
{
- if( vpd83 && (LSM_ERR_OK != lsm_volume_vpd83_verify(vpd83)) ) {
- return NULL;
+ if (vpd83 && (LSM_ERR_OK != lsm_volume_vpd83_verify(vpd83))) {
+ return NULL;
}

- lsm_volume *rc = (lsm_volume *)calloc(1, sizeof(lsm_volume));
+ lsm_volume *rc = (lsm_volume *) calloc(1, sizeof(lsm_volume));
if (rc) {
rc->magic = LSM_VOL_MAGIC;
rc->id = strdup(id);
rc->name = strdup(name);

- if( vpd83 ) {
+ if (vpd83) {
rc->vpd83 = strdup(vpd83);
}

@@ -667,13 +673,12 @@ lsm_volume * lsm_volume_record_alloc(const char *id, const char *name,
rc->system_id = strdup(system_id);
rc->pool_id = strdup(pool_id);

- if( plugin_data ) {
+ if (plugin_data) {
rc->plugin_data = strdup(plugin_data);
}

- if( !rc->id || !rc->name || (vpd83 && !rc->vpd83) || !rc->system_id ||
- !rc->pool_id ||
- (plugin_data && !rc->plugin_data)) {
+ if (!rc->id || !rc->name || (vpd83 && !rc->vpd83) || !rc->system_id ||
+ !rc->pool_id || (plugin_data && !rc->plugin_data)) {
lsm_volume_record_free(rc);
rc = NULL;
}
@@ -684,11 +689,12 @@ lsm_volume * lsm_volume_record_alloc(const char *id, const char *name,
CREATE_ALLOC_ARRAY_FUNC(lsm_disk_record_array_alloc, lsm_disk *)

lsm_disk *lsm_disk_record_alloc(const char *id, const char *name,
- lsm_disk_type disk_type, uint64_t block_size, uint64_t block_count,
- uint64_t disk_status, const char *system_id)
+ lsm_disk_type disk_type, uint64_t block_size,
+ uint64_t block_count, uint64_t disk_status,
+ const char *system_id)
{
- lsm_disk *rc = (lsm_disk *)malloc(sizeof(lsm_disk));
- if( rc ) {
+ lsm_disk *rc = (lsm_disk *) malloc(sizeof(lsm_disk));
+ if (rc) {
rc->magic = LSM_DISK_MAGIC;
rc->id = strdup(id);
rc->name = strdup(name);
@@ -698,7 +704,7 @@ lsm_disk *lsm_disk_record_alloc(const char *id, const char *name,
rc->disk_status = disk_status;
rc->system_id = strdup(system_id);

- if( !rc->id || !rc->name || !rc->system_id ) {
+ if (!rc->id || !rc->name || !rc->system_id) {
lsm_disk_record_free(rc);
rc = NULL;
}
@@ -710,9 +716,9 @@ CREATE_ALLOC_ARRAY_FUNC(lsm_system_record_array_alloc, lsm_system *)

lsm_system *lsm_system_record_alloc(const char *id, const char *name,
uint32_t status, const char *status_info,
- const char* plugin_data)
+ const char *plugin_data)
{
- lsm_system *rc = (lsm_system *)calloc(1, sizeof(lsm_system));
+ lsm_system *rc = (lsm_system *) calloc(1, sizeof(lsm_system));
if (rc) {
rc->magic = LSM_SYSTEM_MAGIC;
rc->id = strdup(id);
@@ -720,11 +726,11 @@ lsm_system *lsm_system_record_alloc(const char *id, const char *name,
rc->status = status;
rc->status_info = strdup(status_info);

- if( plugin_data ) {
+ if (plugin_data) {
rc->plugin_data = strdup(plugin_data);
}

- if( !rc->name || !rc->id || !rc->status_info ||
+ if (!rc->name || !rc->id || !rc->status_info ||
(plugin_data && !rc->plugin_data)) {
lsm_system_record_free(rc);
rc = NULL;
@@ -733,9 +739,9 @@ lsm_system *lsm_system_record_alloc(const char *id, const char *name,
return rc;
}

-int lsm_system_record_free(lsm_system *s)
+int lsm_system_record_free(lsm_system * s)
{
- if( LSM_IS_SYSTEM(s) ) {
+ if (LSM_IS_SYSTEM(s)) {
s->magic = LSM_DEL_MAGIC(LSM_SYSTEM_MAGIC);

if (s->id) {
@@ -762,58 +768,60 @@ int lsm_system_record_free(lsm_system *s)
}

CREATE_FREE_ARRAY_FUNC(lsm_system_record_array_free, lsm_system_record_free,
- lsm_system *, LSM_ERR_INVALID_ARGUMENT)
+ lsm_system *, LSM_ERR_INVALID_ARGUMENT)

-lsm_system *lsm_system_record_copy(lsm_system *s)
+lsm_system *lsm_system_record_copy(lsm_system * s)
{
lsm_system *rc = NULL;
- if( LSM_IS_SYSTEM(s) ) {
- rc = lsm_system_record_alloc(s->id, s->name, s->status, s->status_info, s->plugin_data);
+ if (LSM_IS_SYSTEM(s)) {
+ rc = lsm_system_record_alloc(s->id, s->name, s->status, s->status_info,
+ s->plugin_data);
}
return rc;
}

-const char *lsm_system_id_get(lsm_system *s)
+const char *lsm_system_id_get(lsm_system * s)
{
- if( LSM_IS_SYSTEM(s) ) {
+ if (LSM_IS_SYSTEM(s)) {
return s->id;
}
return NULL;
}

-const char *lsm_system_name_get(lsm_system *s)
+const char *lsm_system_name_get(lsm_system * s)
{
- if( LSM_IS_SYSTEM(s) ) {
+ if (LSM_IS_SYSTEM(s)) {
return s->name;
}
return NULL;
}

-uint32_t lsm_system_status_get(lsm_system *s)
+uint32_t lsm_system_status_get(lsm_system * s)
{
- if( LSM_IS_SYSTEM(s) ) {
+ if (LSM_IS_SYSTEM(s)) {
return s->status;
}
return UINT32_MAX;
}

-MEMBER_FUNC_GET(const char *, lsm_system_plugin_data_get, lsm_system *s,
+MEMBER_FUNC_GET(const char *, lsm_system_plugin_data_get, lsm_system * s,
s, LSM_IS_SYSTEM, plugin_data, NULL)

-lsm_volume *lsm_volume_record_copy(lsm_volume *vol)
+lsm_volume *lsm_volume_record_copy(lsm_volume * vol)
{
lsm_volume *rc = NULL;
- if( LSM_IS_VOL(vol) ) {
+ if (LSM_IS_VOL(vol)) {
rc = lsm_volume_record_alloc(vol->id, vol->name, vol->vpd83,
- vol->block_size, vol->number_of_blocks,
- vol->admin_state, vol->system_id, vol->pool_id, vol->plugin_data);
+ vol->block_size, vol->number_of_blocks,
+ vol->admin_state, vol->system_id,
+ vol->pool_id, vol->plugin_data);
}
return rc;
}

-int lsm_volume_record_free(lsm_volume *v)
+int lsm_volume_record_free(lsm_volume * v)
{
- if ( LSM_IS_VOL(v) ) {
+ if (LSM_IS_VOL(v)) {
v->magic = LSM_DEL_MAGIC(LSM_VOL_MAGIC);

if (v->id) {
@@ -831,12 +839,12 @@ int lsm_volume_record_free(lsm_volume *v)
v->vpd83 = NULL;
}

- if( v->system_id ) {
+ if (v->system_id) {
free(v->system_id);
v->system_id = NULL;
}

- if( v->pool_id ) {
+ if (v->pool_id) {
free(v->pool_id);
v->pool_id = NULL;
}
@@ -850,21 +858,22 @@ int lsm_volume_record_free(lsm_volume *v)
return LSM_ERR_INVALID_ARGUMENT;
}

-CREATE_FREE_ARRAY_FUNC( lsm_volume_record_array_free, lsm_volume_record_free,
- lsm_volume *, LSM_ERR_INVALID_ARGUMENT)
+CREATE_FREE_ARRAY_FUNC(lsm_volume_record_array_free, lsm_volume_record_free,
+ lsm_volume *, LSM_ERR_INVALID_ARGUMENT)

-lsm_disk *lsm_disk_record_copy(lsm_disk *disk)
+lsm_disk *lsm_disk_record_copy(lsm_disk * disk)
{
- if( LSM_IS_DISK(disk) ) {
+ if (LSM_IS_DISK(disk)) {
return lsm_disk_record_alloc(disk->id, disk->name, disk->disk_type,
- disk->block_size, disk->block_count, disk->disk_status, disk->system_id);
+ disk->block_size, disk->block_count,
+ disk->disk_status, disk->system_id);
}
return NULL;
}

-int lsm_disk_record_free(lsm_disk *d)
+int lsm_disk_record_free(lsm_disk * d)
{
- if ( LSM_IS_DISK(d) ) {
+ if (LSM_IS_DISK(d)) {
d->magic = LSM_DEL_MAGIC(LSM_DISK_MAGIC);

free(d->id);
@@ -882,11 +891,12 @@ int lsm_disk_record_free(lsm_disk *d)
return LSM_ERR_INVALID_ARGUMENT;
}

-CREATE_FREE_ARRAY_FUNC( lsm_disk_record_array_free, lsm_disk_record_free,
- lsm_disk *, LSM_ERR_INVALID_ARGUMENT)
+CREATE_FREE_ARRAY_FUNC(lsm_disk_record_array_free, lsm_disk_record_free,
+ lsm_disk *, LSM_ERR_INVALID_ARGUMENT)

/* We would certainly expand this to encompass the entire function */
-#define MEMBER_SET_REF(x, validation, member, value, alloc_func, free_func, error) \
+#define MEMBER_SET_REF(x, validation, member, value, alloc_func, \
+ free_func, error) \
if( validation(x) ) { \
if(x->member) { \
free_func(x->member); \
@@ -902,7 +912,6 @@ CREATE_FREE_ARRAY_FUNC( lsm_disk_record_array_free, lsm_disk_record_free,
} else { \
return error; \
}
-
/* We would certainly expand this to encompass the entire function */
#define MEMBER_SET_VAL(x, validation, member, value, error) \
if( validation(x) ) { \
@@ -911,99 +920,99 @@ CREATE_FREE_ARRAY_FUNC( lsm_disk_record_array_free, lsm_disk_record_free,
} else { \
return error; \
}
-
-const char* lsm_volume_id_get(lsm_volume *v)
+const char *lsm_volume_id_get(lsm_volume * v)
{
MEMBER_GET(v, LSM_IS_VOL, id, NULL);
}

-const char* lsm_volume_name_get(lsm_volume *v)
+const char *lsm_volume_name_get(lsm_volume * v)
{
MEMBER_GET(v, LSM_IS_VOL, name, NULL);
}

-const char* lsm_volume_vpd83_get(lsm_volume *v)
+const char *lsm_volume_vpd83_get(lsm_volume * v)
{
MEMBER_GET(v, LSM_IS_VOL, vpd83, NULL);
}

-uint64_t lsm_volume_block_size_get(lsm_volume *v)
+uint64_t lsm_volume_block_size_get(lsm_volume * v)
{
MEMBER_GET(v, LSM_IS_VOL, block_size, 0);
}

-uint64_t lsm_volume_number_of_blocks_get(lsm_volume *v)
+uint64_t lsm_volume_number_of_blocks_get(lsm_volume * v)
{
MEMBER_GET(v, LSM_IS_VOL, number_of_blocks, 0);
}

-uint32_t lsm_volume_admin_state_get(lsm_volume *v)
+uint32_t lsm_volume_admin_state_get(lsm_volume * v)
{
MEMBER_GET(v, LSM_IS_VOL, admin_state, 0);
}

-char *lsm_volume_system_id_get( lsm_volume *v)
+char *lsm_volume_system_id_get(lsm_volume * v)
{
MEMBER_GET(v, LSM_IS_VOL, system_id, NULL);
}

-char *lsm_volume_pool_id_get( lsm_volume *v)
+char *lsm_volume_pool_id_get(lsm_volume * v)
{
MEMBER_GET(v, LSM_IS_VOL, pool_id, NULL);
}

-MEMBER_FUNC_GET(const char *, lsm_volume_plugin_data_get, lsm_volume *v, v, LSM_IS_VOL, plugin_data, NULL)
+MEMBER_FUNC_GET(const char *, lsm_volume_plugin_data_get, lsm_volume * v, v,
+ LSM_IS_VOL, plugin_data, NULL)

-const char *lsm_disk_id_get( lsm_disk *d)
+const char *lsm_disk_id_get(lsm_disk * d)
{
MEMBER_GET(d, LSM_IS_DISK, id, NULL);
}

-const char *lsm_disk_name_get( lsm_disk *d)
+const char *lsm_disk_name_get(lsm_disk * d)
{
MEMBER_GET(d, LSM_IS_DISK, name, NULL);
}

-lsm_disk_type lsm_disk_type_get( lsm_disk *d)
+lsm_disk_type lsm_disk_type_get(lsm_disk * d)
{
MEMBER_GET(d, LSM_IS_DISK, disk_type, LSM_DISK_TYPE_OTHER);
}

-uint64_t lsm_disk_block_size_get( lsm_disk *d)
+uint64_t lsm_disk_block_size_get(lsm_disk * d)
{
MEMBER_GET(d, LSM_IS_DISK, block_size, 0);
}

-uint64_t lsm_disk_number_of_blocks_get( lsm_disk *d)
+uint64_t lsm_disk_number_of_blocks_get(lsm_disk * d)
{
MEMBER_GET(d, LSM_IS_DISK, block_count, 0);
}

-uint64_t lsm_disk_status_get( lsm_disk *d)
+uint64_t lsm_disk_status_get(lsm_disk * d)
{
MEMBER_GET(d, LSM_IS_DISK, disk_status, LSM_DISK_STATUS_UNKNOWN);
}

-const char *lsm_disk_system_id_get( lsm_disk *d)
+const char *lsm_disk_system_id_get(lsm_disk * d)
{
MEMBER_GET(d, LSM_IS_DISK, system_id, NULL);
}

CREATE_ALLOC_ARRAY_FUNC(lsm_access_group_record_array_alloc, lsm_access_group *)

-static lsm_string_list *standardize_init_list(lsm_string_list *initiators)
+static lsm_string_list *standardize_init_list(lsm_string_list * initiators)
{
uint32_t i = 0;
lsm_string_list *rc = lsm_string_list_copy(initiators);
char *wwpn = NULL;

- if( rc ) {
- for( i = 0; i < lsm_string_list_size(rc); ++i ) {
- if( LSM_ERR_OK == wwpn_validate(lsm_string_list_elem_get(rc, i)) ) {
+ if (rc) {
+ for (i = 0; i < lsm_string_list_size(rc); ++i) {
+ if (LSM_ERR_OK == wwpn_validate(lsm_string_list_elem_get(rc, i))) {
/* We have a wwpn, switch to internal representation */
wwpn = wwpn_convert(lsm_string_list_elem_get(rc, i));
- if( !wwpn ||
- LSM_ERR_OK != lsm_string_list_elem_set(rc, i, wwpn) ) {
+ if (!wwpn ||
+ LSM_ERR_OK != lsm_string_list_elem_set(rc, i, wwpn)) {
free(wwpn);
lsm_string_list_free(rc);
rc = NULL;
@@ -1020,16 +1029,17 @@ static lsm_string_list *standardize_init_list(lsm_string_list *initiators)


lsm_access_group *lsm_access_group_record_alloc(const char *id,
- const char *name,
- lsm_string_list *initiators,
- lsm_access_group_init_type init_type,
- const char *system_id,
- const char *plugin_data)
+ const char *name,
+ lsm_string_list * initiators,
+ lsm_access_group_init_type
+ init_type,
+ const char *system_id,
+ const char *plugin_data)
{
lsm_access_group *rc = NULL;
- if( id && name && system_id ) {
- rc = (lsm_access_group *)malloc(sizeof(lsm_access_group));
- if( rc ) {
+ if (id && name && system_id) {
+ rc = (lsm_access_group *) malloc(sizeof(lsm_access_group));
+ if (rc) {
rc->magic = LSM_ACCESS_GROUP_MAGIC;
rc->id = strdup(id);
rc->name = strdup(name);
@@ -1037,15 +1047,15 @@ lsm_access_group *lsm_access_group_record_alloc(const char *id,
rc->initiators = standardize_init_list(initiators);
rc->init_type = init_type;

- if( plugin_data ) {
+ if (plugin_data) {
rc->plugin_data = strdup(plugin_data);
} else {
rc->plugin_data = NULL;
}

- if( !rc->id || !rc->name || !rc->system_id ||
+ if (!rc->id || !rc->name || !rc->system_id ||
(plugin_data && !rc->plugin_data) ||
- (initiators && !rc->initiators) ) {
+ (initiators && !rc->initiators)) {
lsm_access_group_record_free(rc);
rc = NULL;
}
@@ -1054,10 +1064,10 @@ lsm_access_group *lsm_access_group_record_alloc(const char *id,
return rc;
}

-lsm_access_group *lsm_access_group_record_copy( lsm_access_group *ag )
+lsm_access_group *lsm_access_group_record_copy(lsm_access_group * ag)
{
lsm_access_group *rc = NULL;
- if( LSM_IS_ACCESS_GROUP(ag) ) {
+ if (LSM_IS_ACCESS_GROUP(ag)) {
rc = lsm_access_group_record_alloc(ag->id, ag->name,
ag->initiators, ag->init_type,
ag->system_id, ag->plugin_data);
@@ -1065,9 +1075,9 @@ lsm_access_group *lsm_access_group_record_copy( lsm_access_group *ag )
return rc;
}

-int lsm_access_group_record_free(lsm_access_group *ag)
+int lsm_access_group_record_free(lsm_access_group * ag)
{
- if( LSM_IS_ACCESS_GROUP(ag) ) {
+ if (LSM_IS_ACCESS_GROUP(ag)) {
ag->magic = LSM_DEL_MAGIC(LSM_ACCESS_GROUP_MAGIC);
free(ag->id);
free(ag->name);
@@ -1080,43 +1090,47 @@ int lsm_access_group_record_free(lsm_access_group *ag)
return LSM_ERR_INVALID_ARGUMENT;
}

-CREATE_FREE_ARRAY_FUNC(lsm_access_group_record_array_free, lsm_access_group_record_free,
- lsm_access_group *, LSM_ERR_INVALID_ARGUMENT)
+CREATE_FREE_ARRAY_FUNC(lsm_access_group_record_array_free,
+ lsm_access_group_record_free, lsm_access_group *,
+ LSM_ERR_INVALID_ARGUMENT)

-const char *lsm_access_group_id_get( lsm_access_group *group )
+const char *lsm_access_group_id_get(lsm_access_group * group)
{
- if( LSM_IS_ACCESS_GROUP(group) ) {
+ if (LSM_IS_ACCESS_GROUP(group)) {
return group->id;
}
return NULL;
}
-const char *lsm_access_group_name_get( lsm_access_group *group )
+
+const char *lsm_access_group_name_get(lsm_access_group * group)
{
- if( LSM_IS_ACCESS_GROUP(group) ) {
+ if (LSM_IS_ACCESS_GROUP(group)) {
return group->name;
}
return NULL;
}
-const char *lsm_access_group_system_id_get( lsm_access_group *group )
+
+const char *lsm_access_group_system_id_get(lsm_access_group * group)
{
- if( LSM_IS_ACCESS_GROUP(group) ) {
+ if (LSM_IS_ACCESS_GROUP(group)) {
return group->system_id;
}
return NULL;
}

-lsm_string_list * lsm_access_group_initiator_id_get( lsm_access_group *group )
+lsm_string_list *lsm_access_group_initiator_id_get(lsm_access_group * group)
{
- if( LSM_IS_ACCESS_GROUP(group) ) {
+ if (LSM_IS_ACCESS_GROUP(group)) {
return group->initiators;
}
return NULL;
}

-void lsm_access_group_initiator_id_set( lsm_access_group *group, lsm_string_list *il)
+void lsm_access_group_initiator_id_set(lsm_access_group * group,
+ lsm_string_list * il)
{
- if( LSM_IS_ACCESS_GROUP(group) ) {
- if( group->initiators && group->initiators != il ) {
+ if (LSM_IS_ACCESS_GROUP(group)) {
+ if (group->initiators && group->initiators != il) {
lsm_string_list_free(group->initiators);
}

@@ -1124,9 +1138,9 @@ void lsm_access_group_initiator_id_set( lsm_access_group *group, lsm_string_list
}
}

-lsm_error_ptr lsm_error_last_get(lsm_connect *c)
+lsm_error_ptr lsm_error_last_get(lsm_connect * c)
{
- if( LSM_IS_CONNECT(c) ) {
+ if (LSM_IS_CONNECT(c)) {
lsm_error_ptr e = c->error;
c->error = NULL;
return e;
@@ -1135,13 +1149,13 @@ lsm_error_ptr lsm_error_last_get(lsm_connect *c)
}

lsm_block_range *lsm_block_range_record_alloc(uint64_t source_start,
- uint64_t dest_start,
- uint64_t block_count)
+ uint64_t dest_start,
+ uint64_t block_count)
{
lsm_block_range *rc = NULL;

- rc = (lsm_block_range*) malloc(sizeof(lsm_block_range));
- if( rc ) {
+ rc = (lsm_block_range *) malloc(sizeof(lsm_block_range));
+ if (rc) {
rc->magic = LSM_BLOCK_RANGE_MAGIC;
rc->source_start = source_start;
rc->dest_start = dest_start;
@@ -1150,9 +1164,9 @@ lsm_block_range *lsm_block_range_record_alloc(uint64_t source_start,
return rc;
}

-int lsm_block_range_record_free( lsm_block_range *br )
+int lsm_block_range_record_free(lsm_block_range * br)
{
- if( LSM_IS_BLOCK_RANGE(br) ) {
+ if (LSM_IS_BLOCK_RANGE(br)) {
br->magic = LSM_DEL_MAGIC(LSM_BLOCK_RANGE_MAGIC);
free(br);
return LSM_ERR_OK;
@@ -1160,48 +1174,48 @@ int lsm_block_range_record_free( lsm_block_range *br )
return LSM_ERR_INVALID_ARGUMENT;
}

-lsm_block_range *lsm_block_range_record_copy( lsm_block_range *source )
+lsm_block_range *lsm_block_range_record_copy(lsm_block_range * source)
{
lsm_block_range *dest = NULL;

- if( LSM_IS_BLOCK_RANGE(source) ) {
+ if (LSM_IS_BLOCK_RANGE(source)) {
dest = lsm_block_range_record_alloc(source->source_start,
- source->dest_start,
- source->block_count);
+ source->dest_start,
+ source->block_count);
}
return dest;
}

CREATE_ALLOC_ARRAY_FUNC(lsm_block_range_record_array_alloc, lsm_block_range *)
-CREATE_FREE_ARRAY_FUNC(lsm_block_range_record_array_free, lsm_block_range_record_free,
- lsm_block_range *, LSM_ERR_INVALID_ARGUMENT)
+ CREATE_FREE_ARRAY_FUNC(lsm_block_range_record_array_free,
+ lsm_block_range_record_free, lsm_block_range *,
+ LSM_ERR_INVALID_ARGUMENT)


-uint64_t lsm_block_range_source_start_get(lsm_block_range *br)
+uint64_t lsm_block_range_source_start_get(lsm_block_range * br)
{
MEMBER_GET(br, LSM_IS_BLOCK_RANGE, source_start, 0);
}

-uint64_t lsm_block_range_dest_start_get(lsm_block_range *br)
+uint64_t lsm_block_range_dest_start_get(lsm_block_range * br)
{
MEMBER_GET(br, LSM_IS_BLOCK_RANGE, dest_start, 0);
}

-uint64_t lsm_block_range_block_count_get(lsm_block_range *br)
+uint64_t lsm_block_range_block_count_get(lsm_block_range * br)
{
MEMBER_GET(br, LSM_IS_BLOCK_RANGE, block_count, 0);
}

-lsm_fs * lsm_fs_record_alloc(const char *id, const char *name,
- uint64_t total_space,
- uint64_t free_space,
- const char *pool_id,
- const char *system_id,
- const char* plugin_data)
+lsm_fs *lsm_fs_record_alloc(const char *id, const char *name,
+ uint64_t total_space,
+ uint64_t free_space,
+ const char *pool_id,
+ const char *system_id, const char *plugin_data)
{
lsm_fs *rc = NULL;
- rc = (lsm_fs *)calloc(1, sizeof(lsm_fs));
- if( rc ) {
+ rc = (lsm_fs *) calloc(1, sizeof(lsm_fs));
+ if (rc) {
rc->magic = LSM_FS_MAGIC;
rc->id = strdup(id);
rc->name = strdup(name);
@@ -1210,11 +1224,11 @@ lsm_fs * lsm_fs_record_alloc(const char *id, const char *name,
rc->total_space = total_space;
rc->free_space = free_space;

- if( plugin_data ) {
+ if (plugin_data) {
rc->plugin_data = strdup(plugin_data);
}

- if( !rc->id || !rc->name || !rc->pool_id || !rc->system_id ||
+ if (!rc->id || !rc->name || !rc->pool_id || !rc->system_id ||
(plugin_data && !rc->plugin_data)) {
lsm_fs_record_free(rc);
rc = NULL;
@@ -1223,9 +1237,9 @@ lsm_fs * lsm_fs_record_alloc(const char *id, const char *name,
return rc;
}

-int lsm_fs_record_free( lsm_fs *fs)
+int lsm_fs_record_free(lsm_fs * fs)
{
- if( LSM_IS_FS(fs) ) {
+ if (LSM_IS_FS(fs)) {
fs->magic = LSM_DEL_MAGIC(LSM_FS_MAGIC);
free(fs->id);
free(fs->name);
@@ -1238,72 +1252,70 @@ int lsm_fs_record_free( lsm_fs *fs)
return LSM_ERR_INVALID_ARGUMENT;
}

-lsm_fs *lsm_fs_record_copy(lsm_fs *source)
+lsm_fs *lsm_fs_record_copy(lsm_fs * source)
{
lsm_fs *dest = NULL;

- if( LSM_IS_FS(source) ) {
+ if (LSM_IS_FS(source)) {
dest = lsm_fs_record_alloc(source->id, source->name,
- source->total_space, source->free_space,
- source->pool_id,
- source->system_id,
- source->plugin_data);
+ source->total_space, source->free_space,
+ source->pool_id,
+ source->system_id, source->plugin_data);
}
return dest;
}

CREATE_ALLOC_ARRAY_FUNC(lsm_fs_record_array_alloc, lsm_fs *)
CREATE_FREE_ARRAY_FUNC(lsm_fs_record_array_free, lsm_fs_record_free, lsm_fs *,
- LSM_ERR_INVALID_ARGUMENT)
+ LSM_ERR_INVALID_ARGUMENT)

-const char *lsm_fs_id_get(lsm_fs *fs)
+const char *lsm_fs_id_get(lsm_fs * fs)
{
MEMBER_GET(fs, LSM_IS_FS, id, NULL);
}

-const char *lsm_fs_name_get(lsm_fs *fs)
+const char *lsm_fs_name_get(lsm_fs * fs)
{
MEMBER_GET(fs, LSM_IS_FS, name, NULL);
}

-const char *lsm_fs_system_id_get(lsm_fs *fs)
+const char *lsm_fs_system_id_get(lsm_fs * fs)
{
MEMBER_GET(fs, LSM_IS_FS, system_id, NULL);
}

-const char *lsm_fs_pool_id_get(lsm_fs *fs)
+const char *lsm_fs_pool_id_get(lsm_fs * fs)
{
MEMBER_GET(fs, LSM_IS_FS, pool_id, NULL);
}

-uint64_t lsm_fs_total_space_get(lsm_fs *fs)
+uint64_t lsm_fs_total_space_get(lsm_fs * fs)
{
MEMBER_GET(fs, LSM_IS_FS, total_space, 0);
}
-uint64_t lsm_fs_free_space_get(lsm_fs *fs)
+
+uint64_t lsm_fs_free_space_get(lsm_fs * fs)
{
MEMBER_GET(fs, LSM_IS_FS, free_space, 0);
}

-MEMBER_FUNC_GET(const char *, lsm_fs_plugin_data_get, lsm_fs *fs,
+MEMBER_FUNC_GET(const char *, lsm_fs_plugin_data_get, lsm_fs * fs,
fs, LSM_IS_POOL, plugin_data, NULL)

-lsm_fs_ss * lsm_fs_ss_record_alloc(const char *id, const char *name,
- uint64_t ts,
- const char * plugin_data)
+lsm_fs_ss *lsm_fs_ss_record_alloc(const char *id, const char *name,
+ uint64_t ts, const char *plugin_data)
{
lsm_fs_ss *rc = (lsm_fs_ss *) calloc(1, sizeof(lsm_fs_ss));
- if( rc ) {
+ if (rc) {
rc->magic = LSM_SS_MAGIC;
rc->id = strdup(id);
rc->name = strdup(name);
rc->ts = ts;
- if( plugin_data ) {
+ if (plugin_data) {
rc->plugin_data = strdup(plugin_data);
}

- if( !rc->id || ! rc->name ||
- (plugin_data && !rc->plugin_data)) {
+ if (!rc->id || !rc->name || (plugin_data && !rc->plugin_data)) {
lsm_fs_ss_record_free(rc);
rc = NULL;
}
@@ -1311,20 +1323,20 @@ lsm_fs_ss * lsm_fs_ss_record_alloc(const char *id, const char *name,
return rc;
}

-lsm_fs_ss *lsm_fs_ss_record_copy(lsm_fs_ss *source)
+lsm_fs_ss *lsm_fs_ss_record_copy(lsm_fs_ss * source)
{
lsm_fs_ss *rc = NULL;
- if( LSM_IS_SS(source) ) {
+ if (LSM_IS_SS(source)) {
rc = lsm_fs_ss_record_alloc(source->id,
- source->name,
- source->ts, source->plugin_data);
+ source->name,
+ source->ts, source->plugin_data);
}
return rc;
}

-int lsm_fs_ss_record_free( lsm_fs_ss *ss)
+int lsm_fs_ss_record_free(lsm_fs_ss * ss)
{
- if( LSM_IS_SS(ss) ) {
+ if (LSM_IS_SS(ss)) {
ss->magic = LSM_DEL_MAGIC(LSM_SS_MAGIC);
free(ss->id);
free(ss->name);
@@ -1337,45 +1349,46 @@ int lsm_fs_ss_record_free( lsm_fs_ss *ss)
}

CREATE_ALLOC_ARRAY_FUNC(lsm_fs_ss_record_array_alloc, lsm_fs_ss *)
-CREATE_FREE_ARRAY_FUNC(lsm_fs_ss_record_array_free, lsm_fs_ss_record_free, lsm_fs_ss *,
- LSM_ERR_INVALID_ARGUMENT)

-const char *lsm_fs_ss_id_get(lsm_fs_ss *ss)
+CREATE_FREE_ARRAY_FUNC(lsm_fs_ss_record_array_free, lsm_fs_ss_record_free,
+ lsm_fs_ss *, LSM_ERR_INVALID_ARGUMENT)
+
+const char *lsm_fs_ss_id_get(lsm_fs_ss * ss)
{
MEMBER_GET(ss, LSM_IS_SS, id, NULL);
}

-const char *lsm_fs_ss_name_get(lsm_fs_ss *ss)
+const char *lsm_fs_ss_name_get(lsm_fs_ss * ss)
{
MEMBER_GET(ss, LSM_IS_SS, name, NULL);
}

-uint64_t lsm_fs_ss_time_stamp_get(lsm_fs_ss *ss)
+uint64_t lsm_fs_ss_time_stamp_get(lsm_fs_ss * ss)
{
MEMBER_GET(ss, LSM_IS_SS, ts, 0);
}

-MEMBER_FUNC_GET(const char *, lsm_fs_ss_plugin_data_get, lsm_fs_ss *ss,
+MEMBER_FUNC_GET(const char *, lsm_fs_ss_plugin_data_get, lsm_fs_ss * ss,
ss, LSM_IS_SS, plugin_data, NULL)

lsm_nfs_export *lsm_nfs_export_record_alloc(const char *id,
const char *fs_id,
const char *export_path,
const char *auth,
- lsm_string_list *root,
- lsm_string_list *rw,
- lsm_string_list *ro,
+ lsm_string_list * root,
+ lsm_string_list * rw,
+ lsm_string_list * ro,
uint64_t anonuid,
uint64_t anongid,
const char *options,
- const char * plugin_data)
+ const char *plugin_data)
{
- lsm_nfs_export *rc = NULL;
+ lsm_nfs_export *rc = NULL;

/* This is required */
- if( fs_id ) {
- rc = (lsm_nfs_export *)calloc(1, sizeof(lsm_nfs_export));
- if( rc ) {
+ if (fs_id) {
+ rc = (lsm_nfs_export *) calloc(1, sizeof(lsm_nfs_export));
+ if (rc) {
rc->magic = LSM_NFS_EXPORT_MAGIC;
rc->id = (id) ? strdup(id) : NULL;
rc->fs_id = strdup(fs_id);
@@ -1388,11 +1401,11 @@ lsm_nfs_export *lsm_nfs_export_record_alloc(const char *id,
rc->anongid = anongid;
rc->options = (options) ? strdup(options) : NULL;

- if( plugin_data ) {
+ if (plugin_data) {
rc->plugin_data = strdup(plugin_data);
}

- if( !rc->id ||
+ if (!rc->id ||
!rc->fs_id ||
(export_path && !rc->export_path) ||
(auth && !rc->auth_type) ||
@@ -1410,9 +1423,9 @@ lsm_nfs_export *lsm_nfs_export_record_alloc(const char *id,
return rc;
}

-int lsm_nfs_export_record_free( lsm_nfs_export *exp )
+int lsm_nfs_export_record_free(lsm_nfs_export * exp)
{
- if( LSM_IS_NFS_EXPORT(exp) ) {
+ if (LSM_IS_NFS_EXPORT(exp)) {
exp->magic = LSM_DEL_MAGIC(LSM_NFS_EXPORT_MAGIC);
free(exp->id);
free(exp->fs_id);
@@ -1431,160 +1444,162 @@ int lsm_nfs_export_record_free( lsm_nfs_export *exp )
}


-lsm_nfs_export *lsm_nfs_export_record_copy( lsm_nfs_export *s )
+lsm_nfs_export *lsm_nfs_export_record_copy(lsm_nfs_export * s)
{
- if(LSM_IS_NFS_EXPORT(s)) {
+ if (LSM_IS_NFS_EXPORT(s)) {
return lsm_nfs_export_record_alloc(s->id, s->fs_id, s->export_path,
- s->auth_type, s->root, s->rw, s->ro, s->anonuid,
- s->anongid, s->options, s->plugin_data);
+ s->auth_type, s->root, s->rw, s->ro,
+ s->anonuid, s->anongid, s->options,
+ s->plugin_data);
}
return NULL;
}

CREATE_ALLOC_ARRAY_FUNC(lsm_nfs_export_record_array_alloc, lsm_nfs_export *)
-CREATE_FREE_ARRAY_FUNC(lsm_nfs_export_record_array_free, lsm_nfs_export_record_free,
- lsm_nfs_export *, LSM_ERR_INVALID_ARGUMENT)
+ CREATE_FREE_ARRAY_FUNC(lsm_nfs_export_record_array_free,
+ lsm_nfs_export_record_free, lsm_nfs_export *,
+ LSM_ERR_INVALID_ARGUMENT)

-const char *lsm_nfs_export_id_get( lsm_nfs_export *exp )
+const char *lsm_nfs_export_id_get(lsm_nfs_export * exp)
{
MEMBER_GET(exp, LSM_IS_NFS_EXPORT, id, NULL);
}

-int lsm_nfs_export_id_set(lsm_nfs_export *exp, const char *ep )
+int lsm_nfs_export_id_set(lsm_nfs_export * exp, const char *ep)
{
MEMBER_SET_REF(exp, LSM_IS_NFS_EXPORT, id, ep, strdup, free,
- LSM_ERR_INVALID_ARGUMENT);
+ LSM_ERR_INVALID_ARGUMENT);
}

-const char *lsm_nfs_export_fs_id_get( lsm_nfs_export *exp )
+const char *lsm_nfs_export_fs_id_get(lsm_nfs_export * exp)
{
MEMBER_GET(exp, LSM_IS_NFS_EXPORT, fs_id, NULL);
}

-int lsm_nfs_export_fs_id_set( lsm_nfs_export *exp, const char *fs_id)
+int lsm_nfs_export_fs_id_set(lsm_nfs_export * exp, const char *fs_id)
{
MEMBER_SET_REF(exp, LSM_IS_NFS_EXPORT, fs_id, fs_id, strdup, free,
- LSM_ERR_INVALID_ARGUMENT);
+ LSM_ERR_INVALID_ARGUMENT);
}

-const char *lsm_nfs_export_export_path_get( lsm_nfs_export *exp )
+const char *lsm_nfs_export_export_path_get(lsm_nfs_export * exp)
{
MEMBER_GET(exp, LSM_IS_NFS_EXPORT, export_path, NULL);
}

-int lsm_nfs_export_export_path_set( lsm_nfs_export *exp, const char *ep )
+int lsm_nfs_export_export_path_set(lsm_nfs_export * exp, const char *ep)
{
MEMBER_SET_REF(exp, LSM_IS_NFS_EXPORT, export_path, ep, strdup, free,
- LSM_ERR_INVALID_ARGUMENT);
+ LSM_ERR_INVALID_ARGUMENT);
}

-const char *lsm_nfs_export_auth_type_get( lsm_nfs_export *exp )
+const char *lsm_nfs_export_auth_type_get(lsm_nfs_export * exp)
{
MEMBER_GET(exp, LSM_IS_NFS_EXPORT, auth_type, NULL);
}

-int lsm_nfs_export_auth_type_set( lsm_nfs_export *exp, const char *auth )
+int lsm_nfs_export_auth_type_set(lsm_nfs_export * exp, const char *auth)
{
MEMBER_SET_REF(exp, LSM_IS_NFS_EXPORT, auth_type, auth, strdup, free,
- LSM_ERR_INVALID_ARGUMENT);
+ LSM_ERR_INVALID_ARGUMENT);
}

-lsm_string_list * lsm_nfs_export_root_get( lsm_nfs_export *exp)
+lsm_string_list *lsm_nfs_export_root_get(lsm_nfs_export * exp)
{
MEMBER_GET(exp, LSM_IS_NFS_EXPORT, root, NULL);
}

-int lsm_nfs_export_root_set( lsm_nfs_export *exp, lsm_string_list *root)
+int lsm_nfs_export_root_set(lsm_nfs_export * exp, lsm_string_list * root)
{
MEMBER_SET_REF(exp, LSM_IS_NFS_EXPORT, root, root, lsm_string_list_copy,
- lsm_string_list_free, LSM_ERR_INVALID_ARGUMENT);
+ lsm_string_list_free, LSM_ERR_INVALID_ARGUMENT);
}

-lsm_string_list * lsm_nfs_export_read_write_get( lsm_nfs_export *exp)
+lsm_string_list *lsm_nfs_export_read_write_get(lsm_nfs_export * exp)
{
MEMBER_GET(exp, LSM_IS_NFS_EXPORT, rw, NULL);
}

-int lsm_nfs_export_read_write_set( lsm_nfs_export *exp, lsm_string_list *rw)
+int lsm_nfs_export_read_write_set(lsm_nfs_export * exp, lsm_string_list * rw)
{
MEMBER_SET_REF(exp, LSM_IS_NFS_EXPORT, rw, rw, lsm_string_list_copy,
- lsm_string_list_free, LSM_ERR_INVALID_ARGUMENT);
+ lsm_string_list_free, LSM_ERR_INVALID_ARGUMENT);
}

-lsm_string_list * lsm_nfs_export_read_only_get( lsm_nfs_export *exp)
+lsm_string_list *lsm_nfs_export_read_only_get(lsm_nfs_export * exp)
{
MEMBER_GET(exp, LSM_IS_NFS_EXPORT, ro, NULL);
}

-int lsm_nfs_export_read_only_set(lsm_nfs_export *exp, lsm_string_list *ro)
+int lsm_nfs_export_read_only_set(lsm_nfs_export * exp, lsm_string_list * ro)
{
MEMBER_SET_REF(exp, LSM_IS_NFS_EXPORT, ro, ro, lsm_string_list_copy,
- lsm_string_list_free, LSM_ERR_INVALID_ARGUMENT);
+ lsm_string_list_free, LSM_ERR_INVALID_ARGUMENT);
}

-uint64_t lsm_nfs_export_anon_uid_get( lsm_nfs_export *exp )
+uint64_t lsm_nfs_export_anon_uid_get(lsm_nfs_export * exp)
{
MEMBER_GET(exp, LSM_IS_NFS_EXPORT, anonuid, ANON_UID_GID_ERROR);
}

-int lsm_nfs_export_anon_uid_set( lsm_nfs_export *exp, uint64_t value)
+int lsm_nfs_export_anon_uid_set(lsm_nfs_export * exp, uint64_t value)
{
MEMBER_SET_VAL(exp, LSM_IS_NFS_EXPORT, anonuid, value,
- LSM_ERR_INVALID_ARGUMENT);
+ LSM_ERR_INVALID_ARGUMENT);
}

-uint64_t lsm_nfs_export_anon_gid_get( lsm_nfs_export *exp )
+uint64_t lsm_nfs_export_anon_gid_get(lsm_nfs_export * exp)
{
MEMBER_GET(exp, LSM_IS_NFS_EXPORT, anongid, ANON_UID_GID_ERROR);
}

-int lsm_nfs_export_anon_gid_set( lsm_nfs_export *exp, uint64_t value )
+int lsm_nfs_export_anon_gid_set(lsm_nfs_export * exp, uint64_t value)
{
MEMBER_SET_VAL(exp, LSM_IS_NFS_EXPORT, anongid, value,
- LSM_ERR_INVALID_ARGUMENT);
+ LSM_ERR_INVALID_ARGUMENT);
}

-const char *lsm_nfs_export_options_get( lsm_nfs_export *exp)
+const char *lsm_nfs_export_options_get(lsm_nfs_export * exp)
{
MEMBER_GET(exp, LSM_IS_NFS_EXPORT, options, NULL);
}

-int lsm_nfs_export_options_set( lsm_nfs_export *exp, const char *value )
+int lsm_nfs_export_options_set(lsm_nfs_export * exp, const char *value)
{
MEMBER_SET_REF(exp, LSM_IS_NFS_EXPORT, options, value, strdup, free,
- LSM_ERR_INVALID_ARGUMENT);
+ LSM_ERR_INVALID_ARGUMENT);
}

MEMBER_FUNC_GET(const char *, lsm_nfs_export_plugin_data_get,
- lsm_nfs_export *exp, exp, LSM_IS_NFS_EXPORT, plugin_data, NULL)
+ lsm_nfs_export * exp, exp, LSM_IS_NFS_EXPORT, plugin_data, NULL)

-lsm_capability_value_type lsm_capability_get(lsm_storage_capabilities *cap,
- lsm_capability_type t)
+lsm_capability_value_type lsm_capability_get(lsm_storage_capabilities * cap,
+ lsm_capability_type t)
{
lsm_capability_value_type rc = LSM_CAP_UNSUPPORTED;

- if( LSM_IS_CAPABILITIY(cap) && (uint32_t)t < cap->len ) {
- rc = (lsm_capability_value_type)cap->cap[t];
+ if (LSM_IS_CAPABILITIY(cap) && (uint32_t) t < cap->len) {
+ rc = (lsm_capability_value_type) cap->cap[t];
}
return rc;
}

-int LSM_DLL_EXPORT lsm_capability_supported(lsm_storage_capabilities *cap,
- lsm_capability_type t)
+int LSM_DLL_EXPORT lsm_capability_supported(lsm_storage_capabilities * cap,
+ lsm_capability_type t)
{
- if( lsm_capability_get(cap, t) == LSM_CAP_SUPPORTED ) {
+ if (lsm_capability_get(cap, t) == LSM_CAP_SUPPORTED) {
return 1;
}
return 0;
}

-int lsm_capability_set(lsm_storage_capabilities *cap, lsm_capability_type t,
- lsm_capability_value_type v)
+int lsm_capability_set(lsm_storage_capabilities * cap, lsm_capability_type t,
+ lsm_capability_value_type v)
{
int rc = LSM_ERR_INVALID_ARGUMENT;

- if( LSM_IS_CAPABILITIY(cap) ) {
- if( (uint32_t)t < cap->len) {
+ if (LSM_IS_CAPABILITIY(cap)) {
+ if ((uint32_t) t < cap->len) {
cap->cap[t] = v;
rc = LSM_ERR_OK;
}
@@ -1593,22 +1608,21 @@ int lsm_capability_set(lsm_storage_capabilities *cap, lsm_capability_type t,
return rc;
}

-int lsm_capability_set_n( lsm_storage_capabilities *cap,
- lsm_capability_value_type v,
- ... )
+int lsm_capability_set_n(lsm_storage_capabilities * cap,
+ lsm_capability_value_type v, ...)
{
int rc = LSM_ERR_OK;
int index = 0;

- if( !LSM_IS_CAPABILITIY(cap) ) {
+ if (!LSM_IS_CAPABILITIY(cap)) {
return LSM_ERR_INVALID_ARGUMENT;
}

va_list var_arg;
va_start(var_arg, v);

- while( (index = va_arg(var_arg, int)) != -1 ) {
- if( index < (int)cap->len ) {
+ while ((index = va_arg(var_arg, int)) != -1) {
+ if (index < (int) cap->len) {
cap->cap[index] = v;
} else {
rc = LSM_ERR_INVALID_ARGUMENT;
@@ -1620,19 +1634,19 @@ int lsm_capability_set_n( lsm_storage_capabilities *cap,
return rc;
}

-static char* bytes_to_string(uint8_t *a, uint32_t len)
+static char *bytes_to_string(uint8_t * a, uint32_t len)
{
char *buff = NULL;

- if( a && len ) {
+ if (a && len) {
uint32_t i = 0;
char *tmp = NULL;
size_t str_len = ((sizeof(char) * 2) * len + 1);
- buff = (char*)malloc(str_len);
+ buff = (char *) malloc(str_len);

- if( buff ) {
+ if (buff) {
tmp = buff;
- for( i = 0; i < len; ++i ) {
+ for (i = 0; i < len; ++i) {
tmp += sprintf(tmp, "%02x", a[i]);
}
buff[str_len - 1] = '\0';
@@ -1641,22 +1655,22 @@ static char* bytes_to_string(uint8_t *a, uint32_t len)
return buff;
}

-static uint8_t *string_to_bytes(const char *hex_string, uint32_t *l)
+static uint8_t *string_to_bytes(const char *hex_string, uint32_t * l)
{
uint8_t *rc = NULL;

- if( hex_string && l ) {
+ if (hex_string && l) {
size_t len = strlen(hex_string);
- if( len && (len % 2) == 0) {
+ if (len && (len % 2) == 0) {
len /= 2;
- rc = (uint8_t*)malloc( sizeof(uint8_t) * len);
- if( rc ) {
+ rc = (uint8_t *) malloc(sizeof(uint8_t) * len);
+ if (rc) {
size_t i;
const char *t = hex_string;
*l = len;

- for( i = 0; i < len; ++i ) {
- if( 1 != sscanf(t, "%02hhx", &rc[i])) {
+ for (i = 0; i < len; ++i) {
+ if (1 != sscanf(t, "%02hhx", &rc[i])) {
free(rc);
rc = NULL;
*l = 0;
@@ -1674,20 +1688,21 @@ static uint8_t *string_to_bytes(const char *hex_string, uint32_t *l)
lsm_storage_capabilities *lsm_capability_record_alloc(const char *value)
{
lsm_storage_capabilities *rc = NULL;
- rc = (lsm_storage_capabilities *)malloc(sizeof(struct _lsm_storage_capabilities));
- if(rc) {
+ rc = (lsm_storage_capabilities *)
+ malloc(sizeof(struct _lsm_storage_capabilities));
+ if (rc) {
rc->magic = LSM_CAPABILITIES_MAGIC;

- if( value ) {
+ if (value) {
rc->cap = string_to_bytes(value, &rc->len);
} else {
- rc->cap = (uint8_t *)calloc(LSM_CAP_MAX, sizeof(uint8_t));
- if( rc->cap ) {
+ rc->cap = (uint8_t *) calloc(LSM_CAP_MAX, sizeof(uint8_t));
+ if (rc->cap) {
rc->len = LSM_CAP_MAX;
}
}

- if( !rc->cap ) {
+ if (!rc->cap) {
lsm_capability_record_free(rc);
rc = NULL;
}
@@ -1695,9 +1710,9 @@ lsm_storage_capabilities *lsm_capability_record_alloc(const char *value)
return rc;
}

-int lsm_capability_record_free(lsm_storage_capabilities *cap)
+int lsm_capability_record_free(lsm_storage_capabilities * cap)
{
- if( LSM_IS_CAPABILITIY(cap) ) {
+ if (LSM_IS_CAPABILITIY(cap)) {
cap->magic = LSM_DEL_MAGIC(LSM_CAPABILITIES_MAGIC);
free(cap->cap);
free(cap);
@@ -1706,10 +1721,10 @@ int lsm_capability_record_free(lsm_storage_capabilities *cap)
return LSM_ERR_INVALID_ARGUMENT;
}

-char* capability_string(lsm_storage_capabilities *c)
+char *capability_string(lsm_storage_capabilities * c)
{
char *rc = NULL;
- if( LSM_IS_CAPABILITIY(c) ) {
+ if (LSM_IS_CAPABILITIY(c)) {
rc = bytes_to_string(c->cap, c->len);
}
return rc;
@@ -1719,11 +1734,11 @@ lsm_hash *lsm_hash_alloc(void)
{
lsm_hash *rc = NULL;

- rc = (lsm_hash *)malloc(sizeof(lsm_hash));
- if( rc ) {
+ rc = (lsm_hash *) malloc(sizeof(lsm_hash));
+ if (rc) {
rc->magic = LSM_HASH_MAGIC;
rc->data = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
- if ( !rc->data ) {
+ if (!rc->data) {
lsm_hash_free(rc);
rc = NULL;
}
@@ -1731,22 +1746,22 @@ lsm_hash *lsm_hash_alloc(void)
return rc;
}

-lsm_hash *lsm_hash_copy(lsm_hash *src)
+lsm_hash *lsm_hash_copy(lsm_hash * src)
{
GHashTableIter iter;
gpointer key;
gpointer value;

lsm_hash *dest = NULL;
- if( LSM_IS_HASH(src) ) {
+ if (LSM_IS_HASH(src)) {
dest = lsm_hash_alloc();
- if( dest ) {
- /* Walk through each from src and duplicate it to dest*/
+ if (dest) {
+ /* Walk through each from src and duplicate it to dest */
g_hash_table_iter_init(&iter, src->data);
- while(g_hash_table_iter_next(&iter, &key, &value)) {
- if( LSM_ERR_OK != lsm_hash_string_set(dest,
- (const char*)key, (const char*)value))
- {
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ if (LSM_ERR_OK != lsm_hash_string_set(dest,
+ (const char *) key,
+ (const char *) value)) {
lsm_hash_free(dest);
dest = NULL;
}
@@ -1756,12 +1771,12 @@ lsm_hash *lsm_hash_copy(lsm_hash *src)
return dest;
}

-int lsm_hash_free(lsm_hash *op)
+int lsm_hash_free(lsm_hash * op)
{
- if( LSM_IS_HASH(op) ) {
+ if (LSM_IS_HASH(op)) {
op->magic = LSM_DEL_MAGIC(LSM_HASH_MAGIC);

- if( op->data ) {
+ if (op->data) {
g_hash_table_destroy(op->data);
}

@@ -1771,21 +1786,21 @@ int lsm_hash_free(lsm_hash *op)
return LSM_ERR_INVALID_ARGUMENT;
}

-int lsm_hash_keys(lsm_hash *op, lsm_string_list **l)
+int lsm_hash_keys(lsm_hash * op, lsm_string_list ** l)
{
GHashTableIter iter;
gpointer key;
gpointer value;


- if( LSM_IS_HASH(op) ) {
+ if (LSM_IS_HASH(op)) {
int count = g_hash_table_size(op->data);

- if( count ) {
+ if (count) {
*l = lsm_string_list_alloc(0);
g_hash_table_iter_init(&iter, op->data);
- while(g_hash_table_iter_next(&iter, &key, &value)) {
- if(LSM_ERR_OK != lsm_string_list_append(*l, (char *)key) ) {
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ if (LSM_ERR_OK != lsm_string_list_append(*l, (char *) key)) {
lsm_string_list_free(*l);
*l = NULL;
return LSM_ERR_NO_MEMORY;
@@ -1797,26 +1812,24 @@ int lsm_hash_keys(lsm_hash *op, lsm_string_list **l)
return LSM_ERR_INVALID_ARGUMENT;
}

-const char *lsm_hash_string_get(lsm_hash *op,
- const char *key)
+const char *lsm_hash_string_get(lsm_hash * op, const char *key)
{
- if( LSM_IS_HASH(op) ) {
- return (const char*)g_hash_table_lookup(op->data, key);
+ if (LSM_IS_HASH(op)) {
+ return (const char *) g_hash_table_lookup(op->data, key);
}
return NULL;
}

-int lsm_hash_string_set(lsm_hash *op,
- const char *key,
- const char *value)
+int lsm_hash_string_set(lsm_hash * op, const char *key, const char *value)
{
- if( LSM_IS_HASH(op) ) {
+ if (LSM_IS_HASH(op)) {
char *k_value = strdup(key);
char *d_value = strdup(value);

- if( k_value && d_value ) {
- g_hash_table_remove(op->data, (gpointer)k_value);
- g_hash_table_insert(op->data, (gpointer)k_value, (gpointer)d_value);
+ if (k_value && d_value) {
+ g_hash_table_remove(op->data, (gpointer) k_value);
+ g_hash_table_insert(op->data, (gpointer) k_value,
+ (gpointer) d_value);
return LSM_ERR_OK;
} else {
free(k_value);
@@ -1827,17 +1840,18 @@ int lsm_hash_string_set(lsm_hash *op,
return LSM_ERR_INVALID_ARGUMENT;
}

-lsm_target_port *lsm_target_port_record_alloc( const char *id,
- lsm_target_port_type port_type,
- const char *service_address,
- const char *network_address,
- const char *physical_address,
- const char *physical_name,
- const char *system_id,
- const char *plugin_data)
+lsm_target_port *lsm_target_port_record_alloc(const char *id,
+ lsm_target_port_type port_type,
+ const char *service_address,
+ const char *network_address,
+ const char *physical_address,
+ const char *physical_name,
+ const char *system_id,
+ const char *plugin_data)
{
- lsm_target_port *rc = (lsm_target_port *) calloc(1, sizeof(lsm_target_port));
- if( rc ) {
+ lsm_target_port *rc =
+ (lsm_target_port *) calloc(1, sizeof(lsm_target_port));
+ if (rc) {
rc->magic = LSM_TARGET_PORT_MAGIC;
rc->id = strdup(id);
rc->port_type = port_type;
@@ -1848,19 +1862,19 @@ lsm_target_port *lsm_target_port_record_alloc( const char *id,
rc->system_id = strdup(system_id);
rc->plugin_data = (plugin_data) ? strdup(plugin_data) : NULL;

- if( !rc->id || !rc->service_address || !rc->network_address ||
+ if (!rc->id || !rc->service_address || !rc->network_address ||
!rc->physical_address || !rc->physical_name ||
!rc->system_id || (plugin_data && !rc->plugin_data)) {
- lsm_target_port_record_free(rc);
- rc = NULL;
+ lsm_target_port_record_free(rc);
+ rc = NULL;
}
}
return rc;
}

-int lsm_target_port_record_free(lsm_target_port *tp)
+int lsm_target_port_record_free(lsm_target_port * tp)
{
- if( LSM_IS_TARGET_PORT(tp) ) {
+ if (LSM_IS_TARGET_PORT(tp)) {
tp->magic = LSM_DEL_MAGIC(LSM_TARGET_PORT_MAGIC);
free(tp->id);
tp->id = NULL;
@@ -1882,34 +1896,53 @@ int lsm_target_port_record_free(lsm_target_port *tp)
return LSM_ERR_INVALID_ARGUMENT;
}

-lsm_target_port LSM_DLL_EXPORT *lsm_target_port_copy(lsm_target_port *tp)
+lsm_target_port LSM_DLL_EXPORT *lsm_target_port_copy(lsm_target_port * tp)
{
lsm_target_port *rc = NULL;

- if( LSM_IS_TARGET_PORT(tp) ) {
+ if (LSM_IS_TARGET_PORT(tp)) {
rc = lsm_target_port_record_alloc(tp->id, tp->port_type,
- tp->service_address,
- tp->network_address,
- tp->physical_address,
- tp->physical_name,
- tp->system_id,
- tp->plugin_data);
+ tp->service_address,
+ tp->network_address,
+ tp->physical_address,
+ tp->physical_name,
+ tp->system_id, tp->plugin_data);
}
return rc;
}

-MEMBER_FUNC_GET(const char *, lsm_target_port_id_get, lsm_target_port *tp, tp, LSM_IS_TARGET_PORT, id, NULL)
-MEMBER_FUNC_GET(lsm_target_port_type, lsm_target_port_type_get, lsm_target_port *tp, tp, LSM_IS_TARGET_PORT, port_type, LSM_TARGET_PORT_TYPE_OTHER)
-MEMBER_FUNC_GET(const char *, lsm_target_port_service_address_get, lsm_target_port *tp, tp, LSM_IS_TARGET_PORT, service_address, NULL)
-MEMBER_FUNC_GET(const char *, lsm_target_port_network_address_get, lsm_target_port *tp, tp, LSM_IS_TARGET_PORT, network_address, NULL)
-MEMBER_FUNC_GET(const char *, lsm_target_port_physical_address_get, lsm_target_port *tp, tp, LSM_IS_TARGET_PORT, physical_address, NULL)
-MEMBER_FUNC_GET(const char *, lsm_target_port_physical_name_get, lsm_target_port *tp, tp, LSM_IS_TARGET_PORT, physical_name, NULL)
-MEMBER_FUNC_GET(const char *, lsm_target_port_system_id_get, lsm_target_port *tp, tp, LSM_IS_TARGET_PORT, system_id, NULL)
+MEMBER_FUNC_GET(const char *, lsm_target_port_id_get, lsm_target_port * tp, tp,
+ LSM_IS_TARGET_PORT, id, NULL)
+
+MEMBER_FUNC_GET(lsm_target_port_type, lsm_target_port_type_get,
+ lsm_target_port * tp, tp, LSM_IS_TARGET_PORT, port_type,
+ LSM_TARGET_PORT_TYPE_OTHER)
+
+MEMBER_FUNC_GET(const char *, lsm_target_port_service_address_get,
+ lsm_target_port * tp, tp, LSM_IS_TARGET_PORT, service_address,
+ NULL)
+
+MEMBER_FUNC_GET(const char *, lsm_target_port_network_address_get,
+ lsm_target_port * tp, tp, LSM_IS_TARGET_PORT, network_address,
+ NULL)
+
+MEMBER_FUNC_GET(const char *, lsm_target_port_physical_address_get,
+ lsm_target_port * tp, tp, LSM_IS_TARGET_PORT, physical_address,
+ NULL)
+
+MEMBER_FUNC_GET(const char *, lsm_target_port_physical_name_get,
+ lsm_target_port * tp, tp, LSM_IS_TARGET_PORT, physical_name,
+ NULL)
+
+MEMBER_FUNC_GET(const char *, lsm_target_port_system_id_get,
+ lsm_target_port * tp, tp, LSM_IS_TARGET_PORT, system_id, NULL)
+
+CREATE_ALLOC_ARRAY_FUNC(lsm_target_port_record_array_alloc,
+ lsm_target_port *)

-CREATE_ALLOC_ARRAY_FUNC(lsm_target_port_record_array_alloc, lsm_target_port *)
CREATE_FREE_ARRAY_FUNC(lsm_target_port_record_array_free,
- lsm_target_port_record_free, lsm_target_port *,
- LSM_ERR_INVALID_ARGUMENT)
+ lsm_target_port_record_free, lsm_target_port *,
+ LSM_ERR_INVALID_ARGUMENT)

static int reg_ex_match(const char *pattern, const char *str)
{
@@ -1931,8 +1964,9 @@ static int reg_ex_match(const char *pattern, const char *str)

int iqn_validate(const char *iqn)
{
- if( (iqn && strlen(iqn) > 4) && ( 0 == strncmp(iqn, "iqn", 3) ||
- 0 == strncmp(iqn, "naa", 3) || 0 == strncmp(iqn, "eui", 3)) ) {
+ if ((iqn && strlen(iqn) > 4) && (0 == strncmp(iqn, "iqn", 3) ||
+ 0 == strncmp(iqn, "naa", 3)
+ || 0 == strncmp(iqn, "eui", 3))) {
return LSM_ERR_OK;
}
return LSM_ERR_INVALID_ARGUMENT;
@@ -1940,9 +1974,9 @@ int iqn_validate(const char *iqn)

int wwpn_validate(const char *wwpn)
{
- const char *pattern = "^(0x|0X)?([0-9A-Fa-f]{2})"
- "(([\\.\\:\\-])?[0-9A-Fa-f]{2}){7}$";
- if( 0 == reg_ex_match(pattern, wwpn) ) {
+ const char *pattern = "^(0x|0X)?([0-9A-Fa-f]{2})"
+ "(([\\.\\:\\-])?[0-9A-Fa-f]{2}){7}$";
+ if (0 == reg_ex_match(pattern, wwpn)) {
return LSM_ERR_OK;
}
return LSM_ERR_INVALID_ARGUMENT;
@@ -1954,16 +1988,16 @@ char *wwpn_convert(const char *wwpn)
size_t out = 0;
char *rc = NULL;

- if( LSM_ERR_OK == wwpn_validate(wwpn) ) {
- rc = (char*)calloc(24,1);
+ if (LSM_ERR_OK == wwpn_validate(wwpn)) {
+ rc = (char *) calloc(24, 1);
size_t len = strlen(wwpn);

if (wwpn[1] == 'x' || wwpn[1] == 'X') {
i = 2;
}

- for( ; i < len; ++i ) {
- if( wwpn[i] != ':' && wwpn[i] != '-' && wwpn[i] != '.') {
+ for (; i < len; ++i) {
+ if (wwpn[i] != ':' && wwpn[i] != '-' && wwpn[i] != '.') {
rc[out++] = tolower(wwpn[i]);
} else {
rc[out++] = ':';
@@ -1972,6 +2006,7 @@ char *wwpn_convert(const char *wwpn)
}
return rc;
}
+
#ifdef __cplusplus
}
#endif
diff --git a/c_binding/lsm_datatypes.hpp b/c_binding/lsm_datatypes.hpp
index 75f308a..dc211c2 100644
--- a/c_binding/lsm_datatypes.hpp
+++ b/c_binding/lsm_datatypes.hpp
@@ -30,10 +30,7 @@
#ifdef __cplusplus
extern "C" {
#endif
-
-/* Helper macros to ease getter construction */
-
-/* Implementation for generic getter */
+/* Helper macros to ease getter construction *//* Implementation for generic getter */
#define MEMBER_FUNC_GET(return_type, name, param_sig, x, validation, member, error) \
return_type name( param_sig ) {\
if( validation(x) ) { \
@@ -46,25 +43,21 @@ return_type name( param_sig ) {\
#define MAGIC_CHECK(obj, m) ((obj) && \
((obj)->magic==(m) ))
#define LSM_DEL_MAGIC(obj) ((obj & 0x0FFFFFFF) | 0xD0000000)
-
#define LSM_VOL_MAGIC 0xAA7A0000
#define LSM_IS_VOL(obj) MAGIC_CHECK(obj, LSM_VOL_MAGIC)
-
#define LSM_FLAG_UNUSED_CHECK(x) ( x != 0 )
#define LSM_FLAG_GET_VALUE(x) x["flags"].asUint64_t()
#define LSM_FLAG_EXPECTED_TYPE(x) (Value::numeric_t == x["flags"].valueType())
-
/**
* Information about storage volumes.
- */
-struct LSM_DLL_LOCAL _lsm_volume {
- uint32_t magic;
+ */ struct LSM_DLL_LOCAL _lsm_volume {
+ uint32_t magic;
char *id; /**< System wide unique identifier */
char *name; /**< Human recognizeable name */
char *vpd83; /**< SCSI page 83 unique ID */
- uint64_t block_size; /**< Block size */
- uint64_t number_of_blocks; /**< Number of blocks */
- uint32_t admin_state; /**< Status */
+ uint64_t block_size; /**< Block size */
+ uint64_t number_of_blocks; /**< Number of blocks */
+ uint32_t admin_state; /**< Status */
char *system_id; /**< System this volume belongs */
char *pool_id; /**< Pool this volume is derived from */
char *plugin_data; /**< Private data for plugin */
@@ -77,14 +70,14 @@ struct LSM_DLL_LOCAL _lsm_volume {
* Information about storage pools.
*/
struct LSM_DLL_LOCAL _lsm_pool {
- uint32_t magic; /**< Used for verfication */
+ uint32_t magic; /**< Used for verfication */
char *id; /**< System wide unique identifier */
char *name; /**< Human recognizeable name */
- uint64_t element_type; /**< What the pool can be used for */
- uint64_t unsupported_actions; /**< What pool cannot be used for */
- uint64_t total_space; /**< Total size */
- uint64_t free_space; /**< Free space available */
- uint64_t status; /**< Status of pool */
+ uint64_t element_type; /**< What the pool can be used for */
+ uint64_t unsupported_actions; /**< What pool cannot be used for */
+ uint64_t total_space; /**< Total size */
+ uint64_t free_space; /**< Free space available */
+ uint64_t status; /**< Status of pool */
char *status_info; /**< Status info for pool */
char *system_id; /**< system id */
char *plugin_data; /**< Private data for plugin */
@@ -102,8 +95,10 @@ struct _lsm_access_group {
char *id; /**< Id */
char *name; /**< Name */
char *system_id; /**< System id */
- lsm_access_group_init_type init_type; /**< Init type */
- lsm_string_list *initiators; /**< List of initiators */
+ lsm_access_group_init_type init_type;
+ /**< Init type */
+ lsm_string_list *initiators;
+ /**< List of initiators */
char *plugin_data; /**< Reserved for the plugin to use */
};

@@ -181,19 +176,19 @@ struct _lsm_system {
* Information pertaining to the plug-in specifics.
*/
struct LSM_DLL_LOCAL _lsm_plugin {
- uint32_t magic; /**< Magic, used for structure validation */
- Ipc *tp; /**< IPC transport */
- char *desc; /**< Description */
- char *version; /**< Version */
- void *private_data; /**< Private data for plug-in */
- lsm_error *error; /**< Error information */
- lsm_plugin_register reg; /**< Plug-in registration */
- lsm_plugin_unregister unreg; /**< Plug-in unregistration */
- struct lsm_mgmt_ops_v1 *mgmt_ops; /**< Callback for management ops */
- struct lsm_san_ops_v1 *san_ops; /**< Callbacks for SAN ops */
- struct lsm_nas_ops_v1 *nas_ops; /**< Callbacks for NAS ops */
- struct lsm_fs_ops_v1 *fs_ops; /**< Callbacks for fs ops */
- struct lsm_ops_v1_2 *ops_v1_2; /**< Callbacks for v1.2 ops */
+ uint32_t magic; /**< Magic, used for structure validation */
+ Ipc *tp; /**< IPC transport */
+ char *desc; /**< Description */
+ char *version; /**< Version */
+ void *private_data; /**< Private data for plug-in */
+ lsm_error *error; /**< Error information */
+ lsm_plugin_register reg; /**< Plug-in registration */
+ lsm_plugin_unregister unreg; /**< Plug-in unregistration */
+ struct lsm_mgmt_ops_v1 *mgmt_ops; /**< Callback for management ops */
+ struct lsm_san_ops_v1 *san_ops; /**< Callbacks for SAN ops */
+ struct lsm_nas_ops_v1 *nas_ops; /**< Callbacks for NAS ops */
+ struct lsm_fs_ops_v1 *fs_ops; /**< Callbacks for fs ops */
+ struct lsm_ops_v1_2 *ops_v1_2; /**< Callbacks for v1.2 ops */
};


@@ -202,11 +197,11 @@ struct LSM_DLL_LOCAL _lsm_plugin {
* opaque data type for the library.
*/
struct LSM_DLL_LOCAL _lsm_connect {
- uint32_t magic; /**< Magic, used for structure validation */
- uint32_t flags; /**< Flags for the connection */
- xmlURIPtr uri; /**< URI */
- char *raw_uri; /**< Raw URI string */
- lsm_error *error; /**< Error information */
+ uint32_t magic; /**< Magic, used for structure validation */
+ uint32_t flags; /**< Flags for the connection */
+ xmlURIPtr uri; /**< URI */
+ char *raw_uri; /**< Raw URI string */
+ lsm_error *error; /**< Error information */
Ipc *tp; /**< IPC transport */
};

@@ -218,14 +213,15 @@ struct LSM_DLL_LOCAL _lsm_connect {
* Used to house error information.
*/
struct LSM_DLL_LOCAL _lsm_error {
- uint32_t magic; /**< Magic, used for struct validation */
+ uint32_t magic; /**< Magic, used for struct validation */
lsm_error_number code; /**< Error code */
- uint32_t reserved; /**< Reserved */
+ uint32_t reserved; /**< Reserved */
char *message; /**< Human readable error message */
char *exception; /**< Exception message if present */
char *debug; /**< Debug message */
void *debug_data; /**< Debug data */
- uint32_t debug_data_size; /**< Size of the data */
+ uint32_t debug_data_size;
+ /**< Size of the data */
};

/**
@@ -234,8 +230,8 @@ struct LSM_DLL_LOCAL _lsm_error {
#define LSM_STRING_LIST_MAGIC 0xAA7A000D
#define LSM_IS_STRING_LIST(obj) MAGIC_CHECK(obj, LSM_STRING_LIST_MAGIC)
struct LSM_DLL_LOCAL _lsm_string_list {
- uint32_t magic; /**< Magic value */
- GPtrArray *values;
+ uint32_t magic; /**< Magic value */
+ GPtrArray *values;
};

/**
@@ -244,14 +240,14 @@ struct LSM_DLL_LOCAL _lsm_string_list {
#define LSM_FS_MAGIC 0xAA7A000E
#define LSM_IS_FS(obj) MAGIC_CHECK(obj, LSM_FS_MAGIC)
struct LSM_DLL_LOCAL _lsm_fs {
- uint32_t magic; /**< Magic, used for struct validation */
- char *id; /**< Id */
- char *name; /**< Name */
- char *pool_id; /**< Pool ID */
- uint64_t total_space; /**< Total space */
- uint64_t free_space; /**< Free space */
- char *system_id; /**< System ID */
- char *plugin_data; /**< Plugin private data */
+ uint32_t magic; /**< Magic, used for struct validation */
+ char *id; /**< Id */
+ char *name; /**< Name */
+ char *pool_id; /**< Pool ID */
+ uint64_t total_space; /**< Total space */
+ uint64_t free_space; /**< Free space */
+ char *system_id; /**< System ID */
+ char *plugin_data; /**< Plugin private data */
};

#define LSM_SS_MAGIC 0xAA7A000F
@@ -273,7 +269,7 @@ struct LSM_DLL_LOCAL _lsm_disk {
lsm_disk_type disk_type;
uint64_t block_size;
uint64_t block_count;
- uint64_t disk_status; /* Bit field */
+ uint64_t disk_status; /* Bit field */
char *system_id;
};

@@ -310,7 +306,7 @@ lsm_connect LSM_DLL_LOCAL *connection_get();
* De-allocates the connection.
* @param c Connection to free.
*/
-void LSM_DLL_LOCAL connection_free(lsm_connect *c);
+void LSM_DLL_LOCAL connection_free(lsm_connect * c);

/**
* Loads the requester driver specified in the uri.
@@ -323,13 +319,11 @@ void LSM_DLL_LOCAL connection_free(lsm_connect *c);
* @param flags Reserved flag for future use
* @return LSM_ERR_OK on success, else error code.
*/
-int LSM_DLL_LOCAL driver_load(lsm_connect *c, const char *plugin,
- const char *password, uint32_t timeout,
- lsm_error_ptr *e,
- int startup,
- lsm_flag flags);
+int LSM_DLL_LOCAL driver_load(lsm_connect * c, const char *plugin,
+ const char *password, uint32_t timeout,
+ lsm_error_ptr * e, int startup, lsm_flag flags);

-char LSM_DLL_LOCAL *capability_string(lsm_storage_capabilities *c);
+char LSM_DLL_LOCAL *capability_string(lsm_storage_capabilities * c);

const char LSM_DLL_LOCAL *uds_path(void);

@@ -347,8 +341,8 @@ const char LSM_DLL_LOCAL *uds_path(void);
* 2 = Number converted to unsigned integer, value in ui
* 3 = Number converted to long double, value in d
*/
-int LSM_DLL_LOCAL number_convert(const char *str_num, int64_t *si, uint64_t *ui,
- long double *d);
+int LSM_DLL_LOCAL number_convert(const char *str_num, int64_t * si,
+ uint64_t * ui, long double *d);


/**
@@ -375,5 +369,4 @@ char LSM_DLL_LOCAL *wwpn_convert(const char *wwpn);
#ifdef __cplusplus
}
#endif
-
-#endif /* LSM_DATATYPES_H */
+#endif /* LSM_DATATYPES_H */
diff --git a/c_binding/lsm_ipc.cpp b/c_binding/lsm_ipc.cpp
index 51c862a..35a4e54 100644
--- a/c_binding/lsm_ipc.cpp
+++ b/c_binding/lsm_ipc.cpp
@@ -12,7 +12,8 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
*
* Author: tasleson
*/
@@ -43,7 +44,7 @@


#if defined(HAVE_YAJL_YAJL_VERSION_H) && YAJL_MAJOR > 1
- #define LSM_NEW_YAJL
+#define LSM_NEW_YAJL
#endif

static std::string zero_pad_num(unsigned int num)
@@ -53,15 +54,15 @@ static std::string zero_pad_num(unsigned int num)
return ss.str();
}

-Transport::Transport() : s(-1)
+Transport::Transport():s(-1)
{
}

-Transport::Transport(int socket_desc) : s(socket_desc)
+Transport::Transport(int socket_desc):s(socket_desc)
{
}

-int Transport::msg_send(const std::string &msg, int &error_code)
+int Transport::msg_send(const std::string & msg, int &error_code)
{
int rc = -1;
error_code = 0;
@@ -74,7 +75,7 @@ int Transport::msg_send(const std::string &msg, int &error_code)

while (written < msg_size) {
int wrote = send(s, data.c_str() + written, (msg_size - written),
- MSG_NOSIGNAL); //Prevent SIGPIPE on write
+ MSG_NOSIGNAL); //Prevent SIGPIPE on write
if (wrote != -1) {
written += wrote;
} else {
@@ -100,8 +101,8 @@ static std::string string_read(int fd, size_t count, int &error_code)

while (amount_read < count) {
ssize_t rd = recv(fd, buff, std::min(sizeof(buff),
- (count - amount_read)),
- MSG_WAITALL);
+ (count - amount_read)),
+ MSG_WAITALL);
if (rd > 0) {
amount_read += rd;
rc += std::string(buff, rd);
@@ -122,10 +123,10 @@ std::string Transport::msg_recv(int &error_code)
std::string msg;
error_code = 0;
unsigned long int payload_len = 0;
- std::string len = string_read(s, HDR_LEN, error_code); //Read the length
+ std::string len = string_read(s, HDR_LEN, error_code); //Read the length
if (len.size() && error_code == 0) {
payload_len = strtoul(len.c_str(), NULL, 10);
- if( payload_len < 0x80000000 ) { /* Should be big enough */
+ if (payload_len < 0x80000000) { /* Should be big enough */
msg = string_read(s, payload_len, error_code);
}
//fprintf(stderr, "<<< %s\n", msg.c_str());
@@ -133,7 +134,7 @@ std::string Transport::msg_recv(int &error_code)
return msg;
}

-int Transport::socket_get(const std::string& path, int &error_code)
+int Transport::socket_get(const std::string & path, int &error_code)
{
int sfd = socket(AF_UNIX, SOCK_STREAM, 0);
int rc = -1;
@@ -150,10 +151,10 @@ int Transport::socket_get(const std::string& path, int &error_code)
rc = connect(sfd, (struct sockaddr *) &addr, sizeof(addr));
if (rc != 0) {
error_code = errno;
- rc = -1; //Redundant, connect should set to -1 on error
+ rc = -1; //Redundant, connect should set to -1 on error
::close(sfd);
} else {
- rc = sfd; //We are good to go.
+ rc = sfd; //We are good to go.
}
}
return rc;
@@ -169,92 +170,92 @@ int Transport::close()
int rc = EBADF;

if (s >= 0) {
- int rc = ::close(s);
+ int rc =::close(s);
if (rc != 0) {
rc = errno;
}
-
// Regardless, clear out socket
s = -1;
}
return rc;
}

-EOFException::EOFException(std::string m) : std::runtime_error(m)
+EOFException::EOFException(std::string m):std::runtime_error(m)
{
}

-ValueException::ValueException(std::string m) : std::runtime_error(m)
+ValueException::ValueException(std::string m):std::runtime_error(m)
{
}

-LsmException::LsmException(int code, std::string &msg) :
+LsmException::LsmException(int code, std::string & msg):
std::runtime_error(msg), error_code(code)
{

}

-LsmException::LsmException(int code, std::string &msg, const std::string &debug_addl):
-std::runtime_error(msg), error_code(code), debug(debug_addl)
+LsmException::LsmException(int code, std::string & msg,
+ const std::
+ string & debug_addl):std::runtime_error(msg),
+error_code(code), debug(debug_addl)
{
}

-LsmException::~LsmException() throw ()
+LsmException::~LsmException()throw()
{
}

-LsmException::LsmException(int code, std::string &msg,
- const std::string &debug_addl,
- const std::string &debug_data_addl) :
-std::runtime_error(msg),
-error_code(code), debug(debug_addl),
-debug_data(debug_data_addl)
+LsmException::LsmException(int code, std::string & msg,
+ const std::string & debug_addl,
+ const std::
+ string & debug_data_addl):std::runtime_error(msg),
+error_code(code), debug(debug_addl), debug_data(debug_data_addl)
{
}

-Value::Value(void) : t(null_t)
+Value::Value(void):t(null_t)
{
}

-Value::Value(bool v) : t(boolean_t), s((v) ? "true" : "false")
+Value::Value(bool v):t(boolean_t), s((v) ? "true" : "false")
{
}

-Value::Value(double v) : t(numeric_t), s(to_string(v))
+Value::Value(double v):t(numeric_t), s(to_string(v))
{
}

-Value::Value(long double v) : t(numeric_t), s(to_string(v))
+Value::Value(long double v):t(numeric_t), s(to_string(v))
{
}

-Value::Value(uint32_t v) : t(numeric_t), s(to_string(v))
+Value::Value(uint32_t v):t(numeric_t), s(to_string(v))
{
}

-Value::Value(int32_t v) : t(numeric_t), s(to_string(v))
+Value::Value(int32_t v):t(numeric_t), s(to_string(v))
{
}

-Value::Value(uint64_t v) : t(numeric_t), s(to_string(v))
+Value::Value(uint64_t v):t(numeric_t), s(to_string(v))
{
}

-Value::Value(int64_t v) : t(numeric_t), s(to_string(v))
+Value::Value(int64_t v):t(numeric_t), s(to_string(v))
{
}

-Value::Value(value_type type, const std::string &v) : t(type), s(v)
+Value::Value(value_type type, const std::string & v):t(type), s(v)
{
}

-Value::Value(const std::vector<Value> &v) : t(array_t), array(v)
+Value::Value(const std::vector < Value > &v):t(array_t), array(v)
{
}

Value::Value(const char *v)
{
- if(v) {
+ if (v) {
t = string_t;
s = std::string(v);
} else {
@@ -262,11 +263,11 @@ Value::Value(const char *v)
}
}

-Value::Value(const std::string &v) : t(string_t), s(v)
+Value::Value(const std::string & v):t(string_t), s(v)
{
}

-Value::Value(const std::map<std::string, Value> &v) : t(object_t), obj(v)
+Value::Value(const std::map < std::string, Value > &v):t(object_t), obj(v)
{
}

@@ -275,25 +276,25 @@ std::string Value::serialize(void)
const unsigned char *buf;
std::string json;

- #ifdef LSM_NEW_YAJL
- size_t len;
- yajl_gen g = yajl_gen_alloc(NULL);
- if( g ) {
- /* These could fail, but we will continue regardless */
- yajl_gen_config(g, yajl_gen_beautify, 1);
- yajl_gen_config(g, yajl_gen_indent_string, " ");
- }
- #else
- unsigned int len;
- yajl_gen_config conf = {1, " "};
- yajl_gen g = yajl_gen_alloc(&conf, NULL);
- #endif
+#ifdef LSM_NEW_YAJL
+ size_t len;
+ yajl_gen g = yajl_gen_alloc(NULL);
+ if (g) {
+ /* These could fail, but we will continue regardless */
+ yajl_gen_config(g, yajl_gen_beautify, 1);
+ yajl_gen_config(g, yajl_gen_indent_string, " ");
+ }
+#else
+ unsigned int len;
+ yajl_gen_config conf = { 1, " " };
+ yajl_gen g = yajl_gen_alloc(&conf, NULL);
+#endif

if (g) {
marshal(g);

if (yajl_gen_status_ok == yajl_gen_get_buf(g, &buf, &len)) {
- json = std::string((const char*) buf);
+ json = std::string((const char *) buf);
}
yajl_gen_free(g);
}
@@ -305,26 +306,24 @@ Value::value_type Value::valueType() const
return t;
}

-Value& Value::operator[](const std::string &key)
-{
- if( t == object_t ) {
+Value & Value::operator[](const std::string & key) {
+ if (t == object_t) {
return obj[key];
}
throw ValueException("Value not object");
}

-Value& Value::operator[](uint32_t i)
-{
- if( t == array_t ) {
+Value & Value::operator[](uint32_t i) {
+ if (t == array_t) {
return array[i];
}
throw ValueException("Value not array");
}

-bool Value::hasKey(const std::string &k)
+bool Value::hasKey(const std::string & k)
{
- if( t == object_t ) {
- std::map<std::string, Value>::iterator iter = obj.find(k);
+ if (t == object_t) {
+ std::map < std::string, Value >::iterator iter = obj.find(k);
if (iter != obj.end() && iter->first == k) {
return true;
}
@@ -332,21 +331,21 @@ bool Value::hasKey(const std::string &k)
return false;
}

-bool Value::isValidRequest()
+bool Value::isValidRequest()
{
return (t == Value::object_t && hasKey("method") &&
hasKey("id") && hasKey("params"));
}

-Value Value::getValue( const char* key )
+Value Value::getValue(const char *key)
{
- if( hasKey(key) ) {
+ if (hasKey(key)) {
return obj[key];
}
return Value();
}

-const char * Value::asNumString()
+const char *Value::asNumString()
{
const char *rc = NULL;

@@ -356,7 +355,7 @@ const char * Value::asNumString()
return rc;
}

-void * Value::asVoid()
+void *Value::asVoid()
{
if (t == null_t) {
return NULL;
@@ -367,7 +366,7 @@ void * Value::asVoid()
bool Value::asBool()
{
if (t == boolean_t) {
- return(s == "true");
+ return (s == "true");
}
throw ValueException("Value not boolean");
}
@@ -415,7 +414,7 @@ int64_t Value::asInt64_t()
{
if (t == numeric_t) {
int64_t rc;
- if (sscanf(s.c_str(), "%lld", (long long int*) &rc) > 0) {
+ if (sscanf(s.c_str(), "%lld", (long long int *) &rc) > 0) {
return rc;
}
throw ValueException("Not an integer");
@@ -439,7 +438,7 @@ uint64_t Value::asUint64_t()
{
if (t == numeric_t) {
uint64_t rc;
- if (sscanf(s.c_str(), "%llu", (long long unsigned int*) &rc) > 0) {
+ if (sscanf(s.c_str(), "%llu", (long long unsigned int *) &rc) > 0) {
return rc;
}
throw ValueException("Not an integer");
@@ -451,23 +450,23 @@ std::string Value::asString()
{
if (t == string_t) {
return s;
- } else if( t == null_t ) {
+ } else if (t == null_t) {
return std::string();
}
throw ValueException("Value not string");
}

-const char * Value::asC_str()
+const char *Value::asC_str()
{
if (t == string_t) {
return s.c_str();
- } else if( t == null_t ) {
+ } else if (t == null_t) {
return NULL;
}
throw ValueException("Value not string");
}

-std::map<std::string, Value> Value::asObject()
+std::map < std::string, Value > Value::asObject()
{
if (t == object_t) {
return obj;
@@ -475,7 +474,7 @@ std::map<std::string, Value> Value::asObject()
throw ValueException("Value not object");
}

-std::vector<Value> Value::asArray()
+std::vector < Value > Value::asArray()
{
if (t == array_t) {
return array;
@@ -486,169 +485,168 @@ std::vector<Value> Value::asArray()
void Value::marshal(yajl_gen g)
{
switch (t) {
- case(null_t):
- {
- if (yajl_gen_status_ok != yajl_gen_null(g)) {
- throw ValueException("yajl_gen_null failure");
- }
- break;
- }
- case(boolean_t):
- {
- if (yajl_gen_status_ok != yajl_gen_bool(g, (s == "true") ? 1 : 0)) {
- throw ValueException("yajl_gen_bool failure");
+ case (null_t):
+ {
+ if (yajl_gen_status_ok != yajl_gen_null(g)) {
+ throw ValueException("yajl_gen_null failure");
+ }
+ break;
}
- break;
- }
- case(string_t):
- {
- if (yajl_gen_status_ok !=
- yajl_gen_string(g, (const unsigned char*) s.c_str(), s.size())) {
- throw ValueException("yajl_gen_string failure");
+ case (boolean_t):
+ {
+ if (yajl_gen_status_ok != yajl_gen_bool(g, (s == "true") ? 1 : 0)) {
+ throw ValueException("yajl_gen_bool failure");
+ }
+ break;
}
- break;
- }
- case(numeric_t):
- {
- if (yajl_gen_status_ok != yajl_gen_number(g, s.c_str(), s.size())) {
- throw ValueException("yajl_gen_number failure");
+ case (string_t):
+ {
+ if (yajl_gen_status_ok !=
+ yajl_gen_string(g, (const unsigned char *) s.c_str(),
+ s.size())) {
+ throw ValueException("yajl_gen_string failure");
+ }
+ break;
}
- break;
- }
- case(object_t):
- {
-
- if (yajl_gen_status_ok != yajl_gen_map_open(g)) {
- throw ValueException("yajl_gen_map_open failure");
+ case (numeric_t):
+ {
+ if (yajl_gen_status_ok != yajl_gen_number(g, s.c_str(), s.size())) {
+ throw ValueException("yajl_gen_number failure");
+ }
+ break;
}
+ case (object_t):
+ {

- std::map<std::string, Value>::iterator iter;
+ if (yajl_gen_status_ok != yajl_gen_map_open(g)) {
+ throw ValueException("yajl_gen_map_open failure");
+ }

- for (iter = obj.begin(); iter != obj.end(); iter++) {
- if (yajl_gen_status_ok != yajl_gen_string(g,
- (const unsigned char*) iter->first.c_str(),
- iter->first.size())) {
- throw ValueException("yajl_gen_string failure");
+ std::map < std::string, Value >::iterator iter;
+
+ for (iter = obj.begin(); iter != obj.end(); iter++) {
+ if (yajl_gen_status_ok != yajl_gen_string(g,
+ (const unsigned
+ char *) iter->first.
+ c_str(),
+ iter->first.size())) {
+ throw ValueException("yajl_gen_string failure");
+ }
+ iter->second.marshal(g);
}
- iter->second.marshal(g);
- }

- if (yajl_gen_status_ok != yajl_gen_map_close(g)) {
- throw ValueException("yajl_gen_map_close failure");
- }
- break;
- }
- case(array_t):
- {
- if (yajl_gen_status_ok != yajl_gen_array_open(g)) {
- throw ValueException("yajl_gen_array_open failure");
+ if (yajl_gen_status_ok != yajl_gen_map_close(g)) {
+ throw ValueException("yajl_gen_map_close failure");
+ }
+ break;
}
+ case (array_t):
+ {
+ if (yajl_gen_status_ok != yajl_gen_array_open(g)) {
+ throw ValueException("yajl_gen_array_open failure");
+ }

- for (unsigned int i = 0; i < array.size(); ++i) {
- array[i].marshal(g);
- }
+ for (unsigned int i = 0; i < array.size(); ++i) {
+ array[i].marshal(g);
+ }

- if (yajl_gen_status_ok != yajl_gen_array_close(g)) {
- throw ValueException("yajl_gen_array_close failure");
+ if (yajl_gen_status_ok != yajl_gen_array_close(g)) {
+ throw ValueException("yajl_gen_array_close failure");
+ }
+ break;
}
- break;
- }
}
}

class LSM_DLL_LOCAL ParseElement {
-public:
+ public:

enum parse_type {
null, boolean, string, number, begin_map, end_map,
begin_array, end_array, map_key, unknown
};

- ParseElement() : t(unknown)
- {
+ ParseElement():t(unknown) {
+ } ParseElement(parse_type type):t(type) {
}

- ParseElement(parse_type type) : t(type)
- {
- }
-
- ParseElement(parse_type type, std::string value) : t(type), v(value)
- {
+ ParseElement(parse_type type, std::string value):t(type), v(value) {
}
parse_type t;
std::string v;

- std::string to_string()
- {
- return "type " + ::to_string(t) + ": value" + v;
+ std::string to_string() {
+ return "type " +::to_string(t) + ": value" + v;
}
};

#ifdef LSM_NEW_YAJL
- #define YAJL_SIZE_T size_t
+#define YAJL_SIZE_T size_t
#else
- #define YAJL_SIZE_T unsigned int
+#define YAJL_SIZE_T unsigned int
#endif

-static int handle_value(void * ctx, ParseElement::parse_type type)
+static int handle_value(void *ctx, ParseElement::parse_type type)
{
- std::list<ParseElement> *l = (std::list<ParseElement> *)ctx;
+ std::list < ParseElement > *l = (std::list < ParseElement > *)ctx;
l->push_back(ParseElement(type));
return 1;
}

-static int handle_value(void * ctx, ParseElement::parse_type type,
- const char* s, size_t len)
+static int handle_value(void *ctx, ParseElement::parse_type type,
+ const char *s, size_t len)
{
- std::list<ParseElement> *l = (std::list<ParseElement> *)ctx;
+ std::list < ParseElement > *l = (std::list < ParseElement > *)ctx;
l->push_back(ParseElement(type, std::string(s, len)));
return 1;
}

-static int handle_null(void * ctx)
+static int handle_null(void *ctx)
{
return handle_value(ctx, ParseElement::null);
}

-static int handle_boolean(void * ctx, int boolean)
+static int handle_boolean(void *ctx, int boolean)
{
std::string b = (boolean) ? "true" : "false";
return handle_value(ctx, ParseElement::boolean, b.c_str(), b.size());
}

-static int handle_number(void * ctx, const char *s, YAJL_SIZE_T len)
+static int handle_number(void *ctx, const char *s, YAJL_SIZE_T len)
{
return handle_value(ctx, ParseElement::number, s, len);
}

-static int handle_string(void * ctx, const unsigned char * stringVal,
- YAJL_SIZE_T len)
+static int handle_string(void *ctx, const unsigned char *stringVal,
+ YAJL_SIZE_T len)
{
- return handle_value(ctx, ParseElement::string, (const char*) stringVal, len);
+ return handle_value(ctx, ParseElement::string,
+ (const char *) stringVal, len);
}

-static int handle_map_key(void * ctx, const unsigned char * stringVal,
- YAJL_SIZE_T len)
+static int handle_map_key(void *ctx, const unsigned char *stringVal,
+ YAJL_SIZE_T len)
{
- return handle_value(ctx, ParseElement::map_key, (const char*) stringVal, len);
+ return handle_value(ctx, ParseElement::map_key,
+ (const char *) stringVal, len);
}

-static int handle_start_map(void * ctx)
+static int handle_start_map(void *ctx)
{
return handle_value(ctx, ParseElement::begin_map);
}

-static int handle_end_map(void * ctx)
+static int handle_end_map(void *ctx)
{
return handle_value(ctx, ParseElement::end_map);
}

-static int handle_start_array(void * ctx)
+static int handle_start_array(void *ctx)
{
return handle_value(ctx, ParseElement::begin_array);
}

-static int handle_end_array(void * ctx)
+static int handle_end_array(void *ctx)
{
return handle_value(ctx, ParseElement::end_array);
}
@@ -667,18 +665,18 @@ static yajl_callbacks callbacks = {
handle_end_array
};

-static ParseElement get_next(std::list<ParseElement> &l)
+static ParseElement get_next(std::list < ParseElement > &l)
{
ParseElement rc = l.front();
l.pop_front();
return rc;
}

-static Value ParseElements(std::list<ParseElement> &l);
+static Value ParseElements(std::list < ParseElement > &l);

-static Value HandleArray(std::list<ParseElement> &l)
+static Value HandleArray(std::list < ParseElement > &l)
{
- std::vector<Value> values;
+ std::vector < Value > values;

ParseElement cur;

@@ -698,9 +696,9 @@ static Value HandleArray(std::list<ParseElement> &l)
return Value(values);
}

-static Value HandleObject(std::list<ParseElement> &l)
+static Value HandleObject(std::list < ParseElement > &l)
{
- std::map<std::string, Value> values;
+ std::map < std::string, Value > values;
ParseElement cur;

if (!l.empty()) {
@@ -717,7 +715,7 @@ static Value HandleObject(std::list<ParseElement> &l)
return Value(values);
}

-static Value ParseElements(std::list<ParseElement> &l)
+static Value ParseElements(std::list < ParseElement > &l)
{
if (!l.empty()) {
ParseElement cur = get_next(l);
@@ -727,66 +725,67 @@ static Value ParseElements(std::list<ParseElement> &l)
case (ParseElement::boolean):
case (ParseElement::string):
case (ParseElement::number):
- {
- return Value((Value::value_type)cur.t, cur.v);
- break;
- }
+ {
+ return Value((Value::value_type) cur.t, cur.v);
+ break;
+ }
case (ParseElement::begin_map):
- {
- return HandleObject(l);
- break;
- }
+ {
+ return HandleObject(l);
+ break;
+ }
case (ParseElement::end_map):
- {
- throw ValueException("Unexpected end_map");
- break;
- }
+ {
+ throw ValueException("Unexpected end_map");
+ break;
+ }
case (ParseElement::begin_array):
- {
- return HandleArray(l);
- break;
- }
- case( ParseElement::end_array):
- {
- throw ValueException("Unexpected end_array");
- break;
- }
- case( ParseElement::map_key):
- {
- throw ValueException("Unexpected map_key");
- break;
- }
- case( ParseElement::unknown):
- {
- throw ValueException("Unexpected unknown");
- break;
- }
+ {
+ return HandleArray(l);
+ break;
+ }
+ case (ParseElement::end_array):
+ {
+ throw ValueException("Unexpected end_array");
+ break;
+ }
+ case (ParseElement::map_key):
+ {
+ throw ValueException("Unexpected map_key");
+ break;
+ }
+ case (ParseElement::unknown):
+ {
+ throw ValueException("Unexpected unknown");
+ break;
+ }
}
}
return Value();
}

-std::string Payload::serialize(Value &v)
+std::string Payload::serialize(Value & v)
{
return v.serialize();
}

-Value Payload::deserialize(const std::string &json)
+Value Payload::deserialize(const std::string & json)
{
yajl_handle hand;
yajl_status stat;
- std::list<ParseElement> l;
+ std::list < ParseElement > l;

- #ifdef LSM_NEW_YAJL
- hand = yajl_alloc(&callbacks, NULL, (void *) &l);
- yajl_config(hand, yajl_allow_comments, 1);
- #else
- yajl_parser_config cfg = {1, 1};
- hand = yajl_alloc(&callbacks, &cfg, NULL, (void *) &l);
- #endif
+#ifdef LSM_NEW_YAJL
+ hand = yajl_alloc(&callbacks, NULL, (void *) &l);
+ yajl_config(hand, yajl_allow_comments, 1);
+#else
+ yajl_parser_config cfg = { 1, 1 };
+ hand = yajl_alloc(&callbacks, &cfg, NULL, (void *) &l);
+#endif

if (hand) {
- stat = yajl_parse(hand, (const unsigned char*) json.c_str(), json.size());
+ stat =
+ yajl_parse(hand, (const unsigned char *) json.c_str(), json.size());
yajl_free(hand);

if (stat == yajl_status_ok) {
@@ -820,11 +819,12 @@ Ipc::~Ipc()
t.close();
}

-void Ipc::requestSend(const std::string request, const Value &params, int32_t id)
+void Ipc::requestSend(const std::string request, const Value & params,
+ int32_t id)
{
int rc = 0;
int ec = 0;
- std::map<std::string, Value> v;
+ std::map < std::string, Value > v;

v["method"] = Value(request);
v["id"] = Value(id);
@@ -833,10 +833,10 @@ void Ipc::requestSend(const std::string request, const Value &params, int32_t id
Value req(v);
rc = t.msg_send(Payload::serialize(req), ec);

- if( rc != 0 ) {
+ if (rc != 0) {
std::string em = std::string("Error sending message: errno ")
- + ::to_string(ec);
- throw LsmException((int)LSM_ERR_TRANSPORT_COMMUNICATION, em);
+ +::to_string(ec);
+ throw LsmException((int) LSM_ERR_TRANSPORT_COMMUNICATION, em);
}
}

@@ -845,8 +845,8 @@ void Ipc::errorSend(int error_code, std::string msg, std::string debug,
{
int ec = 0;
int rc = 0;
- std::map<std::string, Value> v;
- std::map<std::string, Value> error_data;
+ std::map < std::string, Value > v;
+ std::map < std::string, Value > error_data;

error_data["code"] = Value(error_code);
error_data["message"] = Value(msg);
@@ -858,10 +858,10 @@ void Ipc::errorSend(int error_code, std::string msg, std::string debug,
Value e(v);
rc = t.msg_send(Payload::serialize(e), ec);

- if( rc != 0 ) {
+ if (rc != 0) {
std::string em = std::string("Error sending error message: errno ")
- + ::to_string(ec);
- throw LsmException((int)LSM_ERR_TRANSPORT_COMMUNICATION, em);
+ +::to_string(ec);
+ throw LsmException((int) LSM_ERR_TRANSPORT_COMMUNICATION, em);
}
}

@@ -872,11 +872,11 @@ Value Ipc::readRequest(void)
return Payload::deserialize(resp);
}

-void Ipc::responseSend(const Value &response, uint32_t id)
+void Ipc::responseSend(const Value & response, uint32_t id)
{
int rc;
int ec;
- std::map<std::string, Value> v;
+ std::map < std::string, Value > v;

v["id"] = id;
v["result"] = response;
@@ -884,29 +884,29 @@ void Ipc::responseSend(const Value &response, uint32_t id)
Value resp(v);
rc = t.msg_send(Payload::serialize(resp), ec);

- if( rc != 0 ) {
+ if (rc != 0) {
std::string em = std::string("Error sending response: errno ")
- + ::to_string(ec);
- throw LsmException((int)LSM_ERR_TRANSPORT_COMMUNICATION, em);
+ +::to_string(ec);
+ throw LsmException((int) LSM_ERR_TRANSPORT_COMMUNICATION, em);
}
}

Value Ipc::responseRead()
{
Value r = readRequest();
- if( r.hasKey(std::string("result"))) {
+ if (r.hasKey(std::string("result"))) {
return r.getValue("result");
} else {
- std::map<std::string, Value> rp = r.asObject();
- std::map<std::string, Value> error = rp["error"].asObject();
+ std::map < std::string, Value > rp = r.asObject();
+ std::map < std::string, Value > error = rp["error"].asObject();

std::string msg = error["message"].asString();
std::string data = error["data"].asString();
- throw LsmException((int)(error["code"].asInt32_t()), msg, data);
+ throw LsmException((int) (error["code"].asInt32_t()), msg, data);
}
}

-Value Ipc::rpc(const std::string &request, const Value &params, int32_t id)
+Value Ipc::rpc(const std::string & request, const Value & params, int32_t id)
{
requestSend(request, params, id);
return responseRead();
diff --git a/c_binding/lsm_ipc.hpp b/c_binding/lsm_ipc.hpp
index 8377386..744a940 100644
--- a/c_binding/lsm_ipc.hpp
+++ b/c_binding/lsm_ipc.hpp
@@ -12,7 +12,8 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
*
* Author: tasleson
*/
@@ -38,7 +39,7 @@
* more threads.
*/
class LSM_DLL_LOCAL Transport {
-public:
+ public:

/**
* Size of the header which immediately proceeds the payload.
@@ -49,13 +50,13 @@ public:
* Empty ctor.
* @return
*/
- Transport();
+ Transport();

/**
* Class ctor
* @param socket_desc Connected socket descriptor.
*/
- Transport(int socket_desc);
+ Transport(int socket_desc);

/**
* Class dtor
@@ -68,7 +69,7 @@ public:
* @param[out] error_code Errno (only valid if we return -1)
* @return 0 on success, else -1
*/
- int msg_send(const std::string &msg, int &error_code);
+ int msg_send(const std::string & msg, int &error_code);

/**
* Received a message over the transport.
@@ -77,7 +78,7 @@ public:
* @param error_code (0 on success, else errno)
* @return Message on success else 0 size with error_code set (not if EOF)
*/
- std::string msg_recv(int &error_code);
+ std::string msg_recv(int &error_code);

/**
* Creates a connected socket (AF_UNIX) to the specified path
@@ -85,7 +86,7 @@ public:
* @param error_code Error reason for the failure (errno)
* @return -1 on error, else connected socket.
*/
- static int socket_get(const std::string &path, int &error_code);
+ static int socket_get(const std::string & path, int &error_code);

/**
* Closes the transport, called in the destructor if not done in advance.
@@ -93,8 +94,8 @@ public:
*/
int close();

-private:
- int s; //Socket descriptor
+ private:
+ int s; //Socket descriptor
};

/**
@@ -102,7 +103,8 @@ private:
* @param v Template type T
* @return string representation
*/
-template <class Type> static std::string to_string(Type v) {
+template < class Type > static std::string to_string(Type v)
+{
std::stringstream out;
out << v;
return out.str();
@@ -112,8 +114,8 @@ template <class Type> static std::string to_string(Type v) {
* Class that represents an EOF condition
* @param m Message
*/
-class LSM_DLL_LOCAL EOFException : public std::runtime_error {
-public:
+class LSM_DLL_LOCAL EOFException:public std::runtime_error {
+ public:
EOFException(std::string m);
};

@@ -121,8 +123,8 @@ public:
/**
* User defined class for Value errors during serialize / de-serialize.
*/
-class LSM_DLL_LOCAL ValueException : public std::runtime_error {
-public:
+class LSM_DLL_LOCAL ValueException:public std::runtime_error {
+ public:
/**
* Constructor
* @param m Exception message
@@ -133,15 +135,15 @@ public:
/**
* User defined class for errors
*/
-class LSM_DLL_LOCAL LsmException : public std::runtime_error {
-public:
+class LSM_DLL_LOCAL LsmException:public std::runtime_error {
+ public:

/**
* Constructor
* @param code Error code
* @param msg Error message
*/
- LsmException(int code, std::string &msg);
+ LsmException(int code, std::string & msg);

/**
* Constructor
@@ -149,7 +151,7 @@ public:
* @param msg Error message
* @param debug_addl Additional debug data
*/
- LsmException(int code, std::string &msg, const std::string &debug_addl);
+ LsmException(int code, std::string & msg, const std::string & debug_addl);

/**
* Constructor
@@ -158,13 +160,14 @@ public:
* @param debug_addl Additional debug
* @param debug_data_addl Additional debug data
*/
- LsmException(int code, std::string &msg, const std::string &debug_addl,
- const std::string &debug_data_addl);
+ LsmException(int code, std::string & msg,
+ const std::string & debug_addl,
+ const std::string & debug_data_addl);

/**
* Destructor
*/
- ~LsmException() throw ();
+ ~LsmException() throw();

int error_code;
std::string debug;
@@ -175,7 +178,7 @@ public:
* Represents a value in the serialization.
*/
class LSM_DLL_LOCAL Value {
-public:
+ public:

/**
* Different types this class can hold.
@@ -231,7 +234,7 @@ public:
* @param type Type this object will hold.
* @param v value
*/
- Value(value_type type, const std::string &v);
+ Value(value_type type, const std::string & v);

/**
* Constructor for char * i.e. string.
@@ -243,19 +246,19 @@ public:
* Constructor for std::string
* @param v value
*/
- Value(const std::string &v);
+ Value(const std::string & v);

/**
* Constructor for object type
* @param v values
*/
- Value(const std::map<std::string, Value> &v);
+ Value(const std::map < std::string, Value > &v);

/**
* Constructor for array type
* @param v array values
*/
- Value(const std::vector<Value> &v);
+ Value(const std::vector < Value > &v);

/**
* Serialize Value to json
@@ -274,20 +277,20 @@ public:
* @param key
* @return Value
*/
- Value& operator[](const std::string &key);
+ Value & operator[] (const std::string & key);

/**
* Overloaded operator for vector(array) access
* @param i
* @return Value
*/
- Value& operator[](uint32_t i);
+ Value & operator[] (uint32_t i);

/**
* Returns true if value has a key in key/value pair
* @return true if key exists, else false.
*/
- bool hasKey(const std::string &k);
+ bool hasKey(const std::string & k);

/**
* Checks to see if a Value contains a valid request
@@ -300,18 +303,18 @@ public:
* @param key
* @return Value
*/
- Value getValue(const char* key);
+ Value getValue(const char *key);

/**
* Returns a numeric as the string holding it.
*/
- const char* asNumString();
+ const char *asNumString();

/**
* Returns NULL if void type, else ValueException
* @return NULL
*/
- void * asVoid();
+ void *asVoid();

/**
* Boolean value represented by object.
@@ -366,19 +369,19 @@ public:
* key/value represented by object.
* @return map of key and values else ValueException on error
*/
- std::map<std::string, Value> asObject();
+ std::map < std::string, Value > asObject();

/**
* vector of values represented by object.
* @return vector of array values else ValueException on error
*/
- std::vector<Value> asArray();
+ std::vector < Value > asArray();

-private:
+ private:
value_type t;
std::string s;
- std::map<std::string, Value> obj;
- std::vector<Value> array;
+ std::map < std::string, Value > obj;
+ std::vector < Value > array;

void marshal(yajl_gen g);
};
@@ -387,24 +390,24 @@ private:
* Serialize, de-serialize methods.
*/
class LSM_DLL_LOCAL Payload {
-public:
+ public:
/**
* Given a Value returns json representation.
* @param v Value to serialize
* @return String representation
*/
- static std::string serialize(Value &v);
+ static std::string serialize(Value & v);

/**
* Given a json string return a Value
* @param json String to de-serialize
* @return Value
*/
- static Value deserialize(const std::string &json);
+ static Value deserialize(const std::string & json);
};

class LSM_DLL_LOCAL Ipc {
-public:
+ public:
/**
* Constructor
*/
@@ -433,8 +436,8 @@ public:
* @param params Parameters
* @param id Request ID
*/
- void requestSend(const std::string request, const Value &params,
- int32_t id = 100);
+ void requestSend(const std::string request, const Value & params,
+ int32_t id = 100);
/**
* Reads a request
* @returns Value
@@ -446,7 +449,7 @@ public:
* @param response Response value
* @param id Id that matches request
*/
- void responseSend(const Value &response, uint32_t id = 100);
+ void responseSend(const Value & response, uint32_t id = 100);

/**
* Read a response
@@ -462,7 +465,7 @@ public:
* @param id Id that matches request
*/
void errorSend(int error_code, std::string msg, std::string debug,
- uint32_t id = 100);
+ uint32_t id = 100);

/**
* Do a remote procedure call (Request with a returned response
@@ -471,11 +474,12 @@ public:
* @param id Id of request
* @return Result of the operation.
*/
- Value rpc(const std::string &request, const Value &params, int32_t id = 100);
+ Value rpc(const std::string & request, const Value & params,
+ int32_t id = 100);


-private:
+ private:
Transport t;
};

-#endif
\ No newline at end of file
+#endif
diff --git a/c_binding/lsm_mgmt.cpp b/c_binding/lsm_mgmt.cpp
index 841545d..bbf481c 100644
--- a/c_binding/lsm_mgmt.cpp
+++ b/c_binding/lsm_mgmt.cpp
@@ -29,27 +29,35 @@
#include "lsm_datatypes.hpp"
#include "lsm_convert.hpp"

-#define COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
+#define COUNT_OF(x) \
+ ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
+
+static const char *const POOL_SEARCH_KEYS[] = { "id", "system_id" };

-static const char * const POOL_SEARCH_KEYS[] = { "id", "system_id" };
#define POOL_SEARCH_KEYS_COUNT COUNT_OF(POOL_SEARCH_KEYS)

-static const char * const VOLUME_SEARCH_KEYS[] = {"id", "system_id", "pool_id"};
+static const char *const VOLUME_SEARCH_KEYS[] =
+ { "id", "system_id", "pool_id" };
#define VOLUME_SEARCH_KEYS_COUNT COUNT_OF(VOLUME_SEARCH_KEYS)

-static const char * const DISK_SEARCH_KEYS[] = {"id", "system_id"};
+static const char *const DISK_SEARCH_KEYS[] = { "id", "system_id" };
+
#define DISK_SEARCH_KEYS_COUNT COUNT_OF(DISK_SEARCH_KEYS)

-static const char * const FS_SEARCH_KEYS[] = {"id", "system_id", "pool_id"};
+static const char *const FS_SEARCH_KEYS[] = { "id", "system_id", "pool_id" };
+
#define FS_SEARCH_KEYS_COUNT COUNT_OF(FS_SEARCH_KEYS)

-static const char * const NFS_EXPORT_SEARCH_KEYS[] = {"id", "fs_id"};
+static const char *const NFS_EXPORT_SEARCH_KEYS[] = { "id", "fs_id" };
+
#define NFS_EXPORT_SEARCH_KEYS_COUNT COUNT_OF(NFS_EXPORT_SEARCH_KEYS)

-static const char * const ACCESS_GROUP_SEARCH_KEYS[] = {"id", "system_id"};
+static const char *const ACCESS_GROUP_SEARCH_KEYS[] = { "id", "system_id" };
+
#define ACCESS_GROUP_SEARCH_KEYS_COUNT COUNT_OF(ACCESS_GROUP_SEARCH_KEYS)

-static const char * const TARGET_PORT_SEARCH_KEYS[] = {"id", "system_id"};
+static const char *const TARGET_PORT_SEARCH_KEYS[] = { "id", "system_id" };
+
#define TARGET_PORT_SEARCH_KEYS_COUNT COUNT_OF(TARGET_PORT_SEARCH_KEYS)

/**
@@ -64,12 +72,12 @@ static const char * const TARGET_PORT_SEARCH_KEYS[] = {"id", "system_id"};
} while (0)

static int check_search_key(const char *search_key,
- const char * const supported_keys[],
+ const char *const supported_keys[],
size_t supported_keys_count)
{
size_t i = 0;
- for( i = 0; i < supported_keys_count; ++i ) {
- if( 0 == strcmp(search_key, supported_keys[i])) {
+ for (i = 0; i < supported_keys_count; ++i) {
+ if (0 == strcmp(search_key, supported_keys[i])) {
return 1;
}
}
@@ -77,58 +85,58 @@ static int check_search_key(const char *search_key,
}

int lsm_initiator_id_verify(const char *init_id,
- lsm_access_group_init_type *init_type)
+ lsm_access_group_init_type * init_type)
{
int rc = LSM_ERR_INVALID_ARGUMENT;

- if( init_id != NULL && strlen(init_id) > 3 ) {
+ if (init_id != NULL && strlen(init_id) > 3) {

- switch( *init_type ) {
- case( LSM_ACCESS_GROUP_INIT_TYPE_UNKNOWN ):
- if( 0 == iqn_validate(init_id) ) {
- *init_type = LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_IQN;
- rc = LSM_ERR_OK;
- }
- if( 0 == wwpn_validate(init_id) ) {
- *init_type = LSM_ACCESS_GROUP_INIT_TYPE_WWPN;
- rc = LSM_ERR_OK;
- }
- break;
- case( LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_IQN ):
- if( 0 == iqn_validate(init_id) ) {
- *init_type = LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_IQN;
- rc = LSM_ERR_OK;
- }
- break;
- case( LSM_ACCESS_GROUP_INIT_TYPE_WWPN ):
- if( 0 == wwpn_validate(init_id) ) {
- *init_type = LSM_ACCESS_GROUP_INIT_TYPE_WWPN;
- rc = LSM_ERR_OK;
- }
- break;
- default:
- break;
+ switch (*init_type) {
+ case (LSM_ACCESS_GROUP_INIT_TYPE_UNKNOWN):
+ if (0 == iqn_validate(init_id)) {
+ *init_type = LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_IQN;
+ rc = LSM_ERR_OK;
+ }
+ if (0 == wwpn_validate(init_id)) {
+ *init_type = LSM_ACCESS_GROUP_INIT_TYPE_WWPN;
+ rc = LSM_ERR_OK;
+ }
+ break;
+ case (LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_IQN):
+ if (0 == iqn_validate(init_id)) {
+ *init_type = LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_IQN;
+ rc = LSM_ERR_OK;
+ }
+ break;
+ case (LSM_ACCESS_GROUP_INIT_TYPE_WWPN):
+ if (0 == wwpn_validate(init_id)) {
+ *init_type = LSM_ACCESS_GROUP_INIT_TYPE_WWPN;
+ rc = LSM_ERR_OK;
+ }
+ break;
+ default:
+ break;
}
}
return rc;
}

-int lsm_volume_vpd83_verify( const char *vpd83 )
+int lsm_volume_vpd83_verify(const char *vpd83)
{
int rc = LSM_ERR_INVALID_ARGUMENT;
int i;
size_t vpd83_len;

- if( vpd83 ){
+ if (vpd83) {
vpd83_len = strlen(vpd83);
- if( (vpd83_len == 32 && vpd83[0] == '6' ) ||
- (vpd83_len == 16 && vpd83[0] == '2' ) ||
- (vpd83_len == 16 && vpd83[0] == '3' ) ||
- (vpd83_len == 16 && vpd83[0] == '5' )) {
- for(i = 0; i < vpd83_len; ++i) {
+ if ((vpd83_len == 32 && vpd83[0] == '6') ||
+ (vpd83_len == 16 && vpd83[0] == '2') ||
+ (vpd83_len == 16 && vpd83[0] == '3') ||
+ (vpd83_len == 16 && vpd83[0] == '5')) {
+ for (i = 0; i < vpd83_len; ++i) {
char v = vpd83[i];
// 0-9 || a-f is OK
- if( !((v >= 48 && v <= 57) || (v >= 97 && v <= 102)) ) {
+ if (!((v >= 48 && v <= 57) || (v >= 97 && v <= 102))) {
return rc;
}
}
@@ -138,22 +146,22 @@ int lsm_volume_vpd83_verify( const char *vpd83 )
return rc;
}

-static int verify_initiator_id(const char *id, lsm_access_group_init_type t,
- Value &initiator)
+static int verify_initiator_id(const char *id,
+ lsm_access_group_init_type t, Value & initiator)
{
initiator = Value(id);

- if( t == LSM_ACCESS_GROUP_INIT_TYPE_WWPN ) {
+ if (t == LSM_ACCESS_GROUP_INIT_TYPE_WWPN) {
char *wwpn = wwpn_convert(id);
- if( wwpn ) {
+ if (wwpn) {
initiator = Value(wwpn);
free(wwpn);
wwpn = NULL;
} else {
return LSM_ERR_INVALID_ARGUMENT;
}
- } else if( t == LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_IQN ) {
- if( iqn_validate(id) ) {
+ } else if (t == LSM_ACCESS_GROUP_INIT_TYPE_ISCSI_IQN) {
+ if (iqn_validate(id)) {
return LSM_ERR_INVALID_ARGUMENT;
}
}
@@ -173,28 +181,28 @@ static int verify_initiator_id(const char *id, lsm_access_group_init_type t,
#define CHECK_RP(x) (!(x) || *(x) != NULL)

int lsm_connect_password(const char *uri, const char *password,
- lsm_connect **conn, uint32_t timeout, lsm_error_ptr *e,
- lsm_flag flags)
+ lsm_connect ** conn, uint32_t timeout,
+ lsm_error_ptr * e, lsm_flag flags)
{
int rc = LSM_ERR_OK;
lsm_connect *c = NULL;

/* Password is optional */
- if( CHECK_STR(uri) || CHECK_RP(conn) || !timeout || CHECK_RP(e) ||
- LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_STR(uri) || CHECK_RP(conn) || !timeout || CHECK_RP(e) ||
+ LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

c = connection_get();
- if(c) {
+ if (c) {
c->uri = xmlParseURI(uri);
- if( c->uri && c->uri->scheme ) {
+ if (c->uri && c->uri->scheme) {
c->raw_uri = strdup(uri);
- if( c->raw_uri ) {
- rc = driver_load(c, c->uri->scheme, password, timeout, e, 1,
- flags);
- if( rc == LSM_ERR_OK ) {
- *conn = (lsm_connect *)c;
+ if (c->raw_uri) {
+ rc = driver_load(c, c->uri->scheme, password, timeout, e,
+ 1, flags);
+ if (rc == LSM_ERR_OK) {
+ *conn = (lsm_connect *) c;
}
} else {
rc = LSM_ERR_NO_MEMORY;
@@ -203,8 +211,8 @@ int lsm_connect_password(const char *uri, const char *password,
rc = LSM_ERR_INVALID_ARGUMENT;
}

- /*If we fail for any reason free resources associated with connection*/
- if( rc != LSM_ERR_OK ) {
+ /*If we fail for any reason free resources associated with connection */
+ if (rc != LSM_ERR_OK) {
connection_free(c);
}
} else {
@@ -213,9 +221,9 @@ int lsm_connect_password(const char *uri, const char *password,
return rc;
}

-static int lsm_error_log(lsm_connect *c, lsm_error_ptr error)
+static int lsm_error_log(lsm_connect * c, lsm_error_ptr error)
{
- if ( !LSM_IS_CONNECT(c) || !LSM_IS_ERROR(error) ) {
+ if (!LSM_IS_CONNECT(c) || !LSM_IS_ERROR(error)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -228,48 +236,53 @@ static int lsm_error_log(lsm_connect *c, lsm_error_ptr error)
return LSM_ERR_OK;
}

-static lsm_error_number log_exception(lsm_connect *c, lsm_error_number error,
- const char *message, const char *exception_msg)
+static lsm_error_number log_exception(lsm_connect * c,
+ lsm_error_number error,
+ const char *message,
+ const char *exception_msg)
{
lsm_error_ptr err = lsm_error_create(error, message,
- exception_msg, NULL,
- NULL, 0);
- if( err ) {
+ exception_msg, NULL,
+ NULL, 0);
+ if (err) {
lsm_error_log(c, err);
}
return error;
}

-static int rpc(lsm_connect *c, const char *method, const Value &parameters,
- Value &response) throw ()
+static int rpc(lsm_connect * c, const char *method,
+ const Value & parameters, Value & response) throw()
{
try {
- response = c->tp->rpc(method,parameters);
- } catch ( const ValueException &ve ) {
- return log_exception(c, LSM_ERR_TRANSPORT_SERIALIZATION, "Serialization error",
- ve.what());
- } catch ( const LsmException &le ) {
- return log_exception(c, (lsm_error_number)le.error_code, le.what(),
- NULL);
- } catch ( const EOFException &eof ) {
- return log_exception(c, LSM_ERR_TRANSPORT_COMMUNICATION, "Plug-in died",
- "Check syslog");
- } catch (...) {
+ response = c->tp->rpc(method, parameters);
+ } catch(const ValueException & ve) {
+ return log_exception(c, LSM_ERR_TRANSPORT_SERIALIZATION,
+ "Serialization error", ve.what());
+ }
+ catch(const LsmException & le) {
+ return log_exception(c, (lsm_error_number) le.error_code,
+ le.what(), NULL);
+ }
+ catch(const EOFException & eof) {
+ return log_exception(c, LSM_ERR_TRANSPORT_COMMUNICATION,
+ "Plug-in died", "Check syslog");
+ }
+ catch( ...) {
return log_exception(c, LSM_ERR_LIB_BUG, "Unexpected exception",
- "Unknown exception");
+ "Unknown exception");
}
return LSM_ERR_OK;
}

-static int job_check( lsm_connect *c, int rc, Value &response, char **job )
+static int job_check(lsm_connect * c, int rc, Value & response, char **job)
{
try {
- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
//We get a value back, either null or job id.
- if( Value::string_t == response.valueType() ) {
+ if (Value::string_t == response.valueType()) {
*job = strdup(response.asString().c_str());

- if( *job ) {
+ if (*job) {
rc = LSM_ERR_JOB_STARTED;
} else {
rc = LSM_ERR_NO_MEMORY;
@@ -278,34 +291,35 @@ static int job_check( lsm_connect *c, int rc, Value &response, char **job )
*job = NULL;
}
}
- } catch (const ValueException &ve) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Wrong type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Wrong type", ve.what());
}
return rc;
}

-static int get_access_groups( lsm_connect *c, int rc, Value &response,
- lsm_access_group **groups[], uint32_t *count)
+static int get_access_groups(lsm_connect * c, int rc, Value & response,
+ lsm_access_group ** groups[], uint32_t * count)
{
try {
- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
+ if (LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
rc = value_array_to_access_groups(response, groups, count);
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}

-static int add_search_params(std::map<std::string, Value> &p, const char *k,
- const char *v, const char * const supported_keys[],
- size_t supported_keys_count)
+static int add_search_params(std::map < std::string, Value > &p,
+ const char *k, const char *v,
+ const char *const supported_keys[],
+ size_t supported_keys_count)
{
- if( k ) {
- if( v ) {
- if( !check_search_key(k, supported_keys, supported_keys_count) ) {
+ if (k) {
+ if (v) {
+ if (!check_search_key(k, supported_keys, supported_keys_count)) {
return LSM_ERR_UNSUPPORTED_SEARCH_KEY;
}
} else {
@@ -317,15 +331,15 @@ static int add_search_params(std::map<std::string, Value> &p, const char *k,
return LSM_ERR_OK;
}

-int lsm_connect_close(lsm_connect *c, lsm_flag flags)
+int lsm_connect_close(lsm_connect * c, lsm_flag flags)
{
CONN_SETUP(c);

- if( LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["flags"] = Value(flags);
Value parameters(p);
Value response;
@@ -340,22 +354,22 @@ int lsm_connect_close(lsm_connect *c, lsm_flag flags)

static Value _create_flag_param(lsm_flag flags)
{
- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["flags"] = Value(flags);
return Value(p);
}

-int lsm_plugin_info_get(lsm_connect *c, char **desc,
- char **version, lsm_flag flags)
+int lsm_plugin_info_get(lsm_connect * c, char **desc,
+ char **version, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( CHECK_RP(desc) || CHECK_RP(version) ) {
+ if (CHECK_RP(desc) || CHECK_RP(version)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -366,32 +380,31 @@ int lsm_plugin_info_get(lsm_connect *c, char **desc,

rc = rpc(c, "plugin_info", parameters, response);

- if( rc == LSM_ERR_OK ) {
- std::vector<Value> j = response.asArray();
+ if (rc == LSM_ERR_OK) {
+ std::vector < Value > j = response.asArray();
*desc = strdup(j[0].asC_str());
*version = strdup(j[1].asC_str());

- if( !*desc || !*version ) {
+ if (!*desc || !*version) {
rc = LSM_ERR_NO_MEMORY;
free(*desc);
free(*version);
}
}
- } catch (const ValueException &ve) {
+ }
+ catch(const ValueException & ve) {
free(*desc);
*desc = NULL;
free(*version);
*version = NULL;
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}

return rc;
}

int lsm_available_plugins_list(const char *sep,
- lsm_string_list **plugins,
- lsm_flag flags)
+ lsm_string_list ** plugins, lsm_flag flags)
{
int rc = LSM_ERR_OK;
DIR *dirp = NULL;
@@ -404,39 +417,40 @@ int lsm_available_plugins_list(const char *sep,
const char *uds_dir = uds_path();
lsm_string_list *plugin_list = NULL;

- if( CHECK_STR(sep) || CHECK_RP(plugins) || LSM_FLAG_UNUSED_CHECK(flags)) {
+ if (CHECK_STR(sep) || CHECK_RP(plugins)
+ || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

plugin_list = lsm_string_list_alloc(0);
- if( !plugin_list ) {
+ if (!plugin_list) {
return LSM_ERR_NO_MEMORY;
}

dirp = opendir(uds_dir);
- if( dirp ) {
- for(;;) {
+ if (dirp) {
+ for (;;) {
dp = readdir(dirp);
- if( NULL == dp ) {
+ if (NULL == dp) {
break;
}
-
// Check to see if we have a socket
- if( DT_SOCK == dp->d_type ) {
+ if (DT_SOCK == dp->d_type) {
c = connection_get();
- if ( c ) {
+ if (c) {
rc = driver_load(c, dp->d_name, NULL, 30000, &e, 0, 0);
- if( LSM_ERR_OK == rc) {
+ if (LSM_ERR_OK == rc) {
// Get the plugin information
rc = lsm_plugin_info_get(c, &desc, &version, 0);
- if( LSM_ERR_OK == rc) {
- int format = asprintf(&s, "%s%s%s", desc, sep, version);
+ if (LSM_ERR_OK == rc) {
+ int format =
+ asprintf(&s, "%s%s%s", desc, sep, version);
free(desc);
desc = NULL;
free(version);
version = NULL;

- if( -1 == format ) {
+ if (-1 == format) {
rc = LSM_ERR_NO_MEMORY;
break;
}
@@ -444,7 +458,7 @@ int lsm_available_plugins_list(const char *sep,
rc = lsm_string_list_append(plugin_list, s);
free(s);
s = NULL;
- if( LSM_ERR_OK != rc ) {
+ if (LSM_ERR_OK != rc) {
break;
}

@@ -457,25 +471,25 @@ int lsm_available_plugins_list(const char *sep,
c = NULL;
}
}
- } /* for(;;) */
+ } /* for(;;) */

- if( e ) {
+ if (e) {
lsm_error_free(e);
e = NULL;
}

- if( c ) {
- connection_free(c);
- c = NULL;
+ if (c) {
+ connection_free(c);
+ c = NULL;
}


- if( -1 == closedir(dirp)) {
+ if (-1 == closedir(dirp)) {
//log the error
rc = LSM_ERR_LIB_BUG;
}

- } else { /* If dirp == NULL */
+ } else { /* If dirp == NULL */
//Log the error
rc = LSM_ERR_LIB_BUG;
}
@@ -490,15 +504,15 @@ int lsm_available_plugins_list(const char *sep,
return rc;
}

-int lsm_connect_timeout_set(lsm_connect *c, uint32_t timeout, lsm_flag flags)
+int lsm_connect_timeout_set(lsm_connect * c, uint32_t timeout, lsm_flag flags)
{
CONN_SETUP(c);

- if( LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["ms"] = Value(timeout);
p["flags"] = Value(flags);
Value parameters(p);
@@ -508,12 +522,12 @@ int lsm_connect_timeout_set(lsm_connect *c, uint32_t timeout, lsm_flag flags)
return rpc(c, "time_out_set", parameters, response);
}

-int lsm_connect_timeout_get(lsm_connect *c, uint32_t *timeout, lsm_flag flags)
+int lsm_connect_timeout_get(lsm_connect * c, uint32_t * timeout, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -523,58 +537,57 @@ int lsm_connect_timeout_get(lsm_connect *c, uint32_t *timeout, lsm_flag flags)
Value response;

rc = rpc(c, "time_out_get", parameters, response);
- if( rc == LSM_ERR_OK ) {
+ if (rc == LSM_ERR_OK) {
*timeout = response.asUint32_t();
}
}
- catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}

-static int job_status( lsm_connect *c, const char *job,
- lsm_job_status *status, uint8_t *percentComplete,
- Value &returned_value, lsm_flag flags)
+static int job_status(lsm_connect * c, const char *job,
+ lsm_job_status * status, uint8_t * percentComplete,
+ Value & returned_value, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !job || !status || !percentComplete ) {
+ if (!job || !status || !percentComplete) {
return LSM_ERR_INVALID_ARGUMENT;
}

try {
- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["job_id"] = Value(job);
p["flags"] = Value(flags);
Value parameters(p);
Value response;

rc = rpc(c, "job_status", parameters, response);
- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
//We get back an array [status, percent, volume]
- std::vector<Value> j = response.asArray();
- *status = (lsm_job_status)j[0].asInt32_t();
- *percentComplete = (uint8_t)j[1].asUint32_t();
+ std::vector < Value > j = response.asArray();
+ *status = (lsm_job_status) j[0].asInt32_t();
+ *percentComplete = (uint8_t) j[1].asUint32_t();

returned_value = j[2];
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}

-int lsm_job_status_get(lsm_connect *c, const char *job_id,
- lsm_job_status *status, uint8_t *percentComplete,
- lsm_flag flags)
+int lsm_job_status_get(lsm_connect * c, const char *job_id,
+ lsm_job_status * status, uint8_t * percentComplete,
+ lsm_flag flags)
{
CONN_SETUP(c);

- if( LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -582,17 +595,17 @@ int lsm_job_status_get(lsm_connect *c, const char *job_id,
return job_status(c, job_id, status, percentComplete, rv, flags);
}

-int lsm_job_status_pool_get(lsm_connect *c,
- const char *job, lsm_job_status *status,
- uint8_t *percentComplete, lsm_pool **pool,
- lsm_flag flags)
+int lsm_job_status_pool_get(lsm_connect * c,
+ const char *job, lsm_job_status * status,
+ uint8_t * percentComplete, lsm_pool ** pool,
+ lsm_flag flags)
{
Value rv;
int rc = LSM_ERR_OK;

CONN_SETUP(c);

- if( CHECK_RP(pool) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_RP(pool) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -600,33 +613,34 @@ int lsm_job_status_pool_get(lsm_connect *c,

rc = job_status(c, job, status, percentComplete, rv, flags);

- if( LSM_ERR_OK == rc ) {
- if( Value::object_t == rv.valueType() ) {
+ if (LSM_ERR_OK == rc) {
+ if (Value::object_t == rv.valueType()) {
*pool = value_to_pool(rv);
- if( !(*pool) ) {
+ if (!(*pool)) {
rc = LSM_ERR_NO_MEMORY;
}
} else {
*pool = NULL;
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}

-int lsm_job_status_volume_get( lsm_connect *c, const char *job,
- lsm_job_status *status, uint8_t *percentComplete,
- lsm_volume **vol, lsm_flag flags)
+int lsm_job_status_volume_get(lsm_connect * c, const char *job,
+ lsm_job_status * status,
+ uint8_t * percentComplete, lsm_volume ** vol,
+ lsm_flag flags)
{
Value rv;
int rc = LSM_ERR_OK;

CONN_SETUP(c);

- if( CHECK_RP(vol) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_RP(vol) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -634,31 +648,32 @@ int lsm_job_status_volume_get( lsm_connect *c, const char *job,

rc = job_status(c, job, status, percentComplete, rv, flags);

- if( LSM_ERR_OK == rc ) {
- if( Value::object_t == rv.valueType() ) {
+ if (LSM_ERR_OK == rc) {
+ if (Value::object_t == rv.valueType()) {
*vol = value_to_volume(rv);
- if( !(*vol) ) {
+ if (!(*vol)) {
rc = LSM_ERR_NO_MEMORY;
}
} else {
*vol = NULL;
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}

-int lsm_job_status_fs_get(lsm_connect *c, const char *job,
- lsm_job_status *status, uint8_t *percentComplete,
- lsm_fs **fs, lsm_flag flags)
+int lsm_job_status_fs_get(lsm_connect * c, const char *job,
+ lsm_job_status * status,
+ uint8_t * percentComplete, lsm_fs ** fs,
+ lsm_flag flags)
{
int rc = LSM_ERR_OK;
Value rv;

- if( CHECK_RP(fs) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_RP(fs) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -666,31 +681,32 @@ int lsm_job_status_fs_get(lsm_connect *c, const char *job,

rc = job_status(c, job, status, percentComplete, rv, flags);

- if( LSM_ERR_OK == rc ) {
- if( Value::object_t == rv.valueType() ) {
+ if (LSM_ERR_OK == rc) {
+ if (Value::object_t == rv.valueType()) {
*fs = value_to_fs(rv);
- if( !(*fs) ) {
+ if (!(*fs)) {
rc = LSM_ERR_NO_MEMORY;
}
} else {
*fs = NULL;
}
}
- } catch( const ValueException &ve) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}

-int lsm_job_status_ss_get(lsm_connect *c, const char *job,
- lsm_job_status *status, uint8_t *percentComplete,
- lsm_fs_ss **ss, lsm_flag flags)
+int lsm_job_status_ss_get(lsm_connect * c, const char *job,
+ lsm_job_status * status,
+ uint8_t * percentComplete, lsm_fs_ss ** ss,
+ lsm_flag flags)
{
int rc = LSM_ERR_OK;
Value rv;

- if( CHECK_RP(ss) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_RP(ss) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -698,32 +714,32 @@ int lsm_job_status_ss_get(lsm_connect *c, const char *job,

rc = job_status(c, job, status, percentComplete, rv, flags);

- if( LSM_ERR_OK == rc ) {
- if( Value::object_t == rv.valueType() ) {
+ if (LSM_ERR_OK == rc) {
+ if (Value::object_t == rv.valueType()) {
*ss = value_to_ss(rv);
- if( !(*ss) ) {
+ if (!(*ss)) {
rc = LSM_ERR_NO_MEMORY;
}
} else {
*ss = NULL;
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}

-int lsm_job_free(lsm_connect *c, char **job, lsm_flag flags)
+int lsm_job_free(lsm_connect * c, char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( job == NULL || strlen(*job) < 1 || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (job == NULL || strlen(*job) < 1 || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["job_id"] = Value(*job);
p["flags"] = Value(flags);
Value parameters(p);
@@ -731,7 +747,7 @@ int lsm_job_free(lsm_connect *c, char **job, lsm_flag flags)

int rc = rpc(c, "job_free", parameters, response);

- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
/* Free the memory for the job id */
free(*job);
*job = NULL;
@@ -739,18 +755,18 @@ int lsm_job_free(lsm_connect *c, char **job, lsm_flag flags)
return rc;
}

-int lsm_capabilities(lsm_connect *c, lsm_system *system,
- lsm_storage_capabilities **cap, lsm_flag flags)
+int lsm_capabilities(lsm_connect * c, lsm_system * system,
+ lsm_storage_capabilities ** cap, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !LSM_IS_SYSTEM(system) || CHECK_RP(cap) ||
- LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_SYSTEM(system) || CHECK_RP(cap) ||
+ LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;

p["system"] = system_to_value(system);
p["flags"] = Value(flags);
@@ -761,27 +777,27 @@ int lsm_capabilities(lsm_connect *c, lsm_system *system,
try {
rc = rpc(c, "capabilities", parameters, response);

- if( LSM_ERR_OK == rc && Value::object_t == response.valueType() ) {
+ if (LSM_ERR_OK == rc && Value::object_t == response.valueType()) {
*cap = value_to_capabilities(response);
- if( !(*cap) ) {
+ if (!(*cap)) {
rc = LSM_ERR_NO_MEMORY;
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}

return rc;
}

-int lsm_pool_list(lsm_connect *c, char *search_key, char *search_value,
- lsm_pool **poolArray[], uint32_t *count, lsm_flag flags)
+int lsm_pool_list(lsm_connect * c, char *search_key, char *search_value,
+ lsm_pool ** poolArray[], uint32_t * count, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !poolArray || !count || CHECK_RP(poolArray) ) {
+ if (!poolArray || !count || CHECK_RP(poolArray)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -789,11 +805,11 @@ int lsm_pool_list(lsm_connect *c, char *search_key, char *search_value,
*poolArray = NULL;

try {
- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;

- rc = add_search_params(p, search_key, search_value, POOL_SEARCH_KEYS,
- POOL_SEARCH_KEYS_COUNT);
- if( LSM_ERR_OK != rc ) {
+ rc = add_search_params(p, search_key, search_value,
+ POOL_SEARCH_KEYS, POOL_SEARCH_KEYS_COUNT);
+ if (LSM_ERR_OK != rc) {
return rc;
}

@@ -802,34 +818,34 @@ int lsm_pool_list(lsm_connect *c, char *search_key, char *search_value,
Value response;

rc = rpc(c, "pools", parameters, response);
- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
- std::vector<Value> pools = response.asArray();
+ if (LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
+ std::vector < Value > pools = response.asArray();

*count = pools.size();

- if( pools.size() ) {
+ if (pools.size()) {
*poolArray = lsm_pool_record_array_alloc(pools.size());

- for( size_t i = 0; i < pools.size(); ++i ) {
+ for (size_t i = 0; i < pools.size(); ++i) {
(*poolArray)[i] = value_to_pool(pools[i]);
- if( !(*poolArray)[i] ) {
+ if (!(*poolArray)[i]) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}
}
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
goto error;
}

-out:
+ out:
return rc;

-error:
- if( *poolArray && *count ) {
+ error:
+ if (*poolArray && *count) {
lsm_pool_record_array_free(*poolArray, *count);
*poolArray = NULL;
*count = 0;
@@ -837,27 +853,27 @@ error:
goto out;
}

-int lsm_pool_member_info(lsm_connect *c, lsm_pool *pool,
- lsm_volume_raid_type * raid_type,
- lsm_pool_member_type *member_type,
- lsm_string_list **member_ids, lsm_flag flags)
+int lsm_pool_member_info(lsm_connect * c, lsm_pool * pool,
+ lsm_volume_raid_type * raid_type,
+ lsm_pool_member_type * member_type,
+ lsm_string_list ** member_ids, lsm_flag flags)
{
- if( LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !LSM_IS_POOL(pool) ) {
+ if (!LSM_IS_POOL(pool)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( !raid_type || !member_type || !member_ids) {
- return LSM_ERR_INVALID_ARGUMENT;
+ if (!raid_type || !member_type || !member_ids) {
+ return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["pool"] = pool_to_value(pool);
p["flags"] = Value(flags);
Value parameters(p);
@@ -866,57 +882,56 @@ int lsm_pool_member_info(lsm_connect *c, lsm_pool *pool,
Value response;

rc = rpc(c, "pool_member_info", parameters, response);
- if( LSM_ERR_OK == rc ) {
- std::vector<Value> j = response.asArray();
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > j = response.asArray();
*raid_type = (lsm_volume_raid_type) j[0].asInt32_t();
*member_type = (lsm_pool_member_type) j[1].asInt32_t();
*member_ids = NULL;
- if (Value::array_t == j[2].valueType()){
- if (j[2].asArray().size()){
+ if (Value::array_t == j[2].valueType()) {
+ if (j[2].asArray().size()) {
*member_ids = value_to_string_list(j[2]);
- if ( *member_ids == NULL ){
+ if (*member_ids == NULL) {
return LSM_ERR_NO_MEMORY;
- }else if( lsm_string_list_size(*member_ids) !=
- j[2].asArray().size() ){
+ } else if (lsm_string_list_size(*member_ids) !=
+ j[2].asArray().size()) {

lsm_string_list_free(*member_ids);
return LSM_ERR_NO_MEMORY;
}
}
- }else{
- rc = log_exception(
- c, LSM_ERR_PLUGIN_BUG, "member_ids data is not an array",
- "member_ids data is not an array");
+ } else {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG,
+ "member_ids data is not an array",
+ "member_ids data is not an array");
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;

}

-int lsm_target_port_list(lsm_connect *c, const char *search_key,
- const char *search_value,
- lsm_target_port **target_ports[],
- uint32_t *count,
- lsm_flag flags)
+int lsm_target_port_list(lsm_connect * c, const char *search_key,
+ const char *search_value,
+ lsm_target_port ** target_ports[],
+ uint32_t * count, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !target_ports || !count || CHECK_RP(target_ports )) {
- return LSM_ERR_INVALID_ARGUMENT;
+ if (!target_ports || !count || CHECK_RP(target_ports)) {
+ return LSM_ERR_INVALID_ARGUMENT;
}

- try {
- std::map<std::string, Value> p;
+ try {
+ std::map < std::string, Value > p;

rc = add_search_params(p, search_key, search_value,
- TARGET_PORT_SEARCH_KEYS,
- TARGET_PORT_SEARCH_KEYS_COUNT);
- if( LSM_ERR_OK != rc ) {
+ TARGET_PORT_SEARCH_KEYS,
+ TARGET_PORT_SEARCH_KEYS_COUNT);
+ if (LSM_ERR_OK != rc) {
return rc;
}

@@ -925,33 +940,33 @@ int lsm_target_port_list(lsm_connect *c, const char *search_key,
Value response;

rc = rpc(c, "target_ports", parameters, response);
- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
- std::vector<Value> tp = response.asArray();
+ if (LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
+ std::vector < Value > tp = response.asArray();

*count = tp.size();

- if( tp.size() ) {
+ if (tp.size()) {
*target_ports = lsm_target_port_record_array_alloc(tp.size());

- for( size_t i = 0; i < tp.size(); ++i ) {
+ for (size_t i = 0; i < tp.size(); ++i) {
(*target_ports)[i] = value_to_target_port(tp[i]);
- if( !((*target_ports)[i]) ) {
+ if (!((*target_ports)[i])) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}
}
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
goto error;
}
-out:
+ out:
return rc;

-error:
- if( *target_ports && *count ) {
+ error:
+ if (*target_ports && *count) {
lsm_target_port_record_array_free(*target_ports, *count);
*target_ports = NULL;
*count = 0;
@@ -959,37 +974,37 @@ error:
goto out;
}

-static int get_volume_array(lsm_connect *c, int rc, Value &response,
- lsm_volume **volumes[], uint32_t *count)
+static int get_volume_array(lsm_connect * c, int rc, Value & response,
+ lsm_volume ** volumes[], uint32_t * count)
{
- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
+ if (LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
try {
rc = value_array_to_volumes(response, volumes, count);
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Wrong type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Wrong type", ve.what());
}
}
return rc;
}


-int lsm_volume_list(lsm_connect *c, const char *search_key,
- const char *search_value, lsm_volume **volumes[],
- uint32_t *count, lsm_flag flags)
+int lsm_volume_list(lsm_connect * c, const char *search_key,
+ const char *search_value, lsm_volume ** volumes[],
+ uint32_t * count, lsm_flag flags)
{
CONN_SETUP(c);

- if( !volumes || !count || CHECK_RP(volumes)){
+ if (!volumes || !count || CHECK_RP(volumes)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["flags"] = Value(flags);

int rc = add_search_params(p, search_key, search_value, VOLUME_SEARCH_KEYS,
- VOLUME_SEARCH_KEYS_COUNT);
- if( LSM_ERR_OK != rc ) {
+ VOLUME_SEARCH_KEYS_COUNT);
+ if (LSM_ERR_OK != rc) {
return rc;
}

@@ -1000,13 +1015,13 @@ int lsm_volume_list(lsm_connect *c, const char *search_key,
return get_volume_array(c, rc, response, volumes, count);
}

-static int get_disk_array(lsm_connect *c, int rc, Value &response,
- lsm_disk **disks[], uint32_t *count)
+static int get_disk_array(lsm_connect * c, int rc, Value & response,
+ lsm_disk ** disks[], uint32_t * count)
{
- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
+ if (LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
rc = value_array_to_disks(response, disks, count);

- if( LSM_ERR_OK != rc ) {
+ if (LSM_ERR_OK != rc) {
rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", NULL);
}
}
@@ -1014,22 +1029,22 @@ static int get_disk_array(lsm_connect *c, int rc, Value &response,
return rc;
}

-int lsm_disk_list(lsm_connect *c, const char *search_key,
- const char *search_value,
- lsm_disk **disks[], uint32_t *count, lsm_flag flags)
+int lsm_disk_list(lsm_connect * c, const char *search_key,
+ const char *search_value,
+ lsm_disk ** disks[], uint32_t * count, lsm_flag flags)
{
CONN_SETUP(c);

- if (CHECK_RP(disks) || !count ) {
+ if (CHECK_RP(disks) || !count) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["flags"] = Value(flags);

int rc = add_search_params(p, search_key, search_value, DISK_SEARCH_KEYS,
- DISK_SEARCH_KEYS_COUNT);
- if( LSM_ERR_OK != rc ) {
+ DISK_SEARCH_KEYS_COUNT);
+ if (LSM_ERR_OK != rc) {
return rc;
}

@@ -1040,9 +1055,9 @@ int lsm_disk_list(lsm_connect *c, const char *search_key,
return get_disk_array(c, rc, response, disks, count);
}

-typedef void* (*convert)(Value &v);
+typedef void *(*convert) (Value & v);

-static void* parse_job_response(lsm_connect *c, Value response, int &rc,
+static void *parse_job_response(lsm_connect * c, Value response, int &rc,
char **job, convert conv)
{
void *val = NULL;
@@ -1050,90 +1065,91 @@ static void* parse_job_response(lsm_connect *c, Value response, int &rc,

try {
//We get an array back. first value is job, second is data of interest.
- if( Value::array_t == response.valueType() ) {
- std::vector<Value> r = response.asArray();
- if( Value::string_t == r[0].valueType()) {
+ if (Value::array_t == response.valueType()) {
+ std::vector < Value > r = response.asArray();
+ if (Value::string_t == r[0].valueType()) {
*job = strdup((r[0].asString()).c_str());
- if( !(*job) ) {
+ if (!(*job)) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}

rc = LSM_ERR_JOB_STARTED;
}
- if( Value::object_t == r[1].valueType() ) {
+ if (Value::object_t == r[1].valueType()) {
val = conv(r[1]);
- if( !val ) {
+ if (!val) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
goto error;
}

-out:
+ out:
return val;

-error:
+ error:
free(*job);
*job = NULL;
goto out;
}

-int lsm_volume_create(lsm_connect *c, lsm_pool *pool, const char *volumeName,
- uint64_t size, lsm_volume_provision_type provisioning,
- lsm_volume **newVolume, char **job, lsm_flag flags)
+int lsm_volume_create(lsm_connect * c, lsm_pool * pool,
+ const char *volumeName, uint64_t size,
+ lsm_volume_provision_type provisioning,
+ lsm_volume ** newVolume, char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_POOL(pool)) {
+ if (!LSM_IS_POOL(pool)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( CHECK_STR(volumeName) || !size || CHECK_RP(newVolume) ||
- CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ){
+ if (CHECK_STR(volumeName) || !size || CHECK_RP(newVolume) ||
+ CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["pool"] = pool_to_value(pool);
p["volume_name"] = Value(volumeName);
p["size_bytes"] = Value(size);
- p["provisioning"] = Value((int32_t)provisioning);
+ p["provisioning"] = Value((int32_t) provisioning);
p["flags"] = Value(flags);

Value parameters(p);
Value response;

int rc = rpc(c, "volume_create", parameters, response);
- if( LSM_ERR_OK == rc ) {
- *newVolume = (lsm_volume *)parse_job_response(c, response, rc, job,
- (convert)value_to_volume);
+ if (LSM_ERR_OK == rc) {
+ *newVolume =
+ (lsm_volume *) parse_job_response(c, response, rc, job,
+ (convert) value_to_volume);
}
return rc;
}

-int lsm_volume_resize(lsm_connect *c, lsm_volume *volume,
- uint64_t newSize, lsm_volume **resizedVolume,
- char **job, lsm_flag flags )
+int lsm_volume_resize(lsm_connect * c, lsm_volume * volume,
+ uint64_t newSize, lsm_volume ** resizedVolume,
+ char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_VOL(volume) || !newSize || CHECK_RP(resizedVolume) ||
- CHECK_RP(job) || newSize == 0 || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_VOL(volume) || !newSize || CHECK_RP(resizedVolume) ||
+ CHECK_RP(job) || newSize == 0 || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}
-
//If you try to resize to same size, we will return error.
- if( ( newSize/volume->block_size) == volume->number_of_blocks ) {
+ if ((newSize / volume->block_size) == volume->number_of_blocks) {
return LSM_ERR_NO_STATE_CHANGE;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["volume"] = volume_to_value(volume);
p["new_size_bytes"] = Value(newSize);
p["flags"] = Value(flags);
@@ -1142,32 +1158,33 @@ int lsm_volume_resize(lsm_connect *c, lsm_volume *volume,
Value response;

int rc = rpc(c, "volume_resize", parameters, response);
- if( LSM_ERR_OK == rc ) {
- *resizedVolume = (lsm_volume *)parse_job_response(c, response, rc, job,
- (convert)value_to_volume);
+ if (LSM_ERR_OK == rc) {
+ *resizedVolume =
+ (lsm_volume *) parse_job_response(c, response, rc, job,
+ (convert) value_to_volume);
}
return rc;
}

-int lsm_volume_replicate(lsm_connect *c, lsm_pool *pool,
- lsm_replication_type repType, lsm_volume *volumeSrc,
- const char *name, lsm_volume **newReplicant,
- char **job, lsm_flag flags)
+int lsm_volume_replicate(lsm_connect * c, lsm_pool * pool,
+ lsm_replication_type repType,
+ lsm_volume * volumeSrc, const char *name,
+ lsm_volume ** newReplicant, char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( (pool && !LSM_IS_POOL(pool)) || !LSM_IS_VOL(volumeSrc) ) {
+ if ((pool && !LSM_IS_POOL(pool)) || !LSM_IS_VOL(volumeSrc)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if(CHECK_STR(name) || CHECK_RP(newReplicant) || CHECK_RP(job) ||
- LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_STR(name) || CHECK_RP(newReplicant) || CHECK_RP(job) ||
+ LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["pool"] = pool_to_value(pool);
- p["rep_type"] = Value((int32_t)repType);
+ p["rep_type"] = Value((int32_t) repType);
p["volume_src"] = volume_to_value(volumeSrc);
p["name"] = Value(name);
p["flags"] = Value(flags);
@@ -1176,66 +1193,67 @@ int lsm_volume_replicate(lsm_connect *c, lsm_pool *pool,
Value response;

int rc = rpc(c, "volume_replicate", parameters, response);
- if( LSM_ERR_OK == rc ) {
- *newReplicant = (lsm_volume *)parse_job_response(c, response, rc, job,
- (convert)value_to_volume);
+ if (LSM_ERR_OK == rc) {
+ *newReplicant =
+ (lsm_volume *) parse_job_response(c, response, rc, job,
+ (convert) value_to_volume);
}
return rc;

}

-int lsm_volume_replicate_range_block_size(lsm_connect *c, lsm_system *system,
- uint32_t *bs, lsm_flag flags)
+int lsm_volume_replicate_range_block_size(lsm_connect * c,
+ lsm_system * system,
+ uint32_t * bs, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !bs || LSM_FLAG_UNUSED_CHECK(flags) || !LSM_IS_SYSTEM(system) ) {
+ if (!bs || LSM_FLAG_UNUSED_CHECK(flags) || !LSM_IS_SYSTEM(system)) {
return LSM_ERR_INVALID_ARGUMENT;
}

try {
- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["system"] = system_to_value(system);
p["flags"] = Value(flags);
Value parameters(p);
Value response;

rc = rpc(c, "volume_replicate_range_block_size", parameters, response);
- if( LSM_ERR_OK == rc ) {
- if( Value::numeric_t == response.valueType() ) {
+ if (LSM_ERR_OK == rc) {
+ if (Value::numeric_t == response.valueType()) {
*bs = response.asUint32_t();
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}


-int lsm_volume_replicate_range(lsm_connect *c,
- lsm_replication_type repType,
- lsm_volume *source,
- lsm_volume *dest,
- lsm_block_range **ranges,
- uint32_t num_ranges,
- char **job, lsm_flag flags)
+int lsm_volume_replicate_range(lsm_connect * c,
+ lsm_replication_type repType,
+ lsm_volume * source,
+ lsm_volume * dest,
+ lsm_block_range ** ranges,
+ uint32_t num_ranges, char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_VOL(source) || !LSM_IS_VOL(dest) ) {
+ if (!LSM_IS_VOL(source) || !LSM_IS_VOL(dest)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( !ranges || !num_ranges || CHECK_RP(job) ||
+ if (!ranges || !num_ranges || CHECK_RP(job) ||
LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
- p["rep_type"] = Value((int32_t)repType);
+ std::map < std::string, Value > p;
+ p["rep_type"] = Value((int32_t) repType);
p["volume_src"] = volume_to_value(source);
p["volume_dest"] = volume_to_value(dest);
p["ranges"] = block_range_list_to_value(ranges, num_ranges);
@@ -1248,26 +1266,26 @@ int lsm_volume_replicate_range(lsm_connect *c,
return job_check(c, rc, response, job);
}

-static Value _create_volume_flag_param(lsm_volume *volume, lsm_flag flags)
+static Value _create_volume_flag_param(lsm_volume * volume, lsm_flag flags)
{
- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["volume"] = volume_to_value(volume);
p["flags"] = Value(flags);

return Value(p);
}

-int lsm_volume_delete(lsm_connect *c, lsm_volume *volume, char **job,
- lsm_flag flags)
+int lsm_volume_delete(lsm_connect * c, lsm_volume * volume, char **job,
+ lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !LSM_IS_VOL(volume) ) {
+ if (!LSM_IS_VOL(volume)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -1278,71 +1296,71 @@ int lsm_volume_delete(lsm_connect *c, lsm_volume *volume, char **job,

rc = rpc(c, "volume_delete", parameters, response);
rc = job_check(c, rc, response, job);
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;

}

-int lsm_volume_raid_info(lsm_connect *c, lsm_volume *volume,
+int lsm_volume_raid_info(lsm_connect * c, lsm_volume * volume,
lsm_volume_raid_type * raid_type,
- uint32_t *strip_size, uint32_t *disk_count,
- uint32_t *min_io_size, uint32_t *opt_io_size,
+ uint32_t * strip_size, uint32_t * disk_count,
+ uint32_t * min_io_size, uint32_t * opt_io_size,
lsm_flag flags)
{
- if( LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !LSM_IS_VOL(volume) ) {
+ if (!LSM_IS_VOL(volume)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( !raid_type || !strip_size || !disk_count || !min_io_size ||
+ if (!raid_type || !strip_size || !disk_count || !min_io_size ||
!opt_io_size) {
- return LSM_ERR_INVALID_ARGUMENT;
+ return LSM_ERR_INVALID_ARGUMENT;
}

- try {
+ try {

Value parameters = _create_volume_flag_param(volume, flags);
Value response;

rc = rpc(c, "volume_raid_info", parameters, response);
- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
//We get a value back, either null or job id.
- std::vector<Value> j = response.asArray();
+ std::vector < Value > j = response.asArray();
*raid_type = (lsm_volume_raid_type) j[0].asInt32_t();
*strip_size = j[1].asUint32_t();
*disk_count = j[2].asUint32_t();
*min_io_size = j[3].asUint32_t();
*opt_io_size = j[4].asUint32_t();
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;

}

-int lsm_iscsi_chap_auth(lsm_connect *c, const char *init_id,
- const char *username, const char *password,
- const char *out_user, const char *out_password,
- lsm_flag flags)
+int lsm_iscsi_chap_auth(lsm_connect * c, const char *init_id,
+ const char *username, const char *password,
+ const char *out_user, const char *out_password,
+ lsm_flag flags)
{
CONN_SETUP(c);

- if( iqn_validate(init_id) || LSM_FLAG_UNUSED_CHECK(flags)) {
+ if (iqn_validate(init_id) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["init_id"] = Value(init_id);
p["in_user"] = Value(username);
p["in_password"] = Value(password);
@@ -1357,20 +1375,20 @@ int lsm_iscsi_chap_auth(lsm_connect *c, const char *init_id,
return rpc(c, "iscsi_chap_auth", parameters, response);
}

-static int online_offline(lsm_connect *c, lsm_volume *v,
- const char* operation, lsm_flag flags)
+static int online_offline(lsm_connect * c, lsm_volume * v,
+ const char *operation, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_VOL(v)) {
+ if (!LSM_IS_VOL(v)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if ( LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["volume"] = volume_to_value(v);
p["flags"] = Value(flags);

@@ -1379,33 +1397,33 @@ static int online_offline(lsm_connect *c, lsm_volume *v,
return rpc(c, operation, parameters, response);
}

-int lsm_volume_enable(lsm_connect *c, lsm_volume *volume, lsm_flag flags)
+int lsm_volume_enable(lsm_connect * c, lsm_volume * volume, lsm_flag flags)
{
return online_offline(c, volume, "volume_enable", flags);
}

-int lsm_volume_disable(lsm_connect *c, lsm_volume *volume, lsm_flag flags)
+int lsm_volume_disable(lsm_connect * c, lsm_volume * volume, lsm_flag flags)
{
return online_offline(c, volume, "volume_disable", flags);
}

-int lsm_access_group_list(lsm_connect *c, const char *search_key,
- const char *search_value,
- lsm_access_group **groups[], uint32_t *groupCount,
- lsm_flag flags)
+int lsm_access_group_list(lsm_connect * c, const char *search_key,
+ const char *search_value,
+ lsm_access_group ** groups[],
+ uint32_t * groupCount, lsm_flag flags)
{
CONN_SETUP(c);

- if( !groups || !groupCount ) {
+ if (!groups || !groupCount) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;

int rc = add_search_params(p, search_key, search_value,
- ACCESS_GROUP_SEARCH_KEYS,
- ACCESS_GROUP_SEARCH_KEYS_COUNT);
- if( LSM_ERR_OK != rc ) {
+ ACCESS_GROUP_SEARCH_KEYS,
+ ACCESS_GROUP_SEARCH_KEYS_COUNT);
+ if (LSM_ERR_OK != rc) {
return rc;
}

@@ -1417,28 +1435,29 @@ int lsm_access_group_list(lsm_connect *c, const char *search_key,
return get_access_groups(c, rc, response, groups, groupCount);
}

-int lsm_access_group_create(lsm_connect *c, const char *name,
- const char *init_id, lsm_access_group_init_type init_type,
- lsm_system *system,
- lsm_access_group **access_group, lsm_flag flags)
+int lsm_access_group_create(lsm_connect * c, const char *name,
+ const char *init_id,
+ lsm_access_group_init_type init_type,
+ lsm_system * system,
+ lsm_access_group ** access_group, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_SYSTEM(system) || CHECK_STR(name) || CHECK_STR(init_id) ||
- CHECK_RP(access_group) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_SYSTEM(system) || CHECK_STR(name) || CHECK_STR(init_id) ||
+ CHECK_RP(access_group) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

Value id;

- if( LSM_ERR_OK != verify_initiator_id(init_id, init_type, id) ) {
+ if (LSM_ERR_OK != verify_initiator_id(init_id, init_type, id)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["name"] = Value(name);
p["init_id"] = id;
- p["init_type"] = Value((int32_t)init_type);
+ p["init_type"] = Value((int32_t) init_type);
p["system"] = system_to_value(system);
p["flags"] = Value(flags);

@@ -1449,32 +1468,32 @@ int lsm_access_group_create(lsm_connect *c, const char *name,

int rc = rpc(c, "access_group_create", parameters, response);
try {
- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
//We should be getting a value back.
- if( Value::object_t == response.valueType() ) {
+ if (Value::object_t == response.valueType()) {
*access_group = value_to_access_group(response);
- if( !(*access_group) ) {
+ if (!(*access_group)) {
rc = LSM_ERR_NO_MEMORY;
}
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}

-int lsm_access_group_delete(lsm_connect *c, lsm_access_group *access_group,
- lsm_flag flags)
+int lsm_access_group_delete(lsm_connect * c,
+ lsm_access_group * access_group, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_ACCESS_GROUP(access_group) || LSM_FLAG_UNUSED_CHECK(flags) ){
+ if (!LSM_IS_ACCESS_GROUP(access_group) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["access_group"] = access_group_to_value(access_group);
p["flags"] = Value(flags);

@@ -1484,30 +1503,30 @@ int lsm_access_group_delete(lsm_connect *c, lsm_access_group *access_group,
return rpc(c, "access_group_delete", parameters, response);
}

-static int _lsm_ag_add_delete(lsm_connect *c,
- lsm_access_group *access_group,
- const char *init_id,
- lsm_access_group_init_type init_type,
- lsm_access_group **updated_access_group,
- lsm_flag flags, const char *message)
+static int _lsm_ag_add_delete(lsm_connect * c,
+ lsm_access_group * access_group,
+ const char *init_id,
+ lsm_access_group_init_type init_type,
+ lsm_access_group ** updated_access_group,
+ lsm_flag flags, const char *message)
{
CONN_SETUP(c);

- if( !LSM_IS_ACCESS_GROUP(access_group) || CHECK_STR(init_id) ||
+ if (!LSM_IS_ACCESS_GROUP(access_group) || CHECK_STR(init_id) ||
LSM_FLAG_UNUSED_CHECK(flags) || CHECK_RP(updated_access_group)) {
return LSM_ERR_INVALID_ARGUMENT;
}

Value id;

- if( LSM_ERR_OK != verify_initiator_id(init_id, init_type, id) ) {
+ if (LSM_ERR_OK != verify_initiator_id(init_id, init_type, id)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["access_group"] = access_group_to_value(access_group);
p["init_id"] = id;
- p["init_type"] = Value((int32_t)init_type);
+ p["init_type"] = Value((int32_t) init_type);
p["flags"] = Value(flags);

Value parameters(p);
@@ -1515,59 +1534,58 @@ static int _lsm_ag_add_delete(lsm_connect *c,

int rc = rpc(c, message, parameters, response);
try {
- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
//We should be getting a value back.
- if( Value::object_t == response.valueType() ) {
+ if (Value::object_t == response.valueType()) {
*updated_access_group = value_to_access_group(response);
- if( !(*updated_access_group) ) {
+ if (!(*updated_access_group)) {
rc = LSM_ERR_NO_MEMORY;
}
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}

return rc;
}

-int lsm_access_group_initiator_add(lsm_connect *c,
- lsm_access_group *access_group,
- const char *init_id,
- lsm_access_group_init_type init_type,
- lsm_access_group **updated_access_group,
- lsm_flag flags)
+int lsm_access_group_initiator_add(lsm_connect * c,
+ lsm_access_group * access_group,
+ const char *init_id,
+ lsm_access_group_init_type init_type,
+ lsm_access_group **
+ updated_access_group, lsm_flag flags)
{
return _lsm_ag_add_delete(c, access_group, init_id, init_type,
- updated_access_group, flags,
- "access_group_initiator_add");
+ updated_access_group, flags,
+ "access_group_initiator_add");
}

-int lsm_access_group_initiator_delete(lsm_connect *c,
- lsm_access_group *access_group,
- const char* init_id,
- lsm_access_group_init_type init_type,
- lsm_access_group **updated_access_group,
- lsm_flag flags)
+int lsm_access_group_initiator_delete(lsm_connect * c,
+ lsm_access_group * access_group,
+ const char *init_id,
+ lsm_access_group_init_type init_type,
+ lsm_access_group **
+ updated_access_group, lsm_flag flags)
{
return _lsm_ag_add_delete(c, access_group, init_id, init_type,
- updated_access_group, flags,
- "access_group_initiator_delete");
+ updated_access_group, flags,
+ "access_group_initiator_delete");
}

-int lsm_volume_mask(lsm_connect *c, lsm_access_group *access_group,
- lsm_volume *volume,
- lsm_flag flags)
+int lsm_volume_mask(lsm_connect * c, lsm_access_group * access_group,
+ lsm_volume * volume, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_ACCESS_GROUP(access_group) || !LSM_IS_VOL(volume) ||
- LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_ACCESS_GROUP(access_group) || !LSM_IS_VOL(volume) ||
+ LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["access_group"] = access_group_to_value(access_group);
p["volume"] = volume_to_value(volume);
p["flags"] = Value(flags);
@@ -1579,18 +1597,17 @@ int lsm_volume_mask(lsm_connect *c, lsm_access_group *access_group,
}


-int lsm_volume_unmask(lsm_connect *c, lsm_access_group *group,
- lsm_volume *volume,
- lsm_flag flags)
+int lsm_volume_unmask(lsm_connect * c, lsm_access_group * group,
+ lsm_volume * volume, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_ACCESS_GROUP(group) || !LSM_IS_VOL(volume) ||
- LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_ACCESS_GROUP(group) || !LSM_IS_VOL(volume) ||
+ LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["access_group"] = access_group_to_value(group);
p["volume"] = volume_to_value(volume);
p["flags"] = Value(flags);
@@ -1601,21 +1618,21 @@ int lsm_volume_unmask(lsm_connect *c, lsm_access_group *group,
return rpc(c, "volume_unmask", parameters, response);
}

-int lsm_volumes_accessible_by_access_group(lsm_connect *c,
- lsm_access_group *group,
- lsm_volume **volumes[],
- uint32_t *count, lsm_flag flags)
+int lsm_volumes_accessible_by_access_group(lsm_connect * c,
+ lsm_access_group * group,
+ lsm_volume ** volumes[],
+ uint32_t * count, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !LSM_IS_ACCESS_GROUP(group) ||
- !volumes || !count || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_ACCESS_GROUP(group) ||
+ !volumes || !count || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

try {
- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["access_group"] = access_group_to_value(group);
p["flags"] = Value(flags);

@@ -1623,18 +1640,18 @@ int lsm_volumes_accessible_by_access_group(lsm_connect *c,
Value response;

rc = rpc(c, "volumes_accessible_by_access_group", parameters, response);
- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
- std::vector<Value> vol = response.asArray();
+ if (LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
+ std::vector < Value > vol = response.asArray();

*count = vol.size();

- if( vol.size() ) {
+ if (vol.size()) {
*volumes = lsm_volume_record_array_alloc(vol.size());

- if( *volumes ) {
- for( size_t i = 0; i < vol.size(); ++i ) {
+ if (*volumes) {
+ for (size_t i = 0; i < vol.size(); ++i) {
(*volumes)[i] = value_to_volume(vol[i]);
- if( !((*volumes)[i]) ) {
+ if (!((*volumes)[i])) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}
@@ -1644,18 +1661,18 @@ int lsm_volumes_accessible_by_access_group(lsm_connect *c,
}
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
goto error;

}

-out:
+ out:
return rc;

-error:
- if( *volumes && *count ) {
+ error:
+ if (*volumes && *count) {
lsm_volume_record_array_free(*volumes, *count);
*volumes = NULL;
*count = 0;
@@ -1663,22 +1680,22 @@ error:
goto out;
}

-int lsm_access_groups_granted_to_volume(lsm_connect *c,
- lsm_volume *volume,
- lsm_access_group **groups[],
- uint32_t *groupCount, lsm_flag flags)
+int lsm_access_groups_granted_to_volume(lsm_connect * c,
+ lsm_volume * volume,
+ lsm_access_group ** groups[],
+ uint32_t * groupCount, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_VOL(volume)) {
+ if (!LSM_IS_VOL(volume)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( !groups || !groupCount || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!groups || !groupCount || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["volume"] = volume_to_value(volume);
p["flags"] = Value(flags);

@@ -1689,16 +1706,16 @@ int lsm_access_groups_granted_to_volume(lsm_connect *c,
return get_access_groups(c, rc, response, groups, groupCount);
}

-static int _retrieve_bool(int rc, Value &response, uint8_t *yes)
+static int _retrieve_bool(int rc, Value & response, uint8_t * yes)
{
int rc_out = rc;

*yes = 0;

- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
//We should be getting a boolean value back.
- if( Value::boolean_t == response.valueType() ) {
- if( response.asBool() ) {
+ if (Value::boolean_t == response.valueType()) {
+ if (response.asBool()) {
*yes = 1;
}
} else {
@@ -1708,17 +1725,17 @@ static int _retrieve_bool(int rc, Value &response, uint8_t *yes)
return rc_out;
}

-int lsm_volume_child_dependency(lsm_connect *c, lsm_volume *volume,
- uint8_t *yes, lsm_flag flags)
+int lsm_volume_child_dependency(lsm_connect * c, lsm_volume * volume,
+ uint8_t * yes, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !LSM_IS_VOL(volume)) {
+ if (!LSM_IS_VOL(volume)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( !yes || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!yes || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -1729,19 +1746,21 @@ int lsm_volume_child_dependency(lsm_connect *c, lsm_volume *volume,

rc = rpc(c, "volume_child_dependency", parameters, response);
rc = _retrieve_bool(rc, response, yes);
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}

-int lsm_volume_child_dependency_delete(lsm_connect *c, lsm_volume *volume,
- char **job, lsm_flag flags)
+int lsm_volume_child_dependency_delete(lsm_connect * c,
+ lsm_volume * volume, char **job,
+ lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_VOL(volume) || CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_VOL(volume) || CHECK_RP(job)
+ || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -1752,35 +1771,35 @@ int lsm_volume_child_dependency_delete(lsm_connect *c, lsm_volume *volume,
return job_check(c, rc, response, job);
}

-int lsm_system_list(lsm_connect *c, lsm_system **systems[],
- uint32_t *systemCount, lsm_flag flags)
+int lsm_system_list(lsm_connect * c, lsm_system ** systems[],
+ uint32_t * systemCount, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !systems || ! systemCount ) {
+ if (!systems || !systemCount) {
return LSM_ERR_INVALID_ARGUMENT;
}

try {
- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["flags"] = Value(flags);
Value parameters(p);
Value response;

rc = rpc(c, "systems", parameters, response);
- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
- std::vector<Value> sys = response.asArray();
+ if (LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
+ std::vector < Value > sys = response.asArray();

*systemCount = sys.size();

- if( sys.size() ) {
+ if (sys.size()) {
*systems = lsm_system_record_array_alloc(sys.size());

- if( *systems ) {
- for( size_t i = 0; i < sys.size(); ++i ) {
+ if (*systems) {
+ for (size_t i = 0; i < sys.size(); ++i) {
(*systems)[i] = value_to_system(sys[i]);
- if( !(*systems)[i] ) {
+ if (!(*systems)[i]) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}
@@ -1790,41 +1809,41 @@ int lsm_system_list(lsm_connect *c, lsm_system **systems[],
}
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
goto error;

}
-out:
+ out:
return rc;

-error:
- if( *systems ) {
- lsm_system_record_array_free( *systems, *systemCount);
+ error:
+ if (*systems) {
+ lsm_system_record_array_free(*systems, *systemCount);
*systems = NULL;
*systemCount = 0;
}
goto out;
}

-int lsm_fs_list(lsm_connect *c, const char *search_key,
- const char *search_value, lsm_fs **fs[],
- uint32_t *fsCount, lsm_flag flags)
+int lsm_fs_list(lsm_connect * c, const char *search_key,
+ const char *search_value, lsm_fs ** fs[],
+ uint32_t * fsCount, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !fs || !fsCount ) {
+ if (!fs || !fsCount) {
return LSM_ERR_INVALID_ARGUMENT;
}

try {
- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;

int rc = add_search_params(p, search_key, search_value, FS_SEARCH_KEYS,
- FS_SEARCH_KEYS_COUNT);
- if( LSM_ERR_OK != rc ) {
+ FS_SEARCH_KEYS_COUNT);
+ if (LSM_ERR_OK != rc) {
return rc;
}

@@ -1833,18 +1852,18 @@ int lsm_fs_list(lsm_connect *c, const char *search_key,
Value response;

rc = rpc(c, "fs", parameters, response);
- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
- std::vector<Value> sys = response.asArray();
+ if (LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
+ std::vector < Value > sys = response.asArray();

*fsCount = sys.size();

- if( sys.size() ) {
+ if (sys.size()) {
*fs = lsm_fs_record_array_alloc(sys.size());

- if( *fs ) {
- for( size_t i = 0; i < sys.size(); ++i ) {
+ if (*fs) {
+ for (size_t i = 0; i < sys.size(); ++i) {
(*fs)[i] = value_to_fs(sys[i]);
- if( !((*fs)[i]) ) {
+ if (!((*fs)[i])) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}
@@ -1854,17 +1873,17 @@ int lsm_fs_list(lsm_connect *c, const char *search_key,
}
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
goto error;

}
-out:
+ out:
return rc;

-error:
- if( *fs && *fsCount) {
+ error:
+ if (*fs && *fsCount) {
lsm_fs_record_array_free(*fs, *fsCount);
*fs = NULL;
*fsCount = 0;
@@ -1872,22 +1891,21 @@ error:
goto out;
}

-int lsm_fs_create(lsm_connect *c, lsm_pool *pool, const char *name,
- uint64_t size_bytes, lsm_fs **fs, char **job,
- lsm_flag flags)
+int lsm_fs_create(lsm_connect * c, lsm_pool * pool, const char *name,
+ uint64_t size_bytes, lsm_fs ** fs, char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_POOL(pool)) {
+ if (!LSM_IS_POOL(pool)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( CHECK_STR(name) || !size_bytes || CHECK_RP(fs) || CHECK_RP(job)
- || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_STR(name) || !size_bytes || CHECK_RP(fs) || CHECK_RP(job)
+ || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["pool"] = pool_to_value(pool);
p["name"] = Value(name);
p["size_bytes"] = Value(size_bytes);
@@ -1897,26 +1915,26 @@ int lsm_fs_create(lsm_connect *c, lsm_pool *pool, const char *name,
Value response;

int rc = rpc(c, "fs_create", parameters, response);
- if( LSM_ERR_OK == rc ) {
- *fs = (lsm_fs *)parse_job_response(c, response, rc, job,
- (convert)value_to_fs);
+ if (LSM_ERR_OK == rc) {
+ *fs = (lsm_fs *) parse_job_response(c, response, rc, job,
+ (convert) value_to_fs);
}
return rc;
}

-static Value _create_fs_flag_param(lsm_fs *fs, lsm_flag flags)
+static Value _create_fs_flag_param(lsm_fs * fs, lsm_flag flags)
{
- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["fs"] = fs_to_value(fs);
p["flags"] = Value(flags);
return Value(p);
}

-int lsm_fs_delete(lsm_connect *c, lsm_fs *fs, char **job, lsm_flag flags)
+int lsm_fs_delete(lsm_connect * c, lsm_fs * fs, char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_FS(fs) || CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_FS(fs) || CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -1928,18 +1946,18 @@ int lsm_fs_delete(lsm_connect *c, lsm_fs *fs, char **job, lsm_flag flags)
}


-int lsm_fs_resize(lsm_connect *c, lsm_fs *fs,
- uint64_t new_size_bytes, lsm_fs **rfs,
- char **job, lsm_flag flags)
+int lsm_fs_resize(lsm_connect * c, lsm_fs * fs,
+ uint64_t new_size_bytes, lsm_fs ** rfs,
+ char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_FS(fs) || !new_size_bytes || CHECK_RP(rfs) || CHECK_RP(job) ||
- LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_FS(fs) || !new_size_bytes || CHECK_RP(rfs) || CHECK_RP(job)
+ || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["fs"] = fs_to_value(fs);
p["new_size_bytes"] = Value(new_size_bytes);
p["flags"] = Value(flags);
@@ -1948,26 +1966,25 @@ int lsm_fs_resize(lsm_connect *c, lsm_fs *fs,
Value response;

int rc = rpc(c, "fs_resize", parameters, response);
- if( LSM_ERR_OK == rc ) {
- *rfs = (lsm_fs *)parse_job_response(c, response, rc, job,
- (convert)value_to_fs);
+ if (LSM_ERR_OK == rc) {
+ *rfs = (lsm_fs *) parse_job_response(c, response, rc, job,
+ (convert) value_to_fs);
}
return rc;
}

-int lsm_fs_clone(lsm_connect *c, lsm_fs *src_fs,
- const char *name, lsm_fs_ss *optional_ss,
- lsm_fs **cloned_fs,
- char **job, lsm_flag flags)
+int lsm_fs_clone(lsm_connect * c, lsm_fs * src_fs,
+ const char *name, lsm_fs_ss * optional_ss,
+ lsm_fs ** cloned_fs, char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_FS(src_fs) || CHECK_STR(name) || CHECK_RP(cloned_fs) ||
- CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_FS(src_fs) || CHECK_STR(name) || CHECK_RP(cloned_fs) ||
+ CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["src_fs"] = fs_to_value(src_fs);
p["dest_fs_name"] = Value(name);
p["snapshot"] = ss_to_value(optional_ss);
@@ -1977,25 +1994,27 @@ int lsm_fs_clone(lsm_connect *c, lsm_fs *src_fs,
Value response;

int rc = rpc(c, "fs_clone", parameters, response);
- if( LSM_ERR_OK == rc ) {
- *cloned_fs = (lsm_fs *)parse_job_response(c, response, rc, job,
- (convert)value_to_fs);
+ if (LSM_ERR_OK == rc) {
+ *cloned_fs = (lsm_fs *) parse_job_response(c, response, rc, job,
+ (convert) value_to_fs);
}
return rc;
}

-int lsm_fs_file_clone(lsm_connect *c, lsm_fs *fs, const char *src_file_name,
- const char *dest_file_name, lsm_fs_ss *snapshot, char **job,
- lsm_flag flags)
+int lsm_fs_file_clone(lsm_connect * c, lsm_fs * fs,
+ const char *src_file_name,
+ const char *dest_file_name, lsm_fs_ss * snapshot,
+ char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_FS(fs) || CHECK_STR(src_file_name) || CHECK_STR(dest_file_name)
- || CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_FS(fs) || CHECK_STR(src_file_name)
+ || CHECK_STR(dest_file_name)
+ || CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["fs"] = fs_to_value(fs);
p["src_file_name"] = Value(src_file_name);
p["dest_file_name"] = Value(dest_file_name);
@@ -2009,33 +2028,35 @@ int lsm_fs_file_clone(lsm_connect *c, lsm_fs *fs, const char *src_file_name,
return job_check(c, rc, response, job);
}

-static Value _create_fs_file_flag_params(lsm_fs *fs, lsm_string_list *files,
- lsm_flag flags)
+static Value _create_fs_file_flag_params(lsm_fs * fs,
+ lsm_string_list * files,
+ lsm_flag flags)
{
- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["fs"] = fs_to_value(fs);
p["files"] = string_list_to_value(files);
p["flags"] = Value(flags);
return Value(p);
}

-int lsm_fs_child_dependency( lsm_connect *c, lsm_fs *fs, lsm_string_list *files,
- uint8_t *yes, lsm_flag flags)
+int lsm_fs_child_dependency(lsm_connect * c, lsm_fs * fs,
+ lsm_string_list * files, uint8_t * yes,
+ lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !LSM_IS_FS(fs) ) {
+ if (!LSM_IS_FS(fs)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( files ) {
- if( !LSM_IS_STRING_LIST(files) ) {
+ if (files) {
+ if (!LSM_IS_STRING_LIST(files)) {
return LSM_ERR_INVALID_ARGUMENT;
}
}

- if( !yes || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!yes || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -2046,29 +2067,30 @@ int lsm_fs_child_dependency( lsm_connect *c, lsm_fs *fs, lsm_string_list *files,

rc = rpc(c, "fs_child_dependency", parameters, response);
rc = _retrieve_bool(rc, response, yes);
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}

-int lsm_fs_child_dependency_delete( lsm_connect *c, lsm_fs *fs, lsm_string_list *files,
- char **job, lsm_flag flags )
+int lsm_fs_child_dependency_delete(lsm_connect * c, lsm_fs * fs,
+ lsm_string_list * files, char **job,
+ lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_FS(fs)) {
+ if (!LSM_IS_FS(fs)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( files ) {
- if( !LSM_IS_STRING_LIST(files) ) {
+ if (files) {
+ if (!LSM_IS_STRING_LIST(files)) {
return LSM_ERR_INVALID_ARGUMENT;
}
}

- if( CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -2079,17 +2101,17 @@ int lsm_fs_child_dependency_delete( lsm_connect *c, lsm_fs *fs, lsm_string_list
return job_check(c, rc, response, job);
}

-int lsm_fs_ss_list(lsm_connect *c, lsm_fs *fs, lsm_fs_ss **ss[],
- uint32_t *ssCount, lsm_flag flags )
+int lsm_fs_ss_list(lsm_connect * c, lsm_fs * fs, lsm_fs_ss ** ss[],
+ uint32_t * ssCount, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( !LSM_IS_FS(fs) ) {
+ if (!LSM_IS_FS(fs)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( CHECK_RP(ss) || !ssCount ) {
+ if (CHECK_RP(ss) || !ssCount) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -2098,18 +2120,18 @@ int lsm_fs_ss_list(lsm_connect *c, lsm_fs *fs, lsm_fs_ss **ss[],

try {
rc = rpc(c, "fs_snapshots", parameters, response);
- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
- std::vector<Value> sys = response.asArray();
+ if (LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
+ std::vector < Value > sys = response.asArray();

*ssCount = sys.size();

- if( sys.size() ) {
+ if (sys.size()) {
*ss = lsm_fs_ss_record_array_alloc(sys.size());

- if( *ss ) {
- for( size_t i = 0; i < sys.size(); ++i ) {
+ if (*ss) {
+ for (size_t i = 0; i < sys.size(); ++i) {
(*ss)[i] = value_to_ss(sys[i]);
- if( !((*ss)[i]) ) {
+ if (!((*ss)[i])) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}
@@ -2119,16 +2141,16 @@ int lsm_fs_ss_list(lsm_connect *c, lsm_fs *fs, lsm_fs_ss **ss[],
}
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
goto error;
}
-out:
+ out:
return rc;

-error:
- if( *ss && *ssCount ) {
+ error:
+ if (*ss && *ssCount) {
lsm_fs_ss_record_array_free(*ss, *ssCount);
*ss = NULL;
*ssCount = 0;
@@ -2137,20 +2159,21 @@ error:
goto out;
}

-int lsm_fs_ss_create(lsm_connect *c, lsm_fs *fs, const char *name, lsm_fs_ss **snapshot, char **job,
- lsm_flag flags)
+int lsm_fs_ss_create(lsm_connect * c, lsm_fs * fs, const char *name,
+ lsm_fs_ss ** snapshot, char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_FS(fs)) {
+ if (!LSM_IS_FS(fs)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( CHECK_STR(name) || CHECK_RP(snapshot) || CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_STR(name) || CHECK_RP(snapshot) || CHECK_RP(job)
+ || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["fs"] = fs_to_value(fs);
p["snapshot_name"] = Value(name);
p["flags"] = Value(flags);
@@ -2159,31 +2182,32 @@ int lsm_fs_ss_create(lsm_connect *c, lsm_fs *fs, const char *name, lsm_fs_ss **s
Value response;

int rc = rpc(c, "fs_snapshot_create", parameters, response);
- if( LSM_ERR_OK == rc ) {
- *snapshot = (lsm_fs_ss *)parse_job_response(c, response, rc, job,
- (convert)value_to_ss);
+ if (LSM_ERR_OK == rc) {
+ *snapshot = (lsm_fs_ss *) parse_job_response(c, response, rc, job,
+ (convert)
+ value_to_ss);
}
return rc;
}

-int lsm_fs_ss_delete(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss, char **job,
- lsm_flag flags)
+int lsm_fs_ss_delete(lsm_connect * c, lsm_fs * fs, lsm_fs_ss * ss,
+ char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_FS(fs) ) {
+ if (!LSM_IS_FS(fs)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( !LSM_IS_SS(ss) ) {
+ if (!LSM_IS_SS(ss)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["fs"] = fs_to_value(fs);
p["snapshot"] = ss_to_value(ss);
p["flags"] = Value(flags);
@@ -2195,43 +2219,43 @@ int lsm_fs_ss_delete(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss, char **job,
return job_check(c, rc, response, job);
}

-int lsm_fs_ss_restore(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss,
- lsm_string_list *files,
- lsm_string_list *restore_files,
- int all_files, char **job, lsm_flag flags)
+int lsm_fs_ss_restore(lsm_connect * c, lsm_fs * fs, lsm_fs_ss * ss,
+ lsm_string_list * files,
+ lsm_string_list * restore_files,
+ int all_files, char **job, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_FS(fs) ) {
+ if (!LSM_IS_FS(fs)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( !LSM_IS_SS(ss) ) {
+ if (!LSM_IS_SS(ss)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( files ) {
- if( !LSM_IS_STRING_LIST(files) ) {
+ if (files) {
+ if (!LSM_IS_STRING_LIST(files)) {
return LSM_ERR_INVALID_ARGUMENT;
}
}

- if( restore_files ) {
- if( !LSM_IS_STRING_LIST(restore_files) ) {
+ if (restore_files) {
+ if (!LSM_IS_STRING_LIST(restore_files)) {
return LSM_ERR_INVALID_ARGUMENT;
}
}

- if( CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["fs"] = fs_to_value(fs);
p["snapshot"] = ss_to_value(ss);
p["files"] = string_list_to_value(files);
p["restore_files"] = string_list_to_value(restore_files);
- p["all_files"] = Value((all_files)?true:false);
+ p["all_files"] = Value((all_files) ? true : false);
p["flags"] = Value(flags);

Value parameters(p);
@@ -2242,14 +2266,14 @@ int lsm_fs_ss_restore(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss,

}

-int lsm_nfs_list( lsm_connect *c, const char *search_key,
- const char *search_value, lsm_nfs_export **exports[],
- uint32_t *count, lsm_flag flags)
+int lsm_nfs_list(lsm_connect * c, const char *search_key,
+ const char *search_value, lsm_nfs_export ** exports[],
+ uint32_t * count, lsm_flag flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);

- if( CHECK_RP(exports) || !count ) {
+ if (CHECK_RP(exports) || !count) {
return LSM_ERR_INVALID_ARGUMENT;
}

@@ -2257,12 +2281,12 @@ int lsm_nfs_list( lsm_connect *c, const char *search_key,
*exports = NULL;

try {
- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;

rc = add_search_params(p, search_key, search_value,
- NFS_EXPORT_SEARCH_KEYS,
- NFS_EXPORT_SEARCH_KEYS_COUNT);
- if( LSM_ERR_OK != rc ) {
+ NFS_EXPORT_SEARCH_KEYS,
+ NFS_EXPORT_SEARCH_KEYS_COUNT);
+ if (LSM_ERR_OK != rc) {
return rc;
}

@@ -2271,18 +2295,18 @@ int lsm_nfs_list( lsm_connect *c, const char *search_key,
Value response;

rc = rpc(c, "exports", parameters, response);
- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
- std::vector<Value> exps = response.asArray();
+ if (LSM_ERR_OK == rc && Value::array_t == response.valueType()) {
+ std::vector < Value > exps = response.asArray();

*count = exps.size();

- if( *count ) {
+ if (*count) {
*exports = lsm_nfs_export_record_array_alloc(*count);

- if( *exports ) {
- for( size_t i = 0; i < *count; ++i ) {
+ if (*exports) {
+ for (size_t i = 0; i < *count; ++i) {
(*exports)[i] = value_to_nfs_export(exps[i]);
- if( !((*exports)[i]) ) {
+ if (!((*exports)[i])) {
rc = LSM_ERR_NO_MEMORY;
goto error;
}
@@ -2292,63 +2316,62 @@ int lsm_nfs_list( lsm_connect *c, const char *search_key,
}
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
goto error;
}
-out:
+ out:
return rc;

-error:
- if( *exports && *count ) {
- lsm_nfs_export_record_array_free( *exports, *count );
- *exports = NULL;
- *count = 0;
+ error:
+ if (*exports && *count) {
+ lsm_nfs_export_record_array_free(*exports, *count);
+ *exports = NULL;
+ *count = 0;
}
goto out;
}

-int lsm_nfs_export_fs( lsm_connect *c,
- const char *fs_id,
- const char *export_path,
- lsm_string_list *root_list,
- lsm_string_list *rw_list,
- lsm_string_list *ro_list,
- uint64_t anon_uid,
- uint64_t anon_gid,
- const char *auth_type,
- const char *options,
- lsm_nfs_export **exported,
- lsm_flag flags
- )
+int lsm_nfs_export_fs(lsm_connect * c,
+ const char *fs_id,
+ const char *export_path,
+ lsm_string_list * root_list,
+ lsm_string_list * rw_list,
+ lsm_string_list * ro_list,
+ uint64_t anon_uid,
+ uint64_t anon_gid,
+ const char *auth_type,
+ const char *options,
+ lsm_nfs_export ** exported, lsm_flag flags)
{
CONN_SETUP(c);

- if( root_list ) {
- if( !LSM_IS_STRING_LIST(root_list) ) {
+ if (root_list) {
+ if (!LSM_IS_STRING_LIST(root_list)) {
return LSM_ERR_INVALID_ARGUMENT;
}
}

- if( rw_list ) {
- if( !LSM_IS_STRING_LIST(rw_list) ) {
+ if (rw_list) {
+ if (!LSM_IS_STRING_LIST(rw_list)) {
return LSM_ERR_INVALID_ARGUMENT;
}
}

- if( ro_list ) {
- if( !LSM_IS_STRING_LIST(ro_list) ) {
+ if (ro_list) {
+ if (!LSM_IS_STRING_LIST(ro_list)) {
return LSM_ERR_INVALID_ARGUMENT;
}
}

- if( CHECK_STR(fs_id) || CHECK_RP(exported)
- || !(root_list || rw_list || ro_list) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (CHECK_STR(fs_id) || CHECK_RP(exported)
+ || !(root_list || rw_list || ro_list)
+ || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;

p["fs_id"] = Value(fs_id);
p["export_path"] = Value(export_path);
@@ -2366,28 +2389,28 @@ int lsm_nfs_export_fs( lsm_connect *c,

int rc = rpc(c, "export_fs", parameters, response);
try {
- if( LSM_ERR_OK == rc && Value::object_t == response.valueType()) {
+ if (LSM_ERR_OK == rc && Value::object_t == response.valueType()) {
*exported = value_to_nfs_export(response);
- if( !(*exported) ) {
+ if (!(*exported)) {
rc = LSM_ERR_NO_MEMORY;
}
}
- } catch ( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}

-int lsm_nfs_export_delete( lsm_connect *c, lsm_nfs_export *e, lsm_flag flags)
+int lsm_nfs_export_delete(lsm_connect * c, lsm_nfs_export * e, lsm_flag flags)
{
CONN_SETUP(c);

- if( !LSM_IS_NFS_EXPORT(e) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ if (!LSM_IS_NFS_EXPORT(e) || LSM_FLAG_UNUSED_CHECK(flags)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["export"] = nfs_export_to_value(e);
p["flags"] = Value(flags);

@@ -2398,22 +2421,23 @@ int lsm_nfs_export_delete( lsm_connect *c, lsm_nfs_export *e, lsm_flag flags)
return rc;
}

-int lsm_volume_raid_create_cap_get(
- lsm_connect *c, lsm_system *system,
- uint32_t **supported_raid_types, uint32_t *supported_raid_type_count,
- uint32_t **supported_strip_sizes, uint32_t *supported_strip_size_count,
- lsm_flag flags)
+int lsm_volume_raid_create_cap_get(lsm_connect * c, lsm_system * system,
+ uint32_t ** supported_raid_types,
+ uint32_t * supported_raid_type_count,
+ uint32_t ** supported_strip_sizes,
+ uint32_t * supported_strip_size_count,
+ lsm_flag flags)
{
CONN_SETUP(c);

- if( !supported_raid_types || !supported_raid_type_count ||
+ if (!supported_raid_types || !supported_raid_type_count ||
!supported_strip_sizes || !supported_strip_size_count) {
- return LSM_ERR_INVALID_ARGUMENT;
+ return LSM_ERR_INVALID_ARGUMENT;
}

*supported_raid_types = NULL;

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["system"] = system_to_value(system);
p["flags"] = Value(flags);

@@ -2422,29 +2446,29 @@ int lsm_volume_raid_create_cap_get(

int rc = rpc(c, "volume_raid_create_cap_get", parameters, response);
try {
- std::vector<Value> j = response.asArray();
+ std::vector < Value > j = response.asArray();

- rc = values_to_uint32_array(
- j[0], supported_raid_types, supported_raid_type_count);
+ rc = values_to_uint32_array(j[0], supported_raid_types,
+ supported_raid_type_count);

- if( rc != LSM_ERR_OK ){
+ if (rc != LSM_ERR_OK) {
goto error;
}

- rc = values_to_uint32_array(
- j[1], supported_strip_sizes, supported_strip_size_count);
- if( rc != LSM_ERR_OK ){
+ rc = values_to_uint32_array(j[1], supported_strip_sizes,
+ supported_strip_size_count);
+ if (rc != LSM_ERR_OK) {
goto error;
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}

-out:
+ out:
return rc;

-error:
+ error:
free(*supported_raid_types);
*supported_raid_types = NULL;
*supported_raid_type_count = 0;
@@ -2453,69 +2477,67 @@ error:
goto out;
}

-int lsm_volume_raid_create(
- lsm_connect *c, const char *name, lsm_volume_raid_type raid_type,
- lsm_disk *disks[], uint32_t disk_count,
- uint32_t strip_size, lsm_volume **new_volume,
- lsm_flag flags)
+int lsm_volume_raid_create(lsm_connect * c, const char *name,
+ lsm_volume_raid_type raid_type,
+ lsm_disk * disks[], uint32_t disk_count,
+ uint32_t strip_size, lsm_volume ** new_volume,
+ lsm_flag flags)
{
CONN_SETUP(c);

- if (disk_count == 0){
- return log_exception(
- c, LSM_ERR_INVALID_ARGUMENT, "Require at least one disks", NULL);
+ if (disk_count == 0) {
+ return log_exception(c, LSM_ERR_INVALID_ARGUMENT,
+ "Require at least one disks", NULL);
}

- if (raid_type == LSM_VOLUME_RAID_TYPE_RAID1 && disk_count != 2){
- return log_exception(
- c, LSM_ERR_INVALID_ARGUMENT, "RAID 1 only allows two disks", NULL);
+ if (raid_type == LSM_VOLUME_RAID_TYPE_RAID1 && disk_count != 2) {
+ return log_exception(c, LSM_ERR_INVALID_ARGUMENT,
+ "RAID 1 only allows two disks", NULL);
}

- if (raid_type == LSM_VOLUME_RAID_TYPE_RAID5 && disk_count < 3){
- return log_exception(
- c, LSM_ERR_INVALID_ARGUMENT, "RAID 5 require 3 or more disks",
- NULL);
+ if (raid_type == LSM_VOLUME_RAID_TYPE_RAID5 && disk_count < 3) {
+ return log_exception(c, LSM_ERR_INVALID_ARGUMENT,
+ "RAID 5 require 3 or more disks", NULL);
}

- if (raid_type == LSM_VOLUME_RAID_TYPE_RAID6 && disk_count < 4){
- return log_exception(
- c, LSM_ERR_INVALID_ARGUMENT, "RAID 5 require 4 or more disks",
- NULL);
+ if (raid_type == LSM_VOLUME_RAID_TYPE_RAID6 && disk_count < 4) {
+ return log_exception(c, LSM_ERR_INVALID_ARGUMENT,
+ "RAID 5 require 4 or more disks", NULL);
}

- if ( disk_count % 2 ){
- if (raid_type == LSM_VOLUME_RAID_TYPE_RAID10 && disk_count < 4){
- return log_exception(
- c, LSM_ERR_INVALID_ARGUMENT,
- "RAID 10 require even disks count and 4 or more disks",
- NULL);
+ if (disk_count % 2) {
+ if (raid_type == LSM_VOLUME_RAID_TYPE_RAID10 && disk_count < 4) {
+ return log_exception(c, LSM_ERR_INVALID_ARGUMENT,
+ "RAID 10 require even disks count and 4 "
+ "or more disks",
+ NULL);
}
- if (raid_type == LSM_VOLUME_RAID_TYPE_RAID50 && disk_count < 6){
- return log_exception(
- c, LSM_ERR_INVALID_ARGUMENT,
- "RAID 50 require even disks count and 6 or more disks",
- NULL);
+ if (raid_type == LSM_VOLUME_RAID_TYPE_RAID50 && disk_count < 6) {
+ return log_exception(c, LSM_ERR_INVALID_ARGUMENT,
+ "RAID 50 require even disks count and 6 or "
+ "more disks",
+ NULL);
}
- if (raid_type == LSM_VOLUME_RAID_TYPE_RAID60 && disk_count < 8){
- return log_exception(
- c, LSM_ERR_INVALID_ARGUMENT,
- "RAID 60 require even disks count and 8 or more disks",
- NULL);
+ if (raid_type == LSM_VOLUME_RAID_TYPE_RAID60 && disk_count < 8) {
+ return log_exception(c, LSM_ERR_INVALID_ARGUMENT,
+ "RAID 60 require even disks count and 8 or "
+ "more disks",
+ NULL);
}
}

- if (CHECK_RP(new_volume)){
+ if (CHECK_RP(new_volume)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- std::map<std::string, Value> p;
+ std::map < std::string, Value > p;
p["name"] = Value(name);
- p["raid_type"] = Value((int32_t)raid_type);
- p["strip_size"] = Value((int32_t)strip_size);
+ p["raid_type"] = Value((int32_t) raid_type);
+ p["strip_size"] = Value((int32_t) strip_size);
p["flags"] = Value(flags);
- std::vector<Value> disks_value;
+ std::vector < Value > disks_value;
disks_value.reserve(disk_count);
- for (uint32_t i = 0; i < disk_count; i++){
+ for (uint32_t i = 0; i < disk_count; i++) {
disks_value.push_back(disk_to_value(disks[i]));
}
p["disks"] = disks_value;
@@ -2525,15 +2547,15 @@ int lsm_volume_raid_create(

int rc = rpc(c, "volume_raid_create", parameters, response);
try {
- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
*new_volume = value_to_volume(response);
- if( ! (*new_volume) ) {
+ if (!(*new_volume)) {
rc = LSM_ERR_NO_MEMORY;
}
}
- } catch( const ValueException &ve ) {
- rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type",
- ve.what());
+ }
+ catch(const ValueException & ve) {
+ rc = log_exception(c, LSM_ERR_PLUGIN_BUG, "Unexpected type", ve.what());
}
return rc;
}
diff --git a/c_binding/lsm_plugin_ipc.cpp b/c_binding/lsm_plugin_ipc.cpp
index 7ef0a8a..890e1cb 100644
--- a/c_binding/lsm_plugin_ipc.cpp
+++ b/c_binding/lsm_plugin_ipc.cpp
@@ -48,71 +48,73 @@ static int lsm_plugin_run(lsm_plugin_ptr plug);
*/
static std::string ss(char *s)
{
- if( s ) {
+ if (s) {
return std::string(s);
}
return std::string();
}

-void * lsm_data_type_copy(lsm_data_type t, void *item)
+void *lsm_data_type_copy(lsm_data_type t, void *item)
{
void *rc = NULL;

- if( item ) {
- switch( t ) {
- case(LSM_DATA_TYPE_ACCESS_GROUP):
- rc = lsm_access_group_record_copy((lsm_access_group *)item);
- break;
- case(LSM_DATA_TYPE_BLOCK_RANGE):
- rc = lsm_block_range_record_copy((lsm_block_range *)item);
- break;
- case(LSM_DATA_TYPE_FS):
- rc = lsm_fs_record_copy((lsm_fs *)item);
- break;
- case(LSM_DATA_TYPE_NFS_EXPORT):
- rc = lsm_nfs_export_record_copy((lsm_nfs_export *)item);
- break;
- case(LSM_DATA_TYPE_POOL):
- rc = lsm_pool_record_copy((lsm_pool *)item);
- break;
- case(LSM_DATA_TYPE_SS):
- rc = lsm_fs_ss_record_copy((lsm_fs_ss *)item);
- break;
- case(LSM_DATA_TYPE_STRING_LIST):
- rc = lsm_string_list_copy((lsm_string_list *)item);
- break;
- case(LSM_DATA_TYPE_SYSTEM):
- rc = lsm_system_record_copy((lsm_system *)item);
- break;
- case(LSM_DATA_TYPE_VOLUME):
- rc = lsm_volume_record_copy((lsm_volume *)item);
- break;
- case(LSM_DATA_TYPE_DISK):
- rc = lsm_disk_record_copy((lsm_disk *)item);
- break;
- default:
- break;
- }
+ if (item) {
+ switch (t) {
+ case (LSM_DATA_TYPE_ACCESS_GROUP):
+ rc = lsm_access_group_record_copy((lsm_access_group *) item);
+ break;
+ case (LSM_DATA_TYPE_BLOCK_RANGE):
+ rc = lsm_block_range_record_copy((lsm_block_range *) item);
+ break;
+ case (LSM_DATA_TYPE_FS):
+ rc = lsm_fs_record_copy((lsm_fs *) item);
+ break;
+ case (LSM_DATA_TYPE_NFS_EXPORT):
+ rc = lsm_nfs_export_record_copy((lsm_nfs_export *) item);
+ break;
+ case (LSM_DATA_TYPE_POOL):
+ rc = lsm_pool_record_copy((lsm_pool *) item);
+ break;
+ case (LSM_DATA_TYPE_SS):
+ rc = lsm_fs_ss_record_copy((lsm_fs_ss *) item);
+ break;
+ case (LSM_DATA_TYPE_STRING_LIST):
+ rc = lsm_string_list_copy((lsm_string_list *) item);
+ break;
+ case (LSM_DATA_TYPE_SYSTEM):
+ rc = lsm_system_record_copy((lsm_system *) item);
+ break;
+ case (LSM_DATA_TYPE_VOLUME):
+ rc = lsm_volume_record_copy((lsm_volume *) item);
+ break;
+ case (LSM_DATA_TYPE_DISK):
+ rc = lsm_disk_record_copy((lsm_disk *) item);
+ break;
+ default:
+ break;
+ }
}
return rc;
}

-static Value job_handle(const Value &val, char *job)
+static Value job_handle(const Value & val, char *job)
{
- std::vector<Value> r;
+ std::vector < Value > r;
r.push_back(Value(job));
r.push_back(val);
return Value(r);
}

int lsm_register_plugin_v1(lsm_plugin_ptr plug,
- void *private_data, struct lsm_mgmt_ops_v1 *mgm_op,
- struct lsm_san_ops_v1 *san_op, struct lsm_fs_ops_v1 *fs_op,
- struct lsm_nas_ops_v1 *nas_op)
+ void *private_data,
+ struct lsm_mgmt_ops_v1 *mgm_op,
+ struct lsm_san_ops_v1 *san_op,
+ struct lsm_fs_ops_v1 *fs_op,
+ struct lsm_nas_ops_v1 *nas_op)
{
int rc = LSM_ERR_INVALID_ARGUMENT;

- if(LSM_IS_PLUGIN(plug)) {
+ if (LSM_IS_PLUGIN(plug)) {
plug->private_data = private_data;
plug->mgmt_ops = mgm_op;
plug->san_ops = san_op;
@@ -123,15 +125,17 @@ int lsm_register_plugin_v1(lsm_plugin_ptr plug,
return rc;
}

-int lsm_register_plugin_v1_2(
- lsm_plugin_ptr plug, void *private_data, struct lsm_mgmt_ops_v1 *mgm_op,
- struct lsm_san_ops_v1 *san_op, struct lsm_fs_ops_v1 *fs_op,
- struct lsm_nas_ops_v1 *nas_op, struct lsm_ops_v1_2 *ops_v1_2)
+int lsm_register_plugin_v1_2(lsm_plugin_ptr plug, void *private_data,
+ struct lsm_mgmt_ops_v1 *mgm_op,
+ struct lsm_san_ops_v1 *san_op,
+ struct lsm_fs_ops_v1 *fs_op,
+ struct lsm_nas_ops_v1 *nas_op,
+ struct lsm_ops_v1_2 *ops_v1_2)
{
- int rc = lsm_register_plugin_v1(
- plug, private_data, mgm_op, san_op, fs_op, nas_op);
+ int rc = lsm_register_plugin_v1(plug, private_data, mgm_op, san_op, fs_op,
+ nas_op);

- if (rc != LSM_ERR_OK){
+ if (rc != LSM_ERR_OK) {
return rc;
}
plug->ops_v1_2 = ops_v1_2;
@@ -149,12 +153,12 @@ void *lsm_private_data_get(lsm_plugin_ptr plug)

static void lsm_plugin_free(lsm_plugin_ptr p, lsm_flag flags)
{
- if( LSM_IS_PLUGIN(p) ) {
+ if (LSM_IS_PLUGIN(p)) {

delete(p->tp);
p->tp = NULL;

- if( p->unreg ) {
+ if (p->unreg) {
p->unreg(p, flags);
}

@@ -174,15 +178,16 @@ static void lsm_plugin_free(lsm_plugin_ptr p, lsm_flag flags)
}

static lsm_plugin_ptr lsm_plugin_alloc(lsm_plugin_register reg,
- lsm_plugin_unregister unreg,
- const char* desc, const char *version) {
+ lsm_plugin_unregister unreg,
+ const char *desc, const char *version)
+{

- if( !reg || !unreg ) {
+ if (!reg || !unreg) {
return NULL;
}

- lsm_plugin_ptr rc = (lsm_plugin_ptr)calloc(1, sizeof(lsm_plugin));
- if( rc ) {
+ lsm_plugin_ptr rc = (lsm_plugin_ptr) calloc(1, sizeof(lsm_plugin));
+ if (rc) {
rc->magic = LSM_PLUGIN_MAGIC;
rc->reg = reg;
rc->unreg = unreg;
@@ -199,45 +204,44 @@ static lsm_plugin_ptr lsm_plugin_alloc(lsm_plugin_register reg,

static void error_send(lsm_plugin_ptr p, int error_code)
{
- if( !LSM_IS_PLUGIN(p) ) {
+ if (!LSM_IS_PLUGIN(p)) {
return;
}

- if( p->error ) {
- if( p->tp ) {
+ if (p->error) {
+ if (p->tp) {
p->tp->errorSend(p->error->code, ss(p->error->message),
- ss(p->error->debug));
+ ss(p->error->debug));
lsm_error_free(p->error);
p->error = NULL;
}
} else {
- p->tp->errorSend(error_code, "Plugin didn't provide error message",
- "");
+ p->tp->errorSend(error_code, "Plugin didn't provide error message", "");
}
}

-static int get_search_params(Value &params, char **k, char **v)
+static int get_search_params(Value & params, char **k, char **v)
{
int rc = LSM_ERR_OK;
Value key = params["search_key"];
Value val = params["search_value"];

- if( Value::string_t == key.valueType() ) {
- if ( Value::string_t == val.valueType() ) {
+ if (Value::string_t == key.valueType()) {
+ if (Value::string_t == val.valueType()) {
*k = strdup(key.asC_str());
*v = strdup(val.asC_str());

- if( *k == NULL || *v == NULL ) {
- free( *k );
+ if (*k == NULL || *v == NULL) {
+ free(*k);
*k = NULL;
- free( *v );
+ free(*v);
*v = NULL;
rc = LSM_ERR_NO_MEMORY;
}
} else {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
}
- } else if( Value::null_t != key.valueType() ) {
+ } else if (Value::null_t != key.valueType()) {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
}

@@ -250,20 +254,20 @@ static int get_search_params(Value &params, char **k, char **v)
* @param[out] num The numeric value contained in string
* @return true if sn is an integer, else false
*/
-static bool get_num( char *sn, int &num)
+static bool get_num(char *sn, int &num)
{
errno = 0;

num = strtol(sn, NULL, 10);
- if( !errno ) {
+ if (!errno) {
return true;
}
return false;
}

-int lsm_plugin_init_v1( int argc, char *argv[], lsm_plugin_register reg,
- lsm_plugin_unregister unreg,
- const char *desc, const char *version)
+int lsm_plugin_init_v1(int argc, char *argv[], lsm_plugin_register reg,
+ lsm_plugin_unregister unreg,
+ const char *desc, const char *version)
{
int rc = 1;
lsm_plugin_ptr plug = NULL;
@@ -273,9 +277,9 @@ int lsm_plugin_init_v1( int argc, char *argv[], lsm_plugin_register reg,
}

int sd = 0;
- if( argc == 2 && get_num(argv[1], sd) ) {
+ if (argc == 2 && get_num(argv[1], sd)) {
plug = lsm_plugin_alloc(reg, unreg, desc, version);
- if( plug ) {
+ if (plug) {
plug->tp = new Ipc(sd);
if (plug->tp) {
rc = lsm_plugin_run(plug);
@@ -294,42 +298,40 @@ int lsm_plugin_init_v1( int argc, char *argv[], lsm_plugin_register reg,
return rc;
}

-typedef int (*handler)(lsm_plugin_ptr p, Value &params, Value &response);
+typedef int (*handler) (lsm_plugin_ptr p, Value & params, Value & response);

-static int handle_unregister(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_unregister(lsm_plugin_ptr p, Value & params, Value & response)
{
/* This is handled in the event loop */
return LSM_ERR_OK;
}

-static int handle_register(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_register(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
std::string uri_string;
std::string password;

- if( p && p->reg ) {
+ if (p && p->reg) {

Value uri_v = params["uri"];
Value passwd_v = params["password"];
Value tmo_v = params["timeout"];

- if( Value::string_t == uri_v.valueType() &&
+ if (Value::string_t == uri_v.valueType() &&
(Value::string_t == passwd_v.valueType() ||
- Value::null_t == passwd_v.valueType()) &&
+ Value::null_t == passwd_v.valueType()) &&
Value::numeric_t == tmo_v.valueType()) {
lsm_flag flags = LSM_FLAG_GET_VALUE(params);

uri_string = uri_v.asString();

- if( Value::string_t == params["password"].valueType() ) {
+ if (Value::string_t == params["password"].valueType()) {
password = params["password"].asString();
}
-
//Let the plug-in initialize itself.
rc = p->reg(p, uri_string.c_str(), password.c_str(),
- tmo_v.asUint32_t(),
- flags);
+ tmo_v.asUint32_t(), flags);
} else {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
}
@@ -339,13 +341,14 @@ static int handle_register(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int handle_set_time_out( lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_set_time_out(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
- if( p && p->mgmt_ops && p->mgmt_ops->tmo_set ) {
- if( Value::numeric_t == params["ms"].valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (p && p->mgmt_ops && p->mgmt_ops->tmo_set) {
+ if (Value::numeric_t == params["ms"].valueType() &&
+ LSM_FLAG_EXPECTED_TYPE(params)) {
return p->mgmt_ops->tmo_set(p, params["ms"].asUint32_t(),
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));
} else {
return LSM_ERR_TRANSPORT_INVALID_ARG;
}
@@ -353,16 +356,17 @@ static int handle_set_time_out( lsm_plugin_ptr p, Value &params, Value &response
return LSM_ERR_NO_SUPPORT;
}

-static int handle_get_time_out( lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_get_time_out(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
uint32_t tmo = 0;
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->mgmt_ops && p->mgmt_ops->tmo_get ) {
+ if (p && p->mgmt_ops && p->mgmt_ops->tmo_get) {

- if( LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (LSM_FLAG_EXPECTED_TYPE(params)) {
rc = p->mgmt_ops->tmo_get(p, &tmo, LSM_FLAG_GET_VALUE(params));
- if( LSM_ERR_OK == rc) {
+ if (LSM_ERR_OK == rc) {
response = Value(tmo);
}
} else {
@@ -372,7 +376,7 @@ static int handle_get_time_out( lsm_plugin_ptr p, Value &params, Value &response
return rc;
}

-static int handle_job_status( lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_job_status(lsm_plugin_ptr p, Value & params, Value & response)
{
std::string job_id;
lsm_job_status status;
@@ -381,43 +385,44 @@ static int handle_job_status( lsm_plugin_ptr p, Value &params, Value &response)
void *value = NULL;
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->mgmt_ops && p->mgmt_ops->job_status ) {
+ if (p && p->mgmt_ops && p->mgmt_ops->job_status) {

- if( Value::string_t != params["job_id"].valueType() &&
- !LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (Value::string_t != params["job_id"].valueType() &&
+ !LSM_FLAG_EXPECTED_TYPE(params)) {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
} else {

job_id = params["job_id"].asString();

- rc = p->mgmt_ops->job_status(p, job_id.c_str(), &status, &percent, &t,
- &value, LSM_FLAG_GET_VALUE(params));
+ rc = p->mgmt_ops->job_status(p, job_id.c_str(), &status,
+ &percent, &t, &value,
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc) {
- std::vector<Value> result;
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;

- result.push_back(Value((int32_t)status));
+ result.push_back(Value((int32_t) status));
result.push_back(Value(percent));

- if( NULL == value ) {
+ if (NULL == value) {
result.push_back(Value());
} else {
- if( LSM_DATA_TYPE_VOLUME == t &&
- LSM_IS_VOL((lsm_volume *)value)) {
- result.push_back(volume_to_value((lsm_volume *)value));
- lsm_volume_record_free((lsm_volume *)value);
- } else if( LSM_DATA_TYPE_FS == t &&
- LSM_IS_FS((lsm_fs *)value)) {
- result.push_back(fs_to_value((lsm_fs *)value));
- lsm_fs_record_free((lsm_fs *)value);
- } else if( LSM_DATA_TYPE_SS == t &&
- LSM_IS_SS((lsm_fs_ss *)value)) {
- result.push_back(ss_to_value((lsm_fs_ss *)value));
- lsm_fs_ss_record_free((lsm_fs_ss *)value);
- } else if( LSM_DATA_TYPE_POOL == t &&
- LSM_IS_POOL((lsm_pool *)value)) {
- result.push_back(pool_to_value((lsm_pool *)value));
- lsm_pool_record_free((lsm_pool *)value);
+ if (LSM_DATA_TYPE_VOLUME == t &&
+ LSM_IS_VOL((lsm_volume *) value)) {
+ result.push_back(volume_to_value((lsm_volume *) value));
+ lsm_volume_record_free((lsm_volume *) value);
+ } else if (LSM_DATA_TYPE_FS == t &&
+ LSM_IS_FS((lsm_fs *) value)) {
+ result.push_back(fs_to_value((lsm_fs *) value));
+ lsm_fs_record_free((lsm_fs *) value);
+ } else if (LSM_DATA_TYPE_SS == t &&
+ LSM_IS_SS((lsm_fs_ss *) value)) {
+ result.push_back(ss_to_value((lsm_fs_ss *) value));
+ lsm_fs_ss_record_free((lsm_fs_ss *) value);
+ } else if (LSM_DATA_TYPE_POOL == t &&
+ LSM_IS_POOL((lsm_pool *) value)) {
+ result.push_back(pool_to_value((lsm_pool *) value));
+ lsm_pool_record_free((lsm_pool *) value);
} else {
rc = LSM_ERR_PLUGIN_BUG;
}
@@ -429,11 +434,12 @@ static int handle_job_status( lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int handle_plugin_info( lsm_plugin_ptr p, Value &params, Value &response )
+static int handle_plugin_info(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p ) {
- std::vector<Value> result;
+ if (p) {
+ std::vector < Value > result;
result.push_back(Value(p->desc));
result.push_back(Value(p->version));
response = Value(result);
@@ -442,14 +448,14 @@ static int handle_plugin_info( lsm_plugin_ptr p, Value &params, Value &response
return rc;
}

-static int handle_job_free(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_job_free(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->mgmt_ops && p->mgmt_ops->job_free ) {
- if( Value::string_t == params["job_id"].valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (p && p->mgmt_ops && p->mgmt_ops->job_free) {
+ if (Value::string_t == params["job_id"].valueType() &&
+ LSM_FLAG_EXPECTED_TYPE(params)) {
std::string job_num = params["job_id"].asString();
- char *j = (char*)job_num.c_str();
+ char *j = (char *) job_num.c_str();
rc = p->mgmt_ops->job_free(p, j, LSM_FLAG_GET_VALUE(params));
} else {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
@@ -458,24 +464,24 @@ static int handle_job_free(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int handle_system_list(lsm_plugin_ptr p, Value &params,
- Value &response)
+static int handle_system_list(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->mgmt_ops && p->mgmt_ops->system_list ) {
+ if (p && p->mgmt_ops && p->mgmt_ops->system_list) {
lsm_system **systems;
uint32_t count = 0;

- if( LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (LSM_FLAG_EXPECTED_TYPE(params)) {

rc = p->mgmt_ops->system_list(p, &systems, &count,
- LSM_FLAG_GET_VALUE(params));
- if( LSM_ERR_OK == rc ) {
- std::vector<Value> result;
+ LSM_FLAG_GET_VALUE(params));
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;
result.reserve(count);

- for( uint32_t i = 0; i < count; ++i ) {
+ for (uint32_t i = 0; i < count; ++i) {
result.push_back(system_to_value(systems[i]));
}

@@ -489,25 +495,26 @@ static int handle_system_list(lsm_plugin_ptr p, Value &params,
}
return rc;
}
-static int handle_pools(lsm_plugin_ptr p, Value &params, Value &response)
+
+static int handle_pools(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
char *key = NULL;
char *val = NULL;

- if( p && p->mgmt_ops && p->mgmt_ops->pool_list ) {
+ if (p && p->mgmt_ops && p->mgmt_ops->pool_list) {
lsm_pool **pools = NULL;
uint32_t count = 0;

- if( LSM_FLAG_EXPECTED_TYPE(params) &&
- ((rc = get_search_params(params, &key, &val)) == LSM_ERR_OK )) {
+ if (LSM_FLAG_EXPECTED_TYPE(params) &&
+ ((rc = get_search_params(params, &key, &val)) == LSM_ERR_OK)) {
rc = p->mgmt_ops->pool_list(p, key, val, &pools, &count,
LSM_FLAG_GET_VALUE(params));
- if( LSM_ERR_OK == rc) {
- std::vector<Value> result;
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;
result.reserve(count);

- for( uint32_t i = 0; i < count; ++i ) {
+ for (uint32_t i = 0; i < count; ++i) {
result.push_back(pool_to_value(pools[i]));
}

@@ -518,7 +525,7 @@ static int handle_pools(lsm_plugin_ptr p, Value &params, Value &response)
free(key);
free(val);
} else {
- if( rc == LSM_ERR_NO_SUPPORT ) {
+ if (rc == LSM_ERR_NO_SUPPORT) {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
}
}
@@ -526,25 +533,27 @@ static int handle_pools(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int handle_target_ports(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_target_ports(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
char *key = NULL;
char *val = NULL;

- if( p && p->san_ops && p->san_ops->target_port_list ) {
+ if (p && p->san_ops && p->san_ops->target_port_list) {
lsm_target_port **target_ports = NULL;
uint32_t count = 0;

- if( LSM_FLAG_EXPECTED_TYPE(params) &&
- ((rc = get_search_params(params, &key, &val)) == LSM_ERR_OK )) {
- rc = p->san_ops->target_port_list(p, key, val, &target_ports, &count,
- LSM_FLAG_GET_VALUE(params));
- if( LSM_ERR_OK == rc) {
- std::vector<Value> result;
+ if (LSM_FLAG_EXPECTED_TYPE(params) &&
+ ((rc = get_search_params(params, &key, &val)) == LSM_ERR_OK)) {
+ rc = p->san_ops->target_port_list(p, key, val, &target_ports,
+ &count,
+ LSM_FLAG_GET_VALUE(params));
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;
result.reserve(count);

- for( uint32_t i = 0; i < count; ++i ) {
+ for (uint32_t i = 0; i < count; ++i) {
result.push_back(target_port_to_value(target_ports[i]));
}

@@ -555,7 +564,7 @@ static int handle_target_ports(lsm_plugin_ptr p, Value &params, Value &response)
free(key);
free(val);
} else {
- if( rc == LSM_ERR_NO_SUPPORT ) {
+ if (rc == LSM_ERR_NO_SUPPORT) {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
}
}
@@ -563,23 +572,22 @@ static int handle_target_ports(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int capabilities(lsm_plugin_ptr p, Value &params, Value &response)
+static int capabilities(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->mgmt_ops && p->mgmt_ops->capablities) {
+ if (p && p->mgmt_ops && p->mgmt_ops->capablities) {
lsm_storage_capabilities *c = NULL;

Value v_s = params["system"];

- if( IS_CLASS_SYSTEM(v_s) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (IS_CLASS_SYSTEM(v_s) && LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_system *sys = value_to_system(v_s);

- if( sys ) {
+ if (sys) {
rc = p->mgmt_ops->capablities(p, sys, &c,
- LSM_FLAG_GET_VALUE(params));
- if( LSM_ERR_OK == rc) {
+ LSM_FLAG_GET_VALUE(params));
+ if (LSM_ERR_OK == rc) {
response = capabilities_to_value(c);
lsm_capability_record_free(c);
c = NULL;
@@ -595,14 +603,14 @@ static int capabilities(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static void get_volumes(int rc, lsm_volume **vols, uint32_t count,
- Value &response)
+static void get_volumes(int rc, lsm_volume ** vols, uint32_t count,
+ Value & response)
{
- if( LSM_ERR_OK == rc ) {
- std::vector<Value> result;
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;
result.reserve(count);

- for( uint32_t i = 0; i < count; ++i ) {
+ for (uint32_t i = 0; i < count; ++i) {
result.push_back(volume_to_value(vols[i]));
}

@@ -612,27 +620,27 @@ static void get_volumes(int rc, lsm_volume **vols, uint32_t count,
}
}

-static int handle_volumes(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_volumes(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
char *key = NULL;
char *val = NULL;


- if( p && p->san_ops && p->san_ops->vol_get ) {
+ if (p && p->san_ops && p->san_ops->vol_get) {
lsm_volume **vols = NULL;
uint32_t count = 0;

- if( LSM_FLAG_EXPECTED_TYPE(params) &&
- (rc = get_search_params(params, &key, &val)) == LSM_ERR_OK ) {
+ if (LSM_FLAG_EXPECTED_TYPE(params) &&
+ (rc = get_search_params(params, &key, &val)) == LSM_ERR_OK) {
rc = p->san_ops->vol_get(p, key, val, &vols, &count,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

get_volumes(rc, vols, count, response);
free(key);
free(val);
} else {
- if( rc == LSM_ERR_NO_SUPPORT ) {
+ if (rc == LSM_ERR_NO_SUPPORT) {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
}
}
@@ -640,13 +648,14 @@ static int handle_volumes(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static void get_disks(int rc, lsm_disk **disks, uint32_t count, Value &response)
+static void get_disks(int rc, lsm_disk ** disks, uint32_t count,
+ Value & response)
{
- if( LSM_ERR_OK == rc ) {
- std::vector<Value> result;
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;
result.reserve(count);

- for( uint32_t i = 0; i < count; ++i ) {
+ for (uint32_t i = 0; i < count; ++i) {
result.push_back(disk_to_value(disks[i]));
}

@@ -656,25 +665,25 @@ static void get_disks(int rc, lsm_disk **disks, uint32_t count, Value &response)
}
}

-static int handle_disks(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_disks(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
char *key = NULL;
char *val = NULL;

- if( p && p->san_ops && p->san_ops->disk_get ) {
+ if (p && p->san_ops && p->san_ops->disk_get) {
lsm_disk **disks = NULL;
uint32_t count = 0;

- if( LSM_FLAG_EXPECTED_TYPE(params) &&
- (rc = get_search_params(params, &key, &val)) == LSM_ERR_OK ) {
+ if (LSM_FLAG_EXPECTED_TYPE(params) &&
+ (rc = get_search_params(params, &key, &val)) == LSM_ERR_OK) {
rc = p->san_ops->disk_get(p, key, val, &disks, &count,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));
get_disks(rc, disks, count, response);
free(key);
free(val);
} else {
- if( rc == LSM_ERR_NO_SUPPORT ) {
+ if (rc == LSM_ERR_NO_SUPPORT) {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
}
}
@@ -682,32 +691,34 @@ static int handle_disks(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int handle_volume_create(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_volume_create(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->san_ops && p->san_ops->vol_create ) {
+ if (p && p->san_ops && p->san_ops->vol_create) {

Value v_p = params["pool"];
Value v_name = params["volume_name"];
Value v_size = params["size_bytes"];
Value v_prov = params["provisioning"];

- if( IS_CLASS_POOL(v_p) &&
+ if (IS_CLASS_POOL(v_p) &&
Value::string_t == v_name.valueType() &&
Value::numeric_t == v_size.valueType() &&
Value::numeric_t == v_prov.valueType() &&
LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_pool *pool = value_to_pool(v_p);
- if( pool ) {
+ if (pool) {
lsm_volume *vol = NULL;
char *job = NULL;
const char *name = v_name.asC_str();
uint64_t size = v_size.asUint64_t();
- lsm_volume_provision_type pro = (lsm_volume_provision_type)v_prov.asInt32_t();
+ lsm_volume_provision_type pro =
+ (lsm_volume_provision_type) v_prov.asInt32_t();

- rc = p->san_ops->vol_create(p, pool, name, size, pro, &vol, &job,
- LSM_FLAG_GET_VALUE(params));
+ rc = p->san_ops->vol_create(p, pool, name, size, pro, &vol,
+ &job, LSM_FLAG_GET_VALUE(params));

Value v = volume_to_value(vol);
response = job_handle(v, job);
@@ -728,25 +739,26 @@ static int handle_volume_create(lsm_plugin_ptr p, Value &params, Value &response
return rc;
}

-static int handle_volume_resize(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_volume_resize(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->san_ops && p->san_ops->vol_resize ) {
+ if (p && p->san_ops && p->san_ops->vol_resize) {
Value v_vol = params["volume"];
Value v_size = params["new_size_bytes"];

- if( IS_CLASS_VOLUME(v_vol) &&
+ if (IS_CLASS_VOLUME(v_vol) &&
Value::numeric_t == v_size.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_volume *vol = value_to_volume(v_vol);
- if( vol ) {
+ if (vol) {
lsm_volume *resized_vol = NULL;
uint64_t size = v_size.asUint64_t();
char *job = NULL;

- rc = p->san_ops->vol_resize(p, vol, size, &resized_vol, &job,
- LSM_FLAG_GET_VALUE(params));
+ rc = p->san_ops->vol_resize(p, vol, size, &resized_vol,
+ &job, LSM_FLAG_GET_VALUE(params));

Value v = volume_to_value(resized_vol);
response = job_handle(v, job);
@@ -766,38 +778,39 @@ static int handle_volume_resize(lsm_plugin_ptr p, Value &params, Value &response
return rc;
}

-static int handle_volume_replicate(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_volume_replicate(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->vol_replicate ) {
+ if (p && p->san_ops && p->san_ops->vol_replicate) {

Value v_pool = params["pool"];
Value v_vol_src = params["volume_src"];
Value v_rep = params["rep_type"];
Value v_name = params["name"];

- if( ((Value::object_t == v_pool.valueType() &&
- IS_CLASS_POOL(v_pool)) ||
- Value::null_t == v_pool.valueType()) &&
+ if (((Value::object_t == v_pool.valueType() &&
+ IS_CLASS_POOL(v_pool)) ||
+ Value::null_t == v_pool.valueType()) &&
IS_CLASS_VOLUME(v_vol_src) &&
Value::numeric_t == v_rep.valueType() &&
Value::string_t == v_name.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

- lsm_pool *pool = (Value::null_t == v_pool.valueType()) ? NULL :
- value_to_pool(v_pool);
+ lsm_pool *pool = (Value::null_t == v_pool.valueType())? NULL :
+ value_to_pool(v_pool);
lsm_volume *vol = value_to_volume(v_vol_src);
lsm_volume *newVolume = NULL;
- lsm_replication_type rep = (lsm_replication_type)v_rep.asInt32_t();
+ lsm_replication_type rep = (lsm_replication_type) v_rep.asInt32_t();
const char *name = v_name.asC_str();
char *job = NULL;

- if( vol && (pool ||
- (!pool && Value::null_t == v_pool.valueType())) ) {
+ if (vol &&
+ (pool || (!pool && Value::null_t == v_pool.valueType()))) {
rc = p->san_ops->vol_replicate(p, pool, rep, vol, name,
- &newVolume, &job,
- LSM_FLAG_GET_VALUE(params));
+ &newVolume, &job,
+ LSM_FLAG_GET_VALUE(params));

Value v = volume_to_value(newVolume);
response = job_handle(v, job);
@@ -818,25 +831,24 @@ static int handle_volume_replicate(lsm_plugin_ptr p, Value &params, Value &respo
return rc;
}

-static int handle_volume_replicate_range_block_size( lsm_plugin_ptr p,
- Value &params,
- Value &response)
+static int handle_volume_replicate_range_block_size(lsm_plugin_ptr p,
+ Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
uint32_t block_size = 0;

- if( p && p->san_ops && p->san_ops->vol_rep_range_bs ) {
+ if (p && p->san_ops && p->san_ops->vol_rep_range_bs) {
Value v_s = params["system"];

- if( IS_CLASS_SYSTEM(v_s) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (IS_CLASS_SYSTEM(v_s) && LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_system *sys = value_to_system(v_s);

- if( sys ) {
+ if (sys) {
rc = p->san_ops->vol_rep_range_bs(p, sys, &block_size,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
response = Value(block_size);
}

@@ -851,38 +863,38 @@ static int handle_volume_replicate_range_block_size( lsm_plugin_ptr p,
return rc;
}

-static int handle_volume_replicate_range(lsm_plugin_ptr p, Value &params,
- Value &response)
+static int handle_volume_replicate_range(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
uint32_t range_count = 0;
char *job = NULL;
- if( p && p->san_ops && p->san_ops->vol_rep_range ) {
+ if (p && p->san_ops && p->san_ops->vol_rep_range) {
Value v_rep = params["rep_type"];
Value v_vol_src = params["volume_src"];
Value v_vol_dest = params["volume_dest"];
Value v_ranges = params["ranges"];

- if( Value::numeric_t == v_rep.valueType() &&
+ if (Value::numeric_t == v_rep.valueType() &&
IS_CLASS_VOLUME(v_vol_src) &&
IS_CLASS_VOLUME(v_vol_dest) &&
Value::array_t == v_ranges.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_replication_type repType = (lsm_replication_type)
- v_rep.asInt32_t();
+ v_rep.asInt32_t();
lsm_volume *source = value_to_volume(v_vol_src);
lsm_volume *dest = value_to_volume(v_vol_dest);
lsm_block_range **ranges = value_to_block_range_list(v_ranges,
- &range_count);
+ &range_count);

- if( source && dest && ranges ) {
+ if (source && dest && ranges) {

- rc = p->san_ops->vol_rep_range(p, repType, source, dest, ranges,
- range_count, &job,
- LSM_FLAG_GET_VALUE(params));
+ rc = p->san_ops->vol_rep_range(p, repType, source, dest,
+ ranges, range_count, &job,
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_JOB_STARTED == rc ) {
+ if (LSM_ERR_JOB_STARTED == rc) {
response = Value(job);
free(job);
job = NULL;
@@ -903,23 +915,23 @@ static int handle_volume_replicate_range(lsm_plugin_ptr p, Value &params,
return rc;
}

-static int handle_volume_delete(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_volume_delete(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->san_ops && p->san_ops->vol_delete ) {
+ if (p && p->san_ops && p->san_ops->vol_delete) {
Value v_vol = params["volume"];

- if(IS_CLASS_VOLUME(v_vol) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (IS_CLASS_VOLUME(v_vol) && LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_volume *vol = value_to_volume(v_vol);

- if( vol ) {
+ if (vol) {
char *job = NULL;

rc = p->san_ops->vol_delete(p, vol, &job,
LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_JOB_STARTED == rc ) {
+ if (LSM_ERR_JOB_STARTED == rc) {
response = Value(job);
}

@@ -936,26 +948,25 @@ static int handle_volume_delete(lsm_plugin_ptr p, Value &params, Value &response
return rc;
}

-static int handle_vol_enable_disable( lsm_plugin_ptr p, Value &params,
- Value &response, int online)
+static int handle_vol_enable_disable(lsm_plugin_ptr p, Value & params,
+ Value & response, int online)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops &&
- ((online)? p->san_ops->vol_enable : p->san_ops->vol_disable)) {
+ if (p && p->san_ops &&
+ ((online) ? p->san_ops->vol_enable : p->san_ops->vol_disable)) {

Value v_vol = params["volume"];

- if( IS_CLASS_VOLUME(v_vol) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (IS_CLASS_VOLUME(v_vol) && LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_volume *vol = value_to_volume(v_vol);
- if( vol ) {
- if( online ) {
+ if (vol) {
+ if (online) {
rc = p->san_ops->vol_enable(p, vol,
LSM_FLAG_GET_VALUE(params));
} else {
rc = p->san_ops->vol_disable(p, vol,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));
}

lsm_volume_record_free(vol);
@@ -969,41 +980,43 @@ static int handle_vol_enable_disable( lsm_plugin_ptr p, Value &params,
return rc;
}

-static int handle_volume_enable(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_volume_enable(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
return handle_vol_enable_disable(p, params, response, 1);
}

-static int handle_volume_disable(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_volume_disable(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
return handle_vol_enable_disable(p, params, response, 0);
}

-static int handle_volume_raid_info(lsm_plugin_ptr p, Value &params,
- Value &response)
+static int handle_volume_raid_info(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->ops_v1_2 && p->ops_v1_2->vol_raid_info) {
+ if (p && p->ops_v1_2 && p->ops_v1_2->vol_raid_info) {
Value v_vol = params["volume"];

- if(IS_CLASS_VOLUME(v_vol) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (IS_CLASS_VOLUME(v_vol) && LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_volume *vol = value_to_volume(v_vol);
- std::vector<Value> result;
+ std::vector < Value > result;

- if( vol ) {
+ if (vol) {
lsm_volume_raid_type raid_type;
uint32_t strip_size;
uint32_t disk_count;
uint32_t min_io_size;
uint32_t opt_io_size;

- rc = p->ops_v1_2->vol_raid_info(
- p, vol, &raid_type, &strip_size, &disk_count,
- &min_io_size, &opt_io_size, LSM_FLAG_GET_VALUE(params));
+ rc = p->ops_v1_2->vol_raid_info(p, vol, &raid_type,
+ &strip_size, &disk_count,
+ &min_io_size, &opt_io_size,
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc ) {
- result.push_back(Value((int32_t)raid_type));
+ if (LSM_ERR_OK == rc) {
+ result.push_back(Value((int32_t) raid_type));
result.push_back(Value(strip_size));
result.push_back(Value(disk_count));
result.push_back(Value(min_io_size));
@@ -1023,33 +1036,32 @@ static int handle_volume_raid_info(lsm_plugin_ptr p, Value &params,
return rc;
}

-static int handle_pool_member_info(lsm_plugin_ptr p, Value &params,
- Value &response)
+static int handle_pool_member_info(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->ops_v1_2 && p->ops_v1_2->pool_member_info) {
+ if (p && p->ops_v1_2 && p->ops_v1_2->pool_member_info) {
Value v_pool = params["pool"];

- if(IS_CLASS_POOL(v_pool) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (IS_CLASS_POOL(v_pool) && LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_pool *pool = value_to_pool(v_pool);
- std::vector<Value> result;
+ std::vector < Value > result;

- if( pool ) {
+ if (pool) {
lsm_volume_raid_type raid_type = LSM_VOLUME_RAID_TYPE_UNKNOWN;
- lsm_pool_member_type member_type =
- LSM_POOL_MEMBER_TYPE_UNKNOWN;
+ lsm_pool_member_type member_type = LSM_POOL_MEMBER_TYPE_UNKNOWN;
lsm_string_list *member_ids = NULL;

- rc = p->ops_v1_2->pool_member_info(
- p, pool, &raid_type, &member_type,
- &member_ids, LSM_FLAG_GET_VALUE(params));
+ rc = p->ops_v1_2->pool_member_info(p, pool, &raid_type,
+ &member_type,
+ &member_ids,
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc ) {
- result.push_back(Value((int32_t)raid_type));
- result.push_back(Value((int32_t)member_type));
+ if (LSM_ERR_OK == rc) {
+ result.push_back(Value((int32_t) raid_type));
+ result.push_back(Value((int32_t) member_type));
result.push_back(string_list_to_value(member_ids));
- if ( member_ids != NULL ) {
+ if (member_ids != NULL) {
lsm_string_list_free(member_ids);
}
response = Value(result);
@@ -1067,22 +1079,22 @@ static int handle_pool_member_info(lsm_plugin_ptr p, Value &params,
return rc;
}

-static int ag_list(lsm_plugin_ptr p, Value &params, Value &response)
+static int ag_list(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
char *key = NULL;
char *val = NULL;

- if( p && p->san_ops && p->san_ops->ag_list ) {
+ if (p && p->san_ops && p->san_ops->ag_list) {

- if( LSM_FLAG_EXPECTED_TYPE(params) &&
- (rc = get_search_params(params, &key, &val)) == LSM_ERR_OK ) {
+ if (LSM_FLAG_EXPECTED_TYPE(params) &&
+ (rc = get_search_params(params, &key, &val)) == LSM_ERR_OK) {
lsm_access_group **groups = NULL;
uint32_t count;

rc = p->san_ops->ag_list(p, key, val, &groups, &count,
- LSM_FLAG_GET_VALUE(params));
- if( LSM_ERR_OK == rc ) {
+ LSM_FLAG_GET_VALUE(params));
+ if (LSM_ERR_OK == rc) {
response = access_group_list_to_value(groups, count);

/* Free the memory */
@@ -1091,7 +1103,7 @@ static int ag_list(lsm_plugin_ptr p, Value &params, Value &response)
free(key);
free(val);
} else {
- if( rc == LSM_ERR_NO_SUPPORT ) {
+ if (rc == LSM_ERR_NO_SUPPORT) {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
}
}
@@ -1099,34 +1111,32 @@ static int ag_list(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int ag_create(lsm_plugin_ptr p, Value &params, Value &response)
+static int ag_create(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->ag_create ) {
+ if (p && p->san_ops && p->san_ops->ag_create) {
Value v_name = params["name"];
Value v_init_id = params["init_id"];
Value v_init_type = params["init_type"];
Value v_system = params["system"];

- if( Value::string_t == v_name.valueType() &&
+ if (Value::string_t == v_name.valueType() &&
Value::string_t == v_init_id.valueType() &&
Value::numeric_t == v_init_type.valueType() &&
- IS_CLASS_SYSTEM(v_system) &&
- LSM_FLAG_EXPECTED_TYPE(params)) {
+ IS_CLASS_SYSTEM(v_system) && LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_access_group *ag = NULL;
lsm_system *system = value_to_system(v_system);

- if( system ) {
- rc = p->san_ops->ag_create(
- p,
- v_name.asC_str(),
- v_init_id.asC_str(),
- (lsm_access_group_init_type)v_init_type.asInt32_t(),
- system, &ag,
- LSM_FLAG_GET_VALUE(params));
- if( LSM_ERR_OK == rc ) {
+ if (system) {
+ rc = p->san_ops->ag_create(p,
+ v_name.asC_str(),
+ v_init_id.asC_str(),
+ (lsm_access_group_init_type)
+ v_init_type.asInt32_t(), system,
+ &ag, LSM_FLAG_GET_VALUE(params));
+ if (LSM_ERR_OK == rc) {
response = access_group_to_value(ag);
lsm_access_group_record_free(ag);
}
@@ -1141,19 +1151,19 @@ static int ag_create(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int ag_delete(lsm_plugin_ptr p, Value &params, Value &response)
+static int ag_delete(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->ag_delete ) {
+ if (p && p->san_ops && p->san_ops->ag_delete) {
Value v_access_group = params["access_group"];

- if( IS_CLASS_ACCESS_GROUP(v_access_group) &&
+ if (IS_CLASS_ACCESS_GROUP(v_access_group) &&
LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_access_group *ag = value_to_access_group(v_access_group);

- if( ag ) {
+ if (ag) {
rc = p->san_ops->ag_delete(p, ag, LSM_FLAG_GET_VALUE(params));
lsm_access_group_record_free(ag);
} else {
@@ -1167,34 +1177,34 @@ static int ag_delete(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int ag_initiator_add(lsm_plugin_ptr p, Value &params, Value &response)
+static int ag_initiator_add(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->ag_add_initiator ) {
+ if (p && p->san_ops && p->san_ops->ag_add_initiator) {

Value v_group = params["access_group"];
Value v_init_id = params["init_id"];
Value v_init_type = params["init_type"];


- if( IS_CLASS_ACCESS_GROUP(v_group) &&
+ if (IS_CLASS_ACCESS_GROUP(v_group) &&
Value::string_t == v_init_id.valueType() &&
Value::numeric_t == v_init_type.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_access_group *ag = value_to_access_group(v_group);
- if( ag ) {
+ if (ag) {
lsm_access_group *updated_access_group = NULL;
const char *id = v_init_id.asC_str();
lsm_access_group_init_type id_type =
(lsm_access_group_init_type) v_init_type.asInt32_t();

rc = p->san_ops->ag_add_initiator(p, ag, id, id_type,
- &updated_access_group,
- LSM_FLAG_GET_VALUE(params));
+ &updated_access_group,
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
response = access_group_to_value(updated_access_group);
lsm_access_group_record_free(updated_access_group);
}
@@ -1212,33 +1222,33 @@ static int ag_initiator_add(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int ag_initiator_del(lsm_plugin_ptr p, Value &params, Value &response)
+static int ag_initiator_del(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->ag_del_initiator ) {
+ if (p && p->san_ops && p->san_ops->ag_del_initiator) {

Value v_group = params["access_group"];
Value v_init_id = params["init_id"];
Value v_init_type = params["init_type"];

- if( IS_CLASS_ACCESS_GROUP(v_group) &&
+ if (IS_CLASS_ACCESS_GROUP(v_group) &&
Value::string_t == v_init_id.valueType() &&
Value::numeric_t == v_init_type.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_access_group *ag = value_to_access_group(v_group);

- if( ag ) {
+ if (ag) {
lsm_access_group *updated_access_group = NULL;
const char *id = v_init_id.asC_str();
lsm_access_group_init_type id_type =
(lsm_access_group_init_type) v_init_type.asInt32_t();
rc = p->san_ops->ag_del_initiator(p, ag, id, id_type,
- &updated_access_group,
- LSM_FLAG_GET_VALUE(params));
+ &updated_access_group,
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
response = access_group_to_value(updated_access_group);
lsm_access_group_record_free(updated_access_group);
}
@@ -1255,25 +1265,24 @@ static int ag_initiator_del(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int volume_mask(lsm_plugin_ptr p, Value &params, Value &response)
+static int volume_mask(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->ag_grant ) {
+ if (p && p->san_ops && p->san_ops->ag_grant) {

Value v_group = params["access_group"];
Value v_vol = params["volume"];

- if( IS_CLASS_ACCESS_GROUP(v_group) &&
- IS_CLASS_VOLUME(v_vol) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (IS_CLASS_ACCESS_GROUP(v_group) &&
+ IS_CLASS_VOLUME(v_vol) && LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_access_group *ag = value_to_access_group(v_group);
lsm_volume *vol = value_to_volume(v_vol);

- if( ag && vol ) {
+ if (ag && vol) {
rc = p->san_ops->ag_grant(p, ag, vol,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));
} else {
rc = LSM_ERR_NO_MEMORY;
}
@@ -1289,25 +1298,24 @@ static int volume_mask(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int volume_unmask(lsm_plugin_ptr p, Value &params, Value &response)
+static int volume_unmask(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->ag_revoke ) {
+ if (p && p->san_ops && p->san_ops->ag_revoke) {

Value v_group = params["access_group"];
Value v_vol = params["volume"];

- if( IS_CLASS_ACCESS_GROUP(v_group) &&
- IS_CLASS_VOLUME(v_vol) &&
- LSM_FLAG_EXPECTED_TYPE(params)) {
+ if (IS_CLASS_ACCESS_GROUP(v_group) &&
+ IS_CLASS_VOLUME(v_vol) && LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_access_group *ag = value_to_access_group(v_group);
lsm_volume *vol = value_to_volume(v_vol);

- if( ag && vol ) {
+ if (ag && vol) {
rc = p->san_ops->ag_revoke(p, ag, vol,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));
} else {
rc = LSM_ERR_NO_MEMORY;
}
@@ -1323,29 +1331,31 @@ static int volume_unmask(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int vol_accessible_by_ag(lsm_plugin_ptr p, Value &params, Value &response)
+static int vol_accessible_by_ag(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->vol_accessible_by_ag ) {
+ if (p && p->san_ops && p->san_ops->vol_accessible_by_ag) {
Value v_access_group = params["access_group"];

- if( IS_CLASS_ACCESS_GROUP(v_access_group) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (IS_CLASS_ACCESS_GROUP(v_access_group) &&
+ LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_access_group *ag = value_to_access_group(v_access_group);

- if( ag ) {
+ if (ag) {
lsm_volume **vols = NULL;
uint32_t count = 0;

rc = p->san_ops->vol_accessible_by_ag(p, ag, &vols, &count,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE
+ (params));

- if( LSM_ERR_OK == rc ) {
- std::vector<Value> result;
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;
result.reserve(count);

- for( uint32_t i = 0; i < count; ++i ) {
+ for (uint32_t i = 0; i < count; ++i) {
result.push_back(volume_to_value(vols[i]));
}
response = Value(result);
@@ -1365,30 +1375,31 @@ static int vol_accessible_by_ag(lsm_plugin_ptr p, Value &params, Value &response
return rc;
}

-static int ag_granted_to_volume(lsm_plugin_ptr p, Value &params, Value &response)
+static int ag_granted_to_volume(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->ag_granted_to_vol ) {
+ if (p && p->san_ops && p->san_ops->ag_granted_to_vol) {

Value v_vol = params["volume"];

- if( IS_CLASS_VOLUME(v_vol) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (IS_CLASS_VOLUME(v_vol) && LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_volume *volume = value_to_volume(v_vol);

- if( volume ) {
+ if (volume) {
lsm_access_group **groups = NULL;
uint32_t count = 0;

- rc = p->san_ops->ag_granted_to_vol(p, volume, &groups, &count,
- LSM_FLAG_GET_VALUE(params));
+ rc = p->san_ops->ag_granted_to_vol(p, volume, &groups,
+ &count,
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc ) {
- std::vector<Value> result;
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;
result.reserve(count);

- for( uint32_t i = 0; i < count; ++i ) {
+ for (uint32_t i = 0; i < count; ++i) {
result.push_back(access_group_to_value(groups[i]));
}
response = Value(result);
@@ -1407,26 +1418,25 @@ static int ag_granted_to_volume(lsm_plugin_ptr p, Value &params, Value &response
return rc;
}

-static int volume_dependency(lsm_plugin_ptr p, Value &params, Value &response)
+static int volume_dependency(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->vol_child_depends ) {
+ if (p && p->san_ops && p->san_ops->vol_child_depends) {

Value v_vol = params["volume"];

- if( IS_CLASS_VOLUME(v_vol) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (IS_CLASS_VOLUME(v_vol) && LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_volume *volume = value_to_volume(v_vol);

- if( volume ) {
+ if (volume) {
uint8_t yes;

rc = p->san_ops->vol_child_depends(p, volume, &yes,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc ) {
- response = Value((bool)(yes));
+ if (LSM_ERR_OK == rc) {
+ response = Value((bool) (yes));
}

lsm_volume_record_free(volume);
@@ -1442,26 +1452,27 @@ static int volume_dependency(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int volume_dependency_rm(lsm_plugin_ptr p, Value &params, Value &response)
+static int volume_dependency_rm(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->vol_child_depends_rm ) {
+ if (p && p->san_ops && p->san_ops->vol_child_depends_rm) {

Value v_vol = params["volume"];

- if( IS_CLASS_VOLUME(v_vol) &&
- LSM_FLAG_EXPECTED_TYPE(params)) {
+ if (IS_CLASS_VOLUME(v_vol) && LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_volume *volume = value_to_volume(v_vol);

- if( volume ) {
+ if (volume) {

char *job = NULL;

rc = p->san_ops->vol_child_depends_rm(p, volume, &job,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE
+ (params));

- if( LSM_ERR_JOB_STARTED == rc ) {
+ if (LSM_ERR_JOB_STARTED == rc) {
response = Value(job);
free(job);
}
@@ -1478,27 +1489,27 @@ static int volume_dependency_rm(lsm_plugin_ptr p, Value &params, Value &response
return rc;
}

-static int fs(lsm_plugin_ptr p, Value &params, Value &response)
+static int fs(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
char *key = NULL;
char *val = NULL;

- if( p && p->fs_ops && p->fs_ops->fs_list ) {
- if( LSM_FLAG_EXPECTED_TYPE(params) &&
- ((rc = get_search_params(params, &key, &val)) == LSM_ERR_OK )) {
+ if (p && p->fs_ops && p->fs_ops->fs_list) {
+ if (LSM_FLAG_EXPECTED_TYPE(params) &&
+ ((rc = get_search_params(params, &key, &val)) == LSM_ERR_OK)) {

lsm_fs **fs = NULL;
uint32_t count = 0;

rc = p->fs_ops->fs_list(p, key, val, &fs, &count,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc ) {
- std::vector<Value> result;
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;
result.reserve(count);

- for( uint32_t i = 0; i < count; ++i ) {
+ for (uint32_t i = 0; i < count; ++i) {
result.push_back(fs_to_value(fs[i]));
}

@@ -1509,7 +1520,7 @@ static int fs(lsm_plugin_ptr p, Value &params, Value &response)
free(key);
free(val);
} else {
- if( rc == LSM_ERR_NO_SUPPORT ) {
+ if (rc == LSM_ERR_NO_SUPPORT) {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
}
}
@@ -1517,40 +1528,40 @@ static int fs(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int fs_create(lsm_plugin_ptr p, Value &params, Value &response)
+static int fs_create(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->fs_ops && p->fs_ops->fs_create ) {
+ if (p && p->fs_ops && p->fs_ops->fs_create) {

Value v_pool = params["pool"];
Value v_name = params["name"];
Value v_size = params["size_bytes"];

- if( IS_CLASS_POOL(v_pool) &&
+ if (IS_CLASS_POOL(v_pool) &&
Value::string_t == v_name.valueType() &&
Value::numeric_t == v_size.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_pool *pool = value_to_pool(v_pool);

- if( pool ) {
+ if (pool) {
const char *name = params["name"].asC_str();
uint64_t size_bytes = params["size_bytes"].asUint64_t();
lsm_fs *fs = NULL;
char *job = NULL;

- rc = p->fs_ops->fs_create(p, pool, name, size_bytes, &fs, &job,
- LSM_FLAG_GET_VALUE(params));
+ rc = p->fs_ops->fs_create(p, pool, name, size_bytes, &fs,
+ &job, LSM_FLAG_GET_VALUE(params));

- std::vector<Value> r;
+ std::vector < Value > r;

- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
r.push_back(Value());
r.push_back(fs_to_value(fs));
response = Value(r);
lsm_fs_record_free(fs);
- } else if (LSM_ERR_JOB_STARTED == rc ) {
+ } else if (LSM_ERR_JOB_STARTED == rc) {
r.push_back(Value(job));
r.push_back(Value());
response = Value(r);
@@ -1569,25 +1580,25 @@ static int fs_create(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int fs_delete(lsm_plugin_ptr p, Value &params, Value &response)
+static int fs_delete(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->fs_ops && p->fs_ops->fs_delete ) {
+ if (p && p->fs_ops && p->fs_ops->fs_delete) {

Value v_fs = params["fs"];

- if( IS_CLASS_FILE_SYSTEM(v_fs) && LSM_FLAG_EXPECTED_TYPE(params)) {
+ if (IS_CLASS_FILE_SYSTEM(v_fs) && LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_fs *fs = value_to_fs(v_fs);

- if( fs ) {
+ if (fs) {
char *job = NULL;

rc = p->fs_ops->fs_delete(p, fs, &job,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_JOB_STARTED == rc ) {
+ if (LSM_ERR_JOB_STARTED == rc) {
response = Value(job);
free(job);
}
@@ -1603,37 +1614,37 @@ static int fs_delete(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int fs_resize(lsm_plugin_ptr p, Value &params, Value &response)
+static int fs_resize(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->fs_ops && p->fs_ops->fs_resize ) {
+ if (p && p->fs_ops && p->fs_ops->fs_resize) {

Value v_fs = params["fs"];
Value v_size = params["new_size_bytes"];

- if( IS_CLASS_FILE_SYSTEM(v_fs) &&
+ if (IS_CLASS_FILE_SYSTEM(v_fs) &&
Value::numeric_t == v_size.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_fs *fs = value_to_fs(v_fs);

- if( fs ) {
+ if (fs) {
uint64_t size_bytes = v_size.asUint64_t();
lsm_fs *rfs = NULL;
char *job = NULL;

rc = p->fs_ops->fs_resize(p, fs, size_bytes, &rfs, &job,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

- std::vector<Value> r;
+ std::vector < Value > r;

- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
r.push_back(Value());
r.push_back(fs_to_value(rfs));
response = Value(r);
lsm_fs_record_free(rfs);
- } else if (LSM_ERR_JOB_STARTED == rc ) {
+ } else if (LSM_ERR_JOB_STARTED == rc) {
r.push_back(Value(job));
r.push_back(Value());
response = Value(r);
@@ -1651,43 +1662,43 @@ static int fs_resize(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int fs_clone(lsm_plugin_ptr p, Value &params, Value &response)
+static int fs_clone(lsm_plugin_ptr p, Value & params, Value & response)
{
- int rc = LSM_ERR_NO_SUPPORT;
+ int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->fs_ops && p->fs_ops->fs_clone ) {
+ if (p && p->fs_ops && p->fs_ops->fs_clone) {

Value v_src_fs = params["src_fs"];
Value v_name = params["dest_fs_name"];
- Value v_ss = params["snapshot"]; /* This is optional */
+ Value v_ss = params["snapshot"]; /* This is optional */

- if( IS_CLASS_FILE_SYSTEM(v_src_fs) &&
+ if (IS_CLASS_FILE_SYSTEM(v_src_fs) &&
Value::string_t == v_name.valueType() &&
(Value::null_t == v_ss.valueType() ||
- Value::object_t == v_ss.valueType()) &&
+ Value::object_t == v_ss.valueType()) &&
LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_fs *clonedFs = NULL;
char *job = NULL;
lsm_fs *fs = value_to_fs(v_src_fs);
- const char* name = v_name.asC_str();
- lsm_fs_ss *ss = (Value::null_t == v_ss.valueType()) ?
- NULL : value_to_ss(v_ss);
+ const char *name = v_name.asC_str();
+ lsm_fs_ss *ss = (Value::null_t == v_ss.valueType())?
+ NULL : value_to_ss(v_ss);

- if( fs &&
- (( ss && v_ss.valueType() == Value::object_t) ||
- (!ss && v_ss.valueType() == Value::null_t) )) {
+ if (fs &&
+ ((ss && v_ss.valueType() == Value::object_t) ||
+ (!ss && v_ss.valueType() == Value::null_t))) {

rc = p->fs_ops->fs_clone(p, fs, name, &clonedFs, ss, &job,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

- std::vector<Value> r;
- if( LSM_ERR_OK == rc ) {
+ std::vector < Value > r;
+ if (LSM_ERR_OK == rc) {
r.push_back(Value());
r.push_back(fs_to_value(clonedFs));
response = Value(r);
lsm_fs_record_free(clonedFs);
- } else if (LSM_ERR_JOB_STARTED == rc ) {
+ } else if (LSM_ERR_JOB_STARTED == rc) {
r.push_back(Value(job));
r.push_back(Value());
response = Value(r);
@@ -1705,35 +1716,35 @@ static int fs_clone(lsm_plugin_ptr p, Value &params, Value &response)
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
}
}
- return rc;
+ return rc;
}

-static int fs_file_clone(lsm_plugin_ptr p, Value &params, Value &response)
+static int fs_file_clone(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_OK;

- if( p && p->fs_ops && p->fs_ops->fs_file_clone ) {
+ if (p && p->fs_ops && p->fs_ops->fs_file_clone) {

Value v_fs = params["fs"];
Value v_src_name = params["src_file_name"];
Value v_dest_name = params["dest_file_name"];
Value v_ss = params["snapshot"]; /* This is optional */

- if( IS_CLASS_FILE_SYSTEM(v_fs) &&
+ if (IS_CLASS_FILE_SYSTEM(v_fs) &&
Value::string_t == v_src_name.valueType() &&
Value::string_t == v_dest_name.valueType() &&
(Value::null_t == v_ss.valueType() ||
- Value::object_t == v_ss.valueType()) &&
+ Value::object_t == v_ss.valueType()) &&
LSM_FLAG_EXPECTED_TYPE(params)) {


lsm_fs *fs = value_to_fs(v_fs);
- lsm_fs_ss *ss = (Value::null_t == v_ss.valueType()) ?
- NULL : value_to_ss(v_ss);
+ lsm_fs_ss *ss = (Value::null_t == v_ss.valueType())?
+ NULL : value_to_ss(v_ss);

- if( fs &&
- (( ss && v_ss.valueType() == Value::object_t) ||
- (!ss && v_ss.valueType() == Value::null_t) )) {
+ if (fs &&
+ ((ss && v_ss.valueType() == Value::object_t) ||
+ (!ss && v_ss.valueType() == Value::null_t))) {

const char *src = v_src_name.asC_str();
const char *dest = v_dest_name.asC_str();
@@ -1741,9 +1752,9 @@ static int fs_file_clone(lsm_plugin_ptr p, Value &params, Value &response)
char *job = NULL;

rc = p->fs_ops->fs_file_clone(p, fs, src, dest, ss, &job,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_JOB_STARTED == rc ) {
+ if (LSM_ERR_JOB_STARTED == rc) {
response = Value(job);
free(job);
}
@@ -1762,31 +1773,33 @@ static int fs_file_clone(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int fs_child_dependency(lsm_plugin_ptr p, Value &params, Value &response)
+static int fs_child_dependency(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->fs_ops && p->fs_ops->fs_child_dependency ) {
+ if (p && p->fs_ops && p->fs_ops->fs_child_dependency) {

Value v_fs = params["fs"];
Value v_files = params["files"];

- if( IS_CLASS_FILE_SYSTEM(v_fs) &&
+ if (IS_CLASS_FILE_SYSTEM(v_fs) &&
(Value::array_t == v_files.valueType() ||
Value::null_t == v_files.valueType()) &&
- LSM_FLAG_EXPECTED_TYPE(params)) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_fs *fs = value_to_fs(v_fs);
- lsm_string_list *files = (Value::null_t == v_files.valueType()) ?
- NULL : value_to_string_list(v_files);
+ lsm_string_list *files =
+ (Value::null_t ==
+ v_files.valueType())? NULL : value_to_string_list(v_files);

- if( fs && ( files ||
- (!files && Value::null_t == v_files.valueType()) )) {
+ if (fs && (files ||
+ (!files && Value::null_t == v_files.valueType()))) {
uint8_t yes = 0;

rc = p->fs_ops->fs_child_dependency(p, fs, files, &yes);

- if( LSM_ERR_OK == rc ) {
- response = Value((bool)yes);
+ if (LSM_ERR_OK == rc) {
+ response = Value((bool) yes);
}
} else {
rc = LSM_ERR_NO_MEMORY;
@@ -1802,31 +1815,34 @@ static int fs_child_dependency(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int fs_child_dependency_rm(lsm_plugin_ptr p, Value &params, Value &response)
+static int fs_child_dependency_rm(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->fs_ops && p->fs_ops->fs_child_dependency_rm ) {
+ if (p && p->fs_ops && p->fs_ops->fs_child_dependency_rm) {

Value v_fs = params["fs"];
Value v_files = params["files"];

- if( IS_CLASS_FILE_SYSTEM(v_fs) &&
+ if (IS_CLASS_FILE_SYSTEM(v_fs) &&
(Value::array_t == v_files.valueType() ||
Value::null_t == v_files.valueType()) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_fs *fs = value_to_fs(v_fs);
- lsm_string_list *files = (Value::null_t == v_files.valueType()) ?
- NULL: value_to_string_list(v_files);
+ lsm_string_list *files =
+ (Value::null_t ==
+ v_files.valueType())? NULL : value_to_string_list(v_files);

- if( fs &&
- (files || (!files && Value::null_t == v_files.valueType())) ) {
+ if (fs &&
+ (files || (!files && Value::null_t == v_files.valueType()))) {
char *job = NULL;

rc = p->fs_ops->fs_child_dependency_rm(p, fs, files, &job,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE
+ (params));

- if( LSM_ERR_JOB_STARTED == rc ) {
+ if (LSM_ERR_JOB_STARTED == rc) {
response = Value(job);
free(job);
}
@@ -1843,30 +1859,29 @@ static int fs_child_dependency_rm(lsm_plugin_ptr p, Value &params, Value &respon
return rc;
}

-static int ss_list(lsm_plugin_ptr p, Value &params, Value &response)
+static int ss_list(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->fs_ops && p->fs_ops->fs_ss_list ) {
+ if (p && p->fs_ops && p->fs_ops->fs_ss_list) {

Value v_fs = params["fs"];

- if( IS_CLASS_FILE_SYSTEM(v_fs) &&
- LSM_FLAG_EXPECTED_TYPE(params)) {
+ if (IS_CLASS_FILE_SYSTEM(v_fs) && LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_fs *fs = value_to_fs(v_fs);

- if( fs ) {
+ if (fs) {
lsm_fs_ss **ss = NULL;
uint32_t count = 0;

rc = p->fs_ops->fs_ss_list(p, fs, &ss, &count,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc ) {
- std::vector<Value> result;
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;
result.reserve(count);

- for( uint32_t i = 0; i < count; ++i ) {
+ for (uint32_t i = 0; i < count; ++i) {
result.push_back(ss_to_value(ss[i]));
}
response = Value(result);
@@ -1885,35 +1900,35 @@ static int ss_list(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int ss_create(lsm_plugin_ptr p, Value &params, Value &response)
+static int ss_create(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->fs_ops && p->fs_ops->fs_ss_create ) {
+ if (p && p->fs_ops && p->fs_ops->fs_ss_create) {

Value v_fs = params["fs"];
Value v_ss_name = params["snapshot_name"];

- if( IS_CLASS_FILE_SYSTEM(v_fs) &&
+ if (IS_CLASS_FILE_SYSTEM(v_fs) &&
Value::string_t == v_ss_name.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_fs *fs = value_to_fs(v_fs);

- if( fs ) {
+ if (fs) {
lsm_fs_ss *ss = NULL;
char *job = NULL;

const char *name = v_ss_name.asC_str();

rc = p->fs_ops->fs_ss_create(p, fs, name, &ss, &job,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

- std::vector<Value> r;
- if( LSM_ERR_OK == rc ) {
+ std::vector < Value > r;
+ if (LSM_ERR_OK == rc) {
r.push_back(Value());
r.push_back(ss_to_value(ss));
response = Value(r);
lsm_fs_ss_record_free(ss);
- } else if (LSM_ERR_JOB_STARTED == rc ) {
+ } else if (LSM_ERR_JOB_STARTED == rc) {
r.push_back(Value(job));
r.push_back(Value());
response = Value(r);
@@ -1933,27 +1948,26 @@ static int ss_create(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int ss_delete(lsm_plugin_ptr p, Value &params, Value &response)
+static int ss_delete(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->fs_ops && p->fs_ops->fs_ss_delete ) {
+ if (p && p->fs_ops && p->fs_ops->fs_ss_delete) {

Value v_fs = params["fs"];
Value v_ss = params["snapshot"];

- if( IS_CLASS_FILE_SYSTEM(v_fs) &&
- IS_CLASS_FS_SNAPSHOT(v_ss) &&
- LSM_FLAG_EXPECTED_TYPE(params)) {
+ if (IS_CLASS_FILE_SYSTEM(v_fs) &&
+ IS_CLASS_FS_SNAPSHOT(v_ss) && LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_fs *fs = value_to_fs(v_fs);
lsm_fs_ss *ss = value_to_ss(v_ss);

- if( fs && ss ) {
+ if (fs && ss) {
char *job = NULL;
rc = p->fs_ops->fs_ss_delete(p, fs, ss, &job,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_JOB_STARTED == rc ) {
+ if (LSM_ERR_JOB_STARTED == rc) {
response = Value(job);
free(job);
}
@@ -1970,10 +1984,10 @@ static int ss_delete(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int ss_restore(lsm_plugin_ptr p, Value &params, Value &response)
+static int ss_restore(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->fs_ops && p->fs_ops->fs_ss_restore ) {
+ if (p && p->fs_ops && p->fs_ops->fs_ss_restore) {

Value v_fs = params["fs"];
Value v_ss = params["snapshot"];
@@ -1981,34 +1995,37 @@ static int ss_restore(lsm_plugin_ptr p, Value &params, Value &response)
Value v_restore_files = params["restore_files"];
Value v_all_files = params["all_files"];

- if( IS_CLASS_FILE_SYSTEM(v_fs) &&
+ if (IS_CLASS_FILE_SYSTEM(v_fs) &&
IS_CLASS_FS_SNAPSHOT(v_ss) &&
(Value::array_t == v_files.valueType() ||
- Value::null_t == v_files.valueType() ) &&
+ Value::null_t == v_files.valueType()) &&
(Value::array_t == v_restore_files.valueType() ||
- Value::null_t == v_restore_files.valueType()) &&
+ Value::null_t == v_restore_files.valueType()) &&
Value::boolean_t == v_all_files.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

char *job = NULL;
lsm_fs *fs = value_to_fs(v_fs);
lsm_fs_ss *ss = value_to_ss(v_ss);
- lsm_string_list *files = (Value::null_t == v_files.valueType()) ?
- NULL : value_to_string_list(v_files);
- lsm_string_list *restore_files = (Value::null_t ==
- v_restore_files.valueType()) ?
- NULL : value_to_string_list(v_restore_files);
- int all_files = (v_all_files.asBool()) ? 1 : 0;
-
- if( fs && ss &&
- (files || (!files && Value::null_t == v_files.valueType())) &&
- (restore_files || (!restore_files &&
- Value::null_t == v_restore_files.valueType())) ) {
- rc = p->fs_ops->fs_ss_restore(p, fs, ss, files, restore_files,
- all_files, &job,
- LSM_FLAG_GET_VALUE(params));
-
- if( LSM_ERR_JOB_STARTED == rc ) {
+ lsm_string_list *files =
+ (Value::null_t ==
+ v_files.valueType())? NULL : value_to_string_list(v_files);
+ lsm_string_list *restore_files =
+ (Value::null_t ==
+ v_restore_files.valueType())? NULL :
+ value_to_string_list(v_restore_files);
+ int all_files = (v_all_files.asBool())? 1 : 0;
+
+ if (fs && ss &&
+ (files || (!files && Value::null_t == v_files.valueType()))
+ && (restore_files
+ || (!restore_files
+ && Value::null_t == v_restore_files.valueType()))) {
+ rc = p->fs_ops->fs_ss_restore(p, fs, ss, files,
+ restore_files, all_files,
+ &job, LSM_FLAG_GET_VALUE(params));
+
+ if (LSM_ERR_JOB_STARTED == rc) {
response = Value(job);
free(job);
}
@@ -2027,17 +2044,17 @@ static int ss_restore(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int export_auth(lsm_plugin_ptr p, Value &params, Value &response)
+static int export_auth(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->nas_ops && p->nas_ops->nfs_auth_types ) {
+ if (p && p->nas_ops && p->nas_ops->nfs_auth_types) {
lsm_string_list *types = NULL;

- if( LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (LSM_FLAG_EXPECTED_TYPE(params)) {

rc = p->nas_ops->nfs_auth_types(p, &types,
- LSM_FLAG_GET_VALUE(params));
- if( LSM_ERR_OK == rc ) {
+ LSM_FLAG_GET_VALUE(params));
+ if (LSM_ERR_OK == rc) {
response = string_list_to_value(types);
lsm_string_list_free(types);
}
@@ -2049,26 +2066,26 @@ static int export_auth(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int exports(lsm_plugin_ptr p, Value &params, Value &response)
+static int exports(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
char *key = NULL;
char *val = NULL;

- if( p && p->nas_ops && p->nas_ops->nfs_list ) {
+ if (p && p->nas_ops && p->nas_ops->nfs_list) {
lsm_nfs_export **exports = NULL;
uint32_t count = 0;

- if( LSM_FLAG_EXPECTED_TYPE(params) &&
- (rc = get_search_params(params, &key, &val)) == LSM_ERR_OK ) {
+ if (LSM_FLAG_EXPECTED_TYPE(params) &&
+ (rc = get_search_params(params, &key, &val)) == LSM_ERR_OK) {
rc = p->nas_ops->nfs_list(p, key, val, &exports, &count,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc ) {
- std::vector<Value> result;
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;
result.reserve(count);

- for( uint32_t i = 0; i < count; ++i ) {
+ for (uint32_t i = 0; i < count; ++i) {
result.push_back(nfs_export_to_value(exports[i]));
}
response = Value(result);
@@ -2080,7 +2097,7 @@ static int exports(lsm_plugin_ptr p, Value &params, Value &response)
free(key);
free(val);
} else {
- if( rc == LSM_ERR_NO_SUPPORT ) {
+ if (rc == LSM_ERR_NO_SUPPORT) {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
}
}
@@ -2089,20 +2106,20 @@ static int exports(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int64_t get_uid_gid(Value &id)
+static int64_t get_uid_gid(Value & id)
{
- if( Value::null_t == id.valueType() ) {
+ if (Value::null_t == id.valueType()) {
return ANON_UID_GID_NA;
} else {
return id.asInt64_t();
}
}

-static int export_fs(lsm_plugin_ptr p, Value &params, Value &response)
+static int export_fs(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->nas_ops && p->nas_ops->nfs_export ) {
+ if (p && p->nas_ops && p->nas_ops->nfs_export) {

Value v_fs_id = params["fs_id"];
Value v_export_path = params["export_path"];
@@ -2114,25 +2131,25 @@ static int export_fs(lsm_plugin_ptr p, Value &params, Value &response)
Value v_anon_uid = params["anon_uid"];
Value v_anon_gid = params["anon_gid"];

- if( Value::string_t == v_fs_id.valueType() &&
+ if (Value::string_t == v_fs_id.valueType() &&
(Value::string_t == v_export_path.valueType() ||
- Value::null_t == v_export_path.valueType()) &&
+ Value::null_t == v_export_path.valueType()) &&
Value::array_t == v_root_list.valueType() &&
Value::array_t == v_rw_list.valueType() &&
Value::array_t == v_ro_list.valueType() &&
(Value::string_t == v_auth_type.valueType() ||
- Value::null_t == v_auth_type.valueType()) &&
+ Value::null_t == v_auth_type.valueType()) &&
(Value::string_t == v_options.valueType() ||
- Value::null_t == v_options.valueType()) &&
+ Value::null_t == v_options.valueType()) &&
Value::numeric_t == v_anon_uid.valueType() &&
Value::numeric_t == v_anon_gid.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_string_list *root_list = value_to_string_list(v_root_list);
lsm_string_list *rw_list = value_to_string_list(v_rw_list);
lsm_string_list *ro_list = value_to_string_list(v_ro_list);

- if( root_list && rw_list && ro_list ) {
+ if (root_list && rw_list && ro_list) {
const char *fs_id = v_fs_id.asC_str();
const char *export_path = v_export_path.asC_str();
const char *auth_type = v_auth_type.asC_str();
@@ -2142,12 +2159,12 @@ static int export_fs(lsm_plugin_ptr p, Value &params, Value &response)
int64_t anon_uid = get_uid_gid(v_anon_uid);
int64_t anon_gid = get_uid_gid(v_anon_gid);

- rc = p->nas_ops->nfs_export(p, fs_id, export_path, root_list,
- rw_list, ro_list, anon_uid,
- anon_gid, auth_type, options,
- &exported,
+ rc = p->nas_ops->nfs_export(p, fs_id, export_path,
+ root_list, rw_list, ro_list,
+ anon_uid, anon_gid, auth_type,
+ options, &exported,
LSM_FLAG_GET_VALUE(params));
- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
response = nfs_export_to_value(exported);
lsm_nfs_export_record_free(exported);
}
@@ -2167,20 +2184,19 @@ static int export_fs(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int export_remove(lsm_plugin_ptr p, Value &params, Value &response)
+static int export_remove(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->nas_ops && p->nas_ops->nfs_export_remove ) {
+ if (p && p->nas_ops && p->nas_ops->nfs_export_remove) {
Value v_export = params["export"];

- if( IS_CLASS_FS_EXPORT(v_export) &&
- LSM_FLAG_EXPECTED_TYPE(params)) {
+ if (IS_CLASS_FS_EXPORT(v_export) && LSM_FLAG_EXPECTED_TYPE(params)) {
lsm_nfs_export *exp = value_to_nfs_export(v_export);

- if( exp ) {
+ if (exp) {
rc = p->nas_ops->nfs_export_remove(p, exp,
- LSM_FLAG_GET_VALUE(params));
+ LSM_FLAG_GET_VALUE(params));
lsm_nfs_export_record_free(exp);
exp = NULL;
} else {
@@ -2193,34 +2209,34 @@ static int export_remove(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int iscsi_chap(lsm_plugin_ptr p, Value &params, Value &response)
+static int iscsi_chap(lsm_plugin_ptr p, Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;

- if( p && p->san_ops && p->san_ops->iscsi_chap_auth ) {
+ if (p && p->san_ops && p->san_ops->iscsi_chap_auth) {
Value v_init = params["init_id"];
Value v_in_user = params["in_user"];
Value v_in_password = params["in_password"];
Value v_out_user = params["out_user"];
Value v_out_password = params["out_password"];

- if( Value::string_t == v_init.valueType() &&
+ if (Value::string_t == v_init.valueType() &&
(Value::string_t == v_in_user.valueType() ||
- Value::null_t == v_in_user.valueType()) &&
+ Value::null_t == v_in_user.valueType()) &&
(Value::string_t == v_in_password.valueType() ||
- Value::null_t == v_in_password.valueType()) &&
+ Value::null_t == v_in_password.valueType()) &&
(Value::string_t == v_out_user.valueType() ||
- Value::null_t == v_out_user.valueType()) &&
+ Value::null_t == v_out_user.valueType()) &&
(Value::string_t == v_out_password.valueType() ||
- Value::null_t == v_out_password.valueType()) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ Value::null_t == v_out_password.valueType()) &&
+ LSM_FLAG_EXPECTED_TYPE(params)) {

rc = p->san_ops->iscsi_chap_auth(p, v_init.asC_str(),
- v_in_user.asC_str(),
- v_in_password.asC_str(),
- v_out_user.asC_str(),
- v_out_password.asC_str(),
- LSM_FLAG_GET_VALUE(params));
+ v_in_user.asC_str(),
+ v_in_password.asC_str(),
+ v_out_user.asC_str(),
+ v_out_password.asC_str(),
+ LSM_FLAG_GET_VALUE(params));

} else {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
@@ -2228,15 +2244,15 @@ static int iscsi_chap(lsm_plugin_ptr p, Value &params, Value &response)
}
return rc;
}
-static int handle_volume_raid_create_cap_get(
- lsm_plugin_ptr p, Value &params, Value &response)
+
+static int handle_volume_raid_create_cap_get(lsm_plugin_ptr p,
+ Value & params, Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->ops_v1_2 && p->ops_v1_2->vol_create_raid_cap_get ) {
+ if (p && p->ops_v1_2 && p->ops_v1_2->vol_create_raid_cap_get) {
Value v_system = params["system"];

- if( IS_CLASS_SYSTEM(v_system) &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ if (IS_CLASS_SYSTEM(v_system) && LSM_FLAG_EXPECTED_TYPE(params)) {

uint32_t *supported_raid_types = NULL;
uint32_t supported_raid_type_count = 0;
@@ -2246,21 +2262,21 @@ static int handle_volume_raid_create_cap_get(

lsm_system *sys = value_to_system(v_system);

- if( sys ) {
-
- rc = p->ops_v1_2->vol_create_raid_cap_get(
- p, sys, &supported_raid_types, &supported_raid_type_count,
- &supported_strip_sizes, &supported_strip_size_count,
- LSM_FLAG_GET_VALUE(params));
-
- if( LSM_ERR_OK == rc ) {
- std::vector<Value> result;
- result.push_back(
- uint32_array_to_value(
- supported_raid_types, supported_raid_type_count));
- result.push_back(
- uint32_array_to_value(
- supported_strip_sizes, supported_strip_size_count));
+ if (sys) {
+
+ rc = p->ops_v1_2->vol_create_raid_cap_get
+ (p, sys, &supported_raid_types, &supported_raid_type_count,
+ &supported_strip_sizes, &supported_strip_size_count,
+ LSM_FLAG_GET_VALUE (params));
+
+ if (LSM_ERR_OK == rc) {
+ std::vector < Value > result;
+ result.push_back(uint32_array_to_value
+ (supported_raid_types,
+ supported_raid_type_count));
+ result.push_back(uint32_array_to_value
+ (supported_strip_sizes,
+ supported_strip_size_count));
response = Value(result);
free(supported_raid_types);
free(supported_strip_sizes);
@@ -2278,26 +2294,26 @@ static int handle_volume_raid_create_cap_get(
return rc;
}

-static int handle_volume_raid_create(
- lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_volume_raid_create(lsm_plugin_ptr p, Value & params,
+ Value & response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->ops_v1_2 && p->ops_v1_2->vol_create_raid ) {
+ if (p && p->ops_v1_2 && p->ops_v1_2->vol_create_raid) {
Value v_name = params["name"];
Value v_raid_type = params["raid_type"];
Value v_strip_size = params["strip_size"];
Value v_disks = params["disks"];

- if( Value::string_t == v_name.valueType() &&
+ if (Value::string_t == v_name.valueType() &&
Value::numeric_t == v_raid_type.valueType() &&
Value::numeric_t == v_strip_size.valueType() &&
Value::array_t == v_disks.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params) ) {
+ LSM_FLAG_EXPECTED_TYPE(params)) {

lsm_disk **disks = NULL;
uint32_t disk_count = 0;
rc = value_array_to_disks(v_disks, &disks, &disk_count);
- if( LSM_ERR_OK != rc ) {
+ if (LSM_ERR_OK != rc) {
return rc;
}

@@ -2308,11 +2324,12 @@ static int handle_volume_raid_create(

lsm_volume *new_vol = NULL;

- rc = p->ops_v1_2->vol_create_raid(
- p, name, raid_type, disks, disk_count, strip_size,
- &new_vol, LSM_FLAG_GET_VALUE(params));
+ rc = p->ops_v1_2->vol_create_raid(p, name, raid_type, disks,
+ disk_count, strip_size,
+ &new_vol,
+ LSM_FLAG_GET_VALUE(params));

- if( LSM_ERR_OK == rc ) {
+ if (LSM_ERR_OK == rc) {
response = volume_to_value(new_vol);
lsm_volume_record_free(new_vol);
}
@@ -2329,8 +2346,9 @@ static int handle_volume_raid_create(
/**
* map of function pointers
*/
-static std::map<std::string,handler> dispatch = static_map<std::string,handler>
- ("access_group_initiator_add", ag_initiator_add)
+static std::map < std::string, handler > dispatch =
+ static_map < std::string, handler > ("access_group_initiator_add",
+ ag_initiator_add)
("access_group_create", ag_create)
("access_group_delete", ag_delete)
("access_group_initiator_delete", ag_initiator_del)
@@ -2374,7 +2392,8 @@ static std::map<std::string,handler> dispatch = static_map<std::string,handler>
("volume_disable", handle_volume_disable)
("volume_enable", handle_volume_enable)
("volume_replicate", handle_volume_replicate)
- ("volume_replicate_range_block_size", handle_volume_replicate_range_block_size)
+ ("volume_replicate_range_block_size",
+ handle_volume_replicate_range_block_size)
("volume_replicate_range", handle_volume_replicate_range)
("volume_resize", handle_volume_resize)
("volumes_accessible_by_access_group", vol_accessible_by_ag)
@@ -2384,15 +2403,15 @@ static std::map<std::string,handler> dispatch = static_map<std::string,handler>
("volume_raid_create", handle_volume_raid_create)
("volume_raid_create_cap_get", handle_volume_raid_create_cap_get);

-static int process_request(lsm_plugin_ptr p, const std::string &method, Value &request,
- Value &response)
+static int process_request(lsm_plugin_ptr p, const std::string & method,
+ Value & request, Value & response)
{
int rc = LSM_ERR_LIB_BUG;

- response = Value(); //Default response will be null
+ response = Value(); //Default response will be null

- if( dispatch.find(method) != dispatch.end() ) {
- rc = (dispatch[method])(p, request["params"], response);
+ if (dispatch.find(method) != dispatch.end()) {
+ rc = (dispatch[method]) (p, request["params"], response);
} else {
rc = LSM_ERR_NO_SUPPORT;
}
@@ -2405,49 +2424,55 @@ static int lsm_plugin_run(lsm_plugin_ptr p)
int rc = 0;
lsm_flag flags = 0;

- if( LSM_IS_PLUGIN(p) ) {
- while(true) {
+ if (LSM_IS_PLUGIN(p)) {
+ while (true) {
try {

- if( !LSM_IS_PLUGIN(p) ) {
- syslog(LOG_USER|LOG_NOTICE, "Someone stepped on "
- "plugin pointer, exiting!");
+ if (!LSM_IS_PLUGIN(p)) {
+ syslog(LOG_USER | LOG_NOTICE, "Someone stepped on "
+ "plugin pointer, exiting!");
break;
}

Value req = p->tp->readRequest();
Value resp;

- if( req.isValidRequest() ) {
+ if (req.isValidRequest()) {
std::string method = req["method"].asString();
rc = process_request(p, method, req, resp);

- if( LSM_ERR_OK == rc || LSM_ERR_JOB_STARTED == rc ) {
+ if (LSM_ERR_OK == rc || LSM_ERR_JOB_STARTED == rc) {
p->tp->responseSend(resp);
} else {
error_send(p, rc);
}

- if( method == "plugin_unregister" ) {
+ if (method == "plugin_unregister") {
flags = LSM_FLAG_GET_VALUE(req["params"]);
break;
}
} else {
- syslog(LOG_USER|LOG_NOTICE, "Invalid request");
+ syslog(LOG_USER | LOG_NOTICE, "Invalid request");
break;
}
- } catch (EOFException &eof) {
+ }
+ catch(EOFException & eof) {
break;
- } catch (ValueException &ve) {
- syslog(LOG_USER|LOG_NOTICE, "Plug-in exception: %s", ve.what());
+ }
+ catch(ValueException & ve) {
+ syslog(LOG_USER | LOG_NOTICE, "Plug-in exception: %s",
+ ve.what());
rc = 1;
break;
- } catch (LsmException &le) {
- syslog(LOG_USER|LOG_NOTICE, "Plug-in exception: %s", le.what());
+ }
+ catch(LsmException & le) {
+ syslog(LOG_USER | LOG_NOTICE, "Plug-in exception: %s",
+ le.what());
rc = 2;
break;
- } catch ( ... ) {
- syslog(LOG_USER|LOG_NOTICE, "Plug-in un-handled exception");
+ }
+ catch( ...) {
+ syslog(LOG_USER | LOG_NOTICE, "Plug-in un-handled exception");
rc = 3;
break;
}
@@ -2461,32 +2486,34 @@ static int lsm_plugin_run(lsm_plugin_ptr p)
return rc;
}

-int lsm_log_error_basic( lsm_plugin_ptr plug, lsm_error_number code, const char* msg )
+int lsm_log_error_basic(lsm_plugin_ptr plug, lsm_error_number code,
+ const char *msg)
{
- if( !LSM_IS_PLUGIN(plug) ) {
+ if (!LSM_IS_PLUGIN(plug)) {
return LSM_ERR_INVALID_ARGUMENT;
}

lsm_error_ptr e = LSM_ERROR_CREATE_PLUGIN_MSG(code, msg);
- if( e ) {
+ if (e) {
int rc = lsm_plugin_error_log(plug, e);

- if( LSM_ERR_OK != rc ) {
- syslog(LOG_USER|LOG_NOTICE,
- "Plug-in error %d while reporting an error, code= %d, msg= %s",
- rc, code, msg);
+ if (LSM_ERR_OK != rc) {
+ syslog(LOG_USER | LOG_NOTICE,
+ "Plug-in error %d while reporting an error, code= %d, "
+ "msg= %s",
+ rc, code, msg);
}
}
- return (int)code;
+ return (int) code;
}

-int lsm_plugin_error_log( lsm_plugin_ptr plug, lsm_error_ptr error)
+int lsm_plugin_error_log(lsm_plugin_ptr plug, lsm_error_ptr error)
{
- if( !LSM_IS_PLUGIN(plug) || !LSM_IS_ERROR(error) ) {
+ if (!LSM_IS_PLUGIN(plug) || !LSM_IS_ERROR(error)) {
return LSM_ERR_INVALID_ARGUMENT;
}

- if( plug->error ) {
+ if (plug->error) {
lsm_error_free(plug->error);
}

@@ -2507,14 +2534,14 @@ do { \
} \
} while(0)\

-int LSM_DLL_EXPORT lsm_uri_parse(const char *uri, char **scheme, char **user,
- char **server, int *port, char **path,
- lsm_hash **query_params)
+int LSM_DLL_EXPORT lsm_uri_parse(const char *uri, char **scheme,
+ char **user, char **server, int *port,
+ char **path, lsm_hash ** query_params)
{
int rc = LSM_ERR_INVALID_ARGUMENT;
xmlURIPtr u = NULL;

- if( uri && strlen(uri) > 0 ) {
+ if (uri && strlen(uri) > 0) {
*scheme = NULL;
*user = NULL;
*server = NULL;
@@ -2523,7 +2550,7 @@ int LSM_DLL_EXPORT lsm_uri_parse(const char *uri, char **scheme, char **user,
*query_params = NULL;

u = xmlParseURI(uri);
- if( u ) {
+ if (u) {
STR_D(*scheme, u->scheme);
STR_D(*user, u->user);
STR_D(*server, u->server);
@@ -2531,17 +2558,16 @@ int LSM_DLL_EXPORT lsm_uri_parse(const char *uri, char **scheme, char **user,
*port = u->port;

*query_params = lsm_hash_alloc();
- if( *query_params ) {
+ if (*query_params) {
int i;
struct qparam_set *qp = NULL;
qp = qparam_query_parse(u->query_raw);

- if( qp ) {
- for( i = 0; i < qp->n; ++i ) {
+ if (qp) {
+ for (i = 0; i < qp->n; ++i) {
rc = lsm_hash_string_set(*query_params,
- qp->p[i].name,
- qp->p[i].value);
- if( LSM_ERR_OK != rc ) {
+ qp->p[i].name, qp->p[i].value);
+ if (LSM_ERR_OK != rc) {
free_qparam_set(qp);
goto bail;
}
@@ -2556,8 +2582,8 @@ int LSM_DLL_EXPORT lsm_uri_parse(const char *uri, char **scheme, char **user,
rc = LSM_ERR_OK;
}

- bail:
- if( rc != LSM_ERR_OK ){
+ bail:
+ if (rc != LSM_ERR_OK) {
free(*scheme);
*scheme = NULL;
free(*user);
@@ -2571,7 +2597,7 @@ int LSM_DLL_EXPORT lsm_uri_parse(const char *uri, char **scheme, char **user,
*query_params = NULL;
}

- if( u ) {
+ if (u) {
xmlFreeURI(u);
u = NULL;
}
@@ -2580,8 +2606,8 @@ int LSM_DLL_EXPORT lsm_uri_parse(const char *uri, char **scheme, char **user,
}


-typedef int (*array_cmp)(void *item, void *cmp_data);
-typedef void (*free_item)(void *item);
+typedef int (*array_cmp) (void *item, void *cmp_data);
+typedef void (*free_item) (void *item);

#define CMP_FUNCTION(name, method, method_type) \
static int name(void *i, void *d) \
@@ -2603,13 +2629,13 @@ static void name(void *i) \
} \

static int filter(void *a[], size_t size, array_cmp cmp, void *cmp_data,
- free_item fo)
+ free_item fo)
{
int remaining = 0;
size_t i = 0;

- for( i = 0; i < size; ++i ) {
- if( cmp(a[i], cmp_data) ) {
+ for (i = 0; i < size; ++i) {
+ if (cmp(a[i], cmp_data)) {
memmove(&a[remaining], &a[i], sizeof(void *));
remaining += 1;
} else {
@@ -2621,178 +2647,192 @@ static int filter(void *a[], size_t size, array_cmp cmp, void *cmp_data,
}

CMP_FUNCTION(volume_compare_id, lsm_volume_id_get, lsm_volume)
-CMP_FUNCTION(volume_compare_system, lsm_volume_system_id_get, lsm_volume)
-CMP_FUNCTION(volume_compare_pool, lsm_volume_pool_id_get, lsm_volume)
+ CMP_FUNCTION(volume_compare_system, lsm_volume_system_id_get, lsm_volume)
+ CMP_FUNCTION(volume_compare_pool, lsm_volume_pool_id_get, lsm_volume)
CMP_FREE_FUNCTION(volume_free, lsm_volume_record_free, lsm_volume)

-void lsm_plug_volume_search_filter(const char *search_key, const char *search_value,
- lsm_volume *vols[], uint32_t *count)
+void lsm_plug_volume_search_filter(const char *search_key,
+ const char *search_value,
+ lsm_volume * vols[], uint32_t * count)
{
array_cmp cmp = NULL;

- if( search_key ) {
+ if (search_key) {

- if( 0 == strcmp("id", search_key) ) {
+ if (0 == strcmp("id", search_key)) {
cmp = volume_compare_id;
- } else if( 0 == strcmp("system_id", search_key) ) {
+ } else if (0 == strcmp("system_id", search_key)) {
cmp = volume_compare_system;
- } else if ( 0 == strcmp("pool_id", search_key) ) {
+ } else if (0 == strcmp("pool_id", search_key)) {
cmp = volume_compare_pool;
}

- if( cmp ) {
- *count = filter((void **)vols, *count, cmp, (void*)search_value,
- volume_free);
+ if (cmp) {
+ *count =
+ filter((void **) vols, *count, cmp, (void *) search_value,
+ volume_free);
}
}
}

CMP_FUNCTION(pool_compare_id, lsm_pool_id_get, lsm_pool)
-CMP_FUNCTION(pool_compare_system, lsm_pool_system_id_get, lsm_pool)
+ CMP_FUNCTION(pool_compare_system, lsm_pool_system_id_get, lsm_pool)
CMP_FREE_FUNCTION(pool_free, lsm_pool_record_free, lsm_pool);

-void lsm_plug_pool_search_filter(const char *search_key, const char *search_value,
- lsm_pool *pools[], uint32_t *count)
+void lsm_plug_pool_search_filter(const char *search_key,
+ const char *search_value,
+ lsm_pool * pools[], uint32_t * count)
{
array_cmp cmp = NULL;

- if( search_key ) {
+ if (search_key) {

- if( 0 == strcmp("id", search_key) ) {
+ if (0 == strcmp("id", search_key)) {
cmp = pool_compare_id;
- } else if( 0 == strcmp("system_id", search_key) ) {
+ } else if (0 == strcmp("system_id", search_key)) {
cmp = pool_compare_system;
}

- if( cmp ) {
- *count = filter((void **)pools, *count, cmp, (void*)search_value,
- pool_free);
+ if (cmp) {
+ *count =
+ filter((void **) pools, *count, cmp, (void *) search_value,
+ pool_free);
}
}
}

CMP_FUNCTION(disk_compare_id, lsm_disk_id_get, lsm_disk)
-CMP_FUNCTION(disk_compare_system, lsm_disk_system_id_get, lsm_disk)
+ CMP_FUNCTION(disk_compare_system, lsm_disk_system_id_get, lsm_disk)
CMP_FREE_FUNCTION(disk_free, lsm_disk_record_free, lsm_disk)

-void lsm_plug_disk_search_filter(const char *search_key, const char *search_value,
- lsm_disk *disks[], uint32_t *count)
+void lsm_plug_disk_search_filter(const char *search_key,
+ const char *search_value,
+ lsm_disk * disks[], uint32_t * count)
{
array_cmp cmp = NULL;

- if( search_key ) {
+ if (search_key) {

- if( 0 == strcmp("id", search_key) ) {
+ if (0 == strcmp("id", search_key)) {
cmp = disk_compare_id;
- } else if( 0 == strcmp("system_id", search_key) ) {
+ } else if (0 == strcmp("system_id", search_key)) {
cmp = disk_compare_system;
}

- if( cmp ) {
- *count = filter((void **)disks, *count, cmp, (void*)search_value,
- disk_free);
+ if (cmp) {
+ *count =
+ filter((void **) disks, *count, cmp, (void *) search_value,
+ disk_free);
}
}
}

CMP_FUNCTION(access_group_compare_id, lsm_access_group_id_get, lsm_access_group)
-CMP_FUNCTION(access_group_compare_system, lsm_access_group_system_id_get, lsm_access_group)
+ CMP_FUNCTION(access_group_compare_system, lsm_access_group_system_id_get,
+ lsm_access_group)
CMP_FREE_FUNCTION(access_group_free, lsm_access_group_record_free,
- lsm_access_group);
+ lsm_access_group);

void lsm_plug_access_group_search_filter(const char *search_key,
- const char *search_value,
- lsm_access_group *ag[], uint32_t *count)
+ const char *search_value,
+ lsm_access_group * ag[],
+ uint32_t * count)
{
array_cmp cmp = NULL;

- if( search_key ) {
+ if (search_key) {

- if( 0 == strcmp("id", search_key) ) {
+ if (0 == strcmp("id", search_key)) {
cmp = access_group_compare_id;
- } else if( 0 == strcmp("system_id", search_key) ) {
+ } else if (0 == strcmp("system_id", search_key)) {
cmp = access_group_compare_system;
}

- if( cmp ) {
- *count = filter((void **)ag, *count, cmp, (void*)search_value,
- access_group_free);
+ if (cmp) {
+ *count =
+ filter((void **) ag, *count, cmp, (void *) search_value,
+ access_group_free);
}
}
}

CMP_FUNCTION(fs_compare_id, lsm_fs_id_get, lsm_fs)
-CMP_FUNCTION(fs_compare_system, lsm_fs_system_id_get, lsm_fs)
+ CMP_FUNCTION(fs_compare_system, lsm_fs_system_id_get, lsm_fs)
CMP_FREE_FUNCTION(fs_free, lsm_fs_record_free, lsm_fs);

void lsm_plug_fs_search_filter(const char *search_key,
- const char *search_value,
- lsm_fs *fs[], uint32_t *count)
+ const char *search_value,
+ lsm_fs * fs[], uint32_t * count)
{
array_cmp cmp = NULL;

- if( search_key ) {
+ if (search_key) {

- if( 0 == strcmp("id", search_key) ) {
+ if (0 == strcmp("id", search_key)) {
cmp = fs_compare_id;
- } else if( 0 == strcmp("system_id", search_key) ) {
+ } else if (0 == strcmp("system_id", search_key)) {
cmp = fs_compare_system;
}

- if( cmp ) {
- *count = filter((void **)fs, *count, cmp, (void*)search_value,
- fs_free);
+ if (cmp) {
+ *count =
+ filter((void **) fs, *count, cmp, (void *) search_value,
+ fs_free);
}
}
}

CMP_FUNCTION(nfs_compare_id, lsm_nfs_export_id_get, lsm_nfs_export)
-CMP_FUNCTION(nfs_compare_fs_id, lsm_nfs_export_fs_id_get, lsm_nfs_export)
+ CMP_FUNCTION(nfs_compare_fs_id, lsm_nfs_export_fs_id_get, lsm_nfs_export)
CMP_FREE_FUNCTION(nfs_free, lsm_nfs_export_record_free, lsm_nfs_export)

void lsm_plug_nfs_export_search_filter(const char *search_key,
- const char *search_value,
- lsm_nfs_export *exports[], uint32_t *count)
+ const char *search_value,
+ lsm_nfs_export * exports[],
+ uint32_t * count)
{
array_cmp cmp = NULL;

- if( search_key ) {
+ if (search_key) {

- if( 0 == strcmp("id", search_key) ) {
+ if (0 == strcmp("id", search_key)) {
cmp = nfs_compare_id;
- } else if( 0 == strcmp("fs_id", search_key) ) {
+ } else if (0 == strcmp("fs_id", search_key)) {
cmp = nfs_compare_fs_id;
}

- if( cmp ) {
- *count = filter((void **)exports, *count, cmp, (void*)search_value,
- nfs_free);
+ if (cmp) {
+ *count =
+ filter((void **) exports, *count, cmp,
+ (void *) search_value, nfs_free);
}
}
}

CMP_FUNCTION(tp_compare_id, lsm_target_port_id_get, lsm_target_port)
-CMP_FUNCTION(tp_compare_system_id, lsm_target_port_system_id_get, lsm_target_port)
+ CMP_FUNCTION(tp_compare_system_id, lsm_target_port_system_id_get,
+ lsm_target_port)
CMP_FREE_FUNCTION(tp_free, lsm_target_port_record_free, lsm_target_port)

void lsm_plug_target_port_search_filter(const char *search_key,
- const char *search_value,
- lsm_target_port *tp[],
- uint32_t *count)
+ const char *search_value,
+ lsm_target_port * tp[],
+ uint32_t * count)
{
array_cmp cmp = NULL;

- if( search_key ) {
+ if (search_key) {

- if( 0 == strcmp("id", search_key) ) {
+ if (0 == strcmp("id", search_key)) {
cmp = tp_compare_id;
- } else if( 0 == strcmp("system_id", search_key) ) {
+ } else if (0 == strcmp("system_id", search_key)) {
cmp = tp_compare_system_id;
}

- if( cmp ) {
- *count = filter((void **)tp, *count, cmp, (void*)search_value,
- tp_free);
+ if (cmp) {
+ *count =
+ filter((void **) tp, *count, cmp, (void *) search_value,
+ tp_free);
}
}
}
diff --git a/c_binding/lsm_plugin_ipc.hpp b/c_binding/lsm_plugin_ipc.hpp
index 36f3220..c5b6458 100644
--- a/c_binding/lsm_plugin_ipc.hpp
+++ b/c_binding/lsm_plugin_ipc.hpp
@@ -23,27 +23,22 @@
#include <map>
#include "libstoragemgmt/libstoragemgmt_common.h"

-template <typename K, typename V>
-class LSM_DLL_LOCAL static_map
-{
-private:
- std::map<K, V> _m;
-public:
- static_map(const K& key, const V& val)
- {
+template < typename K, typename V > class LSM_DLL_LOCAL static_map {
+ private:
+ std::map < K, V > _m;
+ public:
+ static_map(const K & key, const V & val) {
_m[key] = val;
}

- static_map<K, V>& operator()(const K& key, const V& val)
- {
+ static_map < K, V > &operator()(const K & key, const V & val) {
_m[key] = val;
return *this;
}

- operator std::map<K, V>()
- {
+ operator std::map < K, V > () {
return _m;
}
};

-#endif
\ No newline at end of file
+#endif
diff --git a/c_binding/test.cpp b/c_binding/test.cpp
index 9dde0f2..8c54819 100644
--- a/c_binding/test.cpp
+++ b/c_binding/test.cpp
@@ -7,12 +7,10 @@
std::string gen_random(int len)
{
static const char alphanum[] =
- "0123456789"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz";
+ "0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz";
std::string rc(len, 'x');

- for( int i = 0; i < len; ++i ) {
+ for (int i = 0; i < len; ++i) {
rc[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
}
return rc;
@@ -25,22 +23,24 @@ void TestIt(int fd)
int ec = 0;
Transport t(fd);

- for( int i = 1; i < 1024*1024*16; i += 1) {
+ for (int i = 1; i < 1024 * 1024 * 16; i += 1) {

std::string msg = gen_random(i);

std::cout << "sending msg" << std::endl;
rc = t.sendMsg(msg, ec);
std::cout << "message sent: " << rc << std::endl;
- if( rc == 0 ) {
+ if (rc == 0) {

std::cout << "Receiving msg" << std::endl;
std::string rmsg = t.recvMsg(ec);
- std::cout << "Message received " << rmsg.size() << " Byte(s)" << std::endl;
+ std::
+ cout << "Message received " << rmsg.size() << " Byte(s)" <<
+ std::endl;

- if( rmsg.size() > 0 ) {
+ if (rmsg.size() > 0) {

- if( msg != rmsg ) {
+ if (msg != rmsg) {
std::cout << "Data miss-compare" << std::endl;
std::cout << "Recv: " << rmsg << std::endl;
}
@@ -66,7 +66,7 @@ int main(void)

fd = Transport::getSocket(path, ec);

- if( fd >= 0 ) {
+ if (fd >= 0) {
TestIt(fd);
} else {
std::cout << "Error getting connected socket: " << ec << std::endl;
--
1.8.3.1
Loading...