Commit 54de8fd0 authored by Arun Gopalakrishnan's avatar Arun Gopalakrishnan Committed by Hari Kanigeri

ARM OMAP4 Syslink IPC ListMP, ListMP SharedMem Changes

This patch can be used to synk with the syslink drop 2.0.0.6
for above modules
The major changes are
   1. The atomic function usage came in the above modules
   2. Some logical changes came in some of the fuinctions
     in above modules (create/delete, open/close etc.)
   3. Some of the data structure were changed
Signed-off-by: default avatarArun M G <arunmg@ti.com>
parent d392ad19
...@@ -128,6 +128,12 @@ enum listmp_type { ...@@ -128,6 +128,12 @@ enum listmp_type {
struct listmp_config { struct listmp_config {
u32 max_name_len; u32 max_name_len;
/*!< Maximum length of name */ /*!< Maximum length of name */
bool use_name_server;
/*!< Whether to have this module use the NameServer or not. If the
* NameServer is not needed, set this configuration parameter to false.
* This informs ListMPSharedMemory not to pull in the NameServer module
* In this case, all names passed into create and open are ignored.
*/
}; };
/*! /*!
...@@ -142,14 +148,21 @@ struct listmp_elem { ...@@ -142,14 +148,21 @@ struct listmp_elem {
* @brief Structure defining config parameters for the ListMP instances. * @brief Structure defining config parameters for the ListMP instances.
*/ */
struct listmp_params { struct listmp_params {
bool cache_flag;
/*!< Set to 1 by the open() call. No one else should touch this! */
struct mutex *lock_handle;
/*!< Lock used for critical region management of the list */
void *shared_addr; void *shared_addr;
/*!< shared memory address */ /*!< shared memory address */
u32 shared_addr_size; u32 shared_addr_size;
/*!< shared memory size */ /*!< shared memory size */
char *name; char *name;
/*!< Name of the object */ /*!< Name of the object */
struct mutex *lock_handle; int resourceId;
/*!< Lock used for critical region management of the list */ /*!<
* resourceId Specifies the resource id number.
* Parameter is used only when type is set to Fast List
*/
enum listmp_type list_type ; enum listmp_type list_type ;
/*!< Type of list */ /*!< Type of list */
}; };
...@@ -188,9 +201,16 @@ struct listmp_object { ...@@ -188,9 +201,16 @@ struct listmp_object {
/* Type of list */ /* Type of list */
}; };
/* TBD: To be replaced by Function */ /*
#define listmp_shared_memreq listmp_sharedmemory_shared_memreq * Function initializes listmp parameters
#define listmp_params_init listmp_sharedmemory_params_init */
void listmp_params_init(void *listmp_handle,
struct listmp_params *params);
/*
* Function to get shared memory requirement for the module
*/
int listmp_shared_memreq(struct listmp_params *params);
/* ============================================================================= /* =============================================================================
* Functions to create instance of a list * Functions to create instance of a list
......
...@@ -75,62 +75,77 @@ ...@@ -75,62 +75,77 @@
#define LISTMPSHAREDMEMORY_E_MEMORY \ #define LISTMPSHAREDMEMORY_E_MEMORY \
LISTMPSHAREDMEMORY_MAKE_FAILURE(2) LISTMPSHAREDMEMORY_MAKE_FAILURE(2)
/*!
* @def LISTMPSHAREDMEMORY_E_BUSY
* @brief the name is already registered or not.
*/
#define LISTMPSHAREDMEMORY_E_BUSY \
LISTMPSHAREDMEMORY_MAKE_FAILURE(3)
/*! /*!
* @def LISTMPSHAREDMEMORY_E_FAIL * @def LISTMPSHAREDMEMORY_E_FAIL
* @brief Generic failure. * @brief Generic failure.
*/ */
#define LISTMPSHAREDMEMORY_E_FAIL \ #define LISTMPSHAREDMEMORY_E_FAIL \
LISTMPSHAREDMEMORY_MAKE_FAILURE(4) LISTMPSHAREDMEMORY_MAKE_FAILURE(3)
/*!
* @def LISTMPSHAREDMEMORY_E_NOTFOUND
* @brief name not found in the nameserver.
*/
#define LISTMPSHAREDMEMORY_E_NOTFOUND \
LISTMPSHAREDMEMORY_MAKE_FAILURE(5)
/*! /*!
* @def LISTMPSHAREDMEMORY_E_INVALIDSTATE * @def LISTMPSHAREDMEMORY_E_INVALIDSTATE
* @brief Module is not initialized. * @brief Module is not initialized.
*/ */
#define LISTMPSHAREDMEMORY_E_INVALIDSTATE \ #define LISTMPSHAREDMEMORY_E_INVALIDSTATE \
LISTMPSHAREDMEMORY_MAKE_FAILURE(6) LISTMPSHAREDMEMORY_MAKE_FAILURE(4)
/*!
* @def LISTMPSHAREDMEMORY_E_OSFAILURE
* @brief Failure in OS call.
*/
#define LISTMPSHAREDMEMORY_E_OSFAILURE \
LISTMPSHAREDMEMORY_MAKE_FAILURE(5)
/*! /*!
* @def LISTMPSHAREDMEMORY_E_NOTONWER * @def LISTMPSHAREDMEMORY_E_NOTONWER
* @brief Instance is not created on this processor. * @brief Instance is not created on this processor.
*/ */
#define LISTMPSHAREDMEMORY_E_NOTOWNER \ #define LISTMPSHAREDMEMORY_E_NOTOWNER \
LISTMPSHAREDMEMORY_MAKE_FAILURE(7) LISTMPSHAREDMEMORY_MAKE_FAILURE(6)
/*! /*!
* @def LISTMPSHAREDMEMORY_E_REMOTEACTIVE * @def LISTMPSHAREDMEMORY_E_REMOTEACTIVE
* @brief Remote opener of the instance has not closed the instance. * @brief Remote opener of the instance has not closed the instance.
*/ */
#define LISTMPSHAREDMEMORY_E_REMOTEACTIVE \ #define LISTMPSHAREDMEMORY_E_REMOTEACTIVE \
LISTMPSHAREDMEMORY_MAKE_FAILURE(8) LISTMPSHAREDMEMORY_MAKE_FAILURE(7)
/*! /*!
* @def LISTMPSHAREDMEMORY_E_INUSE * @def LISTMPSHAREDMEMORY_E_INUSE
* @brief Indicates that the instance is in use.. * @brief Indicates that the instance is in use..
*/ */
#define LISTMPSHAREDMEMORY_E_INUSE \ #define LISTMPSHAREDMEMORY_E_INUSE \
LISTMPSHAREDMEMORY_MAKE_FAILURE(8)
/*!
* @def LISTMPSHAREDMEMORY_E_NOTFOUND
* @brief name not found in the nameserver.
*/
#define LISTMPSHAREDMEMORY_E_NOTFOUND \
LISTMPSHAREDMEMORY_MAKE_FAILURE(9) LISTMPSHAREDMEMORY_MAKE_FAILURE(9)
/*! /*!
* @def LISTMPSHAREDMEMORY_E_OSFAILURE * @def LISTMPSHAREDMEMORY_E_NOTCREATED
* @brief Failure in OS call. * @brief Instance is not created yet
*/ */
#define LISTMPSHAREDMEMORY_E_OSFAILURE \ #define LISTMPSHAREDMEMORY_E_NOTCREATED \
LISTMPSHAREDMEMORY_MAKE_FAILURE(10) LISTMPSHAREDMEMORY_MAKE_FAILURE(10)
/*!
* @def LISTMPSHAREDMEMORY_E_VERSION
* @brief Version mismatch error.
*/
#define LISTMPSHAREDMEMORY_E_VERSION \
LISTMPSHAREDMEMORY_MAKE_FAILURE(11)
/*!
* @def LISTMPSHAREDMEMORY_E_BUSY
* @brief the name is already registered or not.
*/
#define LISTMPSHAREDMEMORY_E_BUSY \
LISTMPSHAREDMEMORY_MAKE_FAILURE(12)
/*! /*!
* @def LISTMPSHAREDMEMORY_SUCCESS * @def LISTMPSHAREDMEMORY_SUCCESS
* @brief Operation successful. * @brief Operation successful.
......
...@@ -167,6 +167,8 @@ struct listmp_sharedmemory_cmd_args { ...@@ -167,6 +167,8 @@ struct listmp_sharedmemory_cmd_args {
void *listmp_handle; void *listmp_handle;
struct listmp_params *params; struct listmp_params *params;
u32 name_len; u32 name_len;
u32 shared_addr_srptr;
void *knl_lock_handle;
} create; } create;
struct { struct {
...@@ -177,6 +179,8 @@ struct listmp_sharedmemory_cmd_args { ...@@ -177,6 +179,8 @@ struct listmp_sharedmemory_cmd_args {
void *listmp_handle; void *listmp_handle;
struct listmp_params *params; struct listmp_params *params;
u32 name_len; u32 name_len;
u32 shared_addr_srptr;
void *knl_lock_handle;
} open; } open;
struct { struct {
......
...@@ -77,6 +77,35 @@ static struct GT_Mask listmp_debugmask = { NULL, NULL }; /* GT trace variable */ ...@@ -77,6 +77,35 @@ static struct GT_Mask listmp_debugmask = { NULL, NULL }; /* GT trace variable */
EXPORT_SYMBOL(listmp_debugmask); EXPORT_SYMBOL(listmp_debugmask);
#endif #endif
/*
* ======== listmp_params_init ========
* Purpose:
* Function initializes listmp parameters
*/
void listmp_params_init(void *listmp_handle,
struct listmp_params *params)
{
BUG_ON(params == NULL);
listmp_sharedmemory_params_init(listmp_handle, params);
}
/*
* ======== listmp_shared_memreq ========
* Purpose:
* Function to get shared memory requirement for the module
*/
int listmp_shared_memreq(struct listmp_params *params)
{
int shared_memreq = 0;
if (WARN_ON(params == NULL))
goto exit;
shared_memreq = listmp_sharedmemory_shared_memreq(params);
exit:
return shared_memreq;
}
/* /*
* ======== listmp_create ======== * ======== listmp_create ========
* Purpose: * Purpose:
...@@ -455,3 +484,4 @@ exit: ...@@ -455,3 +484,4 @@ exit:
gt_1trace(listmp_debugmask, GT_LEAVE, "listmp_prev", prevElem); gt_1trace(listmp_debugmask, GT_LEAVE, "listmp_prev", prevElem);
return prevElem; return prevElem;
} }
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
/* Syslink headers */ /* Syslink headers */
#include <gt.h> #include <gt.h>
#include <syslink/atomic_linux.h>
/* Module level headers */ /* Module level headers */
#include <nameserver.h> #include <nameserver.h>
#include <sharedregion.h> #include <sharedregion.h>
...@@ -82,6 +82,10 @@ ...@@ -82,6 +82,10 @@
* Globals * Globals
* ============================================================================= * =============================================================================
*/ */
/*! @brief Macro to make a correct module magic number with refCount */
#define LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(x) \
((LISTMPSHAREDMEMORY_MODULEID << 12u) | (x))
/*! /*!
* @brief Name of the reserved NameServer used for listmp_sharedmemory. * @brief Name of the reserved NameServer used for listmp_sharedmemory.
*/ */
...@@ -99,6 +103,8 @@ ...@@ -99,6 +103,8 @@
*/ */
/*! @brief structure for listmp_sharedmemory module state */ /*! @brief structure for listmp_sharedmemory module state */
struct listmp_sharedmemory_module_object { struct listmp_sharedmemory_module_object {
atomic_t ref_count;
/*!< Reference count */
void *ns_handle; void *ns_handle;
/*!< Handle to the local NameServer used for storing GP objects */ /*!< Handle to the local NameServer used for storing GP objects */
struct list_head obj_list; struct list_head obj_list;
...@@ -121,6 +127,7 @@ struct listmp_sharedmemory_module_object { ...@@ -121,6 +127,7 @@ struct listmp_sharedmemory_module_object {
static static
struct listmp_sharedmemory_module_object listmp_sharedmemory_state = { struct listmp_sharedmemory_module_object listmp_sharedmemory_state = {
.default_cfg.max_name_len = 32, .default_cfg.max_name_len = 32,
.default_cfg.use_name_server = true,
.default_inst_params.shared_addr = 0, .default_inst_params.shared_addr = 0,
.default_inst_params.shared_addr_size = 0, .default_inst_params.shared_addr_size = 0,
.default_inst_params.name = NULL, .default_inst_params.name = NULL,
...@@ -133,17 +140,16 @@ struct listmp_sharedmemory_module_object listmp_sharedmemory_state = { ...@@ -133,17 +140,16 @@ struct listmp_sharedmemory_module_object listmp_sharedmemory_state = {
struct listmp_sharedmemory_obj{ struct listmp_sharedmemory_obj{
struct list_head list_elem; struct list_head list_elem;
/*!< Used for creating a linked list */ /*!< Used for creating a linked list */
struct listmp_elem *listmp_elem; volatile struct listmp_elem *listmp_elem;
/*!< Used for storing listmp_sharedmemory element */ /*!< Used for storing listmp_sharedmemory element */
struct listmp_proc_attrs *owner; struct listmp_proc_attrs *owner;
/*!< Creator's attributes associated with an instance */ /*!< Creator's attributes associated with an instance */
struct listmp_proc_attrs *remote;
/*!< Peer's attributes assoicated with an instance */
listmp_sharedmemory_params params; listmp_sharedmemory_params params;
/*!< the parameter structure */ /*!< the parameter structure */
void *ns_key;
u32 index; u32 index;
/*!< the index for SrPtr */ /*!< the index for SrPtr */
struct listmp_attrs *attrs; volatile struct listmp_attrs *attrs;
/*!< Shared memory attributes */ /*!< Shared memory attributes */
void *top; void *top;
/*!< Pointer to the top Object */ /*!< Pointer to the top Object */
...@@ -194,7 +200,9 @@ int listmp_sharedmemory_get_config(struct listmp_config *cfgParams) ...@@ -194,7 +200,9 @@ int listmp_sharedmemory_get_config(struct listmp_config *cfgParams)
goto exit; goto exit;
} }
if (listmp_sharedmemory_state.ns_handle == NULL) if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true)
/* If setup has not yet been called) */ /* If setup has not yet been called) */
memcpy(cfgParams, &listmp_sharedmemory_state.default_cfg, memcpy(cfgParams, &listmp_sharedmemory_state.default_cfg,
sizeof(struct listmp_config)); sizeof(struct listmp_config));
...@@ -219,28 +227,45 @@ int listmp_sharedmemory_setup(struct listmp_config *config) ...@@ -219,28 +227,45 @@ int listmp_sharedmemory_setup(struct listmp_config *config)
int status1 = 0; int status1 = 0;
void *nshandle = NULL; void *nshandle = NULL;
struct nameserver_params params; struct nameserver_params params;
struct listmp_config tmp_cfg;
gt_1trace(listmpshm_debugmask, GT_ENTER, "ListMPSharedmemsetup", gt_1trace(listmpshm_debugmask, GT_ENTER, "ListMPSharedmemsetup",
config); config);
/* This sets the refCount variable is not initialized, upper 16 bits is
* written with module Id to ensure correctness of refCount variable.
*/
atomic_cmpmask_and_set(&listmp_sharedmemory_state.ref_count,
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0));
if (atomic_inc_return(&listmp_sharedmemory_state.ref_count)
!= LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) {
status = -EEXIST;
goto exit;
}
if (config == NULL) { if (config == NULL) {
memcpy(config, &listmp_sharedmemory_state.default_cfg, listmp_sharedmemory_get_config(&tmp_cfg);
sizeof(struct listmp_config)); config = &tmp_cfg;
} }
if (WARN_ON(config->max_name_len == 0)) { if (WARN_ON(config->max_name_len == 0)) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
} }
/* Initialize the parameters */ if (likely((config->use_name_server == true))) {
nameserver_params_init(&params); /* Initialize the parameters */
params.max_value_len = 4; nameserver_params_init(&params);
params.max_name_len = config->max_name_len; params.max_value_len = 4;
/* Create the nameserver for modules */ params.max_name_len = config->max_name_len;
nshandle = nameserver_create(LISTMP_SHAREDMEMORY_NAMESERVER, &params); /* Create the nameserver for modules */
if (unlikely(nshandle == NULL)) { nshandle = nameserver_create(
status = LISTMPSHAREDMEMORY_E_FAIL; LISTMP_SHAREDMEMORY_NAMESERVER, &params);
goto exit; if (unlikely(nshandle == NULL)) {
status = LISTMPSHAREDMEMORY_E_FAIL;
goto exit;
}
} }
listmp_sharedmemory_state.ns_handle = nshandle; listmp_sharedmemory_state.ns_handle = nshandle;
...@@ -260,10 +285,14 @@ int listmp_sharedmemory_setup(struct listmp_config *config) ...@@ -260,10 +285,14 @@ int listmp_sharedmemory_setup(struct listmp_config *config)
} }
mutex_init(listmp_sharedmemory_state.lock_handle); mutex_init(listmp_sharedmemory_state.lock_handle);
memset(&listmp_sharedmemory_state.cfg, 0, sizeof(struct listmp_config)); /* Copy the cfg */
memcpy(&listmp_sharedmemory_state.cfg, config,
sizeof(struct listmp_config));
goto exit; goto exit;
clean_nameserver: clean_nameserver:
atomic_set(&listmp_sharedmemory_state.ref_count,
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0));
status1 = nameserver_delete status1 = nameserver_delete
(&(listmp_sharedmemory_state.ns_handle)); (&(listmp_sharedmemory_state.ns_handle));
BUG_ON(status1 < 0); BUG_ON(status1 < 0);
...@@ -289,42 +318,62 @@ int listmp_sharedmemory_destroy(void) ...@@ -289,42 +318,62 @@ int listmp_sharedmemory_destroy(void)
gt_0trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_destroy"); gt_0trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_destroy");
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true) {
status = -ENODEV; status = -ENODEV;
goto exit; goto exit;
} }
/* Check if any listmp_sharedmemory instances have not been if (atomic_dec_return(&listmp_sharedmemory_state.ref_count)
* deleted so far. If not, delete them. */ == LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0)) {
for (elem = (head)->next; elem != (head); elem = next) { /* Temporarily increment refCount here. */
/* Retain the next pointer so it doesn't get overwritten */ atomic_set(&listmp_sharedmemory_state.ref_count,
next = elem->next; LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1));
if (((struct listmp_sharedmemory_obj *) elem)->owner /* Check if any listmp_sharedmemory instances have not been
->proc_id == multiproc_get_id(NULL)) { * deleted so far. If not, delete them. */
status1 = listmp_sharedmemory_delete( for (elem = (head)->next; elem != (head); elem = next) {
(listmp_sharedmemory_handle *) /* Retain the next pointer so it doesn't
&(((struct listmp_sharedmemory_obj *) elem)->top)); get overwritten */
WARN_ON(status1 < 0); next = elem->next;
} else { if (((struct listmp_sharedmemory_obj *) elem)->owner
status1 = listmp_sharedmemory_close( ->proc_id == multiproc_get_id(NULL)) {
(listmp_sharedmemory_handle) status1 = listmp_sharedmemory_delete(
(((struct listmp_sharedmemory_obj *) elem)->top)); (listmp_sharedmemory_handle *)
WARN_ON(status1 < 0); &(((struct listmp_sharedmemory_obj *) \
elem)->top));
WARN_ON(status1 < 0);
} else {
status1 = listmp_sharedmemory_close(
(listmp_sharedmemory_handle)
(((struct listmp_sharedmemory_obj *) \
elem)->top));
WARN_ON(status1 < 0);
}
} }
}
/* Delete the nameserver for modules */ /* Again reset refCount. */
status = nameserver_delete( atomic_set(&listmp_sharedmemory_state.ref_count,
&(listmp_sharedmemory_state.ns_handle)); LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0));
BUG_ON(status < 0); if (likely(listmp_sharedmemory_state.cfg.use_name_server
== true)) {
/* Destruct the list object */ /* Delete the nameserver for modules */
list_del(&listmp_sharedmemory_state.obj_list); status = nameserver_delete(
/* Delete the list lock */ &(listmp_sharedmemory_state.ns_handle));
kfree(listmp_sharedmemory_state.lock_handle); BUG_ON(status < 0);
listmp_sharedmemory_state.lock_handle = NULL; }
memset(&listmp_sharedmemory_state.cfg, 0, sizeof(struct listmp_config));
/* Destruct the list object */
list_del(&listmp_sharedmemory_state.obj_list);
/* Delete the list lock */
kfree(listmp_sharedmemory_state.lock_handle);
listmp_sharedmemory_state.lock_handle = NULL;
memset(&listmp_sharedmemory_state.cfg, 0,
sizeof(struct listmp_config));
/* Decrease the refCount */
atomic_set(&listmp_sharedmemory_state.ref_count,
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0));
}
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_destroy", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_destroy",
status); status);
...@@ -343,12 +392,16 @@ exit: ...@@ -343,12 +392,16 @@ exit:
void listmp_sharedmemory_params_init(listmp_sharedmemory_handle handle, void listmp_sharedmemory_params_init(listmp_sharedmemory_handle handle,
listmp_sharedmemory_params *params) listmp_sharedmemory_params *params)
{ {
listmp_sharedmemory_object *object = NULL;
struct listmp_sharedmemory_obj *obj = NULL; struct listmp_sharedmemory_obj *obj = NULL;
gt_2trace(listmpshm_debugmask, GT_ENTER, gt_2trace(listmpshm_debugmask, GT_ENTER,
"listmp_sharedmemory_params_init", handle, params); "listmp_sharedmemory_params_init", handle, params);
if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true)
goto exit;
BUG_ON(params == NULL); BUG_ON(params == NULL);
if (WARN_ON(params == NULL)) if (WARN_ON(params == NULL))
goto exit; goto exit;
...@@ -358,9 +411,10 @@ void listmp_sharedmemory_params_init(listmp_sharedmemory_handle handle, ...@@ -358,9 +411,10 @@ void listmp_sharedmemory_params_init(listmp_sharedmemory_handle handle,
&(listmp_sharedmemory_state.default_inst_params), &(listmp_sharedmemory_state.default_inst_params),
sizeof(listmp_sharedmemory_params)); sizeof(listmp_sharedmemory_params));
} else { } else {
object = (listmp_sharedmemory_object *) handle; obj = (struct listmp_sharedmemory_obj *)
obj = (struct listmp_sharedmemory_obj *) object->obj; (((listmp_sharedmemory_object *) handle)->obj);
memcpy((void *)&obj->params,
memcpy((void *)&obj->params,
(void *)params, (void *)params,
sizeof(listmp_sharedmemory_params)); sizeof(listmp_sharedmemory_params));
} }
...@@ -381,24 +435,23 @@ listmp_sharedmemory_handle listmp_sharedmemory_create( ...@@ -381,24 +435,23 @@ listmp_sharedmemory_handle listmp_sharedmemory_create(
{ {
s32 status = 0; s32 status = 0;
listmp_sharedmemory_object *handle = NULL; listmp_sharedmemory_object *handle = NULL;
struct listmp_sharedmemory_obj *obj = NULL;
gt_1trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_create", gt_1trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_create",
params); params);
BUG_ON(params == NULL); BUG_ON(params == NULL);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true) {
status = -ENODEV; status = -ENODEV;
goto exit; goto exit;
} }
if (WARN_ON(params == NULL)) { if (WARN_ON(params == NULL)) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
} }
if (WARN_ON((params->name == NULL) && (params->shared_addr == NULL))) {
status = -EINVAL;
goto exit;
}
if (WARN_ON((params->shared_addr == (u32)NULL) if (WARN_ON((params->shared_addr == (u32)NULL)
&& (params->list_type != listmp_type_FAST))) { && (params->list_type != listmp_type_FAST))) {
status = -EINVAL; status = -EINVAL;
...@@ -413,16 +466,6 @@ listmp_sharedmemory_handle listmp_sharedmemory_create( ...@@ -413,16 +466,6 @@ listmp_sharedmemory_handle listmp_sharedmemory_create(
handle = (listmp_sharedmemory_object *) handle = (listmp_sharedmemory_object *)
_listmp_sharedmemory_create(params, true); _listmp_sharedmemory_create(params, true);
obj = (struct listmp_sharedmemory_obj *)handle->obj;
if (obj == NULL) {
status = LISTMPSHAREDMEMORY_E_FAIL;
goto exit;
}
obj->listmp_elem->next = (struct listmp_elem *) (sharedregion_get_srptr(
(void *)obj->listmp_elem, obj->index));
obj->listmp_elem->prev = (struct listmp_elem *) (sharedregion_get_srptr(
(void *)obj->listmp_elem, obj->index));
exit: exit:
gt_2trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_create", gt_2trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_create",
status, handle); status, handle);
...@@ -446,7 +489,9 @@ int listmp_sharedmemory_delete(listmp_sharedmemory_handle *listmp_handleptr) ...@@ -446,7 +489,9 @@ int listmp_sharedmemory_delete(listmp_sharedmemory_handle *listmp_handleptr)
listmp_handleptr); listmp_handleptr);
BUG_ON(listmp_handleptr == NULL); BUG_ON(listmp_handleptr == NULL);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true) {
status = -ENODEV; status = -ENODEV;
goto exit; goto exit;
} }
...@@ -461,73 +506,60 @@ int listmp_sharedmemory_delete(listmp_sharedmemory_handle *listmp_handleptr) ...@@ -461,73 +506,60 @@ int listmp_sharedmemory_delete(listmp_sharedmemory_handle *listmp_handleptr)
handle = (listmp_sharedmemory_object *) (*listmp_handleptr); handle = (listmp_sharedmemory_object *) (*listmp_handleptr);
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
params = (listmp_sharedmemory_params *) &obj->params; params = (listmp_sharedmemory_params *) &obj->params;
if (obj->owner->proc_id == multiproc_get_id(NULL)) { if (obj->owner->proc_id == multiproc_get_id(NULL)) {
/* Remove from the local list */ status = -EPERM;
key = mutex_lock_interruptible( goto exit;
listmp_sharedmemory_state.lock_handle); }
list_del(&obj->list_elem);
mutex_unlock(listmp_sharedmemory_state.lock_handle);
if ((obj->owner->open_count == 1)
&& (obj->remote->open_count == 0)) {
/* Remove from the name server */
if (params->name != NULL) {
nameserver_remove(
listmp_sharedmemory_state.ns_handle,
params->name);
/* Free memory for the name */ if (obj->owner->open_count > 1) {
kfree(params->name); status = -EBUSY;
} goto exit;
}
/* Free memory for the processor info's */ if (obj->owner->open_count != 1) {
kfree(obj->owner); status = -EBUSY;
kfree(obj->remote); goto exit;
}
/* Now free the handle */ /* Remove from the local list */
kfree(obj); key = mutex_lock_interruptible(
obj = NULL; listmp_sharedmemory_state.lock_handle);
list_del(&obj->list_elem);
mutex_unlock(listmp_sharedmemory_state.lock_handle);
/* Now free the handle */ if (likely(params->name != NULL)) {
kfree(handle); /* Free memory for the name */
handle = NULL; kfree(params->name);
} else if (obj->owner->open_count > 1) { /* Remove from the name server */
gt_2trace(listmpshm_debugmask, if (likely(listmp_sharedmemory_state.cfg.use_name_server)) {
GT_4CLASS, if (obj->ns_key != NULL) {
"ListMP_delete", nameserver_remove_entry(
status, listmp_sharedmemory_state.ns_handle,
"Unmatched open/close calls!"); obj->ns_key);
status = -EBUSY; obj->ns_key = NULL;
} else { }
gt_2trace(listmpshm_debugmask,
GT_4CLASS,
"ListMP_delete",
status,
"Opener of the instance has not closed"
" the instance!");
status = -EBUSY;
} }
} else {
/*! @retval LISTMPSHAREDMEMORY_E_NOTONWER
* Instance was not created on this processor
*/
status = LISTMPSHAREDMEMORY_E_NOTOWNER;
gt_2trace(listmpshm_debugmask,
GT_4CLASS,
"ListMP_delete",
status,
"Instance was not created on this processor!");
} }
/* Free memory for the processor info's */
kfree(obj->owner);
/* Now free the handle */
kfree(obj);
obj = NULL;
/* Now free the handle */
kfree(handle);
handle = NULL;
*listmp_handleptr = NULL;
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE,
"listmp_sharedmemory_delete", status);
return status; return status;
} }
/* /*
* ======== listmp_sharedmemory_shared_memreq ======== * ======== listmp_sharedmemory_shared_memreq ========
* Purpose: * Purpose:
...@@ -541,16 +573,13 @@ int listmp_sharedmemory_shared_memreq(listmp_sharedmemory_params *params) ...@@ -541,16 +573,13 @@ int listmp_sharedmemory_shared_memreq(listmp_sharedmemory_params *params)
gt_1trace(listmpshm_debugmask, GT_ENTER, gt_1trace(listmpshm_debugmask, GT_ENTER,
"listmp_sharedmemory_sharedMemReq", params); "listmp_sharedmemory_sharedMemReq", params);
BUG_ON(params == NULL);
if (WARN_ON(params == NULL)) { if (WARN_ON(params == NULL)) {
retval = -EINVAL; retval = -EINVAL;
goto exit; goto exit;
} }
if (params->list_type == listmp_type_SHARED) { if (params->list_type == listmp_type_SHARED)
if (params != NULL) retval = (LISTMP_SHAREDMEMORY_CACHESIZE * 2);
retval = (LISTMP_SHAREDMEMORY_CACHESIZE * 2);
}
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, gt_1trace(listmpshm_debugmask, GT_LEAVE,
...@@ -574,13 +603,17 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr, ...@@ -574,13 +603,17 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr,
bool done_flag = false; bool done_flag = false;
struct list_head *elem; struct list_head *elem;
u32 key; u32 key;
u32 shared_shm_base;
struct listmp_attrs *attrs;
gt_1trace(listmpshm_debugmask, GT_ENTER, gt_1trace(listmpshm_debugmask, GT_ENTER,
"listmp_sharedmemory_open", params); "listmp_sharedmemory_open", params);
BUG_ON(listmp_handleptr == NULL); BUG_ON(listmp_handleptr == NULL);
BUG_ON(params == NULL); BUG_ON(params == NULL);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true) {
status = -ENODEV; status = -ENODEV;
goto exit; goto exit;
} }
...@@ -592,20 +625,41 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr, ...@@ -592,20 +625,41 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr,
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
} }
if (WARN_ON((params->name == NULL)
&& (params->shared_addr == (u32)NULL))) { if (WARN_ON((listmp_sharedmemory_state.cfg.use_name_server == false)
&& (params->shared_addr == (u32)NULL))) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
} }
if (WARN_ON(params->shared_addr_size
< listmp_sharedmemory_shared_memreq(params))) { if (WARN_ON((listmp_sharedmemory_state.cfg.use_name_server == true)
&& (params->shared_addr == (u32)NULL))
&& (params->name == NULL)) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
} }
/* First check in the local list */ /* First check in the local list */
list_for_each(elem, &listmp_sharedmemory_state.obj_list) { list_for_each(elem, &listmp_sharedmemory_state.obj_list) {
if (params->name != NULL) { if (((struct listmp_sharedmemory_obj *)elem)->params.shared_addr
== params->shared_addr) {
key = mutex_lock_interruptible(
listmp_sharedmemory_state.lock_handle);
if (((struct listmp_sharedmemory_obj *)elem)
->owner->proc_id
== multiproc_get_id(NULL))
((struct listmp_sharedmemory_obj *)elem)
->owner->open_count++;
mutex_unlock(
listmp_sharedmemory_state.lock_handle);
*listmp_handleptr = \
(((struct listmp_sharedmemory_obj *)
elem)->top);
done_flag = true;
break;
} else if ((params->name != NULL)
&& (((struct listmp_sharedmemory_obj *)elem) \
->params.name != NULL)){
if (strcmp(((struct listmp_sharedmemory_obj *)elem) if (strcmp(((struct listmp_sharedmemory_obj *)elem)
->params.name, params->name) == 0) { ->params.name, params->name) == 0) {
key = mutex_lock_interruptible( key = mutex_lock_interruptible(
...@@ -615,9 +669,6 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr, ...@@ -615,9 +669,6 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr,
== multiproc_get_id(NULL)) == multiproc_get_id(NULL))
((struct listmp_sharedmemory_obj *)elem) ((struct listmp_sharedmemory_obj *)elem)
->owner->open_count++; ->owner->open_count++;
else
((struct listmp_sharedmemory_obj *)elem)
->remote->open_count++;
mutex_unlock( mutex_unlock(
listmp_sharedmemory_state.lock_handle); listmp_sharedmemory_state.lock_handle);
*listmp_handleptr = \ *listmp_handleptr = \
...@@ -626,37 +677,41 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr, ...@@ -626,37 +677,41 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr,
done_flag = true; done_flag = true;
break; break;
} }
} else { }
if (((struct listmp_sharedmemory_obj *)elem) }
->params.shared_addr == params->shared_addr) {
key = mutex_lock_interruptible(
listmp_sharedmemory_state.lock_handle);
if (((struct listmp_sharedmemory_obj *)elem)
->owner->proc_id == \
multiproc_get_id(NULL))
((struct listmp_sharedmemory_obj *)elem)
->owner->open_count++;
else
((struct listmp_sharedmemory_obj *)elem)
->remote->open_count++;
mutex_unlock( if (likely(done_flag == false)) {
listmp_sharedmemory_state.lock_handle); if (unlikely(params->shared_addr == NULL)) {
*listmp_handleptr = ( if (likely(listmp_sharedmemory_state.cfg.use_name_server
((struct listmp_sharedmemory_obj *)elem) == true)){
->top); /* Find in name server */
done_flag = true; status =
break; nameserver_get(
listmp_sharedmemory_state.ns_handle,
params->name,
&shared_shm_base,
sizeof(u32),
NULL);
if (status >= 0)
params->shared_addr =
sharedregion_get_ptr(
(u32 *)shared_shm_base);
} }
} }
} }
/* Not found in local list */ if (status >= 0) {
if (done_flag == false) { attrs = (struct listmp_attrs *) (params->shared_addr);
*listmp_handleptr = (listmp_sharedmemory_handle) if (unlikely(attrs->status != (LISTMP_SHAREDMEMORY_CREATED)))
_listmp_sharedmemory_create(params, false); status = LISTMPSHAREDMEMORY_E_NOTCREATED;
else if (unlikely(attrs->version !=
(LISTMP_SHAREDMEMORY_VERSION)))
status = LISTMPSHAREDMEMORY_E_VERSION;
} }
if (likely(status >= 0))
*listmp_handleptr = (listmp_sharedmemory_handle)
_listmp_sharedmemory_create(params, false);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_open", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_open",
status); status);
...@@ -669,7 +724,7 @@ exit: ...@@ -669,7 +724,7 @@ exit:
* Purpose: * Purpose:
* Function to close a previously opened instance * Function to close a previously opened instance
*/ */
int listmp_sharedmemory_close(listmp_sharedmemory_handle listMPHandle) int listmp_sharedmemory_close(listmp_sharedmemory_handle listmp_handle)
{ {
int status = 0; int status = 0;
listmp_sharedmemory_object *handle = NULL; listmp_sharedmemory_object *handle = NULL;
...@@ -678,64 +733,51 @@ int listmp_sharedmemory_close(listmp_sharedmemory_handle listMPHandle) ...@@ -678,64 +733,51 @@ int listmp_sharedmemory_close(listmp_sharedmemory_handle listMPHandle)
u32 key; u32 key;
gt_1trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_close", gt_1trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_close",
listMPHandle); listmp_handle);
BUG_ON(listMPHandle == NULL); BUG_ON(listmp_handle == NULL);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true) {
status = -ENODEV; status = -ENODEV;
goto exit; goto exit;
} }
if (listMPHandle == NULL) {
if (listmp_handle == NULL) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
} }
handle = (listmp_sharedmemory_object *)listMPHandle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj == NULL) {
status = -EINVAL;
goto exit;
}
key = mutex_lock_interruptible( key = mutex_lock_interruptible(
listmp_sharedmemory_state.lock_handle); listmp_sharedmemory_state.lock_handle);
if (obj->owner->proc_id == multiproc_get_id(NULL)) if (obj->owner->proc_id == multiproc_get_id(NULL))
(obj)->owner->open_count--; (obj)->owner->open_count--;
else
(obj)->remote->open_count--;
mutex_unlock(listmp_sharedmemory_state.lock_handle);
params = (listmp_sharedmemory_params *) &obj->params; params = (listmp_sharedmemory_params *) &obj->params;
/* Check if ListMP is opened on same processor*/
key = mutex_lock_interruptible( if (((struct listmp_sharedmemory_obj *)obj)->owner->creator == false) {
listmp_sharedmemory_state.lock_handle);
if ((((struct listmp_sharedmemory_obj *)obj)->remote->proc_id == \
multiproc_get_id(NULL)) && \
(((struct listmp_sharedmemory_obj *)obj)
->remote->open_count == 0)) {
list_del(&obj->list_elem); list_del(&obj->list_elem);
/* remove from the name server */
if (params->name != NULL)
nameserver_remove(
listmp_sharedmemory_state.ns_handle,
params->name);
mutex_unlock(listmp_sharedmemory_state.lock_handle);
/* remove from the name server */ /* remove from the name server */
if (params->name != NULL) if (params->name != NULL)
/* Free memory for the name */ /* Free memory for the name */
kfree(params->name); kfree(params->name);
/* Now free the obj */
kfree(obj->params.name);
kfree(obj->owner); kfree(obj->owner);
kfree(obj->remote);
kfree(obj); kfree(obj);
obj = NULL; obj = NULL;
kfree(handle); kfree(handle);
handle = NULL; handle = NULL;
} else {
mutex_unlock(listmp_sharedmemory_state.lock_handle);
} }
mutex_unlock(listmp_sharedmemory_state.lock_handle);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_close", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_close",
status); status);
...@@ -747,29 +789,32 @@ exit: ...@@ -747,29 +789,32 @@ exit:
* Purpose: * Purpose:
* Function to check if the shared memory list is empty * Function to check if the shared memory list is empty
*/ */
bool listmp_sharedmemory_empty(listmp_sharedmemory_handle listMPHandle) bool listmp_sharedmemory_empty(listmp_sharedmemory_handle listmp_handle)
{ {
int status = 0; int status = 0;
bool isEmpty = false; bool is_empty = false;
listmp_sharedmemory_object *handle = NULL; listmp_sharedmemory_object *handle = NULL;
struct listmp_sharedmemory_obj *obj = NULL; struct listmp_sharedmemory_obj *obj = NULL;
s32 retval = 0; s32 retval = 0;
struct listmp_elem *sharedHead; struct listmp_elem *sharedHead;
gt_1trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_empty", gt_1trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_empty",
listMPHandle); listmp_handle);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true) {
status = -ENODEV; status = -ENODEV;
goto exit; goto exit;
} }
if (WARN_ON(listMPHandle == NULL)) {
if (WARN_ON(listmp_handle == NULL)) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
} }
handle = (listmp_sharedmemory_object *)listMPHandle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.lock_handle != NULL) {
...@@ -785,15 +830,15 @@ bool listmp_sharedmemory_empty(listmp_sharedmemory_handle listMPHandle) ...@@ -785,15 +830,15 @@ bool listmp_sharedmemory_empty(listmp_sharedmemory_handle listMPHandle)
(void *)obj->listmp_elem, obj->index)); (void *)obj->listmp_elem, obj->index));
if (obj->listmp_elem->next == sharedHead) if (obj->listmp_elem->next == sharedHead)
isEmpty = true; is_empty = true;
if (obj->params.lock_handle != NULL) if (obj->params.lock_handle != NULL)
gatepeterson_leave(obj->params.lock_handle, 0); gatepeterson_leave(obj->params.lock_handle, 0);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_empty", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_empty",
isEmpty); is_empty);
return isEmpty; return is_empty;
} }
/* /*
...@@ -801,7 +846,7 @@ exit: ...@@ -801,7 +846,7 @@ exit:
* Purpose: * Purpose:
* Function to get head element from a shared memory list * Function to get head element from a shared memory list
*/ */
void *listmp_sharedmemory_get_head(listmp_sharedmemory_handle listMPHandle) void *listmp_sharedmemory_get_head(listmp_sharedmemory_handle listmp_handle)
{ {
listmp_sharedmemory_object *handle = NULL; listmp_sharedmemory_object *handle = NULL;
struct listmp_sharedmemory_obj *obj = NULL; struct listmp_sharedmemory_obj *obj = NULL;
...@@ -812,20 +857,20 @@ void *listmp_sharedmemory_get_head(listmp_sharedmemory_handle listMPHandle) ...@@ -812,20 +857,20 @@ void *listmp_sharedmemory_get_head(listmp_sharedmemory_handle listMPHandle)
s32 retval = 0; s32 retval = 0;
gt_1trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_get_head", gt_1trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_get_head",
listMPHandle); listmp_handle);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
/*! @retval NULL if Module was not initialized */ LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
elem = NULL; LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true)
goto exit; goto exit;
}
if (WARN_ON(listMPHandle == NULL)) { if (WARN_ON(listmp_handle == NULL)) {
/*! @retval NULL if listMPHandle passed is NULL */ /*! @retval NULL if listmp_handle passed is NULL */
elem = NULL; elem = NULL;
goto exit; goto exit;
} }
handle = (listmp_sharedmemory_object *)listMPHandle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.lock_handle != NULL) {
...@@ -845,7 +890,7 @@ void *listmp_sharedmemory_get_head(listmp_sharedmemory_handle listMPHandle) ...@@ -845,7 +890,7 @@ void *listmp_sharedmemory_get_head(listmp_sharedmemory_handle listMPHandle)
localNext = sharedregion_get_ptr((u32 *)elem->next); localNext = sharedregion_get_ptr((u32 *)elem->next);
sharedHead = (struct listmp_elem *) sharedregion_get_srptr( sharedHead = (struct listmp_elem *) sharedregion_get_srptr(
obj->listmp_elem, obj->index); (void *)obj->listmp_elem, obj->index);
/* Fix the head of the list next pointer */ /* Fix the head of the list next pointer */
obj->listmp_elem->next = elem->next; obj->listmp_elem->next = elem->next;
...@@ -869,7 +914,7 @@ exit: ...@@ -869,7 +914,7 @@ exit:
* Purpose: * Purpose:
* Function to get tail element from a shared memory list * Function to get tail element from a shared memory list
*/ */
void *listmp_sharedmemory_get_tail(listmp_sharedmemory_handle listMPHandle) void *listmp_sharedmemory_get_tail(listmp_sharedmemory_handle listmp_handle)
{ {
listmp_sharedmemory_object *handle = NULL; listmp_sharedmemory_object *handle = NULL;
struct listmp_sharedmemory_obj *obj = NULL; struct listmp_sharedmemory_obj *obj = NULL;
...@@ -881,20 +926,25 @@ void *listmp_sharedmemory_get_tail(listmp_sharedmemory_handle listMPHandle) ...@@ -881,20 +926,25 @@ void *listmp_sharedmemory_get_tail(listmp_sharedmemory_handle listMPHandle)
s32 retval = 0; s32 retval = 0;
gt_1trace(listmpshm_debugmask, GT_ENTER, gt_1trace(listmpshm_debugmask, GT_ENTER,
"listmp_sharedmemory_get_tail", listMPHandle); "listmp_sharedmemory_get_tail", listmp_handle);
if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true)
goto exit;
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) {
/*! @retval NULL if Module was not initialized */ /*! @retval NULL if Module was not initialized */
elem = NULL; elem = NULL;
goto exit; goto exit;
} }
if (WARN_ON(listMPHandle == NULL)) { if (WARN_ON(listmp_handle == NULL)) {
/*! @retval NULL if listMPHandle passed is NULL */ /*! @retval NULL if listmp_handle passed is NULL */
elem = NULL; elem = NULL;
goto exit; goto exit;
} }
handle = (listmp_sharedmemory_object *)listMPHandle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.lock_handle != NULL) {
...@@ -915,7 +965,7 @@ void *listmp_sharedmemory_get_tail(listmp_sharedmemory_handle listMPHandle) ...@@ -915,7 +965,7 @@ void *listmp_sharedmemory_get_tail(listmp_sharedmemory_handle listMPHandle)
elem = localHeadPrev; elem = localHeadPrev;
localPrev = sharedregion_get_ptr((u32 *)elem->prev); localPrev = sharedregion_get_ptr((u32 *)elem->prev);
sharedHead = (struct listmp_elem *) sharedregion_get_srptr( sharedHead = (struct listmp_elem *) sharedregion_get_srptr(
obj->listmp_elem, obj->index); (void *)obj->listmp_elem, obj->index);
obj->listmp_elem->prev = elem->prev; obj->listmp_elem->prev = elem->prev;
localPrev->next = sharedHead; localPrev->next = sharedHead;
} }
...@@ -934,7 +984,7 @@ exit: ...@@ -934,7 +984,7 @@ exit:
* Purpose: * Purpose:
* Function to put head element into a shared memory list * Function to put head element into a shared memory list
*/ */
int listmp_sharedmemory_put_head(listmp_sharedmemory_handle listMPHandle, int listmp_sharedmemory_put_head(listmp_sharedmemory_handle listmp_handle,
struct listmp_elem *elem) struct listmp_elem *elem)
{ {
int status = 0; int status = 0;
...@@ -947,18 +997,21 @@ int listmp_sharedmemory_put_head(listmp_sharedmemory_handle listMPHandle, ...@@ -947,18 +997,21 @@ int listmp_sharedmemory_put_head(listmp_sharedmemory_handle listMPHandle,
u32 index; u32 index;
gt_1trace(listmpshm_debugmask, GT_ENTER, gt_1trace(listmpshm_debugmask, GT_ENTER,
"listmp_sharedmemory_put_head", listMPHandle); "listmp_sharedmemory_put_head", listmp_handle);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true) {
status = -ENODEV; status = -ENODEV;
goto exit; goto exit;
} }
if (WARN_ON(listMPHandle == NULL)) {
if (WARN_ON(listmp_handle == NULL)) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
} }
handle = (listmp_sharedmemory_object *)listMPHandle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
index = sharedregion_get_index(elem); index = sharedregion_get_index(elem);
...@@ -996,7 +1049,7 @@ exit: ...@@ -996,7 +1049,7 @@ exit:
* Purpose: * Purpose:
* Function to put tail element into a shared memory list * Function to put tail element into a shared memory list
*/ */
int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listMPHandle, int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listmp_handle,
struct listmp_elem *elem) struct listmp_elem *elem)
{ {
int status = 0; int status = 0;
...@@ -1009,18 +1062,21 @@ int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listMPHandle, ...@@ -1009,18 +1062,21 @@ int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listMPHandle,
u32 index; u32 index;
gt_2trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_put_tail", gt_2trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_put_tail",
listMPHandle, elem); listmp_handle, elem);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true) {
status = -ENODEV; status = -ENODEV;
goto exit; goto exit;
} }
if (WARN_ON(elem == NULL)) { if (WARN_ON(elem == NULL)) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
} }
handle = (listmp_sharedmemory_object *)listMPHandle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
/* Safe to do outside the gate */ /* Safe to do outside the gate */
...@@ -1060,7 +1116,7 @@ exit: ...@@ -1060,7 +1116,7 @@ exit:
* Purpose: * Purpose:
* Function to insert an element into a shared memory list * Function to insert an element into a shared memory list
*/ */
int listmp_sharedmemory_insert(listmp_sharedmemory_handle listMPHandle, int listmp_sharedmemory_insert(listmp_sharedmemory_handle listmp_handle,
struct listmp_elem *new_elem, struct listmp_elem *new_elem,
struct listmp_elem *cur_elem) struct listmp_elem *cur_elem)
{ {
...@@ -1074,19 +1130,22 @@ int listmp_sharedmemory_insert(listmp_sharedmemory_handle listMPHandle, ...@@ -1074,19 +1130,22 @@ int listmp_sharedmemory_insert(listmp_sharedmemory_handle listMPHandle,
u32 index; u32 index;
gt_3trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_insert", gt_3trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_insert",
listMPHandle, new_elem, cur_elem); listmp_handle, new_elem, cur_elem);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true) {
status = -ENODEV; status = -ENODEV;
goto exit; goto exit;
} }
if (WARN_ON(new_elem == NULL)) { if (WARN_ON(new_elem == NULL)) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
} }
handle = (listmp_sharedmemory_object *)listMPHandle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.lock_handle != NULL) {
...@@ -1133,7 +1192,7 @@ exit: ...@@ -1133,7 +1192,7 @@ exit:
* Purpose: * Purpose:
* Function to remove a element from a shared memory list * Function to remove a element from a shared memory list
*/ */
int listmp_sharedmemory_remove(listmp_sharedmemory_handle listMPHandle, int listmp_sharedmemory_remove(listmp_sharedmemory_handle listmp_handle,
struct listmp_elem *elem) struct listmp_elem *elem)
{ {
int status = 0; int status = 0;
...@@ -1144,19 +1203,22 @@ int listmp_sharedmemory_remove(listmp_sharedmemory_handle listMPHandle, ...@@ -1144,19 +1203,22 @@ int listmp_sharedmemory_remove(listmp_sharedmemory_handle listMPHandle,
s32 retval = 0; s32 retval = 0;
gt_2trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_remove", gt_2trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_remove",
listMPHandle, listmp_handle,
elem); elem);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true) {
status = -ENODEV; status = -ENODEV;
goto exit; goto exit;
} }
if (WARN_ON(elem == NULL)) { if (WARN_ON(elem == NULL)) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
} }
handle = (listmp_sharedmemory_object *)listMPHandle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.lock_handle != NULL) {
...@@ -1187,7 +1249,7 @@ exit: ...@@ -1187,7 +1249,7 @@ exit:
* Purpose: * Purpose:
* Function to traverse to next element in shared memory list * Function to traverse to next element in shared memory list
*/ */
void *listmp_sharedmemory_next(listmp_sharedmemory_handle listMPHandle, void *listmp_sharedmemory_next(listmp_sharedmemory_handle listmp_handle,
struct listmp_elem *elem) struct listmp_elem *elem)
{ {
listmp_sharedmemory_object *handle = NULL; listmp_sharedmemory_object *handle = NULL;
...@@ -1198,16 +1260,15 @@ void *listmp_sharedmemory_next(listmp_sharedmemory_handle listMPHandle, ...@@ -1198,16 +1260,15 @@ void *listmp_sharedmemory_next(listmp_sharedmemory_handle listMPHandle,
gt_2trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_next", gt_2trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_next",
listMPHandle, listmp_handle,
elem); elem);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
/*! @retval NULL if Module was not initialized */ LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
retElem = NULL; LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true)
goto exit; goto exit;
}
handle = (listmp_sharedmemory_object *)listMPHandle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.lock_handle != NULL) {
...@@ -1241,7 +1302,7 @@ exit: ...@@ -1241,7 +1302,7 @@ exit:
* Purpose: * Purpose:
* Function to traverse to prev element in shared memory list * Function to traverse to prev element in shared memory list
*/ */
void *listmp_sharedmemory_prev(listmp_sharedmemory_handle listMPHandle, void *listmp_sharedmemory_prev(listmp_sharedmemory_handle listmp_handle,
struct listmp_elem *elem) struct listmp_elem *elem)
{ {
listmp_sharedmemory_object *handle = NULL; listmp_sharedmemory_object *handle = NULL;
...@@ -1251,16 +1312,15 @@ void *listmp_sharedmemory_prev(listmp_sharedmemory_handle listMPHandle, ...@@ -1251,16 +1312,15 @@ void *listmp_sharedmemory_prev(listmp_sharedmemory_handle listMPHandle,
s32 retval = 0; s32 retval = 0;
gt_2trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_prev", gt_2trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_prev",
listMPHandle, listmp_handle,
elem); elem);
if (WARN_ON(listmp_sharedmemory_state.ns_handle == NULL)) { if (atomic_cmpmask_and_lt(&(listmp_sharedmemory_state.ref_count),
/*! @retval NULL if Module was not initialized */ LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(0),
retElem = NULL; LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) == true)
goto exit; goto exit;
}
handle = (listmp_sharedmemory_object *)listMPHandle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.lock_handle != NULL) {
...@@ -1347,41 +1407,49 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create( ...@@ -1347,41 +1407,49 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create(
/* Update attrs */ /* Update attrs */
obj->attrs = (struct listmp_attrs *) obj->attrs = (struct listmp_attrs *)
params->shared_addr; params->shared_addr;
obj->attrs->shared_addr_size = params->shared_addr_size;
obj->attrs->version = LISTMP_SHAREDMEMORY_VERSION;
obj->index = sharedregion_get_index(params->shared_addr);
/* Assign the memory with proper cache line padding */ /* Assign the memory with proper cache line padding */
obj->listmp_elem = (void *) ((u32)obj->attrs + \ obj->listmp_elem = (void *) ((u32)obj->attrs + \
LISTMP_SHAREDMEMORY_CACHESIZE); LISTMP_SHAREDMEMORY_CACHESIZE);
if (create_flag == true) {
obj->attrs->shared_addr_size = params->shared_addr_size;
obj->attrs->version = LISTMP_SHAREDMEMORY_VERSION;
obj->listmp_elem->next = obj->listmp_elem->prev =
(struct listmp_elem *)
(sharedregion_get_srptr((void *)obj->listmp_elem,
obj->index));
}
obj->index = sharedregion_get_index(params->shared_addr);
/* Populate the params member */ /* Populate the params member */
memcpy((void *)&obj->params, memcpy((void *)&obj->params,
(void *)params, (void *)params,
sizeof(listmp_sharedmemory_params)); sizeof(listmp_sharedmemory_params));
if (obj->params.name != NULL) { if (likely(listmp_sharedmemory_state.cfg.use_name_server
/* Copy the name */ == true)) {
obj->params.name = kmalloc(strlen(params->name) + 1, if (obj->params.name != NULL) {
GFP_KERNEL); /* Copy the name */
obj->params.name = kmalloc(strlen(params->name) + 1,
if (obj->params.name == NULL) { GFP_KERNEL);
/*! @retval NULL if Memory allocation failed for
name */ if (obj->params.name == NULL) {
status = -ENOMEM; /*! @retval NULL if Memory allocation failed for
} else { name */
strncpy(obj->params.name, params->name, status = -ENOMEM;
strlen(params->name) + 1); } else {
strncpy(obj->params.name, params->name,
strlen(params->name) + 1);
}
} }
} }
/* Update processor information */ /* Update processor information */
obj->owner = kmalloc(sizeof(struct listmp_proc_attrs), obj->owner = kmalloc(sizeof(struct listmp_proc_attrs),
GFP_KERNEL); GFP_KERNEL);
obj->remote = kmalloc(sizeof(struct listmp_proc_attrs), if (obj->owner == NULL) {
GFP_KERNEL);
if ((obj->owner == NULL) || (obj->remote == NULL)) {
gt_2trace(listmpshm_debugmask, gt_2trace(listmpshm_debugmask,
GT_4CLASS, GT_4CLASS,
"_listmp_sharedmemory_create", "_listmp_sharedmemory_create",
...@@ -1393,9 +1461,6 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create( ...@@ -1393,9 +1461,6 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create(
/* Update owner and opener details */ /* Update owner and opener details */
if (create_flag == true) { if (create_flag == true) {
obj->remote->creator = false;
obj->remote->open_count = 0;
obj->remote->proc_id = MULTIPROC_INVALIDID;
obj->owner->creator = true; obj->owner->creator = true;
obj->owner->open_count = 1; obj->owner->open_count = 1;
obj->owner->proc_id = multiproc_get_id(NULL); obj->owner->proc_id = multiproc_get_id(NULL);
...@@ -1403,13 +1468,9 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create( ...@@ -1403,13 +1468,9 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create(
obj->attrs->status = \ obj->attrs->status = \
LISTMP_SHAREDMEMORY_CREATED; LISTMP_SHAREDMEMORY_CREATED;
} else { } else {
obj->remote->creator = true;
obj->remote->open_count = 1;
obj->remote->proc_id = MULTIPROC_INVALIDID;
obj->owner->creator = false; obj->owner->creator = false;
obj->owner->open_count = 0; obj->owner->open_count = 0;
obj->owner->proc_id = multiproc_get_id("SysM3"); obj->owner->proc_id = MULTIPROC_INVALIDID;
/* TBD */
obj->top = handle; obj->top = handle;
} }
...@@ -1421,18 +1482,23 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create( ...@@ -1421,18 +1482,23 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create(
&listmp_sharedmemory_state.obj_list); &listmp_sharedmemory_state.obj_list);
mutex_unlock(listmp_sharedmemory_state.lock_handle); mutex_unlock(listmp_sharedmemory_state.lock_handle);
/* We will store a shared pointer in the if (create_flag == true) {
* NameServer
*/ /* We will store a shared pointer in the
shmIndex = sharedregion_get_index(params->shared_addr); * NameServer
sharedShmBase = sharedregion_get_srptr( */
params->shared_addr, shmIndex); shmIndex = sharedregion_get_index(params->shared_addr);
/* Add list instance to name server */ sharedShmBase = sharedregion_get_srptr(
if (obj->params.name != NULL) { params->shared_addr, shmIndex);
nameserver_add_uint32( /* Add list instance to name server */
listmp_sharedmemory_state.ns_handle, if (obj->params.name != NULL) {
params->name, obj->ns_key = nameserver_add_uint32(
(u32) (params->shared_addr)); listmp_sharedmemory_state.ns_handle,
params->name,
(u32) (params->shared_addr));
if (obj->ns_key == NULL)
status = -EFAULT;
}
} }
} }
...@@ -1443,13 +1509,16 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create( ...@@ -1443,13 +1509,16 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create(
list_del(&obj->list_elem); list_del(&obj->list_elem);
mutex_unlock(listmp_sharedmemory_state.lock_handle); mutex_unlock(listmp_sharedmemory_state.lock_handle);
if (obj->params.name != NULL) if (likely(listmp_sharedmemory_state.cfg.use_name_server
nameserver_remove(listmp_sharedmemory_state.ns_handle, == true)) {
params->name); if ((obj->params.name != NULL) && (status != -EFAULT))
nameserver_remove_entry(
listmp_sharedmemory_state.ns_handle,
obj->ns_key);
}
if (obj->owner != NULL) if (obj->owner != NULL)
kfree(obj->owner); kfree(obj->owner);
if (obj->remote != NULL)
kfree(obj->remote);
if (obj->params.name != NULL) if (obj->params.name != NULL)
kfree(obj->params.name); kfree(obj->params.name);
......
...@@ -115,6 +115,14 @@ static inline int listmp_sharedmemory_ioctl_params_init( ...@@ -115,6 +115,14 @@ static inline int listmp_sharedmemory_ioctl_params_init(
unsigned long size; unsigned long size;
listmp_sharedmemory_params params; listmp_sharedmemory_params params;
size = copy_from_user(&params,
cargs->args.params_init.params,
sizeof(listmp_sharedmemory_params));
if (size) {
retval = -EFAULT;
goto exit;
}
listmp_sharedmemory_params_init( listmp_sharedmemory_params_init(
cargs->args.params_init.listmp_handle, &params); cargs->args.params_init.listmp_handle, &params);
size = copy_to_user(cargs->args.params_init.params, &params, size = copy_to_user(cargs->args.params_init.params, &params,
...@@ -124,8 +132,8 @@ static inline int listmp_sharedmemory_ioctl_params_init( ...@@ -124,8 +132,8 @@ static inline int listmp_sharedmemory_ioctl_params_init(
goto exit; goto exit;
} }
cargs->api_status = status;
exit: exit:
cargs->api_status = status;
return retval; return retval;
} }
...@@ -166,9 +174,12 @@ static inline int listmp_sharedmemory_ioctl_create( ...@@ -166,9 +174,12 @@ static inline int listmp_sharedmemory_ioctl_create(
} }
params.shared_addr = sharedregion_get_ptr( params.shared_addr = sharedregion_get_ptr(
(u32 *)cargs->args.create.params->shared_addr); (u32 *)cargs->args.create.shared_addr_srptr);
if (unlikely(params.shared_addr == NULL)) if (unlikely(params.shared_addr == NULL))
goto free_name; goto free_name;
/* Update lock_handle in params. */
params.lock_handle = cargs->args.create.knl_lock_handle;
cargs->args.create.listmp_handle = listmp_sharedmemory_create(&params); cargs->args.create.listmp_handle = listmp_sharedmemory_create(&params);
size = copy_to_user(cargs->args.create.params, &params, size = copy_to_user(cargs->args.create.params, &params,
...@@ -241,10 +252,12 @@ static inline int listmp_sharedmemory_ioctl_open( ...@@ -241,10 +252,12 @@ static inline int listmp_sharedmemory_ioctl_open(
} }
params.shared_addr = sharedregion_get_ptr( params.shared_addr = sharedregion_get_ptr(
(u32 *)cargs->args.open.params->shared_addr); (u32 *)cargs->args.open.shared_addr_srptr);
if (unlikely(params.shared_addr == NULL)) if (unlikely(params.shared_addr == NULL))
goto free_name; goto free_name;
/* Update lock_handle in params. */
params.lock_handle = cargs->args.open.knl_lock_handle;
status = listmp_sharedmemory_open(&listmp_handle, &params); status = listmp_sharedmemory_open(&listmp_handle, &params);
if (status) if (status)
goto free_name; goto free_name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment