Tony Asleson
2014-03-11 22:12:22 UTC
- Rename functions so `verb` is at end
- Free functions all return a value instead of a missmatch
- All functions use 'Delete' instead of 'Del' or 'remove
Signed-off-by: Tony Asleson <***@redhat.com>
---
include/libstoragemgmt/libstoragemgmt.h | 20 +--
.../libstoragemgmt/libstoragemgmt_accessgroups.h | 8 +-
include/libstoragemgmt/libstoragemgmt_blockrange.h | 10 +-
.../libstoragemgmt/libstoragemgmt_capabilities.h | 5 +-
include/libstoragemgmt/libstoragemgmt_common.h | 15 +-
include/libstoragemgmt/libstoragemgmt_disk.h | 8 +-
include/libstoragemgmt/libstoragemgmt_error.h | 27 ++--
include/libstoragemgmt/libstoragemgmt_fs.h | 8 +-
include/libstoragemgmt/libstoragemgmt_initiators.h | 8 +-
include/libstoragemgmt/libstoragemgmt_nfsexport.h | 12 +-
.../libstoragemgmt/libstoragemgmt_optionaldata.h | 3 +-
.../libstoragemgmt/libstoragemgmt_plug_interface.h | 20 +--
include/libstoragemgmt/libstoragemgmt_pool.h | 8 +-
include/libstoragemgmt/libstoragemgmt_snapshot.h | 8 +-
include/libstoragemgmt/libstoragemgmt_systems.h | 10 +-
include/libstoragemgmt/libstoragemgmt_volumes.h | 8 +-
plugin/simc_lsmplugin.c | 148 +++++++++----------
src/lsm_convert.cpp | 14 +-
src/lsm_datatypes.cpp | 136 +++++++++++-------
src/lsm_mgmt.cpp | 58 ++++----
src/lsm_plugin_ipc.cpp | 28 ++--
test/tester.c | 160 ++++++++++-----------
22 files changed, 389 insertions(+), 333 deletions(-)
diff --git a/include/libstoragemgmt/libstoragemgmt.h b/include/libstoragemgmt/libstoragemgmt.h
index 7c7a807..9ec7bb9 100644
--- a/include/libstoragemgmt/libstoragemgmt.h
+++ b/include/libstoragemgmt/libstoragemgmt.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -87,7 +87,7 @@ extern "C" {
* @param [in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error code @see lsmErrorNumber
*/
- int LSM_DLL_EXPORT lsmPluginGetInfo(lsmConnect *conn, char **desc,
+ int LSM_DLL_EXPORT lsmPluginInfoGet(lsmConnect *conn, char **desc,
char **version, lsmFlag_t flags);
/**
@@ -98,7 +98,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error code @see lsmErrorNumber
*/
- int LSM_DLL_EXPORT lsmGetAvailablePlugins(const char *sep,
+ int LSM_DLL_EXPORT lsmAvailablePluginsList(const char *sep,
lsmStringList **plugins,
lsmFlag_t flags);
@@ -109,7 +109,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error reason
*/
- int LSM_DLL_EXPORT lsmConnectSetTimeout(lsmConnect *conn,
+ int LSM_DLL_EXPORT lsmConnectTimeoutSet(lsmConnect *conn,
uint32_t timeout, lsmFlag_t flags);
/**
@@ -119,7 +119,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error reason
*/
- int LSM_DLL_EXPORT lsmConnectGetTimeout(lsmConnect *conn,
+ int LSM_DLL_EXPORT lsmConnectTimeoutGet(lsmConnect *conn,
uint32_t *timeout, lsmFlag_t flags);
/**
@@ -459,7 +459,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error reason.
*/
- int LSM_DLL_EXPORT lsmAccessGroupDel(lsmConnect *conn,
+ int LSM_DLL_EXPORT lsmAccessGroupDelete(lsmConnect *conn,
lsmAccessGroup *group, lsmFlag_t flags);
/**
@@ -471,7 +471,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error reason.
*/
- int LSM_DLL_EXPORT lsmAccessGroupAddInitiator(lsmConnect *conn,
+ int LSM_DLL_EXPORT lsmAccessGroupInitiatorAdd(lsmConnect *conn,
lsmAccessGroup *group,
const char *initiator_id,
lsmInitiatorType id_type, lsmFlag_t flags);
@@ -484,7 +484,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return[in] LSM_ERR_OK on success, else error reason.
*/
- int LSM_DLL_EXPORT lsmAccessGroupDelInitiator(lsmConnect *conn,
+ int LSM_DLL_EXPORT lsmAccessGroupInitiatorDelete(lsmConnect *conn,
lsmAccessGroup *group,
const char *initiator_id,
lsmFlag_t flags);
@@ -848,13 +848,13 @@ extern "C" {
);
/**
- * Remove the export.
+ * 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 lsmNfsExportRemove( lsmConnect *c, lsmNfsExport *e,
+ int LSM_DLL_EXPORT lsmNfsExportDelete( lsmConnect *c, lsmNfsExport *e,
lsmFlag_t flags );
#ifdef __cplusplus
diff --git a/include/libstoragemgmt/libstoragemgmt_accessgroups.h b/include/libstoragemgmt/libstoragemgmt_accessgroups.h
index 0e497a2..e65e63b 100644
--- a/include/libstoragemgmt/libstoragemgmt_accessgroups.h
+++ b/include/libstoragemgmt/libstoragemgmt_accessgroups.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -31,15 +31,17 @@ extern "C" {
/**
* Frees the resources for an access group.
* @param group Group to free
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmAccessGroupRecordFree( lsmAccessGroup *group );
+int LSM_DLL_EXPORT lsmAccessGroupRecordFree( lsmAccessGroup *group );
/**
* Frees the resources for an array of access groups.
* @param ag Array of access groups to free resources for
* @param size Number of elements in the array.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmAccessGroupRecordFreeArray( lsmAccessGroup *ag[], uint32_t size );
+int LSM_DLL_EXPORT lsmAccessGroupRecordArrayFree( lsmAccessGroup *ag[], uint32_t size );
/**
* Copies an access group.
diff --git a/include/libstoragemgmt/libstoragemgmt_blockrange.h b/include/libstoragemgmt/libstoragemgmt_blockrange.h
index 893eb46..61364c2 100644
--- a/include/libstoragemgmt/libstoragemgmt_blockrange.h
+++ b/include/libstoragemgmt/libstoragemgmt_blockrange.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -40,8 +40,9 @@ lsmBlockRange LSM_DLL_EXPORT *lsmBlockRangeRecordAlloc(uint64_t source_start,
/**
* Frees a block range record.
* @param br Block range to free
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmBlockRangeRecordFree( lsmBlockRange *br);
+int LSM_DLL_EXPORT lsmBlockRangeRecordFree( lsmBlockRange *br);
/**
@@ -57,15 +58,16 @@ lsmBlockRange LSM_DLL_EXPORT *lsmBlockRangeRecordCopy( lsmBlockRange *source );
* @param size Number of elements to store.
* @return Pointer to memory for array of block ranges.
*/
-lsmBlockRange LSM_DLL_EXPORT **lsmBlockRangeRecordAllocArray( uint32_t size );
+lsmBlockRange LSM_DLL_EXPORT **lsmBlockRangeRecordArrayAlloc( uint32_t size );
/**
* Frees the memory for the array and all records contained in it.
* @param br Array of block ranges to free
* @param size Number of elements in array.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmBlockRangeRecordFreeArray( lsmBlockRange *br[],
+int LSM_DLL_EXPORT lsmBlockRangeRecordArrayFree( lsmBlockRange *br[],
uint32_t size );
/**
diff --git a/include/libstoragemgmt/libstoragemgmt_capabilities.h b/include/libstoragemgmt/libstoragemgmt_capabilities.h
index 040a86a..f34464f 100644
--- a/include/libstoragemgmt/libstoragemgmt_capabilities.h
+++ b/include/libstoragemgmt/libstoragemgmt_capabilities.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -139,8 +139,9 @@ typedef enum {
/**
* Free the memory used by the storage capabilities data structure
* @param cap Valid storage capability data structure.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmCapabilityRecordFree(lsmStorageCapabilities *cap);
+int LSM_DLL_EXPORT lsmCapabilityRecordFree(lsmStorageCapabilities *cap);
/**
* Return the capability for the specified feature.
diff --git a/include/libstoragemgmt/libstoragemgmt_common.h b/include/libstoragemgmt/libstoragemgmt_common.h
index 9725233..64885ba 100644
--- a/include/libstoragemgmt/libstoragemgmt_common.h
+++ b/include/libstoragemgmt/libstoragemgmt_common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -71,7 +71,8 @@ lsmStringList LSM_DLL_EXPORT *lsmStringListCopy(lsmStringList *src);
* @param value Value to use for assignment
* @return LSM_ERR_OK on success, else error reason
*/
-int LSM_DLL_EXPORT lsmStringListSetElem(lsmStringList *sl, uint32_t index, const char* value);
+int LSM_DLL_EXPORT lsmStringListElemSet(lsmStringList *sl, uint32_t index,
+ const char* value);
/**
* Returns the value at the specified elem index
@@ -79,7 +80,8 @@ int LSM_DLL_EXPORT lsmStringListSetElem(lsmStringList *sl, uint32_t index, const
* @param index Index to retrieve
* @return Value at that index position.
*/
-const char LSM_DLL_EXPORT *lsmStringListGetElem(lsmStringList *sl, uint32_t index);
+const char LSM_DLL_EXPORT *lsmStringListElemGet(lsmStringList *sl,
+ uint32_t index);
/**
* Returns the size of the list
@@ -99,12 +101,15 @@ uint32_t LSM_DLL_EXPORT lsmStringListSize(lsmStringList *sl);
int LSM_DLL_EXPORT lsmStringListAppend(lsmStringList *sl, const char* add);
/**
- * Removes the string at the specified index.
+ * Deletes the string at the specified index.
+ * NOTE: The elements after this one are moved down, thus if you wanted to
+ * iterate over the list deleting each element one by one you need to do so in
+ * reverse order.
* @param sl String list to remove item from
* @param index Specified index
* @return LSM_ERR_OK on success, else error reason
*/
-int LSM_DLL_EXPORT lsmStringListRemove(lsmStringList *sl, uint32_t index);
+int LSM_DLL_EXPORT lsmStringListDelete(lsmStringList *sl, uint32_t index);
diff --git a/include/libstoragemgmt/libstoragemgmt_disk.h b/include/libstoragemgmt/libstoragemgmt_disk.h
index cf86342..0676b69 100644
--- a/include/libstoragemgmt/libstoragemgmt_disk.h
+++ b/include/libstoragemgmt/libstoragemgmt_disk.h
@@ -30,9 +30,9 @@ extern "C" {
/**
* Free the memory for a disk record
* @param d Disk memory to free
- * @return None
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmDiskRecordFree(lsmDisk *d);
+int LSM_DLL_EXPORT lsmDiskRecordFree(lsmDisk *d);
/**
* Copy a disk record
@@ -45,9 +45,9 @@ lsmDisk LSM_DLL_EXPORT *lsmDiskRecordCopy(lsmDisk *d);
* Free an array of disk records
* @param disk Array of disk records
* @param size Size of disk array
- * @return None
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmDiskRecordFreeArray( lsmDisk *disk[], uint32_t size);
+int LSM_DLL_EXPORT lsmDiskRecordArrayFree( lsmDisk *disk[], uint32_t size);
/**
* Returns the disk id
diff --git a/include/libstoragemgmt/libstoragemgmt_error.h b/include/libstoragemgmt/libstoragemgmt_error.h
index e113cec..8527e1f 100644
--- a/include/libstoragemgmt/libstoragemgmt_error.h
+++ b/include/libstoragemgmt/libstoragemgmt_error.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -79,6 +79,7 @@ typedef enum {
LSM_ERR_INVALID_IQN = 118, /**< Invalid IQN */
LSM_ERR_INVALID_DISK = 119, /**< Invalid disk */
LSM_ERR_INVALID_OPTIONAL_DATA = 120,/**< Invalid optional data */
+ LSM_ERR_INVALID_BLOCK_RANGE = 121, /**< Invalud block range */
LSM_ERR_IS_MAPPED = 125, /**< Mapping already exists */
@@ -140,7 +141,7 @@ typedef lsmError *lsmErrorPtr;
* @param c Connection pointer.
* @return lsmErrorPtr, Null if no error exists!
*/
-lsmErrorPtr LSM_DLL_EXPORT lsmErrorGetLast(lsmConnect *c);
+lsmErrorPtr LSM_DLL_EXPORT lsmErrorLastGet(lsmConnect *c);
/**
* Frees the error record!
@@ -154,62 +155,62 @@ int LSM_DLL_EXPORT lsmErrorFree(lsmErrorPtr err);
* @param e The lsmErrorPtr
* @return -1 if e is not a valid error pointer, else error number.
*/
-lsmErrorNumber LSM_DLL_EXPORT lsmErrorGetNumber(lsmErrorPtr e);
+lsmErrorNumber LSM_DLL_EXPORT lsmErrorNumberGet(lsmErrorPtr e);
/**
* Retrieves the domain from the error.
* @param e The lsmErrorPtr
* @return -1 if e is not a valid error pointer, else error domain value.
*/
-lsmErrorDomain LSM_DLL_EXPORT lsmErrorGetDomain(lsmErrorPtr e);
+lsmErrorDomain LSM_DLL_EXPORT lsmErrorDomainGet(lsmErrorPtr e);
/**
* Retrieves the error level from the error.
* @param e The lsmErrorPtr
* @return -1 if e is not a valid error pointer, else error level.
*/
-lsmErrorLevel LSM_DLL_EXPORT lsmErrorGetLevel(lsmErrorPtr e);
+lsmErrorLevel LSM_DLL_EXPORT lsmErrorLevelGet(lsmErrorPtr 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
- * lsmErrorGetNumber and check return code.
+ * lsmErrorNumberGet and check return code.
* @param e The lsmErrorPtr
* @return NULL if message data does not exist, else error message.
*/
-char LSM_DLL_EXPORT *lsmErrorGetMessage(lsmErrorPtr e);
+char LSM_DLL_EXPORT *lsmErrorMessageGet(lsmErrorPtr 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
- * lsmErrorGetNumber and check return code.
+ * lsmErrorNumberGet and check return code.
* @param e The lsmErrorPtr
* @return NULL if exception does not exist, else error exception.
*/
-char LSM_DLL_EXPORT *lsmErrorGetException(lsmErrorPtr e);
+char LSM_DLL_EXPORT *lsmErrorExceptionGet(lsmErrorPtr 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
- * lsmErrorGetNumber and check return code.
+ * lsmErrorNumberGet and check return code.
* @param e The lsmErrorPtr
* @return NULL if does not exist, else debug message.
*/
-char LSM_DLL_EXPORT *lsmErrorGetDebug(lsmErrorPtr e);
+char LSM_DLL_EXPORT *lsmErrorDebugGet(lsmErrorPtr 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
- * lsmErrorGetNumber and check return code.
+ * lsmErrorNumberGet and check return code.
* @param e The lsmErrorPtr
* @param[out] size Number of bytes of data returned.
* @return NULL if does not exist, else debug message.
*/
-void LSM_DLL_EXPORT *lsmErrorGetDebugData(lsmErrorPtr e, uint32_t *size);
+void LSM_DLL_EXPORT *lsmErrorDebugDataGet(lsmErrorPtr e, uint32_t *size);
#ifdef __cplusplus
}
diff --git a/include/libstoragemgmt/libstoragemgmt_fs.h b/include/libstoragemgmt/libstoragemgmt_fs.h
index 76cc050..fbe1fbd 100644
--- a/include/libstoragemgmt/libstoragemgmt_fs.h
+++ b/include/libstoragemgmt/libstoragemgmt_fs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -29,8 +29,9 @@ extern "C" {
/**
* Frees a File system record
* @param fs File system to free.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmFsRecordFree(lsmFs *fs);
+int LSM_DLL_EXPORT lsmFsRecordFree(lsmFs *fs);
/**
* Copies a file system record.
@@ -43,8 +44,9 @@ lsmFs LSM_DLL_EXPORT *lsmFsRecordCopy(lsmFs *source);
* Frees an array of file system records
* @param fs Array of file system record pointers
* @param size Number in array to free
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmFsRecordFreeArray(lsmFs * fs[], uint32_t size);
+int LSM_DLL_EXPORT lsmFsRecordArrayFree(lsmFs * fs[], uint32_t size);
/**
* Returns the id of the file system.
diff --git a/include/libstoragemgmt/libstoragemgmt_initiators.h b/include/libstoragemgmt/libstoragemgmt_initiators.h
index 6cc004b..4a8b933 100644
--- a/include/libstoragemgmt/libstoragemgmt_initiators.h
+++ b/include/libstoragemgmt/libstoragemgmt_initiators.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -28,8 +28,9 @@ extern "C" {
/**
* Frees the memory for one initiator record.
* @param i Initiator record.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmInitiatorRecordFree(lsmInitiator *i);
+int LSM_DLL_EXPORT lsmInitiatorRecordFree(lsmInitiator *i);
/**
* Returns a copy of an initiator record.
@@ -42,8 +43,9 @@ lsmInitiator LSM_DLL_EXPORT *lsmInitiatorRecordCopy(lsmInitiator *i);
* Frees the memory for each of the initiators records and then the array itself.
* @param init Array to free.
* @param size Size of array.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmInitiatorRecordFreeArray( lsmInitiator *init[], uint32_t size);
+int LSM_DLL_EXPORT lsmInitiatorRecordArrayFree( lsmInitiator *init[], uint32_t size);
/**
* Returns the type of identifer returned in @see lsmInitiatorIdGet
diff --git a/include/libstoragemgmt/libstoragemgmt_nfsexport.h b/include/libstoragemgmt/libstoragemgmt_nfsexport.h
index e7cf630..4d3279e 100644
--- a/include/libstoragemgmt/libstoragemgmt_nfsexport.h
+++ b/include/libstoragemgmt/libstoragemgmt_nfsexport.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -62,21 +62,23 @@ lsmNfsExport LSM_DLL_EXPORT * lsmNfsExportRecordAlloc( const char *id,
* @param size Number of elements
* @return Allocated memory, NULL on error
*/
-lsmNfsExport LSM_DLL_EXPORT **lsmNfsExportRecordAllocArray( uint32_t size );
+lsmNfsExport LSM_DLL_EXPORT **lsmNfsExportRecordArrayAlloc( uint32_t size );
/**
* Frees the memory for a NFS export record.
* @param exp
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmNfsExportRecordFree( lsmNfsExport *exp );
+int LSM_DLL_EXPORT lsmNfsExportRecordFree( lsmNfsExport *exp );
/**
* Frees the memory for the NFS export array and the memory for each entry
* @param exps Memory to free
* @param size Number of entries
- */
-void LSM_DLL_EXPORT lsmNfsExportRecordFreeArray( lsmNfsExport *exps[],
+ * @return LSM_ERR_OK on success, else error reason.
+ * */
+int LSM_DLL_EXPORT lsmNfsExportRecordArrayFree( lsmNfsExport *exps[],
uint32_t size);
/**
diff --git a/include/libstoragemgmt/libstoragemgmt_optionaldata.h b/include/libstoragemgmt/libstoragemgmt_optionaldata.h
index e39627d..e5fbe5d 100644
--- a/include/libstoragemgmt/libstoragemgmt_optionaldata.h
+++ b/include/libstoragemgmt/libstoragemgmt_optionaldata.h
@@ -30,8 +30,9 @@ extern "C" {
/**
* Free a optional data record
* @param op Record to free.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmOptionalDataRecordFree(lsmOptionalData *op);
+int LSM_DLL_EXPORT lsmOptionalDataRecordFree(lsmOptionalData *op);
/**
* Get the list of 'keys' available in the optional data
diff --git a/include/libstoragemgmt/libstoragemgmt_plug_interface.h b/include/libstoragemgmt/libstoragemgmt_plug_interface.h
index 9738d29..f51c96a 100644
--- a/include/libstoragemgmt/libstoragemgmt_plug_interface.h
+++ b/include/libstoragemgmt/libstoragemgmt_plug_interface.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -893,7 +893,7 @@ int LSM_DLL_EXPORT lsmRegisterPluginV1( lsmPluginPtr plug,
* Used to retrieve private data for plug-in operation.
* @param plug Opaque plug-in pointer.
*/
-void LSM_DLL_EXPORT *lsmGetPrivateData( lsmPluginPtr plug );
+void LSM_DLL_EXPORT *lsmPrivateDataGet( lsmPluginPtr plug );
/**
@@ -950,7 +950,7 @@ lsmErrorPtr LSM_DLL_EXPORT lsmErrorCreate( lsmErrorNumber code,
* @param size Number of elements
* @return Valid pointer or NULL on error.
*/
-lsmPool LSM_DLL_EXPORT **lsmPoolRecordAllocArray( uint32_t size );
+lsmPool LSM_DLL_EXPORT **lsmPoolRecordArrayAlloc( uint32_t size );
/**
* Used to set the free space on a pool record
@@ -980,7 +980,7 @@ lsmPool LSM_DLL_EXPORT *lsmPoolRecordAlloc(const char *id, const char *name,
* @param size Number of elements.
* @return Allocated memory or NULL on error.
*/
-lsmInitiator LSM_DLL_EXPORT **lsmInitiatorRecordAllocArray( uint32_t size );
+lsmInitiator LSM_DLL_EXPORT **lsmInitiatorRecordArrayAlloc( uint32_t size );
/**
* Allocate the storage needed for one initiator record.
@@ -998,7 +998,7 @@ lsmInitiator LSM_DLL_EXPORT *lsmInitiatorRecordAlloc( lsmInitiatorType idType,
* @param size Number of elements.
* @return Allocated memory or NULL on error.
*/
-lsmVolume LSM_DLL_EXPORT **lsmVolumeRecordAllocArray( uint32_t size);
+lsmVolume LSM_DLL_EXPORT **lsmVolumeRecordArrayAlloc( uint32_t size);
/**
@@ -1006,7 +1006,7 @@ lsmVolume LSM_DLL_EXPORT **lsmVolumeRecordAllocArray( uint32_t size);
* @param size Number of elements
* @return Allocated memory or null on error.
*/
-lsmDisk LSM_DLL_EXPORT **lsmDiskRecordAllocArray( uint32_t size );
+lsmDisk LSM_DLL_EXPORT **lsmDiskRecordArrayAlloc( uint32_t size );
/**
@@ -1051,7 +1051,7 @@ lsmVolume LSM_DLL_EXPORT *lsmVolumeRecordAlloc( const char *id,
* @param size Number of elements.
* @return Allocated memory or NULL on error.
*/
-lsmSystem LSM_DLL_EXPORT **lsmSystemRecordAllocArray( uint32_t size );
+lsmSystem LSM_DLL_EXPORT **lsmSystemRecordArrayAlloc( uint32_t size );
/**
* Allocates the storage for one system record.
@@ -1069,7 +1069,7 @@ lsmSystem LSM_DLL_EXPORT *lsmSystemRecordAlloc( const char *id,
* @param size Number of elements to store.
* @return NULL on error, else pointer to array for use.
*/
-lsmAccessGroup LSM_DLL_EXPORT **lsmAccessGroupRecordAllocArray( uint32_t size);
+lsmAccessGroup LSM_DLL_EXPORT **lsmAccessGroupRecordArrayAlloc( uint32_t size);
/**
@@ -1115,7 +1115,7 @@ lsmFs LSM_DLL_EXPORT *lsmFsRecordAlloc( const char *id, const char *name,
* @param size Number of elements
* @return Allocated memory, NULL on error
*/
-lsmFs LSM_DLL_EXPORT **lsmFsRecordAllocArray( uint32_t size );
+lsmFs LSM_DLL_EXPORT **lsmFsRecordArrayAlloc( uint32_t size );
/**
* Allocates the memory for single snap shot record.
@@ -1132,7 +1132,7 @@ lsmSs LSM_DLL_EXPORT *lsmSsRecordAlloc( const char *id, const char *name,
* @param size Number of elements
* @return Allocated memory, NULL on error
*/
-lsmSs LSM_DLL_EXPORT **lsmSsRecordAllocArray( uint32_t size );
+lsmSs LSM_DLL_EXPORT **lsmSsRecordArrayAlloc( uint32_t size );
/**
* Set a capability
diff --git a/include/libstoragemgmt/libstoragemgmt_pool.h b/include/libstoragemgmt/libstoragemgmt_pool.h
index 266a606..7db2490 100644
--- a/include/libstoragemgmt/libstoragemgmt_pool.h
+++ b/include/libstoragemgmt/libstoragemgmt_pool.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -31,14 +31,16 @@ extern "C" {
* Frees the memory for each of the pools and then the pool array itself.
* @param pa Pool array to free.
* @param size Size of the pool array.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmPoolRecordFreeArray( lsmPool *pa[], uint32_t size );
+int LSM_DLL_EXPORT lsmPoolRecordArrayFree( lsmPool *pa[], uint32_t size );
/**
* Frees the memory for an individual pool
* @param p Valid pool
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmPoolRecordFree(lsmPool *p);
+int LSM_DLL_EXPORT lsmPoolRecordFree(lsmPool *p);
/**
* Copies a lsmPoolRecordCopy
diff --git a/include/libstoragemgmt/libstoragemgmt_snapshot.h b/include/libstoragemgmt/libstoragemgmt_snapshot.h
index 4371f59..ca046ff 100644
--- a/include/libstoragemgmt/libstoragemgmt_snapshot.h
+++ b/include/libstoragemgmt/libstoragemgmt_snapshot.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -29,8 +29,9 @@ extern "C" {
/**
* Frees a snapshot record.
* @param ss Snapshot record
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmSsRecordFree(lsmSs *ss);
+int LSM_DLL_EXPORT lsmSsRecordFree(lsmSs *ss);
/**
* Copies a snapshot record.
@@ -43,8 +44,9 @@ lsmSs LSM_DLL_EXPORT *lsmSsRecordCopy(lsmSs *source);
* Frees an array of snapshot record.
* @param ss An array of snapshot record pointers.
* @param size Number of snapshot records.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmSsRecordFreeArray(lsmSs *ss[], uint32_t size);
+int LSM_DLL_EXPORT lsmSsRecordArrayFree(lsmSs *ss[], uint32_t size);
/**
* Returns the snapshot id.
diff --git a/include/libstoragemgmt/libstoragemgmt_systems.h b/include/libstoragemgmt/libstoragemgmt_systems.h
index 6912167..cc780bb 100644
--- a/include/libstoragemgmt/libstoragemgmt_systems.h
+++ b/include/libstoragemgmt/libstoragemgmt_systems.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -38,15 +38,17 @@ lsmSystem *lsmSystemRecordCopy(lsmSystem *s);
/**
* Frees the resources for a lsmSystem
* @param s Record to release
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmSystemRecordFree(lsmSystem *s);
+int LSM_DLL_EXPORT lsmSystemRecordFree(lsmSystem *s);
/**
* Frees the resources for an array for lsmSystem
* @param s Array to release memory for
* @param size Number of elements.
- */
-void LSM_DLL_EXPORT lsmSystemRecordFreeArray(lsmSystem *s[], uint32_t size );
+ * @return LSM_ERR_OK on success, else error reason.
+ * */
+int LSM_DLL_EXPORT lsmSystemRecordArrayFree(lsmSystem *s[], uint32_t size );
/**
* Retrieve the Id for the system.
diff --git a/include/libstoragemgmt/libstoragemgmt_volumes.h b/include/libstoragemgmt/libstoragemgmt_volumes.h
index 3d8bd36..bf93135 100644
--- a/include/libstoragemgmt/libstoragemgmt_volumes.h
+++ b/include/libstoragemgmt/libstoragemgmt_volumes.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -29,8 +29,9 @@ extern "C" {
/**
* Frees the memory fro an individual volume
* @param v Volume pointer to free.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmVolumeRecordFree(lsmVolume *v);
+int LSM_DLL_EXPORT lsmVolumeRecordFree(lsmVolume *v);
/**
* Copies a volume record structure.
@@ -43,8 +44,9 @@ lsmVolume LSM_DLL_EXPORT *lsmVolumeRecordCopy(lsmVolume *vol);
* Frees the memory for each of the volume records and then the array itself.
* @param init Array to free.
* @param size Size of array.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmVolumeRecordFreeArray( lsmVolume *init[], uint32_t size);
+int LSM_DLL_EXPORT lsmVolumeRecordArrayFree( lsmVolume *init[], uint32_t size);
/**
* Retrieves the volume id.
diff --git a/plugin/simc_lsmplugin.c b/plugin/simc_lsmplugin.c
index e7d445f..bf64c92 100644
--- a/plugin/simc_lsmplugin.c
+++ b/plugin/simc_lsmplugin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -295,7 +295,7 @@ static int create_job(struct plugin_data *pd, char **job, lsmDataType t,
static int tmo_set(lsmPluginPtr c, uint32_t timeout, lsmFlag_t flags )
{
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
pd->tmo = timeout;
@@ -306,7 +306,7 @@ static int tmo_set(lsmPluginPtr c, uint32_t timeout, lsmFlag_t flags )
static int tmo_get(lsmPluginPtr c, uint32_t *timeout, lsmFlag_t flags)
{
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
*timeout = pd->tmo;
@@ -387,7 +387,7 @@ static int jobStatus(lsmPluginPtr c, const char *job_id,
void **value, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
struct allocated_job *val = (struct allocated_job*)
@@ -420,11 +420,11 @@ static int list_pools(lsmPluginPtr c, lsmPool **poolArray[],
uint32_t *count, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
*count = pd->num_pools;
- *poolArray = lsmPoolRecordAllocArray( pd->num_pools );
+ *poolArray = lsmPoolRecordArrayAlloc( pd->num_pools );
if( *poolArray ) {
uint32_t i = 0;
@@ -432,7 +432,7 @@ static int list_pools(lsmPluginPtr c, lsmPool **poolArray[],
(*poolArray)[i] = lsmPoolRecordCopy(pd->pool[i]);
if( !(*poolArray)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmPoolRecordFreeArray(*poolArray, i);
+ lsmPoolRecordArrayFree(*poolArray, i);
*poolArray = NULL;
*count = 0;
break;
@@ -451,11 +451,11 @@ static int list_pools(lsmPluginPtr c, lsmPool **poolArray[],
static int list_systems(lsmPluginPtr c, lsmSystem **systems[],
uint32_t *systemCount, lsmFlag_t flags)
{
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
*systemCount = pd->num_systems;
- *systems = lsmSystemRecordAllocArray(MAX_SYSTEMS);
+ *systems = lsmSystemRecordArrayAlloc(MAX_SYSTEMS);
if( *systems ) {
(*systems)[0] = lsmSystemRecordCopy(pd->system[0]);
@@ -463,7 +463,7 @@ static int list_systems(lsmPluginPtr c, lsmSystem **systems[],
if( (*systems)[0] ) {
return LSM_ERR_OK;
} else {
- lsmSystemRecordFreeArray(*systems, pd->num_systems);
+ lsmSystemRecordArrayFree(*systems, pd->num_systems);
}
}
return LSM_ERR_NO_MEMORY;
@@ -475,7 +475,7 @@ static int list_systems(lsmPluginPtr c, lsmSystem **systems[],
static int jobFree(lsmPluginPtr c, char *job_id, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
if( !g_hash_table_remove(pd->jobs, job_id) ) {
@@ -527,7 +527,7 @@ static int _list_initiators(lsmPluginPtr c, lsmInitiator **initArray[],
lsmVolume *filter)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(!pd) {
return LSM_ERR_INVALID_PLUGIN;
@@ -560,7 +560,7 @@ static int _list_initiators(lsmPluginPtr c, lsmInitiator **initArray[],
lsmStringList *inits = lsmAccessGroupInitiatorIdGet(v->ag);
for(i = 0; i < lsmStringListSize(inits); ++i ) {
- char *init_key = strdup(lsmStringListGetElem(inits,i));
+ char *init_key = strdup(lsmStringListElemGet(inits,i));
lsmInitiator *init_val = lsmInitiatorRecordAlloc(v->ag_type,
init_key, "");
@@ -579,7 +579,7 @@ static int _list_initiators(lsmPluginPtr c, lsmInitiator **initArray[],
*count = g_hash_table_size(tmp_inits);
if( *count ) {
- *initArray = lsmInitiatorRecordAllocArray(*count);
+ *initArray = lsmInitiatorRecordArrayAlloc(*count);
if( *initArray ) {
int i = 0;
char *ikey = NULL;
@@ -591,7 +591,7 @@ static int _list_initiators(lsmPluginPtr c, lsmInitiator **initArray[],
(*initArray)[i] = lsmInitiatorRecordCopy(ival);
if( !(*initArray)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmInitiatorRecordFreeArray(*initArray, i);
+ lsmInitiatorRecordArrayFree(*initArray, i);
break;
}
i += 1;
@@ -618,20 +618,20 @@ static int list_volumes(lsmPluginPtr c, lsmVolume **vols[],
uint32_t *count, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
*count = pd->num_volumes;
if( *count ) {
- *vols = lsmVolumeRecordAllocArray( pd->num_volumes );
+ *vols = lsmVolumeRecordArrayAlloc( pd->num_volumes );
if( *vols ) {
uint32_t i = 0;
for( i = 0; i < pd->num_volumes; ++i ) {
(*vols)[i] = lsmVolumeRecordCopy(pd->volume[i].v);
if( !(*vols)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmVolumeRecordFreeArray(*vols, i);
+ lsmVolumeRecordArrayFree(*vols, i);
*vols = NULL;
*count = 0;
break;
@@ -655,7 +655,7 @@ static int list_disks(lsmPluginPtr c, lsmDisk **disks[], uint32_t *count,
int rc = LSM_ERR_OK;
char name[17];
char sn[32];
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
lsmOptionalData *od = lsmOptionalDataRecordAlloc();
if(pd && od) {
@@ -663,7 +663,7 @@ static int list_disks(lsmPluginPtr c, lsmDisk **disks[], uint32_t *count,
// try to make a simulated array that makes sense.
*count = 10;
- *disks = lsmDiskRecordAllocArray(*count);
+ *disks = lsmDiskRecordArrayAlloc(*count);
for( i = 0; i < *count; ++i ) {
snprintf(name, sizeof(name), "Sim C disk %d", i);
snprintf(sn, sizeof(sn), "SIMDISKSN00000%04d\n", i);
@@ -739,7 +739,7 @@ static int volume_create(lsmPluginPtr c, lsmPool *pool,
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int pool_index = find_pool(pd, lsmPoolIdGet(pool));
if( pool_index >= 0 ) {
@@ -795,7 +795,7 @@ static int volume_replicate(lsmPluginPtr c, lsmPool *pool,
int vi;
lsmPool *pool_to_use = pool;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
/* If the user didn't pass us a pool to use, we will use the same one
that the source pool is contained on */
@@ -847,7 +847,7 @@ static int volume_replicate_range(lsmPluginPtr c,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int src_v = find_volume_name(pd, lsmVolumeNameGet(source));
int dest_v = find_volume_name(pd, lsmVolumeNameGet(dest));
@@ -868,7 +868,7 @@ static int volume_resize(lsmPluginPtr c, lsmVolume *volume,
{
int rc = LSM_ERR_OK;
int vi;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
vi = find_volume_name(pd, lsmVolumeNameGet(volume));
@@ -920,7 +920,7 @@ static int volume_delete(lsmPluginPtr c, lsmVolume *volume,
char *k = NULL;
GHashTable *v = NULL;
const char *volume_id = lsmVolumeIdGet(volume);
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int vi = find_volume_name(pd, lsmVolumeNameGet(volume));
if( -1 != vi ) {
lsmVolume *vp = pd->volume[vi].v;
@@ -951,7 +951,7 @@ static int volume_online_offline(lsmPluginPtr c, lsmVolume *v,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int vi = find_volume_name(pd, lsmVolumeNameGet(v));
if( -1 == vi ) {
@@ -966,12 +966,12 @@ static int access_group_list(lsmPluginPtr c,
uint32_t *groupCount, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
*groupCount = g_hash_table_size(pd->access_groups);
if( *groupCount ) {
- *groups = lsmAccessGroupRecordAllocArray(*groupCount);
+ *groups = lsmAccessGroupRecordArrayAlloc(*groupCount);
if( *groups ) {
int i = 0;
char *key = NULL;
@@ -985,7 +985,7 @@ static int access_group_list(lsmPluginPtr c,
(*groups)[i] = lsmAccessGroupRecordCopy(val->ag);
if( !(*groups)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmAccessGroupRecordFreeArray(*groups, i);
+ lsmAccessGroupRecordArrayFree(*groups, i);
*groupCount = 0;
groups = NULL;
break;
@@ -1010,7 +1010,7 @@ static int access_group_create(lsmPluginPtr c,
int rc = LSM_ERR_OK;
lsmAccessGroup *ag = NULL;
struct allocated_ag *aag = NULL;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
char *id = strdup(md5(name));
struct allocated_ag *find = (struct allocated_ag *)
@@ -1019,7 +1019,7 @@ static int access_group_create(lsmPluginPtr c,
if( !find ) {
lsmStringList *initiators = lsmStringListAlloc(1);
if( initiators && id &&
- (LSM_ERR_OK == lsmStringListSetElem(initiators, 0, initiator_id))) {
+ (LSM_ERR_OK == lsmStringListElemSet(initiators, 0, initiator_id))) {
ag = lsmAccessGroupRecordAlloc(id, name, initiators,
system_id);
aag = alloc_allocated_ag(ag, id_type);
@@ -1062,7 +1062,7 @@ static int access_group_delete( lsmPluginPtr c,
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
const char *id = lsmAccessGroupIdGet(group);
gboolean r = g_hash_table_remove(pd->access_groups, (gpointer)id);
@@ -1088,7 +1088,7 @@ static int access_group_add_initiator( lsmPluginPtr c,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_ag *find = (struct allocated_ag *)
g_hash_table_lookup(pd->access_groups,
@@ -1110,7 +1110,7 @@ static int access_group_del_initiator( lsmPluginPtr c,
lsmFlag_t flags)
{
int rc = LSM_ERR_INITIATOR_NOT_IN_ACCESS_GROUP;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_ag *find = (struct allocated_ag *)
g_hash_table_lookup(pd->access_groups,
@@ -1121,8 +1121,8 @@ static int access_group_del_initiator( lsmPluginPtr c,
lsmStringList *inits = lsmAccessGroupInitiatorIdGet(find->ag);
for(i = 0; i < lsmStringListSize(inits); ++i) {
- if( strcmp(init, lsmStringListGetElem(inits, i)) == 0 ) {
- lsmStringListRemove(inits, i);
+ if( strcmp(init, lsmStringListElemGet(inits, i)) == 0 ) {
+ lsmStringListDelete(inits, i);
rc = LSM_ERR_OK;
break;
}
@@ -1141,7 +1141,7 @@ static int access_group_grant(lsmPluginPtr c,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_ag *find = (struct allocated_ag *)
g_hash_table_lookup(pd->access_groups,
@@ -1217,7 +1217,7 @@ static int access_group_revoke(lsmPluginPtr c,
lsmFlag_t flags)
{
int rc = LSM_ERR_NO_MAPPING;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_ag *find = (struct allocated_ag *)
g_hash_table_lookup(pd->access_groups,
@@ -1263,7 +1263,7 @@ static int vol_accessible_by_ag(lsmPluginPtr c,
uint32_t *count, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_ag *find = (struct allocated_ag *)
g_hash_table_lookup(pd->access_groups,
@@ -1276,7 +1276,7 @@ static int vol_accessible_by_ag(lsmPluginPtr c,
if( grants && g_hash_table_size(grants) ) {
*count = g_hash_table_size(grants);
GList *keys = g_hash_table_get_keys(grants);
- *volumes = lsmVolumeRecordAllocArray(*count);
+ *volumes = lsmVolumeRecordArrayAlloc(*count);
if( keys && *volumes ) {
GList *curr = NULL;
@@ -1290,7 +1290,7 @@ static int vol_accessible_by_ag(lsmPluginPtr c,
(char *)curr->data));
if( !(*volumes)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmVolumeRecordFreeArray(*volumes, i);
+ lsmVolumeRecordArrayFree(*volumes, i);
*volumes = NULL;
*count = 0;
break;
@@ -1330,7 +1330,7 @@ static int ag_granted_to_volume( lsmPluginPtr c,
GHashTableIter iter;
char *k = NULL;
GHashTable *v = NULL;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
const char* volume_id = lsmVolumeIdGet(volume);
g_hash_table_iter_init (&iter, pd->group_grant);
GSList *result = NULL;
@@ -1346,7 +1346,7 @@ static int ag_granted_to_volume( lsmPluginPtr c,
if( *count ) {
int i = 0;
- *groups = lsmAccessGroupRecordAllocArray(*count);
+ *groups = lsmAccessGroupRecordArrayAlloc(*count);
GSList *siter = NULL;
if( *groups ) {
@@ -1356,7 +1356,7 @@ static int ag_granted_to_volume( lsmPluginPtr c,
if( !(*groups)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmAccessGroupRecordFreeArray(*groups, i);
+ lsmAccessGroupRecordArrayFree(*groups, i);
*groups = NULL;
*count = 0;
break;
@@ -1377,7 +1377,7 @@ int static volume_dependency(lsmPluginPtr c,
lsmVolume *volume,
uint8_t *yes, lsmFlag_t flags)
{
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int vi = find_volume_name(pd, lsmVolumeNameGet(volume));
if( -1 != vi ) {
@@ -1392,7 +1392,7 @@ int static volume_dependency_rm(lsmPluginPtr c,
lsmVolume *volume,
char **job, lsmFlag_t flags)
{
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int vi = find_volume_name(pd, lsmVolumeNameGet(volume));
if( -1 != vi ) {
@@ -1457,7 +1457,7 @@ static lsmAccessGroup *get_access_group( lsmPluginPtr c, char *group_name,
break;
}
}
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
}
return ag;
}
@@ -1522,7 +1522,7 @@ static int _initiator_in_ag(struct plugin_data *pd, lsmAccessGroup *ag,
uint32_t i = 0;
for ( i = 0; i < count; ++i ) {
- if( strcmp(lsmStringListGetElem(initiators, i), init_id) == 0 ) {
+ if( strcmp(lsmStringListElemGet(initiators, i), init_id) == 0 ) {
return 1;
}
}
@@ -1539,7 +1539,7 @@ static int vol_accessible_by_init(lsmPluginPtr c,
GHashTableIter iter;
char *key = NULL;
struct allocated_ag *val = NULL;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
const char *search = lsmInitiatorIdGet(initiator);
GHashTable *tmp_vols = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
NULL);
@@ -1580,7 +1580,7 @@ static int vol_accessible_by_init(lsmPluginPtr c,
*count = g_hash_table_size(tmp_vols);
if( *count ) {
- *volumes = lsmVolumeRecordAllocArray( *count );
+ *volumes = lsmVolumeRecordArrayAlloc( *count );
if( *volumes ) {
/* Walk through each volume and see if we should include it*/
uint32_t i = 0;
@@ -1592,7 +1592,7 @@ static int vol_accessible_by_init(lsmPluginPtr c,
(*volumes)[alloc_count] = lsmVolumeRecordCopy(tv);
if( !(*volumes)[alloc_count] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmVolumeRecordFreeArray(*volumes, alloc_count);
+ lsmVolumeRecordArrayFree(*volumes, alloc_count);
*count = 0;
*volumes = NULL;
break;
@@ -1650,11 +1650,11 @@ static int fs_list(lsmPluginPtr c, lsmFs **fs[], uint32_t *count,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
*count = g_hash_table_size(pd->fs);
if( *count ) {
- *fs = lsmFsRecordAllocArray( *count );
+ *fs = lsmFsRecordArrayAlloc( *count );
if( *fs ) {
uint32_t i = 0;
char *k = NULL;
@@ -1665,7 +1665,7 @@ static int fs_list(lsmPluginPtr c, lsmFs **fs[], uint32_t *count,
(*fs)[i] = lsmFsRecordCopy(afs->fs);
if( !(*fs)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmFsRecordFreeArray(*fs, i);
+ lsmFsRecordArrayFree(*fs, i);
*count = 0;
*fs = NULL;
break;
@@ -1683,7 +1683,7 @@ static int fs_create(lsmPluginPtr c, lsmPool *pool, const char *name,
uint64_t size_bytes, lsmFs **fs, char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int pi = find_pool(pd, lsmPoolIdGet(pool));
@@ -1737,7 +1737,7 @@ static int fs_create(lsmPluginPtr c, lsmPool *pool, const char *name,
static int fs_delete(lsmPluginPtr c, lsmFs *fs, char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if( !g_hash_table_remove(pd->fs, lsmFsIdGet(fs)) ) {
rc = lsmLogErrorBasic(c, LSM_ERR_NOT_FOUND_FS, "FS not found!");
@@ -1752,7 +1752,7 @@ static int fs_resize(lsmPluginPtr c, lsmFs *fs,
char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *afs = g_hash_table_lookup(pd->fs, lsmFsIdGet(fs));
*rfs = NULL;
@@ -1811,7 +1811,7 @@ static int fs_clone(lsmPluginPtr c, lsmFs *src_fs, const char *dest_fs_name,
char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = g_hash_table_lookup(pd->fs, lsmFsIdGet(src_fs));
@@ -1832,7 +1832,7 @@ static int fs_file_clone(lsmPluginPtr c, lsmFs *fs,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = (struct allocated_fs *)g_hash_table_lookup(
pd->fs, lsmFsIdGet(fs));
@@ -1849,7 +1849,7 @@ static int fs_child_dependency(lsmPluginPtr c, lsmFs *fs,
uint8_t *yes)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if( g_hash_table_lookup(pd->fs, lsmFsIdGet(fs))) {
*yes = 0;
} else {
@@ -1863,7 +1863,7 @@ static int fs_child_dependency_rm( lsmPluginPtr c, lsmFs *fs,
char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if( !g_hash_table_lookup(pd->fs, lsmFsIdGet(fs))) {
rc = lsmLogErrorBasic(c, LSM_ERR_NOT_FOUND_FS, "fs not found");
} else {
@@ -1876,7 +1876,7 @@ static int ss_list(lsmPluginPtr c, lsmFs * fs, lsmSs **ss[],
uint32_t *count, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = (struct allocated_fs *)g_hash_table_lookup(
pd->fs, lsmFsIdGet(fs));
@@ -1890,7 +1890,7 @@ static int ss_list(lsmPluginPtr c, lsmFs * fs, lsmSs **ss[],
*count = g_hash_table_size(find->ss);
if( *count ) {
- *ss = lsmSsRecordAllocArray(*count);
+ *ss = lsmSsRecordArrayAlloc(*count);
if( *ss ) {
int i = 0;
g_hash_table_iter_init(&iter, find->ss);
@@ -1900,7 +1900,7 @@ static int ss_list(lsmPluginPtr c, lsmFs * fs, lsmSs **ss[],
(*ss)[i] = lsmSsRecordCopy(v);
if( !(*ss)[i] ) {
rc = lsmLogErrorBasic(c, LSM_ERR_NO_MEMORY, "ENOMEM");
- lsmSsRecordFreeArray(*ss, i);
+ lsmSsRecordArrayFree(*ss, i);
*ss = NULL;
*count = 0;
break;
@@ -1925,7 +1925,7 @@ static int ss_create(lsmPluginPtr c, lsmFs *fs,
lsmFlag_t flags)
{
int rc = LSM_ERR_NO_MEMORY;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = (struct allocated_fs *)g_hash_table_lookup(
pd->fs, lsmFsIdGet(fs));
@@ -1963,7 +1963,7 @@ static int ss_delete(lsmPluginPtr c, lsmFs *fs, lsmSs *ss,
char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = (struct allocated_fs *)g_hash_table_lookup(
pd->fs, lsmFsIdGet(fs));
@@ -1987,7 +1987,7 @@ static int ss_revert(lsmPluginPtr c, lsmFs *fs, lsmSs *ss,
int all_files, char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = (struct allocated_fs *)g_hash_table_lookup(
pd->fs, lsmFsIdGet(fs));
@@ -2026,7 +2026,7 @@ static int nfs_auth_types(lsmPluginPtr c, lsmStringList **types,
int rc = LSM_ERR_OK;
*types = lsmStringListAlloc(1);
if( *types ) {
- lsmStringListSetElem(*types, 0, "standard");
+ lsmStringListElemSet(*types, 0, "standard");
} else {
rc = LSM_ERR_NO_MEMORY;
}
@@ -2042,7 +2042,7 @@ static int nfs_export_list( lsmPluginPtr c, lsmNfsExport **exports[],
char *k = NULL;
struct allocated_fs *v = NULL;
GSList *result = NULL;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
g_hash_table_iter_init (&fs_iter, pd->fs);
@@ -2064,7 +2064,7 @@ static int nfs_export_list( lsmPluginPtr c, lsmNfsExport **exports[],
if( *count ) {
int i = 0;
GSList *s_iter = NULL;
- *exports = lsmNfsExportRecordAllocArray(*count);
+ *exports = lsmNfsExportRecordArrayAlloc(*count);
if( *exports ) {
for( s_iter = result; s_iter ; s_iter = g_slist_next(s_iter), i++) {
(*exports)[i] = lsmNfsExportRecordCopy(
@@ -2072,7 +2072,7 @@ static int nfs_export_list( lsmPluginPtr c, lsmNfsExport **exports[],
if( !(*exports)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmNfsExportRecordFreeArray(*exports, i);
+ lsmNfsExportRecordArrayFree(*exports, i);
*exports = NULL;
*count = 0;
break;
@@ -2107,7 +2107,7 @@ static int nfs_export_create( lsmPluginPtr c,
{
int rc = LSM_ERR_OK;
char auto_export[2048];
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *fs = g_hash_table_lookup(pd->fs, fs_id);
if( fs ) {
@@ -2150,7 +2150,7 @@ static int nfs_export_remove( lsmPluginPtr c, lsmNfsExport *e,
lsmFlag_t flags )
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *fs = g_hash_table_lookup(pd->fs,
lsmNfsExportFsIdGet(e));
@@ -2259,7 +2259,7 @@ int unload( lsmPluginPtr c, lsmFlag_t flags)
{
uint32_t i = 0;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if( pd ) {
g_hash_table_destroy(pd->jobs);
diff --git a/src/lsm_convert.cpp b/src/lsm_convert.cpp
index 630386e..fc0c140 100644
--- a/src/lsm_convert.cpp
+++ b/src/lsm_convert.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -223,7 +223,7 @@ lsmStringList *valueToStringList(Value &v)
if( il ) {
for( uint32_t i = 0; i < size; ++i ) {
- if(LSM_ERR_OK != lsmStringListSetElem(il, i, vl[i].asC_str())){
+ if(LSM_ERR_OK != lsmStringListElemSet(il, i, vl[i].asC_str())){
lsmStringListFree(il);
il = NULL;
break;
@@ -241,7 +241,7 @@ Value stringListToValue( lsmStringList *sl)
uint32_t size = lsmStringListSize(sl);
for(uint32_t i = 0; i < size; ++i ) {
- rc.push_back(Value(lsmStringListGetElem(sl, i)));
+ rc.push_back(Value(lsmStringListElemGet(sl, i)));
}
}
return Value(rc);
@@ -292,13 +292,13 @@ lsmAccessGroup **valueToAccessGroupList( Value &group, uint32_t *count )
*count = ag.size();
if( *count ) {
- rc = lsmAccessGroupRecordAllocArray(*count);
+ rc = lsmAccessGroupRecordArrayAlloc(*count);
if( rc ) {
uint32_t i;
for(i = 0; i < *count; ++i ) {
rc[i] = valueToAccessGroup(ag[i]);
if( !rc[i] ) {
- lsmAccessGroupRecordFreeArray(rc, i);
+ lsmAccessGroupRecordArrayFree(rc, i);
rc = NULL;
break;
}
@@ -353,12 +353,12 @@ lsmBlockRange **valueToBlockRangeList(Value &brl, uint32_t *count)
std::vector<Value> r = brl.asArray();
*count = r.size();
if( *count ) {
- rc = lsmBlockRangeRecordAllocArray(*count);
+ rc = lsmBlockRangeRecordArrayAlloc(*count);
if( rc ) {
for( uint32_t i = 0; i < *count; ++i ) {
rc[i] = valueToBlockRange(r[i]);
if( !rc[i] ) {
- lsmBlockRangeRecordFreeArray(rc, i);
+ lsmBlockRangeRecordArrayFree(rc, i);
rc = NULL;
break;
}
diff --git a/src/lsm_datatypes.cpp b/src/lsm_datatypes.cpp
index 3c065f6..29052e4 100644
--- a/src/lsm_datatypes.cpp
+++ b/src/lsm_datatypes.cpp
@@ -68,7 +68,7 @@ int lsmStringListAppend(lsmStringList *sl, const char *value)
return rc;
}
-int lsmStringListRemove(lsmStringList *sl, uint32_t index)
+int lsmStringListDelete(lsmStringList *sl, uint32_t index)
{
int rc = LSM_ERR_INVALID_SL;
@@ -84,7 +84,7 @@ int lsmStringListRemove(lsmStringList *sl, uint32_t index)
}
-int lsmStringListSetElem(lsmStringList *sl, uint32_t index,
+int lsmStringListElemSet(lsmStringList *sl, uint32_t index,
const char* value)
{
int rc = LSM_ERR_OK;
@@ -116,7 +116,7 @@ int lsmStringListSetElem(lsmStringList *sl, uint32_t index,
return rc;
}
-const char *lsmStringListGetElem(lsmStringList *sl, uint32_t index)
+const char *lsmStringListElemGet(lsmStringList *sl, uint32_t index)
{
if( LSM_IS_STRING_LIST(sl) ) {
if( index < sl->values->len ) {
@@ -179,8 +179,8 @@ lsmStringList *lsmStringListCopy(lsmStringList *src)
uint32_t i;
for( i = 0; i < size ; ++i ) {
- if ( LSM_ERR_OK != lsmStringListSetElem(dest, i,
- lsmStringListGetElem(src, i))) {
+ if ( LSM_ERR_OK != lsmStringListElemSet(dest, i,
+ lsmStringListElemGet(src, i))) {
/** We had an allocation failure setting an element item */
lsmStringListFree(dest);
dest = NULL;
@@ -411,37 +411,37 @@ int lsmErrorFree(lsmErrorPtr e)
return (type_t)error; \
-lsmErrorNumber lsmErrorGetNumber(lsmErrorPtr e)
+lsmErrorNumber lsmErrorNumberGet(lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(lsmErrorNumber, e, code, -1);
}
-lsmErrorDomain lsmErrorGetDomain(lsmErrorPtr e)
+lsmErrorDomain lsmErrorDomainGet(lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(lsmErrorDomain, e, domain, -1);
}
-lsmErrorLevel lsmErrorGetLevel(lsmErrorPtr e)
+lsmErrorLevel lsmErrorLevelGet(lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(lsmErrorLevel, e, level, -1);
}
-char* lsmErrorGetMessage( lsmErrorPtr e)
+char* lsmErrorMessageGet( lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(char*, e, message, NULL);
}
-char* lsmErrorGetException(lsmErrorPtr e)
+char* lsmErrorExceptionGet(lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(char*, e, exception, NULL);
}
-char* lsmErrorGetDebug(lsmErrorPtr e)
+char* lsmErrorDebugGet(lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(char*, e, debug, NULL);
}
-void* lsmErrorGetDebugData(lsmErrorPtr e, uint32_t *size)
+void* lsmErrorDebugDataGet(lsmErrorPtr e, uint32_t *size)
{
if (LSM_IS_ERROR(e) && size != NULL) {
if (e->debug_data) {
@@ -480,8 +480,8 @@ rtype *name(uint32_t size) \
* @param record_type Type to record
* @return None
*/
-#define CREATE_FREE_ARRAY_FUNC(name, free_func, record_type)\
-void name( record_type pa[], uint32_t size) \
+#define CREATE_FREE_ARRAY_FUNC(name, free_func, record_type, error)\
+int name( record_type pa[], uint32_t size) \
{ \
if (pa) { \
uint32_t i = 0; \
@@ -489,11 +489,13 @@ void name( record_type pa[], uint32_t size) \
free_func(pa[i]); \
} \
free(pa); \
+ return LSM_ERR_OK; \
} \
+ return error; \
}
-CREATE_ALLOC_ARRAY_FUNC(lsmPoolRecordAllocArray, lsmPool *)
+CREATE_ALLOC_ARRAY_FUNC(lsmPoolRecordArrayAlloc, lsmPool *)
lsmPool *lsmPoolRecordAlloc(const char *id, const char *name,
uint64_t totalSpace, uint64_t freeSpace, uint64_t status,
@@ -537,7 +539,7 @@ lsmPool * lsmPoolRecordCopy( lsmPool *toBeCopied)
return NULL;
}
-void lsmPoolRecordFree(lsmPool *p)
+int lsmPoolRecordFree(lsmPool *p)
{
if (LSM_IS_POOL(p)) {
p->magic = LSM_DEL_MAGIC(LSM_POOL_MAGIC);
@@ -556,10 +558,13 @@ void lsmPoolRecordFree(lsmPool *p)
p->system_id = NULL;
}
free(p);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_POOL;
}
-CREATE_FREE_ARRAY_FUNC(lsmPoolRecordFreeArray, lsmPoolRecordFree, lsmPool *)
+CREATE_FREE_ARRAY_FUNC(lsmPoolRecordArrayFree, lsmPoolRecordFree, lsmPool *,
+ LSM_ERR_INVALID_POOL)
char *lsmPoolNameGet(lsmPool *p)
{
@@ -609,7 +614,7 @@ char *lsmPoolSystemIdGet( lsmPool *p )
return NULL;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmInitiatorRecordAllocArray, lsmInitiator *)
+CREATE_ALLOC_ARRAY_FUNC(lsmInitiatorRecordArrayAlloc, lsmInitiator *)
lsmInitiator *lsmInitiatorRecordAlloc(lsmInitiatorType idType, const char* id,
const char* name)
@@ -638,7 +643,7 @@ lsmInitiator *lsmInitiatorRecordCopy(lsmInitiator *i)
return rc;
}
-void lsmInitiatorRecordFree(lsmInitiator *i)
+int lsmInitiatorRecordFree(lsmInitiator *i)
{
if( LSM_IS_INIT(i) ) {
i->magic = LSM_DEL_MAGIC(LSM_INIT_MAGIC);
@@ -649,11 +654,13 @@ void lsmInitiatorRecordFree(lsmInitiator *i)
i->name = NULL;
}
free(i);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_INIT;
}
-CREATE_FREE_ARRAY_FUNC( lsmInitiatorRecordFreeArray, lsmInitiatorRecordFree,
- lsmInitiator *)
+CREATE_FREE_ARRAY_FUNC( lsmInitiatorRecordArrayFree, lsmInitiatorRecordFree,
+ lsmInitiator *, LSM_ERR_INVALID_INIT)
lsmInitiatorType lsmInitiatorTypeGet(lsmInitiator *i)
{
@@ -679,7 +686,7 @@ char *lsmInitiatorNameGet(lsmInitiator *i)
return NULL;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmVolumeRecordAllocArray, lsmVolume *)
+CREATE_ALLOC_ARRAY_FUNC(lsmVolumeRecordArrayAlloc, lsmVolume *)
lsmVolume * lsmVolumeRecordAlloc(const char *id, const char *name,
const char *vpd83, uint64_t blockSize,
@@ -707,7 +714,7 @@ lsmVolume * lsmVolumeRecordAlloc(const char *id, const char *name,
return rc;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmDiskRecordAllocArray, lsmDisk *)
+CREATE_ALLOC_ARRAY_FUNC(lsmDiskRecordArrayAlloc, lsmDisk *)
lsmDisk *lsmDiskRecordAlloc(const char *id, const char *name,
lsmDiskType disk_type, uint64_t block_size, uint64_t block_count,
@@ -733,7 +740,7 @@ lsmDisk *lsmDiskRecordAlloc(const char *id, const char *name,
return rc;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmSystemRecordAllocArray, lsmSystem *)
+CREATE_ALLOC_ARRAY_FUNC(lsmSystemRecordArrayAlloc, lsmSystem *)
lsmSystem *lsmSystemRecordAlloc( const char *id, const char *name,
uint32_t status)
@@ -752,7 +759,7 @@ lsmSystem *lsmSystemRecordAlloc( const char *id, const char *name,
return rc;
}
-void lsmSystemRecordFree(lsmSystem *s)
+int lsmSystemRecordFree(lsmSystem *s)
{
if( LSM_IS_SYSTEM(s) ) {
s->magic = LSM_DEL_MAGIC(LSM_SYSTEM_MAGIC);
@@ -768,10 +775,13 @@ void lsmSystemRecordFree(lsmSystem *s)
}
free(s);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_SYSTEM;
}
-CREATE_FREE_ARRAY_FUNC(lsmSystemRecordFreeArray, lsmSystemRecordFree, lsmSystem *)
+CREATE_FREE_ARRAY_FUNC(lsmSystemRecordArrayFree, lsmSystemRecordFree,
+ lsmSystem *, LSM_ERR_INVALID_SYSTEM)
lsmSystem *lsmSystemRecordCopy(lsmSystem *s)
{
@@ -817,7 +827,7 @@ lsmVolume *lsmVolumeRecordCopy(lsmVolume *vol)
return rc;
}
-void lsmVolumeRecordFree(lsmVolume *v)
+int lsmVolumeRecordFree(lsmVolume *v)
{
if ( LSM_IS_VOL(v) ) {
v->magic = LSM_DEL_MAGIC(LSM_VOL_MAGIC);
@@ -848,11 +858,13 @@ void lsmVolumeRecordFree(lsmVolume *v)
}
free(v);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_VOL;
}
-CREATE_FREE_ARRAY_FUNC( lsmVolumeRecordFreeArray, lsmVolumeRecordFree,
- lsmVolume *)
+CREATE_FREE_ARRAY_FUNC( lsmVolumeRecordArrayFree, lsmVolumeRecordFree,
+ lsmVolume *, LSM_ERR_INVALID_VOL)
lsmDisk *lsmDiskRecordCopy(lsmDisk *disk)
{
@@ -864,7 +876,7 @@ lsmDisk *lsmDiskRecordCopy(lsmDisk *disk)
return NULL;
}
-void lsmDiskRecordFree(lsmDisk *d)
+int lsmDiskRecordFree(lsmDisk *d)
{
if ( LSM_IS_DISK(d) ) {
d->magic = LSM_DEL_MAGIC(LSM_DISK_MAGIC);
@@ -882,11 +894,13 @@ void lsmDiskRecordFree(lsmDisk *d)
d->optional_data = NULL;
free(d);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_DISK;
}
-CREATE_FREE_ARRAY_FUNC( lsmDiskRecordFreeArray, lsmDiskRecordFree,
- lsmDisk *)
+CREATE_FREE_ARRAY_FUNC( lsmDiskRecordArrayFree, lsmDiskRecordFree,
+ lsmDisk *, LSM_ERR_INVALID_DISK)
/* We would certainly expand this to encompass the entire function */
#define MEMBER_GET(x, validation, member, error) \
@@ -1003,7 +1017,7 @@ lsmOptionalData *lsmDiskOptionalDataGet(lsmDisk *d)
MEMBER_GET(d, LSM_IS_DISK, optional_data, NULL);
}
-CREATE_ALLOC_ARRAY_FUNC(lsmAccessGroupRecordAllocArray, lsmAccessGroup *)
+CREATE_ALLOC_ARRAY_FUNC(lsmAccessGroupRecordArrayAlloc, lsmAccessGroup *)
lsmAccessGroup *lsmAccessGroupRecordAlloc(const char *id,
const char *name,
@@ -1039,7 +1053,7 @@ lsmAccessGroup *lsmAccessGroupRecordCopy( lsmAccessGroup *ag )
return rc;
}
-void lsmAccessGroupRecordFree(lsmAccessGroup *ag)
+int lsmAccessGroupRecordFree(lsmAccessGroup *ag)
{
if( LSM_IS_ACCESS_GROUP(ag) ) {
ag->magic = LSM_DEL_MAGIC(LSM_ACCESS_GROUP_MAGIC);
@@ -1048,11 +1062,13 @@ void lsmAccessGroupRecordFree(lsmAccessGroup *ag)
free(ag->system_id);
lsmStringListFree(ag->initiators);
free(ag);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_ACCESS_GROUP;
}
-CREATE_FREE_ARRAY_FUNC(lsmAccessGroupRecordFreeArray, lsmAccessGroupRecordFree,
- lsmAccessGroup *)
+CREATE_FREE_ARRAY_FUNC(lsmAccessGroupRecordArrayFree, lsmAccessGroupRecordFree,
+ lsmAccessGroup *, LSM_ERR_INVALID_ACCESS_GROUP)
const char *lsmAccessGroupIdGet( lsmAccessGroup *group )
{
@@ -1095,7 +1111,7 @@ void lsmAccessGroupInitiatorIdSet( lsmAccessGroup *group, lsmStringList *il)
}
}
-lsmErrorPtr lsmErrorGetLast(lsmConnect *c)
+lsmErrorPtr lsmErrorLastGet(lsmConnect *c)
{
if( LSM_IS_CONNECT(c) ) {
lsmErrorPtr e = c->error;
@@ -1121,12 +1137,14 @@ lsmBlockRange *lsmBlockRangeRecordAlloc(uint64_t source_start,
return rc;
}
-void lsmBlockRangeRecordFree( lsmBlockRange *br )
+int lsmBlockRangeRecordFree( lsmBlockRange *br )
{
if( LSM_IS_BLOCK_RANGE(br) ) {
br->magic = LSM_DEL_MAGIC(LSM_BLOCK_RANGE_MAGIC);
free(br);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_BLOCK_RANGE;
}
lsmBlockRange *lsmBlockRangeRecordCopy( lsmBlockRange *source )
@@ -1141,9 +1159,9 @@ lsmBlockRange *lsmBlockRangeRecordCopy( lsmBlockRange *source )
return dest;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmBlockRangeRecordAllocArray, lsmBlockRange *)
-CREATE_FREE_ARRAY_FUNC(lsmBlockRangeRecordFreeArray, lsmBlockRangeRecordFree,
- lsmBlockRange *)
+CREATE_ALLOC_ARRAY_FUNC(lsmBlockRangeRecordArrayAlloc, lsmBlockRange *)
+CREATE_FREE_ARRAY_FUNC(lsmBlockRangeRecordArrayFree, lsmBlockRangeRecordFree,
+ lsmBlockRange *, LSM_ERR_INVALID_BLOCK_RANGE)
uint64_t lsmBlockRangeSourceStartGet(lsmBlockRange *br)
@@ -1186,7 +1204,7 @@ lsmFs * lsmFsRecordAlloc( const char *id, const char *name,
return rc;
}
-void lsmFsRecordFree( lsmFs *fs)
+int lsmFsRecordFree( lsmFs *fs)
{
if( LSM_IS_FS(fs) ) {
fs->magic = LSM_DEL_MAGIC(LSM_FS_MAGIC);
@@ -1195,7 +1213,9 @@ void lsmFsRecordFree( lsmFs *fs)
free(fs->pool_id);
free(fs->system_id);
free(fs);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_FS;
}
lsmFs *lsmFsRecordCopy(lsmFs *source)
@@ -1211,8 +1231,9 @@ lsmFs *lsmFsRecordCopy(lsmFs *source)
return dest;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmFsRecordAllocArray, lsmFs *)
-CREATE_FREE_ARRAY_FUNC(lsmFsRecordFreeArray, lsmFsRecordFree, lsmFs *)
+CREATE_ALLOC_ARRAY_FUNC(lsmFsRecordArrayAlloc, lsmFs *)
+CREATE_FREE_ARRAY_FUNC(lsmFsRecordArrayFree, lsmFsRecordFree, lsmFs *,
+ LSM_ERR_INVALID_FS)
const char *lsmFsIdGet(lsmFs *fs)
{
@@ -1272,18 +1293,21 @@ lsmSs *lsmSsRecordCopy(lsmSs *source)
return rc;
}
-void lsmSsRecordFree( lsmSs *ss)
+int lsmSsRecordFree( lsmSs *ss)
{
if( LSM_IS_SS(ss) ) {
ss->magic = LSM_DEL_MAGIC(LSM_SS_MAGIC);
free(ss->id);
free(ss->name);
free(ss);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_SS;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmSsRecordAllocArray, lsmSs *)
-CREATE_FREE_ARRAY_FUNC(lsmSsRecordFreeArray, lsmSsRecordFree, lsmSs *)
+CREATE_ALLOC_ARRAY_FUNC(lsmSsRecordArrayAlloc, lsmSs *)
+CREATE_FREE_ARRAY_FUNC(lsmSsRecordArrayFree, lsmSsRecordFree, lsmSs *,
+ LSM_ERR_INVALID_SS)
const char *lsmSsIdGet(lsmSs *ss)
{
@@ -1339,7 +1363,7 @@ lsmNfsExport *lsmNfsExportRecordAlloc( const char *id,
return rc;
}
-void lsmNfsExportRecordFree( lsmNfsExport *exp )
+int lsmNfsExportRecordFree( lsmNfsExport *exp )
{
if( LSM_IS_NFS_EXPORT(exp) ) {
exp->magic = LSM_DEL_MAGIC(LSM_NFS_EXPORT_MAGIC);
@@ -1353,7 +1377,9 @@ void lsmNfsExportRecordFree( lsmNfsExport *exp )
free(exp->options);
free(exp);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_NFS;
}
@@ -1367,9 +1393,9 @@ lsmNfsExport *lsmNfsExportRecordCopy( lsmNfsExport *s )
return NULL;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmNfsExportRecordAllocArray, lsmNfsExport *)
-CREATE_FREE_ARRAY_FUNC(lsmNfsExportRecordFreeArray, lsmNfsExportRecordFree,
- lsmNfsExport *)
+CREATE_ALLOC_ARRAY_FUNC(lsmNfsExportRecordArrayAlloc, lsmNfsExport *)
+CREATE_FREE_ARRAY_FUNC(lsmNfsExportRecordArrayFree, lsmNfsExportRecordFree,
+ lsmNfsExport *, LSM_ERR_INVALID_NFS)
const char *lsmNfsExportIdGet( lsmNfsExport *exp )
{
@@ -1617,13 +1643,15 @@ lsmStorageCapabilities *lsmCapabilityRecordAlloc(const char *value)
return rc;
}
-void lsmCapabilityRecordFree(lsmStorageCapabilities *cap)
+int lsmCapabilityRecordFree(lsmStorageCapabilities *cap)
{
if( LSM_IS_CAPABILITIY(cap) ) {
cap->magic = LSM_DEL_MAGIC(LSM_CAPABILITIES_MAGIC);
free(cap->cap);
free(cap);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_CAPABILITY;
}
char* capabilityString(lsmStorageCapabilities *c)
@@ -1676,7 +1704,7 @@ lsmOptionalData *lsmOptionalDataRecordCopy(lsmOptionalData *src)
return dest;
}
-void lsmOptionalDataRecordFree(lsmOptionalData *op)
+int lsmOptionalDataRecordFree(lsmOptionalData *op)
{
if( LSM_IS_OPTIONAL_DATA(op) ) {
op->magic = LSM_DEL_MAGIC(LSM_OPTIONAL_DATA_MAGIC);
@@ -1686,7 +1714,9 @@ void lsmOptionalDataRecordFree(lsmOptionalData *op)
}
free(op);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_OPTIONAL_DATA;
}
int lsmOptionalDataListGet(lsmOptionalData *op, lsmStringList **l,
diff --git a/src/lsm_mgmt.cpp b/src/lsm_mgmt.cpp
index 289e598..4bc1c37 100644
--- a/src/lsm_mgmt.cpp
+++ b/src/lsm_mgmt.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -205,7 +205,7 @@ int lsmConnectClose(lsmConnect *c, lsmFlag_t flags)
return rc;
}
-int lsmPluginGetInfo(lsmConnect *c, char **desc,
+int lsmPluginInfoGet(lsmConnect *c, char **desc,
char **version, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
@@ -250,7 +250,7 @@ int lsmPluginGetInfo(lsmConnect *c, char **desc,
return rc;
}
-int lsmGetAvailablePlugins(const char *sep,
+int lsmAvailablePluginsList(const char *sep,
lsmStringList **plugins,
lsmFlag_t flags)
{
@@ -289,7 +289,7 @@ int lsmGetAvailablePlugins(const char *sep,
rc = loadDriver(c, dp->d_name, NULL, 30000, &e, 0, 0);
if( LSM_ERR_OK == rc) {
// Get the plugin information
- rc = lsmPluginGetInfo(c, &desc, &version, 0);
+ rc = lsmPluginInfoGet(c, &desc, &version, 0);
if( LSM_ERR_OK == rc) {
int format = asprintf(&s, "%s%s%s", desc, sep, version);
free(desc);
@@ -351,7 +351,7 @@ int lsmGetAvailablePlugins(const char *sep,
return rc;
}
-int lsmConnectSetTimeout(lsmConnect *c, uint32_t timeout, lsmFlag_t flags)
+int lsmConnectTimeoutSet(lsmConnect *c, uint32_t timeout, lsmFlag_t flags)
{
CONN_SETUP(c);
@@ -369,7 +369,7 @@ int lsmConnectSetTimeout(lsmConnect *c, uint32_t timeout, lsmFlag_t flags)
return rpc(c, "set_time_out", parameters, response);
}
-int lsmConnectGetTimeout(lsmConnect *c, uint32_t *timeout, lsmFlag_t flags)
+int lsmConnectTimeoutGet(lsmConnect *c, uint32_t *timeout, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);
@@ -616,7 +616,7 @@ int lsmPoolList(lsmConnect *c, lsmPool **poolArray[],
*count = pools.size();
if( pools.size() ) {
- *poolArray = lsmPoolRecordAllocArray(pools.size());
+ *poolArray = lsmPoolRecordArrayAlloc(pools.size());
for( size_t i = 0; i < pools.size(); ++i ) {
(*poolArray)[i] = valueToPool(pools[i]);
@@ -627,7 +627,7 @@ int lsmPoolList(lsmConnect *c, lsmPool **poolArray[],
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *poolArray && *count ) {
- lsmPoolRecordFreeArray(*poolArray, *count);
+ lsmPoolRecordArrayFree(*poolArray, *count);
*poolArray = NULL;
*count = 0;
}
@@ -646,7 +646,7 @@ static int get_initiator_array(lsmConnect *c, int rc, Value &response,
if( inits.size() ) {
- *initiators = lsmInitiatorRecordAllocArray(inits.size());
+ *initiators = lsmInitiatorRecordArrayAlloc(inits.size());
if( *initiators ) {
for( size_t i = 0; i < inits.size(); ++i ) {
@@ -659,7 +659,7 @@ static int get_initiator_array(lsmConnect *c, int rc, Value &response,
}
} catch ( const ValueException &ve ) {
if( *initiators && *count ) {
- lsmInitiatorRecordFreeArray(*initiators, *count);
+ lsmInitiatorRecordArrayFree(*initiators, *count);
*initiators = NULL;
*count = 0;
}
@@ -699,7 +699,7 @@ static int get_volume_array(lsmConnect *c, int rc, Value response,
*count = vol.size();
if( vol.size() ) {
- *volumes = lsmVolumeRecordAllocArray(vol.size());
+ *volumes = lsmVolumeRecordArrayAlloc(vol.size());
if( *volumes ){
for( size_t i = 0; i < vol.size(); ++i ) {
@@ -712,7 +712,7 @@ static int get_volume_array(lsmConnect *c, int rc, Value response,
}
} catch( const ValueException &ve) {
if( *volumes && *count ) {
- lsmVolumeRecordFreeArray(*volumes, *count);
+ lsmVolumeRecordArrayFree(*volumes, *count);
*volumes = NULL;
*count = 0;
}
@@ -753,7 +753,7 @@ static int get_disk_array(lsmConnect *c, int rc, Value &response,
*count = d.size();
if( d.size() ) {
- *disks = lsmDiskRecordAllocArray(d.size());
+ *disks = lsmDiskRecordArrayAlloc(d.size());
if( *disks ){
for( size_t i = 0; i < d.size(); ++i ) {
@@ -768,7 +768,7 @@ static int get_disk_array(lsmConnect *c, int rc, Value &response,
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *disks && *count ) {
- lsmDiskRecordFreeArray(*disks, *count);
+ lsmDiskRecordArrayFree(*disks, *count);
*disks = NULL;
*count = 0;
}
@@ -1268,7 +1268,7 @@ int lsmAccessGroupCreate(lsmConnect *c, const char *name,
return rc;
}
-int lsmAccessGroupDel(lsmConnect *c, lsmAccessGroup *group, lsmFlag_t flags)
+int lsmAccessGroupDelete(lsmConnect *c, lsmAccessGroup *group, lsmFlag_t flags)
{
CONN_SETUP(c);
@@ -1290,7 +1290,7 @@ int lsmAccessGroupDel(lsmConnect *c, lsmAccessGroup *group, lsmFlag_t flags)
return rpc(c, "access_group_del", parameters, response);
}
-int lsmAccessGroupAddInitiator(lsmConnect *c,
+int lsmAccessGroupInitiatorAdd(lsmConnect *c,
lsmAccessGroup *group,
const char *initiator_id,
lsmInitiatorType id_type,
@@ -1319,7 +1319,7 @@ int lsmAccessGroupAddInitiator(lsmConnect *c,
return rpc(c, "access_group_add_initiator", parameters, response);
}
-int lsmAccessGroupDelInitiator(lsmConnect *c, lsmAccessGroup *group,
+int lsmAccessGroupInitiatorDelete(lsmConnect *c, lsmAccessGroup *group,
const char* initiator_id, lsmFlag_t flags)
{
CONN_SETUP(c);
@@ -1435,7 +1435,7 @@ int lsmVolumesAccessibleByAccessGroup(lsmConnect *c,
*count = vol.size();
if( vol.size() ) {
- *volumes = lsmVolumeRecordAllocArray(vol.size());
+ *volumes = lsmVolumeRecordArrayAlloc(vol.size());
for( size_t i = 0; i < vol.size(); ++i ) {
(*volumes)[i] = valueToVolume(vol[i]);
@@ -1446,7 +1446,7 @@ int lsmVolumesAccessibleByAccessGroup(lsmConnect *c,
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *volumes && *count ) {
- lsmVolumeRecordFreeArray(*volumes, *count);
+ lsmVolumeRecordArrayFree(*volumes, *count);
*volumes = NULL;
*count = 0;
}
@@ -1569,13 +1569,13 @@ int lsmSystemList(lsmConnect *c, lsmSystem **systems[],
*systemCount = sys.size();
if( sys.size() ) {
- *systems = lsmSystemRecordAllocArray(sys.size());
+ *systems = lsmSystemRecordArrayAlloc(sys.size());
if( *systems ) {
for( size_t i = 0; i < sys.size(); ++i ) {
(*systems)[i] = valueToSystem(sys[i]);
if( !(*systems)[i] ) {
- lsmSystemRecordFreeArray(*systems, i);
+ lsmSystemRecordArrayFree(*systems, i);
rc = LSM_ERR_NO_MEMORY;
break;
}
@@ -1589,7 +1589,7 @@ int lsmSystemList(lsmConnect *c, lsmSystem **systems[],
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *systems ) {
- lsmSystemRecordFreeArray( *systems, *systemCount);
+ lsmSystemRecordArrayFree( *systems, *systemCount);
*systems = NULL;
*systemCount = 0;
}
@@ -1620,7 +1620,7 @@ int lsmFsList(lsmConnect *c, lsmFs **fs[], uint32_t *fsCount,
*fsCount = sys.size();
if( sys.size() ) {
- *fs = lsmFsRecordAllocArray(sys.size());
+ *fs = lsmFsRecordArrayAlloc(sys.size());
if( *fs ) {
for( size_t i = 0; i < sys.size(); ++i ) {
@@ -1635,7 +1635,7 @@ int lsmFsList(lsmConnect *c, lsmFs **fs[], uint32_t *fsCount,
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *fs && *fsCount) {
- lsmFsRecordFreeArray(*fs, *fsCount);
+ lsmFsRecordArrayFree(*fs, *fsCount);
*fs = NULL;
*fsCount = 0;
}
@@ -1900,7 +1900,7 @@ int lsmFsSsList(lsmConnect *c, lsmFs *fs, lsmSs **ss[],
*ssCount = sys.size();
if( sys.size() ) {
- *ss = lsmSsRecordAllocArray(sys.size());
+ *ss = lsmSsRecordArrayAlloc(sys.size());
if( *ss ) {
for( size_t i = 0; i < sys.size(); ++i ) {
@@ -1915,7 +1915,7 @@ int lsmFsSsList(lsmConnect *c, lsmFs *fs, lsmSs **ss[],
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *ss && *ssCount ) {
- lsmSsRecordFreeArray(*ss, *ssCount);
+ lsmSsRecordArrayFree(*ss, *ssCount);
*ss = NULL;
*ssCount = 0;
}
@@ -2060,7 +2060,7 @@ int lsmNfsList( lsmConnect *c, lsmNfsExport **exports[], uint32_t *count,
*count = exps.size();
if( *count ) {
- *exports = lsmNfsExportRecordAllocArray(*count);
+ *exports = lsmNfsExportRecordArrayAlloc(*count);
if( *exports ) {
for( size_t i = 0; i < *count; ++i ) {
@@ -2075,7 +2075,7 @@ int lsmNfsList( lsmConnect *c, lsmNfsExport **exports[], uint32_t *count,
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *exports && *count ) {
- lsmNfsExportRecordFreeArray( *exports, *count );
+ lsmNfsExportRecordArrayFree( *exports, *count );
*exports = NULL;
*count = 0;
}
@@ -2145,7 +2145,7 @@ int lsmNfsExportFs( lsmConnect *c,
return rc;
}
-int lsmNfsExportRemove( lsmConnect *c, lsmNfsExport *e, lsmFlag_t flags)
+int lsmNfsExportDelete( lsmConnect *c, lsmNfsExport *e, lsmFlag_t flags)
{
CONN_SETUP(c);
diff --git a/src/lsm_plugin_ipc.cpp b/src/lsm_plugin_ipc.cpp
index c68a742..01493c5 100644
--- a/src/lsm_plugin_ipc.cpp
+++ b/src/lsm_plugin_ipc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -117,7 +117,7 @@ int lsmRegisterPluginV1(lsmPluginPtr plug,
return rc;
}
-void *lsmGetPrivateData(lsmPluginPtr plug)
+void *lsmPrivateDataGet(lsmPluginPtr plug)
{
if (!LSM_IS_PLUGIN(plug)) {
return NULL;
@@ -414,7 +414,7 @@ static int handle_system_list(lsmPluginPtr p, Value ¶ms,
result.push_back(systemToValue(systems[i]));
}
- lsmSystemRecordFreeArray(systems, count);
+ lsmSystemRecordArrayFree(systems, count);
systems = NULL;
response = Value(result);
}
@@ -442,7 +442,7 @@ static int handle_pools(lsmPluginPtr p, Value ¶ms, Value &response)
result.push_back(poolToValue(pools[i]));
}
- lsmPoolRecordFreeArray(pools, count);
+ lsmPoolRecordArrayFree(pools, count);
pools = NULL;
response = Value(result);
}
@@ -495,7 +495,7 @@ static void get_initiators(int rc, lsmInitiator **inits, uint32_t count,
result.push_back(initiatorToValue(inits[i]));
}
- lsmInitiatorRecordFreeArray(inits, count);
+ lsmInitiatorRecordArrayFree(inits, count);
inits = NULL;
resp = Value(result);
}
@@ -530,7 +530,7 @@ static void get_volumes(int rc, lsmVolume **vols, uint32_t count,
result.push_back(volumeToValue(vols[i]));
}
- lsmVolumeRecordFreeArray(vols, count);
+ lsmVolumeRecordArrayFree(vols, count);
vols = NULL;
response = Value(result);
}
@@ -566,7 +566,7 @@ static void get_disks(int rc, lsmDisk **disks, uint32_t count, Value &response)
result.push_back(diskToValue(disks[i]));
}
- lsmDiskRecordFreeArray(disks, count);
+ lsmDiskRecordArrayFree(disks, count);
disks = NULL;
response = Value(result);
}
@@ -808,7 +808,7 @@ static int handle_volume_replicate_range(lsmPluginPtr p, Value ¶ms,
lsmVolumeRecordFree(source);
lsmVolumeRecordFree(dest);
- lsmBlockRangeRecordFreeArray(ranges, range_count);
+ lsmBlockRangeRecordArrayFree(ranges, range_count);
} else {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
@@ -909,7 +909,7 @@ static int ag_list(lsmPluginPtr p, Value ¶ms, Value &response)
response = accessGroupListToValue(groups, count);
/* Free the memory */
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
}
} else {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
@@ -1148,7 +1148,7 @@ static int vol_accessible_by_ag(lsmPluginPtr p, Value ¶ms, Value &response)
}
lsmAccessGroupRecordFree(ag);
- lsmVolumeRecordFreeArray(vols, count);
+ lsmVolumeRecordArrayFree(vols, count);
vols = NULL;
} else {
rc = LSM_ERR_NO_MEMORY;
@@ -1190,7 +1190,7 @@ static int ag_granted_to_volume(lsmPluginPtr p, Value ¶ms, Value &response)
}
lsmVolumeRecordFree(volume);
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
groups = NULL;
} else {
rc = LSM_ERR_NO_MEMORY;
@@ -1294,7 +1294,7 @@ static int fs(lsmPluginPtr p, Value ¶ms, Value &response)
}
response = Value(result);
- lsmFsRecordFreeArray(fs, count);
+ lsmFsRecordArrayFree(fs, count);
fs = NULL;
}
} else {
@@ -1650,7 +1650,7 @@ static int ss_list(lsmPluginPtr p, Value ¶ms, Value &response)
lsmFsRecordFree(fs);
fs = NULL;
- lsmSsRecordFreeArray(ss, count);
+ lsmSsRecordArrayFree(ss, count);
ss = NULL;
}
}
@@ -1844,7 +1844,7 @@ static int exports(lsmPluginPtr p, Value ¶ms, Value &response)
}
response = Value(result);
- lsmNfsExportRecordFreeArray(exports, count);
+ lsmNfsExportRecordArrayFree(exports, count);
exports = NULL;
count = 0;
}
diff --git a/test/tester.c b/test/tester.c
index ac37bdd..52fddfb 100644
--- a/test/tester.c
+++ b/test/tester.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -104,7 +104,7 @@ lsmPool *getTestPool(lsmConnect *c)
for(i = 0; i < count; ++i ) {
if(strcmp(lsmPoolNameGet(pools[i]), "lsm_test_aggr") == 0 ) {
test_pool = lsmPoolRecordCopy(pools[i]);
- lsmPoolRecordFreeArray(pools, count);
+ lsmPoolRecordArrayFree(pools, count);
break;
}
}
@@ -116,8 +116,8 @@ void dump_error(lsmErrorPtr e)
{
if (e != NULL) {
printf("Error msg= %s - exception %s - debug %s\n",
- lsmErrorGetMessage(e),
- lsmErrorGetException(e), lsmErrorGetDebug(e));
+ lsmErrorMessageGet(e),
+ lsmErrorExceptionGet(e), lsmErrorDebugGet(e));
lsmErrorFree(e);
e = NULL;
@@ -159,8 +159,8 @@ char *error(lsmErrorPtr e)
if( e != NULL ) {
snprintf(eb, sizeof(eb), "Error msg= %s - exception %s - debug %s",
- lsmErrorGetMessage(e),
- lsmErrorGetException(e), lsmErrorGetDebug(e));
+ lsmErrorMessageGet(e),
+ lsmErrorExceptionGet(e), lsmErrorDebugGet(e));
lsmErrorFree(e);
e = NULL;
} else {
@@ -177,14 +177,14 @@ void wait_for_job(lsmConnect *c, char **job_id)
do {
rc = lsmJobStatusGet(c, *job_id, &status, &pc, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "lsmJobStatusVolumeGet = %d (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "lsmJobStatusVolumeGet = %d (%s)", rc, error(lsmErrorLastGet(c)));
printf("GENERIC: Job %s in progress, %d done, status = %d\n", *job_id, pc, status);
usleep(POLL_SLEEP);
} while( status == LSM_JOB_INPROGRESS );
rc = lsmJobFree(c, job_id, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorLastGet(c)));
fail_unless( LSM_JOB_COMPLETE == status);
fail_unless( 100 == pc);
@@ -200,7 +200,7 @@ lsmVolume *wait_for_job_vol(lsmConnect *c, char **job_id)
do {
rc = lsmJobStatusVolumeGet(c, *job_id, &status, &pc, &vol, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorLastGet(c)));
printf("VOLUME: Job %s in progress, %d done, status = %d\n", *job_id, pc, status);
usleep(POLL_SLEEP);
@@ -209,7 +209,7 @@ lsmVolume *wait_for_job_vol(lsmConnect *c, char **job_id)
printf("Volume complete: Job %s percent %d done, status = %d, rc=%d\n", *job_id, pc, status, rc);
rc = lsmJobFree(c, job_id, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorLastGet(c)));
fail_unless( LSM_JOB_COMPLETE == status);
fail_unless( 100 == pc);
@@ -226,14 +226,14 @@ lsmFs *wait_for_job_fs(lsmConnect *c, char **job_id)
do {
rc = lsmJobStatusFsGet(c, *job_id, &status, &pc, &fs, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorLastGet(c)));
printf("FS: Job %s in progress, %d done, status = %d\n", *job_id, pc, status);
usleep(POLL_SLEEP);
} while( status == LSM_JOB_INPROGRESS );
rc = lsmJobFree(c, job_id, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorLastGet(c)));
fail_unless( LSM_JOB_COMPLETE == status);
fail_unless( 100 == pc);
@@ -250,14 +250,14 @@ lsmSs *wait_for_job_ss(lsmConnect *c, char **job_id)
do {
rc = lsmJobStatusSsGet(c, *job_id, &status, &pc, &ss, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorLastGet(c)));
printf("SS: Job %s in progress, %d done, status = %d\n", *job_id, pc, status);
usleep(POLL_SLEEP);
} while( status == LSM_JOB_INPROGRESS );
rc = lsmJobFree(c, job_id, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorLastGet(c)));
fail_unless( LSM_JOB_COMPLETE == status);
fail_unless( 100 == pc);
@@ -279,8 +279,8 @@ int compare_string_lists(lsmStringList *l, lsmStringList *r)
}
for( i = 0; i < lsmStringListSize(l); ++i ) {
- if( strcmp(lsmStringListGetElem(l, i),
- lsmStringListGetElem(r, i)) != 0) {
+ if( strcmp(lsmStringListElemGet(l, i),
+ lsmStringListElemGet(r, i)) != 0) {
return 1;
}
}
@@ -305,7 +305,7 @@ void create_volumes(lsmConnect *c, lsmPool *p, int num)
LSM_PROVISION_DEFAULT, &n, &job, LSM_FLAG_RSVD);
fail_unless( vc == LSM_ERR_OK || vc == LSM_ERR_JOB_STARTED,
- "lsmVolumeCreate %d (%s)", vc, error(lsmErrorGetLast(c)));
+ "lsmVolumeCreate %d (%s)", vc, error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == vc ) {
n = wait_for_job_vol(c, &job);
@@ -330,7 +330,7 @@ lsmSystem *get_system()
if( LSM_ERR_OK == rc && count) {
rc_sys = lsmSystemRecordCopy(sys[0]);
- lsmSystemRecordFreeArray(sys, count);
+ lsmSystemRecordArrayFree(sys, count);
}
return rc_sys;
}
@@ -347,15 +347,15 @@ START_TEST(test_smoke_test)
uint32_t tmo = 0;
//Set timeout.
- rc = lsmConnectSetTimeout(c, set_tmo, LSM_FLAG_RSVD);
+ rc = lsmConnectTimeoutSet(c, set_tmo, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_OK == rc, "lsmConnectSetTimeout %d (%s)", rc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
//Get time-out.
- rc = lsmConnectGetTimeout(c, &tmo, LSM_FLAG_RSVD);
+ rc = lsmConnectTimeoutGet(c, &tmo, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_OK == rc, "Error getting tmo %d (%s)", rc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
fail_unless( set_tmo == tmo, " %u != %u", set_tmo, tmo );
@@ -366,7 +366,7 @@ START_TEST(test_smoke_test)
//Get pool list
rc = lsmPoolList(c, &pools, &poolCount, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_OK == rc, "lsmPoolList rc =%d (%s)", rc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
//Check pool count
count = poolCount;
@@ -404,7 +404,7 @@ START_TEST(test_smoke_test)
LSM_PROVISION_DEFAULT, &n, &job, LSM_FLAG_RSVD);
fail_unless( vc == LSM_ERR_OK || vc == LSM_ERR_JOB_STARTED,
- "lsmVolumeCreate %d (%s)", vc, error(lsmErrorGetLast(c)));
+ "lsmVolumeCreate %d (%s)", vc, error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == vc ) {
n = wait_for_job_vol(c, &job);
@@ -426,7 +426,7 @@ START_TEST(test_smoke_test)
}
- lsmBlockRange **range = lsmBlockRangeRecordAllocArray(3);
+ lsmBlockRange **range = lsmBlockRangeRecordArrayAlloc(3);
fail_unless(NULL != range);
@@ -469,13 +469,13 @@ START_TEST(test_smoke_test)
} else {
if( LSM_ERR_OK != rep_range ) {
- dump_error(lsmErrorGetLast(c));
+ dump_error(lsmErrorLastGet(c));
}
fail_unless(LSM_ERR_OK == rep_range);
}
- lsmBlockRangeRecordFreeArray(range, 3);
+ lsmBlockRangeRecordArrayFree(range, 3);
int online = lsmVolumeOffline(c, n, LSM_FLAG_RSVD);
fail_unless( LSM_ERR_OK == online);
@@ -487,7 +487,7 @@ START_TEST(test_smoke_test)
int delRc = lsmVolumeDelete(c, n, &jobDel, LSM_FLAG_RSVD);
fail_unless( delRc == LSM_ERR_OK || delRc == LSM_ERR_JOB_STARTED,
- "lsmVolumeDelete %d (%s)", rc, error(lsmErrorGetLast(c)));
+ "lsmVolumeDelete %d (%s)", rc, error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == delRc ) {
wait_for_job_vol(c, &jobDel);
@@ -501,7 +501,7 @@ START_TEST(test_smoke_test)
rc = lsmInitiatorList(c, &inits, &count, LSM_FLAG_RSVD);
fail_unless( LSM_ERR_OK == rc, "lsmInitiatorList %d (%s)", rc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
fail_unless( count == 0, "Count 0 != %d\n", count);
@@ -515,7 +515,7 @@ START_TEST(test_smoke_test)
fail_unless( LSM_ERR_OK == rc , "lsmVolumeList %d (%s)",rc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
for (i = 0; i < count; ++i) {
printf("%s - %s - %s - %"PRIu64" - %"PRIu64" - %x\n",
@@ -541,7 +541,7 @@ START_TEST(test_smoke_test)
fail_unless(resizeRc == LSM_ERR_OK || resizeRc == LSM_ERR_JOB_STARTED,
"lsmVolumeResize %d (%s)", resizeRc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == resizeRc ) {
resized = wait_for_job_vol(c, &resizeJob);
@@ -557,7 +557,7 @@ START_TEST(test_smoke_test)
fail_unless(repRc == LSM_ERR_OK || repRc == LSM_ERR_JOB_STARTED,
"lsmVolumeReplicate %d (%s)", repRc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == repRc ) {
rep = wait_for_job_vol(c, &job);
@@ -565,10 +565,10 @@ START_TEST(test_smoke_test)
lsmVolumeRecordFree(rep);
- lsmVolumeRecordFreeArray(volumes, count);
+ lsmVolumeRecordArrayFree(volumes, count);
if (pools) {
- lsmPoolRecordFreeArray(pools, poolCount);
+ lsmPoolRecordArrayFree(pools, poolCount);
}
}
@@ -588,7 +588,7 @@ START_TEST(test_access_groups)
fail_unless(LSM_ERR_OK == rc, "Expected success on listing access groups %d", rc);
fail_unless(count == 0, "Expect 0 access groups, got %"PRIu32, count);
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
groups = NULL;
count = 0;
@@ -629,18 +629,18 @@ START_TEST(test_access_groups)
rc = lsmAccessGroupList(c, &groups, &count, LSM_FLAG_RSVD);
fail_unless( LSM_ERR_OK == rc);
fail_unless( 1 == count );
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
groups = NULL;
count = 0;
char *job = NULL;
- rc = lsmAccessGroupAddInitiator(c, group, "iqn.1994-05.com.domain:01.89bd02", LSM_INITIATOR_ISCSI, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupInitiatorAdd(c, group, "iqn.1994-05.com.domain:01.89bd02", LSM_INITIATOR_ISCSI, LSM_FLAG_RSVD);
if( LSM_ERR_JOB_STARTED == rc ) {
wait_for_job(c, &job);
} else {
- fail_unless(LSM_ERR_OK == rc, "Expected success on lsmAccessGroupAddInitiator %d", rc);
+ fail_unless(LSM_ERR_OK == rc, "Expected success on lsmAccessGroupInitiatorAdd %d", rc);
}
rc = lsmAccessGroupList(c, &groups, &count, LSM_FLAG_RSVD);
@@ -650,7 +650,7 @@ START_TEST(test_access_groups)
lsmStringList *init_list = lsmAccessGroupInitiatorIdGet(groups[0]);
fail_unless( lsmStringListSize(init_list) == 2, "Expecting 2 initiators, current num = %d\n", lsmStringListSize(init_list) );
for( i = 0; i < lsmStringListSize(init_list); ++i) {
- printf("%d = %s\n", i, lsmStringListGetElem(init_list, i));
+ printf("%d = %s\n", i, lsmStringListElemGet(init_list, i));
}
lsmStringListFree(init_list);
@@ -666,7 +666,7 @@ START_TEST(test_access_groups)
for( i = 0; i < init_list_count; ++i ) {
printf("Deleting initiator %s from group!\n", lsmInitiatorIdGet(inits[i]));
- rc = lsmAccessGroupDelInitiator(c, groups[0],
+ rc = lsmAccessGroupInitiatorDelete(c, groups[0],
lsmInitiatorIdGet(inits[i]), LSM_FLAG_RSVD);
if( LSM_ERR_JOB_STARTED == rc ) {
@@ -676,7 +676,7 @@ START_TEST(test_access_groups)
}
}
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
groups = NULL;
count = 0;
@@ -688,7 +688,7 @@ START_TEST(test_access_groups)
fail_unless( init_list != NULL);
fail_unless( lsmStringListSize(init_list) == 0);
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
groups = NULL;
count = 0;
@@ -717,7 +717,7 @@ START_TEST(test_access_groups_grant_revoke)
LSM_PROVISION_DEFAULT, &n, &job, LSM_FLAG_RSVD);
fail_unless( vc == LSM_ERR_OK || vc == LSM_ERR_JOB_STARTED,
- "lsmVolumeCreate %d (%s)", vc, error(lsmErrorGetLast(c)));
+ "lsmVolumeCreate %d (%s)", vc, error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == vc ) {
n = wait_for_job_vol(c, &job);
@@ -739,7 +739,7 @@ START_TEST(test_access_groups_grant_revoke)
fail_unless(v_count == 1);
fail_unless(strcmp(lsmVolumeIdGet(volumes[0]), lsmVolumeIdGet(n)) == 0);
- lsmVolumeRecordFreeArray(volumes, v_count);
+ lsmVolumeRecordArrayFree(volumes, v_count);
lsmAccessGroup **groups;
uint32_t g_count = 0;
@@ -748,7 +748,7 @@ START_TEST(test_access_groups_grant_revoke)
fail_unless(g_count == 1);
fail_unless(strcmp(lsmAccessGroupIdGet(groups[0]), lsmAccessGroupIdGet(group)) == 0);
- lsmAccessGroupRecordFreeArray(groups, g_count);
+ lsmAccessGroupRecordArrayFree(groups, g_count);
rc = lsmAccessGroupRevoke(c, group, n, LSM_FLAG_RSVD);
if( LSM_ERR_JOB_STARTED == rc ) {
@@ -757,7 +757,7 @@ START_TEST(test_access_groups_grant_revoke)
fail_unless(LSM_ERR_OK == rc);
}
- rc = lsmAccessGroupDel(c, group, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupDelete(c, group, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_OK == rc);
lsmAccessGroupRecordFree(group);
@@ -821,7 +821,7 @@ START_TEST(test_fs)
fail_unless(LSM_ERR_OK == rc);
fail_unless(2 == fs_count, "fs_count = %d", fs_count);
- lsmFsRecordFreeArray(fs_list, fs_count);
+ lsmFsRecordArrayFree(fs_list, fs_count);
rc = lsmFsResize(c,nfs, 100000000, &resized_fs, &job, LSM_FLAG_RSVD);
@@ -883,7 +883,7 @@ START_TEST(test_ss)
printf("List return code= %d\n", rc);
if(rc) {
- printf("%s\n", error(lsmErrorGetLast(c)));
+ printf("%s\n", error(lsmErrorLastGet(c)));
}
fail_unless( LSM_ERR_OK == rc);
fail_unless( NULL == ss_list);
@@ -907,8 +907,8 @@ START_TEST(test_ss)
lsmStringList *files = lsmStringListAlloc(1);
if(files) {
- rc = lsmStringListSetElem(files, 0, "some/file/name.txt");
- fail_unless( LSM_ERR_OK == rc, "lsmStringListSetElem rc = %d", rc);
+ rc = lsmStringListElemSet(files, 0, "some/file/name.txt");
+ fail_unless( LSM_ERR_OK == rc, "lsmStringListElemSet rc = %d", rc);
}
rc = lsmFsSsRevert(c, fs, ss, files, files, 0, &job, LSM_FLAG_RSVD);
@@ -927,7 +927,7 @@ START_TEST(test_ss)
wait_for_job(c, &job);
}
- lsmSsRecordFreeArray(ss_list, ss_count);
+ lsmSsRecordArrayFree(ss_list, ss_count);
lsmFsRecordFree(fs);
printf("Testing snapshots done!\n");
@@ -960,7 +960,7 @@ START_TEST(test_systems)
status = lsmSystemStatusGet(sys[0]);
fail_unless(status == LSM_SYSTEM_STATUS_OK, "status = %x", status);
- lsmSystemRecordFreeArray(sys, count);
+ lsmSystemRecordArrayFree(sys, count);
}
END_TEST
@@ -1045,7 +1045,7 @@ START_TEST(test_disks)
//uint32_t num_keys = lsmStringListSize(keys);
//fail_unless( num_keys == key_count, "%d != %d", num_keys, key_count);
for(j = 0; j < key_count; ++j ) {
- key = lsmStringListGetElem(keys, j);
+ key = lsmStringListElemGet(keys, j);
data = lsmOptionalDataStringGet(od, key);
fail_unless(key != NULL && strlen(key) > 0);
fail_unless(data != NULL && strlen(data) > 0);
@@ -1059,7 +1059,7 @@ START_TEST(test_disks)
lsmOptionalDataRecordFree(od);
}
}
- lsmDiskRecordFreeArray(d, count);
+ lsmDiskRecordArrayFree(d, count);
} else {
fail_unless(d == NULL);
fail_unless(count == 0);
@@ -1100,7 +1100,7 @@ START_TEST(test_nfs_exports)
lsmStringList *access = lsmStringListAlloc(1);
fail_unless(NULL != access);
- lsmStringListSetElem(access, 0, "192.168.2.29");
+ lsmStringListElemSet(access, 0, "192.168.2.29");
lsmNfsExport *e = NULL;
@@ -1116,9 +1116,9 @@ START_TEST(test_nfs_exports)
fail_unless( exports != NULL);
fail_unless( count == 1 );
- rc = lsmNfsExportRemove(c, exports[0], LSM_FLAG_RSVD);
+ rc = lsmNfsExportDelete(c, exports[0], LSM_FLAG_RSVD);
fail_unless( LSM_ERR_OK == rc, "lsmNfsExportRemove %d\n", rc );
- lsmNfsExportRecordFreeArray(exports, count);
+ lsmNfsExportRecordArrayFree(exports, count);
exports = NULL;
@@ -1497,18 +1497,18 @@ START_TEST(test_invalid_input)
/* lsmAccessGroupDel */
- rc = lsmAccessGroupDel(c, NULL, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupDelete(c, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_ACCESS_GROUP, "rc = %d", rc);
- /* lsmAccessGroupAddInitiator */
- rc = lsmAccessGroupAddInitiator(c, NULL, NULL, 0, LSM_FLAG_RSVD);
+ /* lsmAccessGroupInitiatorAdd */
+ rc = lsmAccessGroupInitiatorAdd(c, NULL, NULL, 0, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_ACCESS_GROUP, "rc = %d", rc);
- rc = lsmAccessGroupDelInitiator(c, NULL, NULL, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupInitiatorDelete(c, NULL, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_ACCESS_GROUP, "rc = %d", rc);
- rc = lsmAccessGroupDelInitiator(c, ag, NULL, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupInitiatorDelete(c, ag, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_ARGUMENT, "rc = %d", rc);
@@ -1720,7 +1720,7 @@ START_TEST(test_invalid_input)
LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_ARGUMENT, "rc = %d", rc);
- rc = lsmNfsExportRemove(c, NULL, LSM_FLAG_RSVD);
+ rc = lsmNfsExportDelete(c, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_NFS, "rc = %d", rc);
}
END_TEST
@@ -1822,7 +1822,7 @@ static int get_init(lsmConnect *c, const char *init_id, lsmInitiator * *found) {
}
}
- lsmInitiatorRecordFreeArray(inits, count);
+ lsmInitiatorRecordArrayFree(inits, count);
return rc;
}
@@ -1876,7 +1876,7 @@ START_TEST(test_initiator_methods)
fail_unless( strcmp(lsmVolumeIdGet(volumes[0]), lsmVolumeIdGet(nv)) == 0);
}
- lsmVolumeRecordFreeArray(volumes, count);
+ lsmVolumeRecordArrayFree(volumes, count);
}
lsmInitiator **initiators = NULL;
@@ -1894,7 +1894,7 @@ START_TEST(test_initiator_methods)
fail_unless(lsmInitiatorNameGet(initiators[0]) != NULL);
}
- lsmInitiatorRecordFreeArray(initiators, count);
+ lsmInitiatorRecordArrayFree(initiators, count);
}
if( LSM_ERR_OK == rc ) {
@@ -1938,7 +1938,7 @@ START_TEST(test_iscsi_auth_in)
fail_unless(LSM_ERR_OK == rc, "rc = %d", rc) ;
}
- rc = lsmAccessGroupDel(c, group, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupDelete(c, group, LSM_FLAG_RSVD);
if(LSM_ERR_JOB_STARTED == rc ) {
wait_for_job(c, &job);
@@ -1957,7 +1957,7 @@ START_TEST(test_plugin_info)
char *desc = NULL;
char *version = NULL;
- int rc = lsmPluginGetInfo(c, &desc, &version, LSM_FLAG_RSVD);
+ int rc = lsmPluginInfoGet(c, &desc, &version, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_OK == rc, "rc = %d", rc);
@@ -1967,13 +1967,13 @@ START_TEST(test_plugin_info)
free(version);
}
- rc = lsmPluginGetInfo(NULL, &desc, &version, LSM_FLAG_RSVD);
+ rc = lsmPluginInfoGet(NULL, &desc, &version, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_INVALID_CONN == rc, "rc = %d", rc);
- rc = lsmPluginGetInfo(c, NULL, &version, LSM_FLAG_RSVD);
+ rc = lsmPluginInfoGet(c, NULL, &version, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_INVALID_ARGUMENT == rc, "rc = %d", rc);
- rc = lsmPluginGetInfo(c, &desc, NULL, LSM_FLAG_RSVD);
+ rc = lsmPluginInfoGet(c, &desc, NULL, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_INVALID_ARGUMENT == rc, "rc = %d", rc);
}
END_TEST
@@ -1984,12 +1984,12 @@ START_TEST(test_get_available_plugins)
int num = 0;
lsmStringList *plugins = NULL;
- int rc = lsmGetAvailablePlugins(":", &plugins, 0);
+ int rc = lsmAvailablePluginsList(":", &plugins, 0);
fail_unless(LSM_ERR_OK == rc, "rc = %d", rc);
num = lsmStringListSize(plugins);
for( i = 0; i < num; i++) {
- const char *info = lsmStringListGetElem(plugins, i);
+ const char *info = lsmStringListElemGet(plugins, i);
fail_unless(strlen(info) > 0);
printf("%s\n", info);
}
@@ -2016,13 +2016,13 @@ START_TEST(test_error_reporting)
fail_unless(e != NULL);
if( e ) {
- fail_unless(LSM_ERR_INTERNAL_ERROR == lsmErrorGetNumber(e));
- fail_unless(LSM_ERR_DOMAIN_PLUG_IN == lsmErrorGetDomain(e));
- fail_unless(LSM_ERR_LEVEL_ERROR == lsmErrorGetLevel(e));
- fail_unless(strcmp(msg, lsmErrorGetMessage(e)) == 0);
- fail_unless(strcmp(exception, lsmErrorGetException(e)) == 0);
- fail_unless(strcmp(debug_msg, lsmErrorGetDebug(e)) == 0);
- debug_data = lsmErrorGetDebugData(e, &debug_size);
+ fail_unless(LSM_ERR_INTERNAL_ERROR == lsmErrorNumberGet(e));
+ fail_unless(LSM_ERR_DOMAIN_PLUG_IN == lsmErrorDomainGet(e));
+ fail_unless(LSM_ERR_LEVEL_ERROR == lsmErrorLevelGet(e));
+ fail_unless(strcmp(msg, lsmErrorMessageGet(e)) == 0);
+ fail_unless(strcmp(exception, lsmErrorExceptionGet(e)) == 0);
+ fail_unless(strcmp(debug_msg, lsmErrorDebugGet(e)) == 0);
+ debug_data = lsmErrorDebugDataGet(e, &debug_size);
fail_unless(debug_data != NULL);
fail_unless(debug_size == sizeof(d));
fail_unless(memcmp(d, debug_data, debug_size) == 0);
- Free functions all return a value instead of a missmatch
- All functions use 'Delete' instead of 'Del' or 'remove
Signed-off-by: Tony Asleson <***@redhat.com>
---
include/libstoragemgmt/libstoragemgmt.h | 20 +--
.../libstoragemgmt/libstoragemgmt_accessgroups.h | 8 +-
include/libstoragemgmt/libstoragemgmt_blockrange.h | 10 +-
.../libstoragemgmt/libstoragemgmt_capabilities.h | 5 +-
include/libstoragemgmt/libstoragemgmt_common.h | 15 +-
include/libstoragemgmt/libstoragemgmt_disk.h | 8 +-
include/libstoragemgmt/libstoragemgmt_error.h | 27 ++--
include/libstoragemgmt/libstoragemgmt_fs.h | 8 +-
include/libstoragemgmt/libstoragemgmt_initiators.h | 8 +-
include/libstoragemgmt/libstoragemgmt_nfsexport.h | 12 +-
.../libstoragemgmt/libstoragemgmt_optionaldata.h | 3 +-
.../libstoragemgmt/libstoragemgmt_plug_interface.h | 20 +--
include/libstoragemgmt/libstoragemgmt_pool.h | 8 +-
include/libstoragemgmt/libstoragemgmt_snapshot.h | 8 +-
include/libstoragemgmt/libstoragemgmt_systems.h | 10 +-
include/libstoragemgmt/libstoragemgmt_volumes.h | 8 +-
plugin/simc_lsmplugin.c | 148 +++++++++----------
src/lsm_convert.cpp | 14 +-
src/lsm_datatypes.cpp | 136 +++++++++++-------
src/lsm_mgmt.cpp | 58 ++++----
src/lsm_plugin_ipc.cpp | 28 ++--
test/tester.c | 160 ++++++++++-----------
22 files changed, 389 insertions(+), 333 deletions(-)
diff --git a/include/libstoragemgmt/libstoragemgmt.h b/include/libstoragemgmt/libstoragemgmt.h
index 7c7a807..9ec7bb9 100644
--- a/include/libstoragemgmt/libstoragemgmt.h
+++ b/include/libstoragemgmt/libstoragemgmt.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -87,7 +87,7 @@ extern "C" {
* @param [in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error code @see lsmErrorNumber
*/
- int LSM_DLL_EXPORT lsmPluginGetInfo(lsmConnect *conn, char **desc,
+ int LSM_DLL_EXPORT lsmPluginInfoGet(lsmConnect *conn, char **desc,
char **version, lsmFlag_t flags);
/**
@@ -98,7 +98,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error code @see lsmErrorNumber
*/
- int LSM_DLL_EXPORT lsmGetAvailablePlugins(const char *sep,
+ int LSM_DLL_EXPORT lsmAvailablePluginsList(const char *sep,
lsmStringList **plugins,
lsmFlag_t flags);
@@ -109,7 +109,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error reason
*/
- int LSM_DLL_EXPORT lsmConnectSetTimeout(lsmConnect *conn,
+ int LSM_DLL_EXPORT lsmConnectTimeoutSet(lsmConnect *conn,
uint32_t timeout, lsmFlag_t flags);
/**
@@ -119,7 +119,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error reason
*/
- int LSM_DLL_EXPORT lsmConnectGetTimeout(lsmConnect *conn,
+ int LSM_DLL_EXPORT lsmConnectTimeoutGet(lsmConnect *conn,
uint32_t *timeout, lsmFlag_t flags);
/**
@@ -459,7 +459,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error reason.
*/
- int LSM_DLL_EXPORT lsmAccessGroupDel(lsmConnect *conn,
+ int LSM_DLL_EXPORT lsmAccessGroupDelete(lsmConnect *conn,
lsmAccessGroup *group, lsmFlag_t flags);
/**
@@ -471,7 +471,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error reason.
*/
- int LSM_DLL_EXPORT lsmAccessGroupAddInitiator(lsmConnect *conn,
+ int LSM_DLL_EXPORT lsmAccessGroupInitiatorAdd(lsmConnect *conn,
lsmAccessGroup *group,
const char *initiator_id,
lsmInitiatorType id_type, lsmFlag_t flags);
@@ -484,7 +484,7 @@ extern "C" {
* @param[in] flags Reserved for future use, must be zero.
* @return[in] LSM_ERR_OK on success, else error reason.
*/
- int LSM_DLL_EXPORT lsmAccessGroupDelInitiator(lsmConnect *conn,
+ int LSM_DLL_EXPORT lsmAccessGroupInitiatorDelete(lsmConnect *conn,
lsmAccessGroup *group,
const char *initiator_id,
lsmFlag_t flags);
@@ -848,13 +848,13 @@ extern "C" {
);
/**
- * Remove the export.
+ * 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 lsmNfsExportRemove( lsmConnect *c, lsmNfsExport *e,
+ int LSM_DLL_EXPORT lsmNfsExportDelete( lsmConnect *c, lsmNfsExport *e,
lsmFlag_t flags );
#ifdef __cplusplus
diff --git a/include/libstoragemgmt/libstoragemgmt_accessgroups.h b/include/libstoragemgmt/libstoragemgmt_accessgroups.h
index 0e497a2..e65e63b 100644
--- a/include/libstoragemgmt/libstoragemgmt_accessgroups.h
+++ b/include/libstoragemgmt/libstoragemgmt_accessgroups.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -31,15 +31,17 @@ extern "C" {
/**
* Frees the resources for an access group.
* @param group Group to free
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmAccessGroupRecordFree( lsmAccessGroup *group );
+int LSM_DLL_EXPORT lsmAccessGroupRecordFree( lsmAccessGroup *group );
/**
* Frees the resources for an array of access groups.
* @param ag Array of access groups to free resources for
* @param size Number of elements in the array.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmAccessGroupRecordFreeArray( lsmAccessGroup *ag[], uint32_t size );
+int LSM_DLL_EXPORT lsmAccessGroupRecordArrayFree( lsmAccessGroup *ag[], uint32_t size );
/**
* Copies an access group.
diff --git a/include/libstoragemgmt/libstoragemgmt_blockrange.h b/include/libstoragemgmt/libstoragemgmt_blockrange.h
index 893eb46..61364c2 100644
--- a/include/libstoragemgmt/libstoragemgmt_blockrange.h
+++ b/include/libstoragemgmt/libstoragemgmt_blockrange.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -40,8 +40,9 @@ lsmBlockRange LSM_DLL_EXPORT *lsmBlockRangeRecordAlloc(uint64_t source_start,
/**
* Frees a block range record.
* @param br Block range to free
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmBlockRangeRecordFree( lsmBlockRange *br);
+int LSM_DLL_EXPORT lsmBlockRangeRecordFree( lsmBlockRange *br);
/**
@@ -57,15 +58,16 @@ lsmBlockRange LSM_DLL_EXPORT *lsmBlockRangeRecordCopy( lsmBlockRange *source );
* @param size Number of elements to store.
* @return Pointer to memory for array of block ranges.
*/
-lsmBlockRange LSM_DLL_EXPORT **lsmBlockRangeRecordAllocArray( uint32_t size );
+lsmBlockRange LSM_DLL_EXPORT **lsmBlockRangeRecordArrayAlloc( uint32_t size );
/**
* Frees the memory for the array and all records contained in it.
* @param br Array of block ranges to free
* @param size Number of elements in array.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmBlockRangeRecordFreeArray( lsmBlockRange *br[],
+int LSM_DLL_EXPORT lsmBlockRangeRecordArrayFree( lsmBlockRange *br[],
uint32_t size );
/**
diff --git a/include/libstoragemgmt/libstoragemgmt_capabilities.h b/include/libstoragemgmt/libstoragemgmt_capabilities.h
index 040a86a..f34464f 100644
--- a/include/libstoragemgmt/libstoragemgmt_capabilities.h
+++ b/include/libstoragemgmt/libstoragemgmt_capabilities.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -139,8 +139,9 @@ typedef enum {
/**
* Free the memory used by the storage capabilities data structure
* @param cap Valid storage capability data structure.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmCapabilityRecordFree(lsmStorageCapabilities *cap);
+int LSM_DLL_EXPORT lsmCapabilityRecordFree(lsmStorageCapabilities *cap);
/**
* Return the capability for the specified feature.
diff --git a/include/libstoragemgmt/libstoragemgmt_common.h b/include/libstoragemgmt/libstoragemgmt_common.h
index 9725233..64885ba 100644
--- a/include/libstoragemgmt/libstoragemgmt_common.h
+++ b/include/libstoragemgmt/libstoragemgmt_common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -71,7 +71,8 @@ lsmStringList LSM_DLL_EXPORT *lsmStringListCopy(lsmStringList *src);
* @param value Value to use for assignment
* @return LSM_ERR_OK on success, else error reason
*/
-int LSM_DLL_EXPORT lsmStringListSetElem(lsmStringList *sl, uint32_t index, const char* value);
+int LSM_DLL_EXPORT lsmStringListElemSet(lsmStringList *sl, uint32_t index,
+ const char* value);
/**
* Returns the value at the specified elem index
@@ -79,7 +80,8 @@ int LSM_DLL_EXPORT lsmStringListSetElem(lsmStringList *sl, uint32_t index, const
* @param index Index to retrieve
* @return Value at that index position.
*/
-const char LSM_DLL_EXPORT *lsmStringListGetElem(lsmStringList *sl, uint32_t index);
+const char LSM_DLL_EXPORT *lsmStringListElemGet(lsmStringList *sl,
+ uint32_t index);
/**
* Returns the size of the list
@@ -99,12 +101,15 @@ uint32_t LSM_DLL_EXPORT lsmStringListSize(lsmStringList *sl);
int LSM_DLL_EXPORT lsmStringListAppend(lsmStringList *sl, const char* add);
/**
- * Removes the string at the specified index.
+ * Deletes the string at the specified index.
+ * NOTE: The elements after this one are moved down, thus if you wanted to
+ * iterate over the list deleting each element one by one you need to do so in
+ * reverse order.
* @param sl String list to remove item from
* @param index Specified index
* @return LSM_ERR_OK on success, else error reason
*/
-int LSM_DLL_EXPORT lsmStringListRemove(lsmStringList *sl, uint32_t index);
+int LSM_DLL_EXPORT lsmStringListDelete(lsmStringList *sl, uint32_t index);
diff --git a/include/libstoragemgmt/libstoragemgmt_disk.h b/include/libstoragemgmt/libstoragemgmt_disk.h
index cf86342..0676b69 100644
--- a/include/libstoragemgmt/libstoragemgmt_disk.h
+++ b/include/libstoragemgmt/libstoragemgmt_disk.h
@@ -30,9 +30,9 @@ extern "C" {
/**
* Free the memory for a disk record
* @param d Disk memory to free
- * @return None
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmDiskRecordFree(lsmDisk *d);
+int LSM_DLL_EXPORT lsmDiskRecordFree(lsmDisk *d);
/**
* Copy a disk record
@@ -45,9 +45,9 @@ lsmDisk LSM_DLL_EXPORT *lsmDiskRecordCopy(lsmDisk *d);
* Free an array of disk records
* @param disk Array of disk records
* @param size Size of disk array
- * @return None
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmDiskRecordFreeArray( lsmDisk *disk[], uint32_t size);
+int LSM_DLL_EXPORT lsmDiskRecordArrayFree( lsmDisk *disk[], uint32_t size);
/**
* Returns the disk id
diff --git a/include/libstoragemgmt/libstoragemgmt_error.h b/include/libstoragemgmt/libstoragemgmt_error.h
index e113cec..8527e1f 100644
--- a/include/libstoragemgmt/libstoragemgmt_error.h
+++ b/include/libstoragemgmt/libstoragemgmt_error.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -79,6 +79,7 @@ typedef enum {
LSM_ERR_INVALID_IQN = 118, /**< Invalid IQN */
LSM_ERR_INVALID_DISK = 119, /**< Invalid disk */
LSM_ERR_INVALID_OPTIONAL_DATA = 120,/**< Invalid optional data */
+ LSM_ERR_INVALID_BLOCK_RANGE = 121, /**< Invalud block range */
LSM_ERR_IS_MAPPED = 125, /**< Mapping already exists */
@@ -140,7 +141,7 @@ typedef lsmError *lsmErrorPtr;
* @param c Connection pointer.
* @return lsmErrorPtr, Null if no error exists!
*/
-lsmErrorPtr LSM_DLL_EXPORT lsmErrorGetLast(lsmConnect *c);
+lsmErrorPtr LSM_DLL_EXPORT lsmErrorLastGet(lsmConnect *c);
/**
* Frees the error record!
@@ -154,62 +155,62 @@ int LSM_DLL_EXPORT lsmErrorFree(lsmErrorPtr err);
* @param e The lsmErrorPtr
* @return -1 if e is not a valid error pointer, else error number.
*/
-lsmErrorNumber LSM_DLL_EXPORT lsmErrorGetNumber(lsmErrorPtr e);
+lsmErrorNumber LSM_DLL_EXPORT lsmErrorNumberGet(lsmErrorPtr e);
/**
* Retrieves the domain from the error.
* @param e The lsmErrorPtr
* @return -1 if e is not a valid error pointer, else error domain value.
*/
-lsmErrorDomain LSM_DLL_EXPORT lsmErrorGetDomain(lsmErrorPtr e);
+lsmErrorDomain LSM_DLL_EXPORT lsmErrorDomainGet(lsmErrorPtr e);
/**
* Retrieves the error level from the error.
* @param e The lsmErrorPtr
* @return -1 if e is not a valid error pointer, else error level.
*/
-lsmErrorLevel LSM_DLL_EXPORT lsmErrorGetLevel(lsmErrorPtr e);
+lsmErrorLevel LSM_DLL_EXPORT lsmErrorLevelGet(lsmErrorPtr 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
- * lsmErrorGetNumber and check return code.
+ * lsmErrorNumberGet and check return code.
* @param e The lsmErrorPtr
* @return NULL if message data does not exist, else error message.
*/
-char LSM_DLL_EXPORT *lsmErrorGetMessage(lsmErrorPtr e);
+char LSM_DLL_EXPORT *lsmErrorMessageGet(lsmErrorPtr 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
- * lsmErrorGetNumber and check return code.
+ * lsmErrorNumberGet and check return code.
* @param e The lsmErrorPtr
* @return NULL if exception does not exist, else error exception.
*/
-char LSM_DLL_EXPORT *lsmErrorGetException(lsmErrorPtr e);
+char LSM_DLL_EXPORT *lsmErrorExceptionGet(lsmErrorPtr 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
- * lsmErrorGetNumber and check return code.
+ * lsmErrorNumberGet and check return code.
* @param e The lsmErrorPtr
* @return NULL if does not exist, else debug message.
*/
-char LSM_DLL_EXPORT *lsmErrorGetDebug(lsmErrorPtr e);
+char LSM_DLL_EXPORT *lsmErrorDebugGet(lsmErrorPtr 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
- * lsmErrorGetNumber and check return code.
+ * lsmErrorNumberGet and check return code.
* @param e The lsmErrorPtr
* @param[out] size Number of bytes of data returned.
* @return NULL if does not exist, else debug message.
*/
-void LSM_DLL_EXPORT *lsmErrorGetDebugData(lsmErrorPtr e, uint32_t *size);
+void LSM_DLL_EXPORT *lsmErrorDebugDataGet(lsmErrorPtr e, uint32_t *size);
#ifdef __cplusplus
}
diff --git a/include/libstoragemgmt/libstoragemgmt_fs.h b/include/libstoragemgmt/libstoragemgmt_fs.h
index 76cc050..fbe1fbd 100644
--- a/include/libstoragemgmt/libstoragemgmt_fs.h
+++ b/include/libstoragemgmt/libstoragemgmt_fs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -29,8 +29,9 @@ extern "C" {
/**
* Frees a File system record
* @param fs File system to free.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmFsRecordFree(lsmFs *fs);
+int LSM_DLL_EXPORT lsmFsRecordFree(lsmFs *fs);
/**
* Copies a file system record.
@@ -43,8 +44,9 @@ lsmFs LSM_DLL_EXPORT *lsmFsRecordCopy(lsmFs *source);
* Frees an array of file system records
* @param fs Array of file system record pointers
* @param size Number in array to free
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmFsRecordFreeArray(lsmFs * fs[], uint32_t size);
+int LSM_DLL_EXPORT lsmFsRecordArrayFree(lsmFs * fs[], uint32_t size);
/**
* Returns the id of the file system.
diff --git a/include/libstoragemgmt/libstoragemgmt_initiators.h b/include/libstoragemgmt/libstoragemgmt_initiators.h
index 6cc004b..4a8b933 100644
--- a/include/libstoragemgmt/libstoragemgmt_initiators.h
+++ b/include/libstoragemgmt/libstoragemgmt_initiators.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -28,8 +28,9 @@ extern "C" {
/**
* Frees the memory for one initiator record.
* @param i Initiator record.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmInitiatorRecordFree(lsmInitiator *i);
+int LSM_DLL_EXPORT lsmInitiatorRecordFree(lsmInitiator *i);
/**
* Returns a copy of an initiator record.
@@ -42,8 +43,9 @@ lsmInitiator LSM_DLL_EXPORT *lsmInitiatorRecordCopy(lsmInitiator *i);
* Frees the memory for each of the initiators records and then the array itself.
* @param init Array to free.
* @param size Size of array.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmInitiatorRecordFreeArray( lsmInitiator *init[], uint32_t size);
+int LSM_DLL_EXPORT lsmInitiatorRecordArrayFree( lsmInitiator *init[], uint32_t size);
/**
* Returns the type of identifer returned in @see lsmInitiatorIdGet
diff --git a/include/libstoragemgmt/libstoragemgmt_nfsexport.h b/include/libstoragemgmt/libstoragemgmt_nfsexport.h
index e7cf630..4d3279e 100644
--- a/include/libstoragemgmt/libstoragemgmt_nfsexport.h
+++ b/include/libstoragemgmt/libstoragemgmt_nfsexport.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -62,21 +62,23 @@ lsmNfsExport LSM_DLL_EXPORT * lsmNfsExportRecordAlloc( const char *id,
* @param size Number of elements
* @return Allocated memory, NULL on error
*/
-lsmNfsExport LSM_DLL_EXPORT **lsmNfsExportRecordAllocArray( uint32_t size );
+lsmNfsExport LSM_DLL_EXPORT **lsmNfsExportRecordArrayAlloc( uint32_t size );
/**
* Frees the memory for a NFS export record.
* @param exp
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmNfsExportRecordFree( lsmNfsExport *exp );
+int LSM_DLL_EXPORT lsmNfsExportRecordFree( lsmNfsExport *exp );
/**
* Frees the memory for the NFS export array and the memory for each entry
* @param exps Memory to free
* @param size Number of entries
- */
-void LSM_DLL_EXPORT lsmNfsExportRecordFreeArray( lsmNfsExport *exps[],
+ * @return LSM_ERR_OK on success, else error reason.
+ * */
+int LSM_DLL_EXPORT lsmNfsExportRecordArrayFree( lsmNfsExport *exps[],
uint32_t size);
/**
diff --git a/include/libstoragemgmt/libstoragemgmt_optionaldata.h b/include/libstoragemgmt/libstoragemgmt_optionaldata.h
index e39627d..e5fbe5d 100644
--- a/include/libstoragemgmt/libstoragemgmt_optionaldata.h
+++ b/include/libstoragemgmt/libstoragemgmt_optionaldata.h
@@ -30,8 +30,9 @@ extern "C" {
/**
* Free a optional data record
* @param op Record to free.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmOptionalDataRecordFree(lsmOptionalData *op);
+int LSM_DLL_EXPORT lsmOptionalDataRecordFree(lsmOptionalData *op);
/**
* Get the list of 'keys' available in the optional data
diff --git a/include/libstoragemgmt/libstoragemgmt_plug_interface.h b/include/libstoragemgmt/libstoragemgmt_plug_interface.h
index 9738d29..f51c96a 100644
--- a/include/libstoragemgmt/libstoragemgmt_plug_interface.h
+++ b/include/libstoragemgmt/libstoragemgmt_plug_interface.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -893,7 +893,7 @@ int LSM_DLL_EXPORT lsmRegisterPluginV1( lsmPluginPtr plug,
* Used to retrieve private data for plug-in operation.
* @param plug Opaque plug-in pointer.
*/
-void LSM_DLL_EXPORT *lsmGetPrivateData( lsmPluginPtr plug );
+void LSM_DLL_EXPORT *lsmPrivateDataGet( lsmPluginPtr plug );
/**
@@ -950,7 +950,7 @@ lsmErrorPtr LSM_DLL_EXPORT lsmErrorCreate( lsmErrorNumber code,
* @param size Number of elements
* @return Valid pointer or NULL on error.
*/
-lsmPool LSM_DLL_EXPORT **lsmPoolRecordAllocArray( uint32_t size );
+lsmPool LSM_DLL_EXPORT **lsmPoolRecordArrayAlloc( uint32_t size );
/**
* Used to set the free space on a pool record
@@ -980,7 +980,7 @@ lsmPool LSM_DLL_EXPORT *lsmPoolRecordAlloc(const char *id, const char *name,
* @param size Number of elements.
* @return Allocated memory or NULL on error.
*/
-lsmInitiator LSM_DLL_EXPORT **lsmInitiatorRecordAllocArray( uint32_t size );
+lsmInitiator LSM_DLL_EXPORT **lsmInitiatorRecordArrayAlloc( uint32_t size );
/**
* Allocate the storage needed for one initiator record.
@@ -998,7 +998,7 @@ lsmInitiator LSM_DLL_EXPORT *lsmInitiatorRecordAlloc( lsmInitiatorType idType,
* @param size Number of elements.
* @return Allocated memory or NULL on error.
*/
-lsmVolume LSM_DLL_EXPORT **lsmVolumeRecordAllocArray( uint32_t size);
+lsmVolume LSM_DLL_EXPORT **lsmVolumeRecordArrayAlloc( uint32_t size);
/**
@@ -1006,7 +1006,7 @@ lsmVolume LSM_DLL_EXPORT **lsmVolumeRecordAllocArray( uint32_t size);
* @param size Number of elements
* @return Allocated memory or null on error.
*/
-lsmDisk LSM_DLL_EXPORT **lsmDiskRecordAllocArray( uint32_t size );
+lsmDisk LSM_DLL_EXPORT **lsmDiskRecordArrayAlloc( uint32_t size );
/**
@@ -1051,7 +1051,7 @@ lsmVolume LSM_DLL_EXPORT *lsmVolumeRecordAlloc( const char *id,
* @param size Number of elements.
* @return Allocated memory or NULL on error.
*/
-lsmSystem LSM_DLL_EXPORT **lsmSystemRecordAllocArray( uint32_t size );
+lsmSystem LSM_DLL_EXPORT **lsmSystemRecordArrayAlloc( uint32_t size );
/**
* Allocates the storage for one system record.
@@ -1069,7 +1069,7 @@ lsmSystem LSM_DLL_EXPORT *lsmSystemRecordAlloc( const char *id,
* @param size Number of elements to store.
* @return NULL on error, else pointer to array for use.
*/
-lsmAccessGroup LSM_DLL_EXPORT **lsmAccessGroupRecordAllocArray( uint32_t size);
+lsmAccessGroup LSM_DLL_EXPORT **lsmAccessGroupRecordArrayAlloc( uint32_t size);
/**
@@ -1115,7 +1115,7 @@ lsmFs LSM_DLL_EXPORT *lsmFsRecordAlloc( const char *id, const char *name,
* @param size Number of elements
* @return Allocated memory, NULL on error
*/
-lsmFs LSM_DLL_EXPORT **lsmFsRecordAllocArray( uint32_t size );
+lsmFs LSM_DLL_EXPORT **lsmFsRecordArrayAlloc( uint32_t size );
/**
* Allocates the memory for single snap shot record.
@@ -1132,7 +1132,7 @@ lsmSs LSM_DLL_EXPORT *lsmSsRecordAlloc( const char *id, const char *name,
* @param size Number of elements
* @return Allocated memory, NULL on error
*/
-lsmSs LSM_DLL_EXPORT **lsmSsRecordAllocArray( uint32_t size );
+lsmSs LSM_DLL_EXPORT **lsmSsRecordArrayAlloc( uint32_t size );
/**
* Set a capability
diff --git a/include/libstoragemgmt/libstoragemgmt_pool.h b/include/libstoragemgmt/libstoragemgmt_pool.h
index 266a606..7db2490 100644
--- a/include/libstoragemgmt/libstoragemgmt_pool.h
+++ b/include/libstoragemgmt/libstoragemgmt_pool.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -31,14 +31,16 @@ extern "C" {
* Frees the memory for each of the pools and then the pool array itself.
* @param pa Pool array to free.
* @param size Size of the pool array.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmPoolRecordFreeArray( lsmPool *pa[], uint32_t size );
+int LSM_DLL_EXPORT lsmPoolRecordArrayFree( lsmPool *pa[], uint32_t size );
/**
* Frees the memory for an individual pool
* @param p Valid pool
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmPoolRecordFree(lsmPool *p);
+int LSM_DLL_EXPORT lsmPoolRecordFree(lsmPool *p);
/**
* Copies a lsmPoolRecordCopy
diff --git a/include/libstoragemgmt/libstoragemgmt_snapshot.h b/include/libstoragemgmt/libstoragemgmt_snapshot.h
index 4371f59..ca046ff 100644
--- a/include/libstoragemgmt/libstoragemgmt_snapshot.h
+++ b/include/libstoragemgmt/libstoragemgmt_snapshot.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -29,8 +29,9 @@ extern "C" {
/**
* Frees a snapshot record.
* @param ss Snapshot record
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmSsRecordFree(lsmSs *ss);
+int LSM_DLL_EXPORT lsmSsRecordFree(lsmSs *ss);
/**
* Copies a snapshot record.
@@ -43,8 +44,9 @@ lsmSs LSM_DLL_EXPORT *lsmSsRecordCopy(lsmSs *source);
* Frees an array of snapshot record.
* @param ss An array of snapshot record pointers.
* @param size Number of snapshot records.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmSsRecordFreeArray(lsmSs *ss[], uint32_t size);
+int LSM_DLL_EXPORT lsmSsRecordArrayFree(lsmSs *ss[], uint32_t size);
/**
* Returns the snapshot id.
diff --git a/include/libstoragemgmt/libstoragemgmt_systems.h b/include/libstoragemgmt/libstoragemgmt_systems.h
index 6912167..cc780bb 100644
--- a/include/libstoragemgmt/libstoragemgmt_systems.h
+++ b/include/libstoragemgmt/libstoragemgmt_systems.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -38,15 +38,17 @@ lsmSystem *lsmSystemRecordCopy(lsmSystem *s);
/**
* Frees the resources for a lsmSystem
* @param s Record to release
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmSystemRecordFree(lsmSystem *s);
+int LSM_DLL_EXPORT lsmSystemRecordFree(lsmSystem *s);
/**
* Frees the resources for an array for lsmSystem
* @param s Array to release memory for
* @param size Number of elements.
- */
-void LSM_DLL_EXPORT lsmSystemRecordFreeArray(lsmSystem *s[], uint32_t size );
+ * @return LSM_ERR_OK on success, else error reason.
+ * */
+int LSM_DLL_EXPORT lsmSystemRecordArrayFree(lsmSystem *s[], uint32_t size );
/**
* Retrieve the Id for the system.
diff --git a/include/libstoragemgmt/libstoragemgmt_volumes.h b/include/libstoragemgmt/libstoragemgmt_volumes.h
index 3d8bd36..bf93135 100644
--- a/include/libstoragemgmt/libstoragemgmt_volumes.h
+++ b/include/libstoragemgmt/libstoragemgmt_volumes.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -29,8 +29,9 @@ extern "C" {
/**
* Frees the memory fro an individual volume
* @param v Volume pointer to free.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmVolumeRecordFree(lsmVolume *v);
+int LSM_DLL_EXPORT lsmVolumeRecordFree(lsmVolume *v);
/**
* Copies a volume record structure.
@@ -43,8 +44,9 @@ lsmVolume LSM_DLL_EXPORT *lsmVolumeRecordCopy(lsmVolume *vol);
* Frees the memory for each of the volume records and then the array itself.
* @param init Array to free.
* @param size Size of array.
+ * @return LSM_ERR_OK on success, else error reason.
*/
-void LSM_DLL_EXPORT lsmVolumeRecordFreeArray( lsmVolume *init[], uint32_t size);
+int LSM_DLL_EXPORT lsmVolumeRecordArrayFree( lsmVolume *init[], uint32_t size);
/**
* Retrieves the volume id.
diff --git a/plugin/simc_lsmplugin.c b/plugin/simc_lsmplugin.c
index e7d445f..bf64c92 100644
--- a/plugin/simc_lsmplugin.c
+++ b/plugin/simc_lsmplugin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -295,7 +295,7 @@ static int create_job(struct plugin_data *pd, char **job, lsmDataType t,
static int tmo_set(lsmPluginPtr c, uint32_t timeout, lsmFlag_t flags )
{
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
pd->tmo = timeout;
@@ -306,7 +306,7 @@ static int tmo_set(lsmPluginPtr c, uint32_t timeout, lsmFlag_t flags )
static int tmo_get(lsmPluginPtr c, uint32_t *timeout, lsmFlag_t flags)
{
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
*timeout = pd->tmo;
@@ -387,7 +387,7 @@ static int jobStatus(lsmPluginPtr c, const char *job_id,
void **value, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
struct allocated_job *val = (struct allocated_job*)
@@ -420,11 +420,11 @@ static int list_pools(lsmPluginPtr c, lsmPool **poolArray[],
uint32_t *count, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
*count = pd->num_pools;
- *poolArray = lsmPoolRecordAllocArray( pd->num_pools );
+ *poolArray = lsmPoolRecordArrayAlloc( pd->num_pools );
if( *poolArray ) {
uint32_t i = 0;
@@ -432,7 +432,7 @@ static int list_pools(lsmPluginPtr c, lsmPool **poolArray[],
(*poolArray)[i] = lsmPoolRecordCopy(pd->pool[i]);
if( !(*poolArray)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmPoolRecordFreeArray(*poolArray, i);
+ lsmPoolRecordArrayFree(*poolArray, i);
*poolArray = NULL;
*count = 0;
break;
@@ -451,11 +451,11 @@ static int list_pools(lsmPluginPtr c, lsmPool **poolArray[],
static int list_systems(lsmPluginPtr c, lsmSystem **systems[],
uint32_t *systemCount, lsmFlag_t flags)
{
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
*systemCount = pd->num_systems;
- *systems = lsmSystemRecordAllocArray(MAX_SYSTEMS);
+ *systems = lsmSystemRecordArrayAlloc(MAX_SYSTEMS);
if( *systems ) {
(*systems)[0] = lsmSystemRecordCopy(pd->system[0]);
@@ -463,7 +463,7 @@ static int list_systems(lsmPluginPtr c, lsmSystem **systems[],
if( (*systems)[0] ) {
return LSM_ERR_OK;
} else {
- lsmSystemRecordFreeArray(*systems, pd->num_systems);
+ lsmSystemRecordArrayFree(*systems, pd->num_systems);
}
}
return LSM_ERR_NO_MEMORY;
@@ -475,7 +475,7 @@ static int list_systems(lsmPluginPtr c, lsmSystem **systems[],
static int jobFree(lsmPluginPtr c, char *job_id, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
if( !g_hash_table_remove(pd->jobs, job_id) ) {
@@ -527,7 +527,7 @@ static int _list_initiators(lsmPluginPtr c, lsmInitiator **initArray[],
lsmVolume *filter)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(!pd) {
return LSM_ERR_INVALID_PLUGIN;
@@ -560,7 +560,7 @@ static int _list_initiators(lsmPluginPtr c, lsmInitiator **initArray[],
lsmStringList *inits = lsmAccessGroupInitiatorIdGet(v->ag);
for(i = 0; i < lsmStringListSize(inits); ++i ) {
- char *init_key = strdup(lsmStringListGetElem(inits,i));
+ char *init_key = strdup(lsmStringListElemGet(inits,i));
lsmInitiator *init_val = lsmInitiatorRecordAlloc(v->ag_type,
init_key, "");
@@ -579,7 +579,7 @@ static int _list_initiators(lsmPluginPtr c, lsmInitiator **initArray[],
*count = g_hash_table_size(tmp_inits);
if( *count ) {
- *initArray = lsmInitiatorRecordAllocArray(*count);
+ *initArray = lsmInitiatorRecordArrayAlloc(*count);
if( *initArray ) {
int i = 0;
char *ikey = NULL;
@@ -591,7 +591,7 @@ static int _list_initiators(lsmPluginPtr c, lsmInitiator **initArray[],
(*initArray)[i] = lsmInitiatorRecordCopy(ival);
if( !(*initArray)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmInitiatorRecordFreeArray(*initArray, i);
+ lsmInitiatorRecordArrayFree(*initArray, i);
break;
}
i += 1;
@@ -618,20 +618,20 @@ static int list_volumes(lsmPluginPtr c, lsmVolume **vols[],
uint32_t *count, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if(pd) {
*count = pd->num_volumes;
if( *count ) {
- *vols = lsmVolumeRecordAllocArray( pd->num_volumes );
+ *vols = lsmVolumeRecordArrayAlloc( pd->num_volumes );
if( *vols ) {
uint32_t i = 0;
for( i = 0; i < pd->num_volumes; ++i ) {
(*vols)[i] = lsmVolumeRecordCopy(pd->volume[i].v);
if( !(*vols)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmVolumeRecordFreeArray(*vols, i);
+ lsmVolumeRecordArrayFree(*vols, i);
*vols = NULL;
*count = 0;
break;
@@ -655,7 +655,7 @@ static int list_disks(lsmPluginPtr c, lsmDisk **disks[], uint32_t *count,
int rc = LSM_ERR_OK;
char name[17];
char sn[32];
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
lsmOptionalData *od = lsmOptionalDataRecordAlloc();
if(pd && od) {
@@ -663,7 +663,7 @@ static int list_disks(lsmPluginPtr c, lsmDisk **disks[], uint32_t *count,
// try to make a simulated array that makes sense.
*count = 10;
- *disks = lsmDiskRecordAllocArray(*count);
+ *disks = lsmDiskRecordArrayAlloc(*count);
for( i = 0; i < *count; ++i ) {
snprintf(name, sizeof(name), "Sim C disk %d", i);
snprintf(sn, sizeof(sn), "SIMDISKSN00000%04d\n", i);
@@ -739,7 +739,7 @@ static int volume_create(lsmPluginPtr c, lsmPool *pool,
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int pool_index = find_pool(pd, lsmPoolIdGet(pool));
if( pool_index >= 0 ) {
@@ -795,7 +795,7 @@ static int volume_replicate(lsmPluginPtr c, lsmPool *pool,
int vi;
lsmPool *pool_to_use = pool;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
/* If the user didn't pass us a pool to use, we will use the same one
that the source pool is contained on */
@@ -847,7 +847,7 @@ static int volume_replicate_range(lsmPluginPtr c,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int src_v = find_volume_name(pd, lsmVolumeNameGet(source));
int dest_v = find_volume_name(pd, lsmVolumeNameGet(dest));
@@ -868,7 +868,7 @@ static int volume_resize(lsmPluginPtr c, lsmVolume *volume,
{
int rc = LSM_ERR_OK;
int vi;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
vi = find_volume_name(pd, lsmVolumeNameGet(volume));
@@ -920,7 +920,7 @@ static int volume_delete(lsmPluginPtr c, lsmVolume *volume,
char *k = NULL;
GHashTable *v = NULL;
const char *volume_id = lsmVolumeIdGet(volume);
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int vi = find_volume_name(pd, lsmVolumeNameGet(volume));
if( -1 != vi ) {
lsmVolume *vp = pd->volume[vi].v;
@@ -951,7 +951,7 @@ static int volume_online_offline(lsmPluginPtr c, lsmVolume *v,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int vi = find_volume_name(pd, lsmVolumeNameGet(v));
if( -1 == vi ) {
@@ -966,12 +966,12 @@ static int access_group_list(lsmPluginPtr c,
uint32_t *groupCount, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
*groupCount = g_hash_table_size(pd->access_groups);
if( *groupCount ) {
- *groups = lsmAccessGroupRecordAllocArray(*groupCount);
+ *groups = lsmAccessGroupRecordArrayAlloc(*groupCount);
if( *groups ) {
int i = 0;
char *key = NULL;
@@ -985,7 +985,7 @@ static int access_group_list(lsmPluginPtr c,
(*groups)[i] = lsmAccessGroupRecordCopy(val->ag);
if( !(*groups)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmAccessGroupRecordFreeArray(*groups, i);
+ lsmAccessGroupRecordArrayFree(*groups, i);
*groupCount = 0;
groups = NULL;
break;
@@ -1010,7 +1010,7 @@ static int access_group_create(lsmPluginPtr c,
int rc = LSM_ERR_OK;
lsmAccessGroup *ag = NULL;
struct allocated_ag *aag = NULL;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
char *id = strdup(md5(name));
struct allocated_ag *find = (struct allocated_ag *)
@@ -1019,7 +1019,7 @@ static int access_group_create(lsmPluginPtr c,
if( !find ) {
lsmStringList *initiators = lsmStringListAlloc(1);
if( initiators && id &&
- (LSM_ERR_OK == lsmStringListSetElem(initiators, 0, initiator_id))) {
+ (LSM_ERR_OK == lsmStringListElemSet(initiators, 0, initiator_id))) {
ag = lsmAccessGroupRecordAlloc(id, name, initiators,
system_id);
aag = alloc_allocated_ag(ag, id_type);
@@ -1062,7 +1062,7 @@ static int access_group_delete( lsmPluginPtr c,
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
const char *id = lsmAccessGroupIdGet(group);
gboolean r = g_hash_table_remove(pd->access_groups, (gpointer)id);
@@ -1088,7 +1088,7 @@ static int access_group_add_initiator( lsmPluginPtr c,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_ag *find = (struct allocated_ag *)
g_hash_table_lookup(pd->access_groups,
@@ -1110,7 +1110,7 @@ static int access_group_del_initiator( lsmPluginPtr c,
lsmFlag_t flags)
{
int rc = LSM_ERR_INITIATOR_NOT_IN_ACCESS_GROUP;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_ag *find = (struct allocated_ag *)
g_hash_table_lookup(pd->access_groups,
@@ -1121,8 +1121,8 @@ static int access_group_del_initiator( lsmPluginPtr c,
lsmStringList *inits = lsmAccessGroupInitiatorIdGet(find->ag);
for(i = 0; i < lsmStringListSize(inits); ++i) {
- if( strcmp(init, lsmStringListGetElem(inits, i)) == 0 ) {
- lsmStringListRemove(inits, i);
+ if( strcmp(init, lsmStringListElemGet(inits, i)) == 0 ) {
+ lsmStringListDelete(inits, i);
rc = LSM_ERR_OK;
break;
}
@@ -1141,7 +1141,7 @@ static int access_group_grant(lsmPluginPtr c,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_ag *find = (struct allocated_ag *)
g_hash_table_lookup(pd->access_groups,
@@ -1217,7 +1217,7 @@ static int access_group_revoke(lsmPluginPtr c,
lsmFlag_t flags)
{
int rc = LSM_ERR_NO_MAPPING;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_ag *find = (struct allocated_ag *)
g_hash_table_lookup(pd->access_groups,
@@ -1263,7 +1263,7 @@ static int vol_accessible_by_ag(lsmPluginPtr c,
uint32_t *count, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_ag *find = (struct allocated_ag *)
g_hash_table_lookup(pd->access_groups,
@@ -1276,7 +1276,7 @@ static int vol_accessible_by_ag(lsmPluginPtr c,
if( grants && g_hash_table_size(grants) ) {
*count = g_hash_table_size(grants);
GList *keys = g_hash_table_get_keys(grants);
- *volumes = lsmVolumeRecordAllocArray(*count);
+ *volumes = lsmVolumeRecordArrayAlloc(*count);
if( keys && *volumes ) {
GList *curr = NULL;
@@ -1290,7 +1290,7 @@ static int vol_accessible_by_ag(lsmPluginPtr c,
(char *)curr->data));
if( !(*volumes)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmVolumeRecordFreeArray(*volumes, i);
+ lsmVolumeRecordArrayFree(*volumes, i);
*volumes = NULL;
*count = 0;
break;
@@ -1330,7 +1330,7 @@ static int ag_granted_to_volume( lsmPluginPtr c,
GHashTableIter iter;
char *k = NULL;
GHashTable *v = NULL;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
const char* volume_id = lsmVolumeIdGet(volume);
g_hash_table_iter_init (&iter, pd->group_grant);
GSList *result = NULL;
@@ -1346,7 +1346,7 @@ static int ag_granted_to_volume( lsmPluginPtr c,
if( *count ) {
int i = 0;
- *groups = lsmAccessGroupRecordAllocArray(*count);
+ *groups = lsmAccessGroupRecordArrayAlloc(*count);
GSList *siter = NULL;
if( *groups ) {
@@ -1356,7 +1356,7 @@ static int ag_granted_to_volume( lsmPluginPtr c,
if( !(*groups)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmAccessGroupRecordFreeArray(*groups, i);
+ lsmAccessGroupRecordArrayFree(*groups, i);
*groups = NULL;
*count = 0;
break;
@@ -1377,7 +1377,7 @@ int static volume_dependency(lsmPluginPtr c,
lsmVolume *volume,
uint8_t *yes, lsmFlag_t flags)
{
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int vi = find_volume_name(pd, lsmVolumeNameGet(volume));
if( -1 != vi ) {
@@ -1392,7 +1392,7 @@ int static volume_dependency_rm(lsmPluginPtr c,
lsmVolume *volume,
char **job, lsmFlag_t flags)
{
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int vi = find_volume_name(pd, lsmVolumeNameGet(volume));
if( -1 != vi ) {
@@ -1457,7 +1457,7 @@ static lsmAccessGroup *get_access_group( lsmPluginPtr c, char *group_name,
break;
}
}
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
}
return ag;
}
@@ -1522,7 +1522,7 @@ static int _initiator_in_ag(struct plugin_data *pd, lsmAccessGroup *ag,
uint32_t i = 0;
for ( i = 0; i < count; ++i ) {
- if( strcmp(lsmStringListGetElem(initiators, i), init_id) == 0 ) {
+ if( strcmp(lsmStringListElemGet(initiators, i), init_id) == 0 ) {
return 1;
}
}
@@ -1539,7 +1539,7 @@ static int vol_accessible_by_init(lsmPluginPtr c,
GHashTableIter iter;
char *key = NULL;
struct allocated_ag *val = NULL;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
const char *search = lsmInitiatorIdGet(initiator);
GHashTable *tmp_vols = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
NULL);
@@ -1580,7 +1580,7 @@ static int vol_accessible_by_init(lsmPluginPtr c,
*count = g_hash_table_size(tmp_vols);
if( *count ) {
- *volumes = lsmVolumeRecordAllocArray( *count );
+ *volumes = lsmVolumeRecordArrayAlloc( *count );
if( *volumes ) {
/* Walk through each volume and see if we should include it*/
uint32_t i = 0;
@@ -1592,7 +1592,7 @@ static int vol_accessible_by_init(lsmPluginPtr c,
(*volumes)[alloc_count] = lsmVolumeRecordCopy(tv);
if( !(*volumes)[alloc_count] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmVolumeRecordFreeArray(*volumes, alloc_count);
+ lsmVolumeRecordArrayFree(*volumes, alloc_count);
*count = 0;
*volumes = NULL;
break;
@@ -1650,11 +1650,11 @@ static int fs_list(lsmPluginPtr c, lsmFs **fs[], uint32_t *count,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
*count = g_hash_table_size(pd->fs);
if( *count ) {
- *fs = lsmFsRecordAllocArray( *count );
+ *fs = lsmFsRecordArrayAlloc( *count );
if( *fs ) {
uint32_t i = 0;
char *k = NULL;
@@ -1665,7 +1665,7 @@ static int fs_list(lsmPluginPtr c, lsmFs **fs[], uint32_t *count,
(*fs)[i] = lsmFsRecordCopy(afs->fs);
if( !(*fs)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmFsRecordFreeArray(*fs, i);
+ lsmFsRecordArrayFree(*fs, i);
*count = 0;
*fs = NULL;
break;
@@ -1683,7 +1683,7 @@ static int fs_create(lsmPluginPtr c, lsmPool *pool, const char *name,
uint64_t size_bytes, lsmFs **fs, char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
int pi = find_pool(pd, lsmPoolIdGet(pool));
@@ -1737,7 +1737,7 @@ static int fs_create(lsmPluginPtr c, lsmPool *pool, const char *name,
static int fs_delete(lsmPluginPtr c, lsmFs *fs, char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if( !g_hash_table_remove(pd->fs, lsmFsIdGet(fs)) ) {
rc = lsmLogErrorBasic(c, LSM_ERR_NOT_FOUND_FS, "FS not found!");
@@ -1752,7 +1752,7 @@ static int fs_resize(lsmPluginPtr c, lsmFs *fs,
char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *afs = g_hash_table_lookup(pd->fs, lsmFsIdGet(fs));
*rfs = NULL;
@@ -1811,7 +1811,7 @@ static int fs_clone(lsmPluginPtr c, lsmFs *src_fs, const char *dest_fs_name,
char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = g_hash_table_lookup(pd->fs, lsmFsIdGet(src_fs));
@@ -1832,7 +1832,7 @@ static int fs_file_clone(lsmPluginPtr c, lsmFs *fs,
lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = (struct allocated_fs *)g_hash_table_lookup(
pd->fs, lsmFsIdGet(fs));
@@ -1849,7 +1849,7 @@ static int fs_child_dependency(lsmPluginPtr c, lsmFs *fs,
uint8_t *yes)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if( g_hash_table_lookup(pd->fs, lsmFsIdGet(fs))) {
*yes = 0;
} else {
@@ -1863,7 +1863,7 @@ static int fs_child_dependency_rm( lsmPluginPtr c, lsmFs *fs,
char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if( !g_hash_table_lookup(pd->fs, lsmFsIdGet(fs))) {
rc = lsmLogErrorBasic(c, LSM_ERR_NOT_FOUND_FS, "fs not found");
} else {
@@ -1876,7 +1876,7 @@ static int ss_list(lsmPluginPtr c, lsmFs * fs, lsmSs **ss[],
uint32_t *count, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = (struct allocated_fs *)g_hash_table_lookup(
pd->fs, lsmFsIdGet(fs));
@@ -1890,7 +1890,7 @@ static int ss_list(lsmPluginPtr c, lsmFs * fs, lsmSs **ss[],
*count = g_hash_table_size(find->ss);
if( *count ) {
- *ss = lsmSsRecordAllocArray(*count);
+ *ss = lsmSsRecordArrayAlloc(*count);
if( *ss ) {
int i = 0;
g_hash_table_iter_init(&iter, find->ss);
@@ -1900,7 +1900,7 @@ static int ss_list(lsmPluginPtr c, lsmFs * fs, lsmSs **ss[],
(*ss)[i] = lsmSsRecordCopy(v);
if( !(*ss)[i] ) {
rc = lsmLogErrorBasic(c, LSM_ERR_NO_MEMORY, "ENOMEM");
- lsmSsRecordFreeArray(*ss, i);
+ lsmSsRecordArrayFree(*ss, i);
*ss = NULL;
*count = 0;
break;
@@ -1925,7 +1925,7 @@ static int ss_create(lsmPluginPtr c, lsmFs *fs,
lsmFlag_t flags)
{
int rc = LSM_ERR_NO_MEMORY;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = (struct allocated_fs *)g_hash_table_lookup(
pd->fs, lsmFsIdGet(fs));
@@ -1963,7 +1963,7 @@ static int ss_delete(lsmPluginPtr c, lsmFs *fs, lsmSs *ss,
char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = (struct allocated_fs *)g_hash_table_lookup(
pd->fs, lsmFsIdGet(fs));
@@ -1987,7 +1987,7 @@ static int ss_revert(lsmPluginPtr c, lsmFs *fs, lsmSs *ss,
int all_files, char **job, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *find = (struct allocated_fs *)g_hash_table_lookup(
pd->fs, lsmFsIdGet(fs));
@@ -2026,7 +2026,7 @@ static int nfs_auth_types(lsmPluginPtr c, lsmStringList **types,
int rc = LSM_ERR_OK;
*types = lsmStringListAlloc(1);
if( *types ) {
- lsmStringListSetElem(*types, 0, "standard");
+ lsmStringListElemSet(*types, 0, "standard");
} else {
rc = LSM_ERR_NO_MEMORY;
}
@@ -2042,7 +2042,7 @@ static int nfs_export_list( lsmPluginPtr c, lsmNfsExport **exports[],
char *k = NULL;
struct allocated_fs *v = NULL;
GSList *result = NULL;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
g_hash_table_iter_init (&fs_iter, pd->fs);
@@ -2064,7 +2064,7 @@ static int nfs_export_list( lsmPluginPtr c, lsmNfsExport **exports[],
if( *count ) {
int i = 0;
GSList *s_iter = NULL;
- *exports = lsmNfsExportRecordAllocArray(*count);
+ *exports = lsmNfsExportRecordArrayAlloc(*count);
if( *exports ) {
for( s_iter = result; s_iter ; s_iter = g_slist_next(s_iter), i++) {
(*exports)[i] = lsmNfsExportRecordCopy(
@@ -2072,7 +2072,7 @@ static int nfs_export_list( lsmPluginPtr c, lsmNfsExport **exports[],
if( !(*exports)[i] ) {
rc = LSM_ERR_NO_MEMORY;
- lsmNfsExportRecordFreeArray(*exports, i);
+ lsmNfsExportRecordArrayFree(*exports, i);
*exports = NULL;
*count = 0;
break;
@@ -2107,7 +2107,7 @@ static int nfs_export_create( lsmPluginPtr c,
{
int rc = LSM_ERR_OK;
char auto_export[2048];
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *fs = g_hash_table_lookup(pd->fs, fs_id);
if( fs ) {
@@ -2150,7 +2150,7 @@ static int nfs_export_remove( lsmPluginPtr c, lsmNfsExport *e,
lsmFlag_t flags )
{
int rc = LSM_ERR_OK;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
struct allocated_fs *fs = g_hash_table_lookup(pd->fs,
lsmNfsExportFsIdGet(e));
@@ -2259,7 +2259,7 @@ int unload( lsmPluginPtr c, lsmFlag_t flags)
{
uint32_t i = 0;
- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c);
+ struct plugin_data *pd = (struct plugin_data*)lsmPrivateDataGet(c);
if( pd ) {
g_hash_table_destroy(pd->jobs);
diff --git a/src/lsm_convert.cpp b/src/lsm_convert.cpp
index 630386e..fc0c140 100644
--- a/src/lsm_convert.cpp
+++ b/src/lsm_convert.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -223,7 +223,7 @@ lsmStringList *valueToStringList(Value &v)
if( il ) {
for( uint32_t i = 0; i < size; ++i ) {
- if(LSM_ERR_OK != lsmStringListSetElem(il, i, vl[i].asC_str())){
+ if(LSM_ERR_OK != lsmStringListElemSet(il, i, vl[i].asC_str())){
lsmStringListFree(il);
il = NULL;
break;
@@ -241,7 +241,7 @@ Value stringListToValue( lsmStringList *sl)
uint32_t size = lsmStringListSize(sl);
for(uint32_t i = 0; i < size; ++i ) {
- rc.push_back(Value(lsmStringListGetElem(sl, i)));
+ rc.push_back(Value(lsmStringListElemGet(sl, i)));
}
}
return Value(rc);
@@ -292,13 +292,13 @@ lsmAccessGroup **valueToAccessGroupList( Value &group, uint32_t *count )
*count = ag.size();
if( *count ) {
- rc = lsmAccessGroupRecordAllocArray(*count);
+ rc = lsmAccessGroupRecordArrayAlloc(*count);
if( rc ) {
uint32_t i;
for(i = 0; i < *count; ++i ) {
rc[i] = valueToAccessGroup(ag[i]);
if( !rc[i] ) {
- lsmAccessGroupRecordFreeArray(rc, i);
+ lsmAccessGroupRecordArrayFree(rc, i);
rc = NULL;
break;
}
@@ -353,12 +353,12 @@ lsmBlockRange **valueToBlockRangeList(Value &brl, uint32_t *count)
std::vector<Value> r = brl.asArray();
*count = r.size();
if( *count ) {
- rc = lsmBlockRangeRecordAllocArray(*count);
+ rc = lsmBlockRangeRecordArrayAlloc(*count);
if( rc ) {
for( uint32_t i = 0; i < *count; ++i ) {
rc[i] = valueToBlockRange(r[i]);
if( !rc[i] ) {
- lsmBlockRangeRecordFreeArray(rc, i);
+ lsmBlockRangeRecordArrayFree(rc, i);
rc = NULL;
break;
}
diff --git a/src/lsm_datatypes.cpp b/src/lsm_datatypes.cpp
index 3c065f6..29052e4 100644
--- a/src/lsm_datatypes.cpp
+++ b/src/lsm_datatypes.cpp
@@ -68,7 +68,7 @@ int lsmStringListAppend(lsmStringList *sl, const char *value)
return rc;
}
-int lsmStringListRemove(lsmStringList *sl, uint32_t index)
+int lsmStringListDelete(lsmStringList *sl, uint32_t index)
{
int rc = LSM_ERR_INVALID_SL;
@@ -84,7 +84,7 @@ int lsmStringListRemove(lsmStringList *sl, uint32_t index)
}
-int lsmStringListSetElem(lsmStringList *sl, uint32_t index,
+int lsmStringListElemSet(lsmStringList *sl, uint32_t index,
const char* value)
{
int rc = LSM_ERR_OK;
@@ -116,7 +116,7 @@ int lsmStringListSetElem(lsmStringList *sl, uint32_t index,
return rc;
}
-const char *lsmStringListGetElem(lsmStringList *sl, uint32_t index)
+const char *lsmStringListElemGet(lsmStringList *sl, uint32_t index)
{
if( LSM_IS_STRING_LIST(sl) ) {
if( index < sl->values->len ) {
@@ -179,8 +179,8 @@ lsmStringList *lsmStringListCopy(lsmStringList *src)
uint32_t i;
for( i = 0; i < size ; ++i ) {
- if ( LSM_ERR_OK != lsmStringListSetElem(dest, i,
- lsmStringListGetElem(src, i))) {
+ if ( LSM_ERR_OK != lsmStringListElemSet(dest, i,
+ lsmStringListElemGet(src, i))) {
/** We had an allocation failure setting an element item */
lsmStringListFree(dest);
dest = NULL;
@@ -411,37 +411,37 @@ int lsmErrorFree(lsmErrorPtr e)
return (type_t)error; \
-lsmErrorNumber lsmErrorGetNumber(lsmErrorPtr e)
+lsmErrorNumber lsmErrorNumberGet(lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(lsmErrorNumber, e, code, -1);
}
-lsmErrorDomain lsmErrorGetDomain(lsmErrorPtr e)
+lsmErrorDomain lsmErrorDomainGet(lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(lsmErrorDomain, e, domain, -1);
}
-lsmErrorLevel lsmErrorGetLevel(lsmErrorPtr e)
+lsmErrorLevel lsmErrorLevelGet(lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(lsmErrorLevel, e, level, -1);
}
-char* lsmErrorGetMessage( lsmErrorPtr e)
+char* lsmErrorMessageGet( lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(char*, e, message, NULL);
}
-char* lsmErrorGetException(lsmErrorPtr e)
+char* lsmErrorExceptionGet(lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(char*, e, exception, NULL);
}
-char* lsmErrorGetDebug(lsmErrorPtr e)
+char* lsmErrorDebugGet(lsmErrorPtr e)
{
LSM_RETURN_ERR_VAL(char*, e, debug, NULL);
}
-void* lsmErrorGetDebugData(lsmErrorPtr e, uint32_t *size)
+void* lsmErrorDebugDataGet(lsmErrorPtr e, uint32_t *size)
{
if (LSM_IS_ERROR(e) && size != NULL) {
if (e->debug_data) {
@@ -480,8 +480,8 @@ rtype *name(uint32_t size) \
* @param record_type Type to record
* @return None
*/
-#define CREATE_FREE_ARRAY_FUNC(name, free_func, record_type)\
-void name( record_type pa[], uint32_t size) \
+#define CREATE_FREE_ARRAY_FUNC(name, free_func, record_type, error)\
+int name( record_type pa[], uint32_t size) \
{ \
if (pa) { \
uint32_t i = 0; \
@@ -489,11 +489,13 @@ void name( record_type pa[], uint32_t size) \
free_func(pa[i]); \
} \
free(pa); \
+ return LSM_ERR_OK; \
} \
+ return error; \
}
-CREATE_ALLOC_ARRAY_FUNC(lsmPoolRecordAllocArray, lsmPool *)
+CREATE_ALLOC_ARRAY_FUNC(lsmPoolRecordArrayAlloc, lsmPool *)
lsmPool *lsmPoolRecordAlloc(const char *id, const char *name,
uint64_t totalSpace, uint64_t freeSpace, uint64_t status,
@@ -537,7 +539,7 @@ lsmPool * lsmPoolRecordCopy( lsmPool *toBeCopied)
return NULL;
}
-void lsmPoolRecordFree(lsmPool *p)
+int lsmPoolRecordFree(lsmPool *p)
{
if (LSM_IS_POOL(p)) {
p->magic = LSM_DEL_MAGIC(LSM_POOL_MAGIC);
@@ -556,10 +558,13 @@ void lsmPoolRecordFree(lsmPool *p)
p->system_id = NULL;
}
free(p);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_POOL;
}
-CREATE_FREE_ARRAY_FUNC(lsmPoolRecordFreeArray, lsmPoolRecordFree, lsmPool *)
+CREATE_FREE_ARRAY_FUNC(lsmPoolRecordArrayFree, lsmPoolRecordFree, lsmPool *,
+ LSM_ERR_INVALID_POOL)
char *lsmPoolNameGet(lsmPool *p)
{
@@ -609,7 +614,7 @@ char *lsmPoolSystemIdGet( lsmPool *p )
return NULL;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmInitiatorRecordAllocArray, lsmInitiator *)
+CREATE_ALLOC_ARRAY_FUNC(lsmInitiatorRecordArrayAlloc, lsmInitiator *)
lsmInitiator *lsmInitiatorRecordAlloc(lsmInitiatorType idType, const char* id,
const char* name)
@@ -638,7 +643,7 @@ lsmInitiator *lsmInitiatorRecordCopy(lsmInitiator *i)
return rc;
}
-void lsmInitiatorRecordFree(lsmInitiator *i)
+int lsmInitiatorRecordFree(lsmInitiator *i)
{
if( LSM_IS_INIT(i) ) {
i->magic = LSM_DEL_MAGIC(LSM_INIT_MAGIC);
@@ -649,11 +654,13 @@ void lsmInitiatorRecordFree(lsmInitiator *i)
i->name = NULL;
}
free(i);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_INIT;
}
-CREATE_FREE_ARRAY_FUNC( lsmInitiatorRecordFreeArray, lsmInitiatorRecordFree,
- lsmInitiator *)
+CREATE_FREE_ARRAY_FUNC( lsmInitiatorRecordArrayFree, lsmInitiatorRecordFree,
+ lsmInitiator *, LSM_ERR_INVALID_INIT)
lsmInitiatorType lsmInitiatorTypeGet(lsmInitiator *i)
{
@@ -679,7 +686,7 @@ char *lsmInitiatorNameGet(lsmInitiator *i)
return NULL;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmVolumeRecordAllocArray, lsmVolume *)
+CREATE_ALLOC_ARRAY_FUNC(lsmVolumeRecordArrayAlloc, lsmVolume *)
lsmVolume * lsmVolumeRecordAlloc(const char *id, const char *name,
const char *vpd83, uint64_t blockSize,
@@ -707,7 +714,7 @@ lsmVolume * lsmVolumeRecordAlloc(const char *id, const char *name,
return rc;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmDiskRecordAllocArray, lsmDisk *)
+CREATE_ALLOC_ARRAY_FUNC(lsmDiskRecordArrayAlloc, lsmDisk *)
lsmDisk *lsmDiskRecordAlloc(const char *id, const char *name,
lsmDiskType disk_type, uint64_t block_size, uint64_t block_count,
@@ -733,7 +740,7 @@ lsmDisk *lsmDiskRecordAlloc(const char *id, const char *name,
return rc;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmSystemRecordAllocArray, lsmSystem *)
+CREATE_ALLOC_ARRAY_FUNC(lsmSystemRecordArrayAlloc, lsmSystem *)
lsmSystem *lsmSystemRecordAlloc( const char *id, const char *name,
uint32_t status)
@@ -752,7 +759,7 @@ lsmSystem *lsmSystemRecordAlloc( const char *id, const char *name,
return rc;
}
-void lsmSystemRecordFree(lsmSystem *s)
+int lsmSystemRecordFree(lsmSystem *s)
{
if( LSM_IS_SYSTEM(s) ) {
s->magic = LSM_DEL_MAGIC(LSM_SYSTEM_MAGIC);
@@ -768,10 +775,13 @@ void lsmSystemRecordFree(lsmSystem *s)
}
free(s);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_SYSTEM;
}
-CREATE_FREE_ARRAY_FUNC(lsmSystemRecordFreeArray, lsmSystemRecordFree, lsmSystem *)
+CREATE_FREE_ARRAY_FUNC(lsmSystemRecordArrayFree, lsmSystemRecordFree,
+ lsmSystem *, LSM_ERR_INVALID_SYSTEM)
lsmSystem *lsmSystemRecordCopy(lsmSystem *s)
{
@@ -817,7 +827,7 @@ lsmVolume *lsmVolumeRecordCopy(lsmVolume *vol)
return rc;
}
-void lsmVolumeRecordFree(lsmVolume *v)
+int lsmVolumeRecordFree(lsmVolume *v)
{
if ( LSM_IS_VOL(v) ) {
v->magic = LSM_DEL_MAGIC(LSM_VOL_MAGIC);
@@ -848,11 +858,13 @@ void lsmVolumeRecordFree(lsmVolume *v)
}
free(v);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_VOL;
}
-CREATE_FREE_ARRAY_FUNC( lsmVolumeRecordFreeArray, lsmVolumeRecordFree,
- lsmVolume *)
+CREATE_FREE_ARRAY_FUNC( lsmVolumeRecordArrayFree, lsmVolumeRecordFree,
+ lsmVolume *, LSM_ERR_INVALID_VOL)
lsmDisk *lsmDiskRecordCopy(lsmDisk *disk)
{
@@ -864,7 +876,7 @@ lsmDisk *lsmDiskRecordCopy(lsmDisk *disk)
return NULL;
}
-void lsmDiskRecordFree(lsmDisk *d)
+int lsmDiskRecordFree(lsmDisk *d)
{
if ( LSM_IS_DISK(d) ) {
d->magic = LSM_DEL_MAGIC(LSM_DISK_MAGIC);
@@ -882,11 +894,13 @@ void lsmDiskRecordFree(lsmDisk *d)
d->optional_data = NULL;
free(d);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_DISK;
}
-CREATE_FREE_ARRAY_FUNC( lsmDiskRecordFreeArray, lsmDiskRecordFree,
- lsmDisk *)
+CREATE_FREE_ARRAY_FUNC( lsmDiskRecordArrayFree, lsmDiskRecordFree,
+ lsmDisk *, LSM_ERR_INVALID_DISK)
/* We would certainly expand this to encompass the entire function */
#define MEMBER_GET(x, validation, member, error) \
@@ -1003,7 +1017,7 @@ lsmOptionalData *lsmDiskOptionalDataGet(lsmDisk *d)
MEMBER_GET(d, LSM_IS_DISK, optional_data, NULL);
}
-CREATE_ALLOC_ARRAY_FUNC(lsmAccessGroupRecordAllocArray, lsmAccessGroup *)
+CREATE_ALLOC_ARRAY_FUNC(lsmAccessGroupRecordArrayAlloc, lsmAccessGroup *)
lsmAccessGroup *lsmAccessGroupRecordAlloc(const char *id,
const char *name,
@@ -1039,7 +1053,7 @@ lsmAccessGroup *lsmAccessGroupRecordCopy( lsmAccessGroup *ag )
return rc;
}
-void lsmAccessGroupRecordFree(lsmAccessGroup *ag)
+int lsmAccessGroupRecordFree(lsmAccessGroup *ag)
{
if( LSM_IS_ACCESS_GROUP(ag) ) {
ag->magic = LSM_DEL_MAGIC(LSM_ACCESS_GROUP_MAGIC);
@@ -1048,11 +1062,13 @@ void lsmAccessGroupRecordFree(lsmAccessGroup *ag)
free(ag->system_id);
lsmStringListFree(ag->initiators);
free(ag);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_ACCESS_GROUP;
}
-CREATE_FREE_ARRAY_FUNC(lsmAccessGroupRecordFreeArray, lsmAccessGroupRecordFree,
- lsmAccessGroup *)
+CREATE_FREE_ARRAY_FUNC(lsmAccessGroupRecordArrayFree, lsmAccessGroupRecordFree,
+ lsmAccessGroup *, LSM_ERR_INVALID_ACCESS_GROUP)
const char *lsmAccessGroupIdGet( lsmAccessGroup *group )
{
@@ -1095,7 +1111,7 @@ void lsmAccessGroupInitiatorIdSet( lsmAccessGroup *group, lsmStringList *il)
}
}
-lsmErrorPtr lsmErrorGetLast(lsmConnect *c)
+lsmErrorPtr lsmErrorLastGet(lsmConnect *c)
{
if( LSM_IS_CONNECT(c) ) {
lsmErrorPtr e = c->error;
@@ -1121,12 +1137,14 @@ lsmBlockRange *lsmBlockRangeRecordAlloc(uint64_t source_start,
return rc;
}
-void lsmBlockRangeRecordFree( lsmBlockRange *br )
+int lsmBlockRangeRecordFree( lsmBlockRange *br )
{
if( LSM_IS_BLOCK_RANGE(br) ) {
br->magic = LSM_DEL_MAGIC(LSM_BLOCK_RANGE_MAGIC);
free(br);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_BLOCK_RANGE;
}
lsmBlockRange *lsmBlockRangeRecordCopy( lsmBlockRange *source )
@@ -1141,9 +1159,9 @@ lsmBlockRange *lsmBlockRangeRecordCopy( lsmBlockRange *source )
return dest;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmBlockRangeRecordAllocArray, lsmBlockRange *)
-CREATE_FREE_ARRAY_FUNC(lsmBlockRangeRecordFreeArray, lsmBlockRangeRecordFree,
- lsmBlockRange *)
+CREATE_ALLOC_ARRAY_FUNC(lsmBlockRangeRecordArrayAlloc, lsmBlockRange *)
+CREATE_FREE_ARRAY_FUNC(lsmBlockRangeRecordArrayFree, lsmBlockRangeRecordFree,
+ lsmBlockRange *, LSM_ERR_INVALID_BLOCK_RANGE)
uint64_t lsmBlockRangeSourceStartGet(lsmBlockRange *br)
@@ -1186,7 +1204,7 @@ lsmFs * lsmFsRecordAlloc( const char *id, const char *name,
return rc;
}
-void lsmFsRecordFree( lsmFs *fs)
+int lsmFsRecordFree( lsmFs *fs)
{
if( LSM_IS_FS(fs) ) {
fs->magic = LSM_DEL_MAGIC(LSM_FS_MAGIC);
@@ -1195,7 +1213,9 @@ void lsmFsRecordFree( lsmFs *fs)
free(fs->pool_id);
free(fs->system_id);
free(fs);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_FS;
}
lsmFs *lsmFsRecordCopy(lsmFs *source)
@@ -1211,8 +1231,9 @@ lsmFs *lsmFsRecordCopy(lsmFs *source)
return dest;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmFsRecordAllocArray, lsmFs *)
-CREATE_FREE_ARRAY_FUNC(lsmFsRecordFreeArray, lsmFsRecordFree, lsmFs *)
+CREATE_ALLOC_ARRAY_FUNC(lsmFsRecordArrayAlloc, lsmFs *)
+CREATE_FREE_ARRAY_FUNC(lsmFsRecordArrayFree, lsmFsRecordFree, lsmFs *,
+ LSM_ERR_INVALID_FS)
const char *lsmFsIdGet(lsmFs *fs)
{
@@ -1272,18 +1293,21 @@ lsmSs *lsmSsRecordCopy(lsmSs *source)
return rc;
}
-void lsmSsRecordFree( lsmSs *ss)
+int lsmSsRecordFree( lsmSs *ss)
{
if( LSM_IS_SS(ss) ) {
ss->magic = LSM_DEL_MAGIC(LSM_SS_MAGIC);
free(ss->id);
free(ss->name);
free(ss);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_SS;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmSsRecordAllocArray, lsmSs *)
-CREATE_FREE_ARRAY_FUNC(lsmSsRecordFreeArray, lsmSsRecordFree, lsmSs *)
+CREATE_ALLOC_ARRAY_FUNC(lsmSsRecordArrayAlloc, lsmSs *)
+CREATE_FREE_ARRAY_FUNC(lsmSsRecordArrayFree, lsmSsRecordFree, lsmSs *,
+ LSM_ERR_INVALID_SS)
const char *lsmSsIdGet(lsmSs *ss)
{
@@ -1339,7 +1363,7 @@ lsmNfsExport *lsmNfsExportRecordAlloc( const char *id,
return rc;
}
-void lsmNfsExportRecordFree( lsmNfsExport *exp )
+int lsmNfsExportRecordFree( lsmNfsExport *exp )
{
if( LSM_IS_NFS_EXPORT(exp) ) {
exp->magic = LSM_DEL_MAGIC(LSM_NFS_EXPORT_MAGIC);
@@ -1353,7 +1377,9 @@ void lsmNfsExportRecordFree( lsmNfsExport *exp )
free(exp->options);
free(exp);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_NFS;
}
@@ -1367,9 +1393,9 @@ lsmNfsExport *lsmNfsExportRecordCopy( lsmNfsExport *s )
return NULL;
}
-CREATE_ALLOC_ARRAY_FUNC(lsmNfsExportRecordAllocArray, lsmNfsExport *)
-CREATE_FREE_ARRAY_FUNC(lsmNfsExportRecordFreeArray, lsmNfsExportRecordFree,
- lsmNfsExport *)
+CREATE_ALLOC_ARRAY_FUNC(lsmNfsExportRecordArrayAlloc, lsmNfsExport *)
+CREATE_FREE_ARRAY_FUNC(lsmNfsExportRecordArrayFree, lsmNfsExportRecordFree,
+ lsmNfsExport *, LSM_ERR_INVALID_NFS)
const char *lsmNfsExportIdGet( lsmNfsExport *exp )
{
@@ -1617,13 +1643,15 @@ lsmStorageCapabilities *lsmCapabilityRecordAlloc(const char *value)
return rc;
}
-void lsmCapabilityRecordFree(lsmStorageCapabilities *cap)
+int lsmCapabilityRecordFree(lsmStorageCapabilities *cap)
{
if( LSM_IS_CAPABILITIY(cap) ) {
cap->magic = LSM_DEL_MAGIC(LSM_CAPABILITIES_MAGIC);
free(cap->cap);
free(cap);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_CAPABILITY;
}
char* capabilityString(lsmStorageCapabilities *c)
@@ -1676,7 +1704,7 @@ lsmOptionalData *lsmOptionalDataRecordCopy(lsmOptionalData *src)
return dest;
}
-void lsmOptionalDataRecordFree(lsmOptionalData *op)
+int lsmOptionalDataRecordFree(lsmOptionalData *op)
{
if( LSM_IS_OPTIONAL_DATA(op) ) {
op->magic = LSM_DEL_MAGIC(LSM_OPTIONAL_DATA_MAGIC);
@@ -1686,7 +1714,9 @@ void lsmOptionalDataRecordFree(lsmOptionalData *op)
}
free(op);
+ return LSM_ERR_OK;
}
+ return LSM_ERR_INVALID_OPTIONAL_DATA;
}
int lsmOptionalDataListGet(lsmOptionalData *op, lsmStringList **l,
diff --git a/src/lsm_mgmt.cpp b/src/lsm_mgmt.cpp
index 289e598..4bc1c37 100644
--- a/src/lsm_mgmt.cpp
+++ b/src/lsm_mgmt.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -205,7 +205,7 @@ int lsmConnectClose(lsmConnect *c, lsmFlag_t flags)
return rc;
}
-int lsmPluginGetInfo(lsmConnect *c, char **desc,
+int lsmPluginInfoGet(lsmConnect *c, char **desc,
char **version, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
@@ -250,7 +250,7 @@ int lsmPluginGetInfo(lsmConnect *c, char **desc,
return rc;
}
-int lsmGetAvailablePlugins(const char *sep,
+int lsmAvailablePluginsList(const char *sep,
lsmStringList **plugins,
lsmFlag_t flags)
{
@@ -289,7 +289,7 @@ int lsmGetAvailablePlugins(const char *sep,
rc = loadDriver(c, dp->d_name, NULL, 30000, &e, 0, 0);
if( LSM_ERR_OK == rc) {
// Get the plugin information
- rc = lsmPluginGetInfo(c, &desc, &version, 0);
+ rc = lsmPluginInfoGet(c, &desc, &version, 0);
if( LSM_ERR_OK == rc) {
int format = asprintf(&s, "%s%s%s", desc, sep, version);
free(desc);
@@ -351,7 +351,7 @@ int lsmGetAvailablePlugins(const char *sep,
return rc;
}
-int lsmConnectSetTimeout(lsmConnect *c, uint32_t timeout, lsmFlag_t flags)
+int lsmConnectTimeoutSet(lsmConnect *c, uint32_t timeout, lsmFlag_t flags)
{
CONN_SETUP(c);
@@ -369,7 +369,7 @@ int lsmConnectSetTimeout(lsmConnect *c, uint32_t timeout, lsmFlag_t flags)
return rpc(c, "set_time_out", parameters, response);
}
-int lsmConnectGetTimeout(lsmConnect *c, uint32_t *timeout, lsmFlag_t flags)
+int lsmConnectTimeoutGet(lsmConnect *c, uint32_t *timeout, lsmFlag_t flags)
{
int rc = LSM_ERR_OK;
CONN_SETUP(c);
@@ -616,7 +616,7 @@ int lsmPoolList(lsmConnect *c, lsmPool **poolArray[],
*count = pools.size();
if( pools.size() ) {
- *poolArray = lsmPoolRecordAllocArray(pools.size());
+ *poolArray = lsmPoolRecordArrayAlloc(pools.size());
for( size_t i = 0; i < pools.size(); ++i ) {
(*poolArray)[i] = valueToPool(pools[i]);
@@ -627,7 +627,7 @@ int lsmPoolList(lsmConnect *c, lsmPool **poolArray[],
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *poolArray && *count ) {
- lsmPoolRecordFreeArray(*poolArray, *count);
+ lsmPoolRecordArrayFree(*poolArray, *count);
*poolArray = NULL;
*count = 0;
}
@@ -646,7 +646,7 @@ static int get_initiator_array(lsmConnect *c, int rc, Value &response,
if( inits.size() ) {
- *initiators = lsmInitiatorRecordAllocArray(inits.size());
+ *initiators = lsmInitiatorRecordArrayAlloc(inits.size());
if( *initiators ) {
for( size_t i = 0; i < inits.size(); ++i ) {
@@ -659,7 +659,7 @@ static int get_initiator_array(lsmConnect *c, int rc, Value &response,
}
} catch ( const ValueException &ve ) {
if( *initiators && *count ) {
- lsmInitiatorRecordFreeArray(*initiators, *count);
+ lsmInitiatorRecordArrayFree(*initiators, *count);
*initiators = NULL;
*count = 0;
}
@@ -699,7 +699,7 @@ static int get_volume_array(lsmConnect *c, int rc, Value response,
*count = vol.size();
if( vol.size() ) {
- *volumes = lsmVolumeRecordAllocArray(vol.size());
+ *volumes = lsmVolumeRecordArrayAlloc(vol.size());
if( *volumes ){
for( size_t i = 0; i < vol.size(); ++i ) {
@@ -712,7 +712,7 @@ static int get_volume_array(lsmConnect *c, int rc, Value response,
}
} catch( const ValueException &ve) {
if( *volumes && *count ) {
- lsmVolumeRecordFreeArray(*volumes, *count);
+ lsmVolumeRecordArrayFree(*volumes, *count);
*volumes = NULL;
*count = 0;
}
@@ -753,7 +753,7 @@ static int get_disk_array(lsmConnect *c, int rc, Value &response,
*count = d.size();
if( d.size() ) {
- *disks = lsmDiskRecordAllocArray(d.size());
+ *disks = lsmDiskRecordArrayAlloc(d.size());
if( *disks ){
for( size_t i = 0; i < d.size(); ++i ) {
@@ -768,7 +768,7 @@ static int get_disk_array(lsmConnect *c, int rc, Value &response,
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *disks && *count ) {
- lsmDiskRecordFreeArray(*disks, *count);
+ lsmDiskRecordArrayFree(*disks, *count);
*disks = NULL;
*count = 0;
}
@@ -1268,7 +1268,7 @@ int lsmAccessGroupCreate(lsmConnect *c, const char *name,
return rc;
}
-int lsmAccessGroupDel(lsmConnect *c, lsmAccessGroup *group, lsmFlag_t flags)
+int lsmAccessGroupDelete(lsmConnect *c, lsmAccessGroup *group, lsmFlag_t flags)
{
CONN_SETUP(c);
@@ -1290,7 +1290,7 @@ int lsmAccessGroupDel(lsmConnect *c, lsmAccessGroup *group, lsmFlag_t flags)
return rpc(c, "access_group_del", parameters, response);
}
-int lsmAccessGroupAddInitiator(lsmConnect *c,
+int lsmAccessGroupInitiatorAdd(lsmConnect *c,
lsmAccessGroup *group,
const char *initiator_id,
lsmInitiatorType id_type,
@@ -1319,7 +1319,7 @@ int lsmAccessGroupAddInitiator(lsmConnect *c,
return rpc(c, "access_group_add_initiator", parameters, response);
}
-int lsmAccessGroupDelInitiator(lsmConnect *c, lsmAccessGroup *group,
+int lsmAccessGroupInitiatorDelete(lsmConnect *c, lsmAccessGroup *group,
const char* initiator_id, lsmFlag_t flags)
{
CONN_SETUP(c);
@@ -1435,7 +1435,7 @@ int lsmVolumesAccessibleByAccessGroup(lsmConnect *c,
*count = vol.size();
if( vol.size() ) {
- *volumes = lsmVolumeRecordAllocArray(vol.size());
+ *volumes = lsmVolumeRecordArrayAlloc(vol.size());
for( size_t i = 0; i < vol.size(); ++i ) {
(*volumes)[i] = valueToVolume(vol[i]);
@@ -1446,7 +1446,7 @@ int lsmVolumesAccessibleByAccessGroup(lsmConnect *c,
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *volumes && *count ) {
- lsmVolumeRecordFreeArray(*volumes, *count);
+ lsmVolumeRecordArrayFree(*volumes, *count);
*volumes = NULL;
*count = 0;
}
@@ -1569,13 +1569,13 @@ int lsmSystemList(lsmConnect *c, lsmSystem **systems[],
*systemCount = sys.size();
if( sys.size() ) {
- *systems = lsmSystemRecordAllocArray(sys.size());
+ *systems = lsmSystemRecordArrayAlloc(sys.size());
if( *systems ) {
for( size_t i = 0; i < sys.size(); ++i ) {
(*systems)[i] = valueToSystem(sys[i]);
if( !(*systems)[i] ) {
- lsmSystemRecordFreeArray(*systems, i);
+ lsmSystemRecordArrayFree(*systems, i);
rc = LSM_ERR_NO_MEMORY;
break;
}
@@ -1589,7 +1589,7 @@ int lsmSystemList(lsmConnect *c, lsmSystem **systems[],
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *systems ) {
- lsmSystemRecordFreeArray( *systems, *systemCount);
+ lsmSystemRecordArrayFree( *systems, *systemCount);
*systems = NULL;
*systemCount = 0;
}
@@ -1620,7 +1620,7 @@ int lsmFsList(lsmConnect *c, lsmFs **fs[], uint32_t *fsCount,
*fsCount = sys.size();
if( sys.size() ) {
- *fs = lsmFsRecordAllocArray(sys.size());
+ *fs = lsmFsRecordArrayAlloc(sys.size());
if( *fs ) {
for( size_t i = 0; i < sys.size(); ++i ) {
@@ -1635,7 +1635,7 @@ int lsmFsList(lsmConnect *c, lsmFs **fs[], uint32_t *fsCount,
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *fs && *fsCount) {
- lsmFsRecordFreeArray(*fs, *fsCount);
+ lsmFsRecordArrayFree(*fs, *fsCount);
*fs = NULL;
*fsCount = 0;
}
@@ -1900,7 +1900,7 @@ int lsmFsSsList(lsmConnect *c, lsmFs *fs, lsmSs **ss[],
*ssCount = sys.size();
if( sys.size() ) {
- *ss = lsmSsRecordAllocArray(sys.size());
+ *ss = lsmSsRecordArrayAlloc(sys.size());
if( *ss ) {
for( size_t i = 0; i < sys.size(); ++i ) {
@@ -1915,7 +1915,7 @@ int lsmFsSsList(lsmConnect *c, lsmFs *fs, lsmSs **ss[],
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *ss && *ssCount ) {
- lsmSsRecordFreeArray(*ss, *ssCount);
+ lsmSsRecordArrayFree(*ss, *ssCount);
*ss = NULL;
*ssCount = 0;
}
@@ -2060,7 +2060,7 @@ int lsmNfsList( lsmConnect *c, lsmNfsExport **exports[], uint32_t *count,
*count = exps.size();
if( *count ) {
- *exports = lsmNfsExportRecordAllocArray(*count);
+ *exports = lsmNfsExportRecordArrayAlloc(*count);
if( *exports ) {
for( size_t i = 0; i < *count; ++i ) {
@@ -2075,7 +2075,7 @@ int lsmNfsList( lsmConnect *c, lsmNfsExport **exports[], uint32_t *count,
rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
ve.what());
if( *exports && *count ) {
- lsmNfsExportRecordFreeArray( *exports, *count );
+ lsmNfsExportRecordArrayFree( *exports, *count );
*exports = NULL;
*count = 0;
}
@@ -2145,7 +2145,7 @@ int lsmNfsExportFs( lsmConnect *c,
return rc;
}
-int lsmNfsExportRemove( lsmConnect *c, lsmNfsExport *e, lsmFlag_t flags)
+int lsmNfsExportDelete( lsmConnect *c, lsmNfsExport *e, lsmFlag_t flags)
{
CONN_SETUP(c);
diff --git a/src/lsm_plugin_ipc.cpp b/src/lsm_plugin_ipc.cpp
index c68a742..01493c5 100644
--- a/src/lsm_plugin_ipc.cpp
+++ b/src/lsm_plugin_ipc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -117,7 +117,7 @@ int lsmRegisterPluginV1(lsmPluginPtr plug,
return rc;
}
-void *lsmGetPrivateData(lsmPluginPtr plug)
+void *lsmPrivateDataGet(lsmPluginPtr plug)
{
if (!LSM_IS_PLUGIN(plug)) {
return NULL;
@@ -414,7 +414,7 @@ static int handle_system_list(lsmPluginPtr p, Value ¶ms,
result.push_back(systemToValue(systems[i]));
}
- lsmSystemRecordFreeArray(systems, count);
+ lsmSystemRecordArrayFree(systems, count);
systems = NULL;
response = Value(result);
}
@@ -442,7 +442,7 @@ static int handle_pools(lsmPluginPtr p, Value ¶ms, Value &response)
result.push_back(poolToValue(pools[i]));
}
- lsmPoolRecordFreeArray(pools, count);
+ lsmPoolRecordArrayFree(pools, count);
pools = NULL;
response = Value(result);
}
@@ -495,7 +495,7 @@ static void get_initiators(int rc, lsmInitiator **inits, uint32_t count,
result.push_back(initiatorToValue(inits[i]));
}
- lsmInitiatorRecordFreeArray(inits, count);
+ lsmInitiatorRecordArrayFree(inits, count);
inits = NULL;
resp = Value(result);
}
@@ -530,7 +530,7 @@ static void get_volumes(int rc, lsmVolume **vols, uint32_t count,
result.push_back(volumeToValue(vols[i]));
}
- lsmVolumeRecordFreeArray(vols, count);
+ lsmVolumeRecordArrayFree(vols, count);
vols = NULL;
response = Value(result);
}
@@ -566,7 +566,7 @@ static void get_disks(int rc, lsmDisk **disks, uint32_t count, Value &response)
result.push_back(diskToValue(disks[i]));
}
- lsmDiskRecordFreeArray(disks, count);
+ lsmDiskRecordArrayFree(disks, count);
disks = NULL;
response = Value(result);
}
@@ -808,7 +808,7 @@ static int handle_volume_replicate_range(lsmPluginPtr p, Value ¶ms,
lsmVolumeRecordFree(source);
lsmVolumeRecordFree(dest);
- lsmBlockRangeRecordFreeArray(ranges, range_count);
+ lsmBlockRangeRecordArrayFree(ranges, range_count);
} else {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
@@ -909,7 +909,7 @@ static int ag_list(lsmPluginPtr p, Value ¶ms, Value &response)
response = accessGroupListToValue(groups, count);
/* Free the memory */
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
}
} else {
rc = LSM_ERR_TRANSPORT_INVALID_ARG;
@@ -1148,7 +1148,7 @@ static int vol_accessible_by_ag(lsmPluginPtr p, Value ¶ms, Value &response)
}
lsmAccessGroupRecordFree(ag);
- lsmVolumeRecordFreeArray(vols, count);
+ lsmVolumeRecordArrayFree(vols, count);
vols = NULL;
} else {
rc = LSM_ERR_NO_MEMORY;
@@ -1190,7 +1190,7 @@ static int ag_granted_to_volume(lsmPluginPtr p, Value ¶ms, Value &response)
}
lsmVolumeRecordFree(volume);
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
groups = NULL;
} else {
rc = LSM_ERR_NO_MEMORY;
@@ -1294,7 +1294,7 @@ static int fs(lsmPluginPtr p, Value ¶ms, Value &response)
}
response = Value(result);
- lsmFsRecordFreeArray(fs, count);
+ lsmFsRecordArrayFree(fs, count);
fs = NULL;
}
} else {
@@ -1650,7 +1650,7 @@ static int ss_list(lsmPluginPtr p, Value ¶ms, Value &response)
lsmFsRecordFree(fs);
fs = NULL;
- lsmSsRecordFreeArray(ss, count);
+ lsmSsRecordArrayFree(ss, count);
ss = NULL;
}
}
@@ -1844,7 +1844,7 @@ static int exports(lsmPluginPtr p, Value ¶ms, Value &response)
}
response = Value(result);
- lsmNfsExportRecordFreeArray(exports, count);
+ lsmNfsExportRecordArrayFree(exports, count);
exports = NULL;
count = 0;
}
diff --git a/test/tester.c b/test/tester.c
index ac37bdd..52fddfb 100644
--- a/test/tester.c
+++ b/test/tester.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -104,7 +104,7 @@ lsmPool *getTestPool(lsmConnect *c)
for(i = 0; i < count; ++i ) {
if(strcmp(lsmPoolNameGet(pools[i]), "lsm_test_aggr") == 0 ) {
test_pool = lsmPoolRecordCopy(pools[i]);
- lsmPoolRecordFreeArray(pools, count);
+ lsmPoolRecordArrayFree(pools, count);
break;
}
}
@@ -116,8 +116,8 @@ void dump_error(lsmErrorPtr e)
{
if (e != NULL) {
printf("Error msg= %s - exception %s - debug %s\n",
- lsmErrorGetMessage(e),
- lsmErrorGetException(e), lsmErrorGetDebug(e));
+ lsmErrorMessageGet(e),
+ lsmErrorExceptionGet(e), lsmErrorDebugGet(e));
lsmErrorFree(e);
e = NULL;
@@ -159,8 +159,8 @@ char *error(lsmErrorPtr e)
if( e != NULL ) {
snprintf(eb, sizeof(eb), "Error msg= %s - exception %s - debug %s",
- lsmErrorGetMessage(e),
- lsmErrorGetException(e), lsmErrorGetDebug(e));
+ lsmErrorMessageGet(e),
+ lsmErrorExceptionGet(e), lsmErrorDebugGet(e));
lsmErrorFree(e);
e = NULL;
} else {
@@ -177,14 +177,14 @@ void wait_for_job(lsmConnect *c, char **job_id)
do {
rc = lsmJobStatusGet(c, *job_id, &status, &pc, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "lsmJobStatusVolumeGet = %d (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "lsmJobStatusVolumeGet = %d (%s)", rc, error(lsmErrorLastGet(c)));
printf("GENERIC: Job %s in progress, %d done, status = %d\n", *job_id, pc, status);
usleep(POLL_SLEEP);
} while( status == LSM_JOB_INPROGRESS );
rc = lsmJobFree(c, job_id, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorLastGet(c)));
fail_unless( LSM_JOB_COMPLETE == status);
fail_unless( 100 == pc);
@@ -200,7 +200,7 @@ lsmVolume *wait_for_job_vol(lsmConnect *c, char **job_id)
do {
rc = lsmJobStatusVolumeGet(c, *job_id, &status, &pc, &vol, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorLastGet(c)));
printf("VOLUME: Job %s in progress, %d done, status = %d\n", *job_id, pc, status);
usleep(POLL_SLEEP);
@@ -209,7 +209,7 @@ lsmVolume *wait_for_job_vol(lsmConnect *c, char **job_id)
printf("Volume complete: Job %s percent %d done, status = %d, rc=%d\n", *job_id, pc, status, rc);
rc = lsmJobFree(c, job_id, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorLastGet(c)));
fail_unless( LSM_JOB_COMPLETE == status);
fail_unless( 100 == pc);
@@ -226,14 +226,14 @@ lsmFs *wait_for_job_fs(lsmConnect *c, char **job_id)
do {
rc = lsmJobStatusFsGet(c, *job_id, &status, &pc, &fs, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorLastGet(c)));
printf("FS: Job %s in progress, %d done, status = %d\n", *job_id, pc, status);
usleep(POLL_SLEEP);
} while( status == LSM_JOB_INPROGRESS );
rc = lsmJobFree(c, job_id, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorLastGet(c)));
fail_unless( LSM_JOB_COMPLETE == status);
fail_unless( 100 == pc);
@@ -250,14 +250,14 @@ lsmSs *wait_for_job_ss(lsmConnect *c, char **job_id)
do {
rc = lsmJobStatusSsGet(c, *job_id, &status, &pc, &ss, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "rc = %d (%s)", rc, error(lsmErrorLastGet(c)));
printf("SS: Job %s in progress, %d done, status = %d\n", *job_id, pc, status);
usleep(POLL_SLEEP);
} while( status == LSM_JOB_INPROGRESS );
rc = lsmJobFree(c, job_id, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorGetLast(c)));
+ fail_unless( LSM_ERR_OK == rc, "lsmJobFree %d, (%s)", rc, error(lsmErrorLastGet(c)));
fail_unless( LSM_JOB_COMPLETE == status);
fail_unless( 100 == pc);
@@ -279,8 +279,8 @@ int compare_string_lists(lsmStringList *l, lsmStringList *r)
}
for( i = 0; i < lsmStringListSize(l); ++i ) {
- if( strcmp(lsmStringListGetElem(l, i),
- lsmStringListGetElem(r, i)) != 0) {
+ if( strcmp(lsmStringListElemGet(l, i),
+ lsmStringListElemGet(r, i)) != 0) {
return 1;
}
}
@@ -305,7 +305,7 @@ void create_volumes(lsmConnect *c, lsmPool *p, int num)
LSM_PROVISION_DEFAULT, &n, &job, LSM_FLAG_RSVD);
fail_unless( vc == LSM_ERR_OK || vc == LSM_ERR_JOB_STARTED,
- "lsmVolumeCreate %d (%s)", vc, error(lsmErrorGetLast(c)));
+ "lsmVolumeCreate %d (%s)", vc, error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == vc ) {
n = wait_for_job_vol(c, &job);
@@ -330,7 +330,7 @@ lsmSystem *get_system()
if( LSM_ERR_OK == rc && count) {
rc_sys = lsmSystemRecordCopy(sys[0]);
- lsmSystemRecordFreeArray(sys, count);
+ lsmSystemRecordArrayFree(sys, count);
}
return rc_sys;
}
@@ -347,15 +347,15 @@ START_TEST(test_smoke_test)
uint32_t tmo = 0;
//Set timeout.
- rc = lsmConnectSetTimeout(c, set_tmo, LSM_FLAG_RSVD);
+ rc = lsmConnectTimeoutSet(c, set_tmo, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_OK == rc, "lsmConnectSetTimeout %d (%s)", rc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
//Get time-out.
- rc = lsmConnectGetTimeout(c, &tmo, LSM_FLAG_RSVD);
+ rc = lsmConnectTimeoutGet(c, &tmo, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_OK == rc, "Error getting tmo %d (%s)", rc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
fail_unless( set_tmo == tmo, " %u != %u", set_tmo, tmo );
@@ -366,7 +366,7 @@ START_TEST(test_smoke_test)
//Get pool list
rc = lsmPoolList(c, &pools, &poolCount, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_OK == rc, "lsmPoolList rc =%d (%s)", rc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
//Check pool count
count = poolCount;
@@ -404,7 +404,7 @@ START_TEST(test_smoke_test)
LSM_PROVISION_DEFAULT, &n, &job, LSM_FLAG_RSVD);
fail_unless( vc == LSM_ERR_OK || vc == LSM_ERR_JOB_STARTED,
- "lsmVolumeCreate %d (%s)", vc, error(lsmErrorGetLast(c)));
+ "lsmVolumeCreate %d (%s)", vc, error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == vc ) {
n = wait_for_job_vol(c, &job);
@@ -426,7 +426,7 @@ START_TEST(test_smoke_test)
}
- lsmBlockRange **range = lsmBlockRangeRecordAllocArray(3);
+ lsmBlockRange **range = lsmBlockRangeRecordArrayAlloc(3);
fail_unless(NULL != range);
@@ -469,13 +469,13 @@ START_TEST(test_smoke_test)
} else {
if( LSM_ERR_OK != rep_range ) {
- dump_error(lsmErrorGetLast(c));
+ dump_error(lsmErrorLastGet(c));
}
fail_unless(LSM_ERR_OK == rep_range);
}
- lsmBlockRangeRecordFreeArray(range, 3);
+ lsmBlockRangeRecordArrayFree(range, 3);
int online = lsmVolumeOffline(c, n, LSM_FLAG_RSVD);
fail_unless( LSM_ERR_OK == online);
@@ -487,7 +487,7 @@ START_TEST(test_smoke_test)
int delRc = lsmVolumeDelete(c, n, &jobDel, LSM_FLAG_RSVD);
fail_unless( delRc == LSM_ERR_OK || delRc == LSM_ERR_JOB_STARTED,
- "lsmVolumeDelete %d (%s)", rc, error(lsmErrorGetLast(c)));
+ "lsmVolumeDelete %d (%s)", rc, error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == delRc ) {
wait_for_job_vol(c, &jobDel);
@@ -501,7 +501,7 @@ START_TEST(test_smoke_test)
rc = lsmInitiatorList(c, &inits, &count, LSM_FLAG_RSVD);
fail_unless( LSM_ERR_OK == rc, "lsmInitiatorList %d (%s)", rc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
fail_unless( count == 0, "Count 0 != %d\n", count);
@@ -515,7 +515,7 @@ START_TEST(test_smoke_test)
fail_unless( LSM_ERR_OK == rc , "lsmVolumeList %d (%s)",rc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
for (i = 0; i < count; ++i) {
printf("%s - %s - %s - %"PRIu64" - %"PRIu64" - %x\n",
@@ -541,7 +541,7 @@ START_TEST(test_smoke_test)
fail_unless(resizeRc == LSM_ERR_OK || resizeRc == LSM_ERR_JOB_STARTED,
"lsmVolumeResize %d (%s)", resizeRc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == resizeRc ) {
resized = wait_for_job_vol(c, &resizeJob);
@@ -557,7 +557,7 @@ START_TEST(test_smoke_test)
fail_unless(repRc == LSM_ERR_OK || repRc == LSM_ERR_JOB_STARTED,
"lsmVolumeReplicate %d (%s)", repRc,
- error(lsmErrorGetLast(c)));
+ error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == repRc ) {
rep = wait_for_job_vol(c, &job);
@@ -565,10 +565,10 @@ START_TEST(test_smoke_test)
lsmVolumeRecordFree(rep);
- lsmVolumeRecordFreeArray(volumes, count);
+ lsmVolumeRecordArrayFree(volumes, count);
if (pools) {
- lsmPoolRecordFreeArray(pools, poolCount);
+ lsmPoolRecordArrayFree(pools, poolCount);
}
}
@@ -588,7 +588,7 @@ START_TEST(test_access_groups)
fail_unless(LSM_ERR_OK == rc, "Expected success on listing access groups %d", rc);
fail_unless(count == 0, "Expect 0 access groups, got %"PRIu32, count);
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
groups = NULL;
count = 0;
@@ -629,18 +629,18 @@ START_TEST(test_access_groups)
rc = lsmAccessGroupList(c, &groups, &count, LSM_FLAG_RSVD);
fail_unless( LSM_ERR_OK == rc);
fail_unless( 1 == count );
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
groups = NULL;
count = 0;
char *job = NULL;
- rc = lsmAccessGroupAddInitiator(c, group, "iqn.1994-05.com.domain:01.89bd02", LSM_INITIATOR_ISCSI, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupInitiatorAdd(c, group, "iqn.1994-05.com.domain:01.89bd02", LSM_INITIATOR_ISCSI, LSM_FLAG_RSVD);
if( LSM_ERR_JOB_STARTED == rc ) {
wait_for_job(c, &job);
} else {
- fail_unless(LSM_ERR_OK == rc, "Expected success on lsmAccessGroupAddInitiator %d", rc);
+ fail_unless(LSM_ERR_OK == rc, "Expected success on lsmAccessGroupInitiatorAdd %d", rc);
}
rc = lsmAccessGroupList(c, &groups, &count, LSM_FLAG_RSVD);
@@ -650,7 +650,7 @@ START_TEST(test_access_groups)
lsmStringList *init_list = lsmAccessGroupInitiatorIdGet(groups[0]);
fail_unless( lsmStringListSize(init_list) == 2, "Expecting 2 initiators, current num = %d\n", lsmStringListSize(init_list) );
for( i = 0; i < lsmStringListSize(init_list); ++i) {
- printf("%d = %s\n", i, lsmStringListGetElem(init_list, i));
+ printf("%d = %s\n", i, lsmStringListElemGet(init_list, i));
}
lsmStringListFree(init_list);
@@ -666,7 +666,7 @@ START_TEST(test_access_groups)
for( i = 0; i < init_list_count; ++i ) {
printf("Deleting initiator %s from group!\n", lsmInitiatorIdGet(inits[i]));
- rc = lsmAccessGroupDelInitiator(c, groups[0],
+ rc = lsmAccessGroupInitiatorDelete(c, groups[0],
lsmInitiatorIdGet(inits[i]), LSM_FLAG_RSVD);
if( LSM_ERR_JOB_STARTED == rc ) {
@@ -676,7 +676,7 @@ START_TEST(test_access_groups)
}
}
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
groups = NULL;
count = 0;
@@ -688,7 +688,7 @@ START_TEST(test_access_groups)
fail_unless( init_list != NULL);
fail_unless( lsmStringListSize(init_list) == 0);
- lsmAccessGroupRecordFreeArray(groups, count);
+ lsmAccessGroupRecordArrayFree(groups, count);
groups = NULL;
count = 0;
@@ -717,7 +717,7 @@ START_TEST(test_access_groups_grant_revoke)
LSM_PROVISION_DEFAULT, &n, &job, LSM_FLAG_RSVD);
fail_unless( vc == LSM_ERR_OK || vc == LSM_ERR_JOB_STARTED,
- "lsmVolumeCreate %d (%s)", vc, error(lsmErrorGetLast(c)));
+ "lsmVolumeCreate %d (%s)", vc, error(lsmErrorLastGet(c)));
if( LSM_ERR_JOB_STARTED == vc ) {
n = wait_for_job_vol(c, &job);
@@ -739,7 +739,7 @@ START_TEST(test_access_groups_grant_revoke)
fail_unless(v_count == 1);
fail_unless(strcmp(lsmVolumeIdGet(volumes[0]), lsmVolumeIdGet(n)) == 0);
- lsmVolumeRecordFreeArray(volumes, v_count);
+ lsmVolumeRecordArrayFree(volumes, v_count);
lsmAccessGroup **groups;
uint32_t g_count = 0;
@@ -748,7 +748,7 @@ START_TEST(test_access_groups_grant_revoke)
fail_unless(g_count == 1);
fail_unless(strcmp(lsmAccessGroupIdGet(groups[0]), lsmAccessGroupIdGet(group)) == 0);
- lsmAccessGroupRecordFreeArray(groups, g_count);
+ lsmAccessGroupRecordArrayFree(groups, g_count);
rc = lsmAccessGroupRevoke(c, group, n, LSM_FLAG_RSVD);
if( LSM_ERR_JOB_STARTED == rc ) {
@@ -757,7 +757,7 @@ START_TEST(test_access_groups_grant_revoke)
fail_unless(LSM_ERR_OK == rc);
}
- rc = lsmAccessGroupDel(c, group, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupDelete(c, group, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_OK == rc);
lsmAccessGroupRecordFree(group);
@@ -821,7 +821,7 @@ START_TEST(test_fs)
fail_unless(LSM_ERR_OK == rc);
fail_unless(2 == fs_count, "fs_count = %d", fs_count);
- lsmFsRecordFreeArray(fs_list, fs_count);
+ lsmFsRecordArrayFree(fs_list, fs_count);
rc = lsmFsResize(c,nfs, 100000000, &resized_fs, &job, LSM_FLAG_RSVD);
@@ -883,7 +883,7 @@ START_TEST(test_ss)
printf("List return code= %d\n", rc);
if(rc) {
- printf("%s\n", error(lsmErrorGetLast(c)));
+ printf("%s\n", error(lsmErrorLastGet(c)));
}
fail_unless( LSM_ERR_OK == rc);
fail_unless( NULL == ss_list);
@@ -907,8 +907,8 @@ START_TEST(test_ss)
lsmStringList *files = lsmStringListAlloc(1);
if(files) {
- rc = lsmStringListSetElem(files, 0, "some/file/name.txt");
- fail_unless( LSM_ERR_OK == rc, "lsmStringListSetElem rc = %d", rc);
+ rc = lsmStringListElemSet(files, 0, "some/file/name.txt");
+ fail_unless( LSM_ERR_OK == rc, "lsmStringListElemSet rc = %d", rc);
}
rc = lsmFsSsRevert(c, fs, ss, files, files, 0, &job, LSM_FLAG_RSVD);
@@ -927,7 +927,7 @@ START_TEST(test_ss)
wait_for_job(c, &job);
}
- lsmSsRecordFreeArray(ss_list, ss_count);
+ lsmSsRecordArrayFree(ss_list, ss_count);
lsmFsRecordFree(fs);
printf("Testing snapshots done!\n");
@@ -960,7 +960,7 @@ START_TEST(test_systems)
status = lsmSystemStatusGet(sys[0]);
fail_unless(status == LSM_SYSTEM_STATUS_OK, "status = %x", status);
- lsmSystemRecordFreeArray(sys, count);
+ lsmSystemRecordArrayFree(sys, count);
}
END_TEST
@@ -1045,7 +1045,7 @@ START_TEST(test_disks)
//uint32_t num_keys = lsmStringListSize(keys);
//fail_unless( num_keys == key_count, "%d != %d", num_keys, key_count);
for(j = 0; j < key_count; ++j ) {
- key = lsmStringListGetElem(keys, j);
+ key = lsmStringListElemGet(keys, j);
data = lsmOptionalDataStringGet(od, key);
fail_unless(key != NULL && strlen(key) > 0);
fail_unless(data != NULL && strlen(data) > 0);
@@ -1059,7 +1059,7 @@ START_TEST(test_disks)
lsmOptionalDataRecordFree(od);
}
}
- lsmDiskRecordFreeArray(d, count);
+ lsmDiskRecordArrayFree(d, count);
} else {
fail_unless(d == NULL);
fail_unless(count == 0);
@@ -1100,7 +1100,7 @@ START_TEST(test_nfs_exports)
lsmStringList *access = lsmStringListAlloc(1);
fail_unless(NULL != access);
- lsmStringListSetElem(access, 0, "192.168.2.29");
+ lsmStringListElemSet(access, 0, "192.168.2.29");
lsmNfsExport *e = NULL;
@@ -1116,9 +1116,9 @@ START_TEST(test_nfs_exports)
fail_unless( exports != NULL);
fail_unless( count == 1 );
- rc = lsmNfsExportRemove(c, exports[0], LSM_FLAG_RSVD);
+ rc = lsmNfsExportDelete(c, exports[0], LSM_FLAG_RSVD);
fail_unless( LSM_ERR_OK == rc, "lsmNfsExportRemove %d\n", rc );
- lsmNfsExportRecordFreeArray(exports, count);
+ lsmNfsExportRecordArrayFree(exports, count);
exports = NULL;
@@ -1497,18 +1497,18 @@ START_TEST(test_invalid_input)
/* lsmAccessGroupDel */
- rc = lsmAccessGroupDel(c, NULL, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupDelete(c, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_ACCESS_GROUP, "rc = %d", rc);
- /* lsmAccessGroupAddInitiator */
- rc = lsmAccessGroupAddInitiator(c, NULL, NULL, 0, LSM_FLAG_RSVD);
+ /* lsmAccessGroupInitiatorAdd */
+ rc = lsmAccessGroupInitiatorAdd(c, NULL, NULL, 0, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_ACCESS_GROUP, "rc = %d", rc);
- rc = lsmAccessGroupDelInitiator(c, NULL, NULL, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupInitiatorDelete(c, NULL, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_ACCESS_GROUP, "rc = %d", rc);
- rc = lsmAccessGroupDelInitiator(c, ag, NULL, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupInitiatorDelete(c, ag, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_ARGUMENT, "rc = %d", rc);
@@ -1720,7 +1720,7 @@ START_TEST(test_invalid_input)
LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_ARGUMENT, "rc = %d", rc);
- rc = lsmNfsExportRemove(c, NULL, LSM_FLAG_RSVD);
+ rc = lsmNfsExportDelete(c, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_NFS, "rc = %d", rc);
}
END_TEST
@@ -1822,7 +1822,7 @@ static int get_init(lsmConnect *c, const char *init_id, lsmInitiator * *found) {
}
}
- lsmInitiatorRecordFreeArray(inits, count);
+ lsmInitiatorRecordArrayFree(inits, count);
return rc;
}
@@ -1876,7 +1876,7 @@ START_TEST(test_initiator_methods)
fail_unless( strcmp(lsmVolumeIdGet(volumes[0]), lsmVolumeIdGet(nv)) == 0);
}
- lsmVolumeRecordFreeArray(volumes, count);
+ lsmVolumeRecordArrayFree(volumes, count);
}
lsmInitiator **initiators = NULL;
@@ -1894,7 +1894,7 @@ START_TEST(test_initiator_methods)
fail_unless(lsmInitiatorNameGet(initiators[0]) != NULL);
}
- lsmInitiatorRecordFreeArray(initiators, count);
+ lsmInitiatorRecordArrayFree(initiators, count);
}
if( LSM_ERR_OK == rc ) {
@@ -1938,7 +1938,7 @@ START_TEST(test_iscsi_auth_in)
fail_unless(LSM_ERR_OK == rc, "rc = %d", rc) ;
}
- rc = lsmAccessGroupDel(c, group, LSM_FLAG_RSVD);
+ rc = lsmAccessGroupDelete(c, group, LSM_FLAG_RSVD);
if(LSM_ERR_JOB_STARTED == rc ) {
wait_for_job(c, &job);
@@ -1957,7 +1957,7 @@ START_TEST(test_plugin_info)
char *desc = NULL;
char *version = NULL;
- int rc = lsmPluginGetInfo(c, &desc, &version, LSM_FLAG_RSVD);
+ int rc = lsmPluginInfoGet(c, &desc, &version, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_OK == rc, "rc = %d", rc);
@@ -1967,13 +1967,13 @@ START_TEST(test_plugin_info)
free(version);
}
- rc = lsmPluginGetInfo(NULL, &desc, &version, LSM_FLAG_RSVD);
+ rc = lsmPluginInfoGet(NULL, &desc, &version, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_INVALID_CONN == rc, "rc = %d", rc);
- rc = lsmPluginGetInfo(c, NULL, &version, LSM_FLAG_RSVD);
+ rc = lsmPluginInfoGet(c, NULL, &version, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_INVALID_ARGUMENT == rc, "rc = %d", rc);
- rc = lsmPluginGetInfo(c, &desc, NULL, LSM_FLAG_RSVD);
+ rc = lsmPluginInfoGet(c, &desc, NULL, LSM_FLAG_RSVD);
fail_unless(LSM_ERR_INVALID_ARGUMENT == rc, "rc = %d", rc);
}
END_TEST
@@ -1984,12 +1984,12 @@ START_TEST(test_get_available_plugins)
int num = 0;
lsmStringList *plugins = NULL;
- int rc = lsmGetAvailablePlugins(":", &plugins, 0);
+ int rc = lsmAvailablePluginsList(":", &plugins, 0);
fail_unless(LSM_ERR_OK == rc, "rc = %d", rc);
num = lsmStringListSize(plugins);
for( i = 0; i < num; i++) {
- const char *info = lsmStringListGetElem(plugins, i);
+ const char *info = lsmStringListElemGet(plugins, i);
fail_unless(strlen(info) > 0);
printf("%s\n", info);
}
@@ -2016,13 +2016,13 @@ START_TEST(test_error_reporting)
fail_unless(e != NULL);
if( e ) {
- fail_unless(LSM_ERR_INTERNAL_ERROR == lsmErrorGetNumber(e));
- fail_unless(LSM_ERR_DOMAIN_PLUG_IN == lsmErrorGetDomain(e));
- fail_unless(LSM_ERR_LEVEL_ERROR == lsmErrorGetLevel(e));
- fail_unless(strcmp(msg, lsmErrorGetMessage(e)) == 0);
- fail_unless(strcmp(exception, lsmErrorGetException(e)) == 0);
- fail_unless(strcmp(debug_msg, lsmErrorGetDebug(e)) == 0);
- debug_data = lsmErrorGetDebugData(e, &debug_size);
+ fail_unless(LSM_ERR_INTERNAL_ERROR == lsmErrorNumberGet(e));
+ fail_unless(LSM_ERR_DOMAIN_PLUG_IN == lsmErrorDomainGet(e));
+ fail_unless(LSM_ERR_LEVEL_ERROR == lsmErrorLevelGet(e));
+ fail_unless(strcmp(msg, lsmErrorMessageGet(e)) == 0);
+ fail_unless(strcmp(exception, lsmErrorExceptionGet(e)) == 0);
+ fail_unless(strcmp(debug_msg, lsmErrorDebugGet(e)) == 0);
+ debug_data = lsmErrorDebugDataGet(e, &debug_size);
fail_unless(debug_data != NULL);
fail_unless(debug_size == sizeof(d));
fail_unless(memcmp(d, debug_data, debug_size) == 0);
--
1.8.2.1
1.8.2.1