#include "lsm_plugin_ipc.hpp"
#include "lsm_datatypes.hpp"
#include "lsm_ipc.hpp"
#include "lsm_convert.hpp"
#include "libstoragemgmt/libstoragemgmt_systems.h"
#include "libstoragemgmt/libstoragemgmt_blockrange.h"
#include "libstoragemgmt/libstoragemgmt_disk.h"
#include "libstoragemgmt/libstoragemgmt_accessgroups.h"
#include "libstoragemgmt/libstoragemgmt_fs.h"
#include "libstoragemgmt/libstoragemgmt_snapshot.h"
#include "libstoragemgmt/libstoragemgmt_nfsexport.h"
#include "libstoragemgmt/libstoragemgmt_plug_interface.h"
#include "libstoragemgmt/libstoragemgmt_targetport.h"
#include "libstoragemgmt/libstoragemgmt_volumes.h"
#include "libstoragemgmt/libstoragemgmt_pool.h"
#include <errno.h>
#include <string.h>
#include <libxml/uri.h>
#include "util/qparams.h"
#include <syslog.h>
Go to the source code of this file.
Defines | |
#define | STR_D(c, s) |
#define | CMP_FUNCTION(name, method, method_type) |
#define | CMP_FREE_FUNCTION(name, method, method_type) |
Typedefs | |
typedef int(* | handler )(lsm_plugin_ptr p, Value ¶ms, Value &response) |
typedef int(* | array_cmp )(void *item, void *cmp_data) |
typedef void(* | free_item )(void *item) |
Functions | |
void * | lsm_data_type_copy (lsm_data_type t, void *item) |
int | lsm_register_plugin_v1 (lsm_plugin_ptr plug, void *private_data, struct lsm_mgmt_ops_v1 *mgm_op, struct lsm_san_ops_v1 *san_op, struct lsm_fs_ops_v1 *fs_op, struct lsm_nas_ops_v1 *nas_op) |
int | lsm_register_plugin_v1_2 (lsm_plugin_ptr plug, void *private_data, struct lsm_mgmt_ops_v1 *mgm_op, struct lsm_san_ops_v1 *san_op, struct lsm_fs_ops_v1 *fs_op, struct lsm_nas_ops_v1 *nas_op, struct lsm_ops_v1_2 *ops_v1_2) |
void * | lsm_private_data_get (lsm_plugin_ptr plug) |
int | lsm_plugin_init_v1 (int argc, char *argv[], lsm_plugin_register reg, lsm_plugin_unregister unreg, const char *desc, const char *version) |
int | lsm_log_error_basic (lsm_plugin_ptr plug, lsm_error_number code, const char *msg) |
int | lsm_plugin_error_log (lsm_plugin_ptr plug, lsm_error_ptr error) |
int LSM_DLL_EXPORT | lsm_uri_parse (const char *uri, char **scheme, char **user, char **server, int *port, char **path, lsm_hash **query_params) |
void | lsm_plug_volume_search_filter (const char *search_key, const char *search_value, lsm_volume *vols[], uint32_t *count) |
CMP_FREE_FUNCTION (pool_free, lsm_pool_record_free, lsm_pool) | |
void | lsm_plug_pool_search_filter (const char *search_key, const char *search_value, lsm_pool *pools[], uint32_t *count) |
void | lsm_plug_disk_search_filter (const char *search_key, const char *search_value, lsm_disk *disks[], uint32_t *count) |
CMP_FUNCTION (access_group_compare_system, lsm_access_group_system_id_get, lsm_access_group) CMP_FREE_FUNCTION(access_group_free | |
void | lsm_plug_access_group_search_filter (const char *search_key, const char *search_value, lsm_access_group *ag[], uint32_t *count) |
CMP_FREE_FUNCTION (fs_free, lsm_fs_record_free, lsm_fs) | |
void | lsm_plug_fs_search_filter (const char *search_key, const char *search_value, lsm_fs *fs[], uint32_t *count) |
void | lsm_plug_nfs_export_search_filter (const char *search_key, const char *search_value, lsm_nfs_export *exports[], uint32_t *count) |
CMP_FUNCTION (tp_compare_system_id, lsm_target_port_system_id_get, lsm_target_port) void lsm_plug_target_port_search_filter(const char *search_key | |
Variables | |
lsm_access_group_record_free | |
lsm_access_group | |
const char * | search_value |
const char lsm_target_port * | tp [] |
#define CMP_FREE_FUNCTION | ( | name, | |||
method, | |||||
method_type | ) |
static void name(void *i) \ { \ method((method_type *)i); \ } \
Definition at line 2625 of file lsm_plugin_ipc.cpp.
#define CMP_FUNCTION | ( | name, | |||
method, | |||||
method_type | ) |
static int name(void *i, void *d) \ { \ method_type *v = (method_type *)i; \ char *val = (char *)d; \ \ if( strcmp(method(v), val) == 0 ) { \ return 1; \ } \ return 0; \ } \
Definition at line 2612 of file lsm_plugin_ipc.cpp.
#define STR_D | ( | c, | |||
s | ) |
do { \ if(s) { \ (c) = strdup(s); \ if( !c ) {\ rc = LSM_ERR_NO_MEMORY; \ goto bail; \ } \ } \ } while(0)\
Definition at line 2526 of file lsm_plugin_ipc.cpp.
typedef int(* array_cmp)(void *item, void *cmp_data) |
Definition at line 2609 of file lsm_plugin_ipc.cpp.
typedef void(* free_item)(void *item) |
Definition at line 2610 of file lsm_plugin_ipc.cpp.
typedef int(* handler)(lsm_plugin_ptr p, Value ¶ms, Value &response) |
Definition at line 300 of file lsm_plugin_ipc.cpp.
CMP_FREE_FUNCTION | ( | fs_free | , | |
lsm_fs_record_free | , | |||
lsm_fs | ||||
) |
CMP_FREE_FUNCTION | ( | pool_free | , | |
lsm_pool_record_free | , | |||
lsm_pool | ||||
) |
CMP_FUNCTION | ( | tp_compare_system_id | , | |
lsm_target_port_system_id_get | , | |||
lsm_target_port | ||||
) | const |
CMP_FUNCTION | ( | access_group_compare_system | , | |
lsm_access_group_system_id_get | , | |||
lsm_access_group | ||||
) |
void* lsm_data_type_copy | ( | lsm_data_type | t, | |
void * | item | |||
) |
Copies the memory pointed to by item with given type t.
t | Type of item to copy | |
item | Pointer to src |
Definition at line 56 of file lsm_plugin_ipc.cpp.
int lsm_log_error_basic | ( | lsm_plugin_ptr | plug, | |
lsm_error_number | code, | |||
const char * | msg | |||
) |
Logs an error with the plug-in
plug | Plug-in pointer | |
code | Error code to return | |
msg | String message |
Definition at line 2489 of file lsm_plugin_ipc.cpp.
void lsm_plug_access_group_search_filter | ( | const char * | search_key, | |
const char * | search_value, | |||
lsm_access_group * | ag[], | |||
uint32_t * | count | |||
) |
Provides for access group filtering when an array doesn't support this natively. Note: Filters in place removing and freeing those that don't match.
search_key | Search field | |
search_value | Search value | |
[in,out] | ag | Array to filter |
[in,out] | count | Number of access groups to filter, number remain |
Definition at line 2736 of file lsm_plugin_ipc.cpp.
void lsm_plug_disk_search_filter | ( | const char * | search_key, | |
const char * | search_value, | |||
lsm_disk * | disks[], | |||
uint32_t * | count | |||
) |
Provides for disk filtering when an array doesn't support this natively. Note: Filters in place removing and freeing those that don't match.
search_key | Search field | |
search_value | Search value | |
[in,out] | disks | Array to filter |
[in,out] | count | Number of disks to filter, number remain |
Definition at line 2708 of file lsm_plugin_ipc.cpp.
void lsm_plug_fs_search_filter | ( | const char * | search_key, | |
const char * | search_value, | |||
lsm_fs * | fs[], | |||
uint32_t * | count | |||
) |
Provides for fs filtering when an array doesn't support this natively. Note: Filters in place removing and freeing those that don't match.
search_key | Search field | |
search_value | Search value | |
[in,out] | fs | Array to filter |
[in,out] | count | Number of file systems to filter, number remain |
Definition at line 2763 of file lsm_plugin_ipc.cpp.
void lsm_plug_nfs_export_search_filter | ( | const char * | search_key, | |
const char * | search_value, | |||
lsm_nfs_export * | exports[], | |||
uint32_t * | count | |||
) |
Provides for nfs filtering when an array doesn't support this natively. Note: Filters in place removing and freeing those that don't match.
search_key | Search field | |
search_value | Search value | |
[in,out] | exports | Array to filter |
[in,out] | count | Number of nfs exports to filter, number remain |
Definition at line 2789 of file lsm_plugin_ipc.cpp.
void lsm_plug_pool_search_filter | ( | const char * | search_key, | |
const char * | search_value, | |||
lsm_pool * | pools[], | |||
uint32_t * | count | |||
) |
Provides for pool filtering when an array doesn't support this natively. Note: Filters in place removing and freeing those that don't match.
search_key | Search field | |
search_value | Search value | |
[in,out] | pools | Array to filter |
[in,out] | count | Number of pools to filter, number remain |
Definition at line 2682 of file lsm_plugin_ipc.cpp.
void lsm_plug_volume_search_filter | ( | const char * | search_key, | |
const char * | search_value, | |||
lsm_volume * | vols[], | |||
uint32_t * | count | |||
) |
Provides for volume filtering when an array doesn't support this natively. Note: Filters in place removing and freeing those that don't match.
search_key | Search field | |
search_value | Search value | |
[in,out] | vols | Array to filter |
[in,out] | count | Number of volumes to filter, number remain |
Definition at line 2654 of file lsm_plugin_ipc.cpp.
int lsm_plugin_error_log | ( | lsm_plugin_ptr | plug, | |
lsm_error_ptr | error | |||
) |
Return an error with the plug-in
plug | Opaque plug-in | |
error | Error to associate. |
Definition at line 2510 of file lsm_plugin_ipc.cpp.
int lsm_plugin_init_v1 | ( | int | argc, | |
char * | argv[], | |||
lsm_plugin_register | reg, | |||
lsm_plugin_unregister | unreg, | |||
const char * | desc, | |||
const char * | version | |||
) |
Initializes the plug-in.
argc | Command line argument count | |
argv | Command line arguments | |
reg | Registration function | |
unreg | Un-Registration function | |
desc | Plug-in description | |
version | Plug-in version |
Definition at line 267 of file lsm_plugin_ipc.cpp.
void* lsm_private_data_get | ( | lsm_plugin_ptr | plug | ) |
Used to retrieve private data for plug-in operation.
plug | Opaque plug-in pointer. |
Definition at line 144 of file lsm_plugin_ipc.cpp.
int lsm_register_plugin_v1 | ( | lsm_plugin_ptr | plug, | |
void * | private_data, | |||
struct lsm_mgmt_ops_v1 * | mgm_ops, | |||
struct lsm_san_ops_v1 * | san_ops, | |||
struct lsm_fs_ops_v1 * | fs_ops, | |||
struct lsm_nas_ops_v1 * | nas_ops | |||
) |
Used to register all the data needed for the plug-in operation.
plug | Pointer provided by the framework | |
private_data | Private data to be used for whatever the plug-in needs | |
mgm_ops | Function pointers for management operations | |
san_ops | Function pointers for SAN operations | |
fs_ops | Function pointers for file system operations | |
nas_ops | Function pointers for NAS operations |
Definition at line 107 of file lsm_plugin_ipc.cpp.
int lsm_register_plugin_v1_2 | ( | lsm_plugin_ptr | plug, | |
void * | private_data, | |||
struct lsm_mgmt_ops_v1 * | mgm_ops, | |||
struct lsm_san_ops_v1 * | san_ops, | |||
struct lsm_fs_ops_v1 * | fs_ops, | |||
struct lsm_nas_ops_v1 * | nas_ops, | |||
struct lsm_ops_v1_2 * | ops_v1_2 | |||
) |
Used to register version 1.2 APIs plug-in operation.
plug | Pointer provided by the framework | |
private_data | Private data to be used for whatever the plug-in needs | |
mgm_ops | Function pointers for struct lsm_mgmt_ops_v1 | |
san_ops | Function pointers for struct lsm_san_ops_v1 | |
fs_ops | Function pointers for struct lsm_fs_ops_v1 | |
nas_ops | Function pointers for struct lsm_nas_ops_v1 | |
ops_v1_2 | Function pointers for struct lsm_ops_v1_2 |
Definition at line 127 of file lsm_plugin_ipc.cpp.
int LSM_DLL_EXPORT lsm_uri_parse | ( | const char * | uri, | |
char ** | scheme, | |||
char ** | user, | |||
char ** | server, | |||
int * | port, | |||
char ** | path, | |||
lsm_hash ** | query_params | |||
) |
Convenience function for plug-in writer. Note: Make sure to free returned items to prevent memory leaks.
[in] | uri | URI to parse |
[out] | scheme | returned scheme |
[out] | user | returned user |
[out] | server | returned server |
[out] | port | returned port |
[out] | path | returned path |
[out] | query_params | returned query params |
Definition at line 2537 of file lsm_plugin_ipc.cpp.
Definition at line 2733 of file lsm_plugin_ipc.cpp.
lsm_access_group_record_free |
Definition at line 2733 of file lsm_plugin_ipc.cpp.
const char* search_value |
Definition at line 2818 of file lsm_plugin_ipc.cpp.
const char lsm_target_port* tp[] |
Definition at line 2818 of file lsm_plugin_ipc.cpp.