MCPcopy Create free account
hub / github.com/corosync/corosync / sam_data_restore

Function sam_data_restore

lib/sam.c:469–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467}
468
469cs_error_t sam_data_restore (
470 void *data,
471 size_t size)
472{
473 cs_error_t ret;
474
475 ret = CS_OK;
476
477 if (data == NULL) {
478 return (CS_ERR_INVALID_PARAM);
479 }
480
481 pthread_mutex_lock (&sam_internal_data.lock);
482
483 if (sam_internal_data.internal_status != SAM_INTERNAL_STATUS_INITIALIZED &&
484 sam_internal_data.internal_status != SAM_INTERNAL_STATUS_REGISTERED &&
485 sam_internal_data.internal_status != SAM_INTERNAL_STATUS_STARTED) {
486
487 ret = CS_ERR_BAD_HANDLE;
488 goto exit_mutex_unlock;
489 }
490
491
492 if (sam_internal_data.user_data_size == 0) {
493 ret = CS_OK;
494
495 goto exit_mutex_unlock;
496 }
497
498 if (size < sam_internal_data.user_data_size) {
499 ret = CS_ERR_INVALID_PARAM;
500
501 goto exit_mutex_unlock;
502 }
503
504 memcpy (data, sam_internal_data.user_data, sam_internal_data.user_data_size);
505
506exit_mutex_unlock:
507 pthread_mutex_unlock (&sam_internal_data.lock);
508
509 return (ret);
510}
511
512static cs_error_t sam_data_store_nolock (
513 const void *data,

Callers 3

test_data_store_restoreFunction · 0.85
test_hcFunction · 0.85
test_warn_signalFunction · 0.85

Calls

no outgoing calls

Tested by 3

test_data_store_restoreFunction · 0.68
test_hcFunction · 0.68
test_warn_signalFunction · 0.68