aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm
diff options
context:
space:
mode:
Diffstat (limited to 'src/svm')
-rw-r--r--src/svm/queue.c8
-rw-r--r--src/svm/ssvm.c2
-rw-r--r--src/svm/svm.c8
-rw-r--r--src/svm/svm_fifo.c35
-rw-r--r--src/svm/svm_fifo_segment.c14
-rw-r--r--src/svm/svmdb.c4
-rw-r--r--src/svm/svmdbtool.c6
-rw-r--r--src/svm/svmtool.c6
-rw-r--r--src/svm/test_svm_fifo1.c10
-rw-r--r--src/svm/test_svm_message_queue.c2
10 files changed, 48 insertions, 47 deletions
diff --git a/src/svm/queue.c b/src/svm/queue.c
index 6a578fb4d6b..6972f14cd33 100644
--- a/src/svm/queue.c
+++ b/src/svm/queue.c
@@ -37,15 +37,15 @@ svm_queue_init (void *base, int nels, int elsize)
pthread_condattr_t cattr;
q = (svm_queue_t *) base;
- memset (q, 0, sizeof (*q));
+ clib_memset (q, 0, sizeof (*q));
q->elsize = elsize;
q->maxsize = nels;
q->producer_evtfd = -1;
q->consumer_evtfd = -1;
- memset (&attr, 0, sizeof (attr));
- memset (&cattr, 0, sizeof (cattr));
+ clib_memset (&attr, 0, sizeof (attr));
+ clib_memset (&cattr, 0, sizeof (cattr));
if (pthread_mutexattr_init (&attr))
clib_unix_warning ("mutexattr_init");
@@ -75,7 +75,7 @@ svm_queue_alloc_and_init (int nels, int elsize, int consumer_pid)
q = clib_mem_alloc_aligned (sizeof (svm_queue_t)
+ nels * elsize, CLIB_CACHE_LINE_BYTES);
- memset (q, 0, sizeof (*q));
+ clib_memset (q, 0, sizeof (*q));
q = svm_queue_init (q, nels, elsize);
q->consumer_pid = consumer_pid;
diff --git a/src/svm/ssvm.c b/src/svm/ssvm.c
index 7fa9b258729..2d9d1b3159f 100644
--- a/src/svm/ssvm.c
+++ b/src/svm/ssvm.c
@@ -381,7 +381,7 @@ ssvm_master_init_private (ssvm_private_t * ssvm)
sh = clib_mem_alloc_aligned (sizeof (*sh), CLIB_CACHE_LINE_BYTES);
ssvm->sh = sh;
- memset (sh, 0, sizeof (*sh));
+ clib_memset (sh, 0, sizeof (*sh));
sh->heap = heap;
sh->type = SSVM_SEGMENT_PRIVATE;
diff --git a/src/svm/svm.c b/src/svm/svm.c
index 681ac4a8926..4aefd20da86 100644
--- a/src/svm/svm.c
+++ b/src/svm/svm.c
@@ -495,7 +495,7 @@ svm_region_init_mapped_region (svm_map_region_args_t * a, svm_region_t * rp)
ASSERT (rp);
int rv;
- memset (rp, 0, sizeof (*rp));
+ clib_memset (rp, 0, sizeof (*rp));
if (pthread_mutexattr_init (&attr))
clib_unix_warning ("mutexattr_init");
@@ -866,7 +866,7 @@ svm_region_init (void)
{
svm_map_region_args_t _a, *a = &_a;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->root_path = 0;
a->name = SVM_GLOBAL_REGION_NAME;
a->baseva = svm_get_global_region_base_va ();
@@ -883,7 +883,7 @@ svm_region_init_chroot (const char *root_path)
{
svm_map_region_args_t _a, *a = &_a;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->root_path = root_path;
a->name = SVM_GLOBAL_REGION_NAME;
a->baseva = svm_get_global_region_base_va ();
@@ -900,7 +900,7 @@ svm_region_init_chroot_uid_gid (const char *root_path, int uid, int gid)
{
svm_map_region_args_t _a, *a = &_a;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->root_path = root_path;
a->name = SVM_GLOBAL_REGION_NAME;
a->baseva = svm_get_global_region_base_va ();
diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c
index aa523c6b55c..46ce32bbbd8 100644
--- a/src/svm/svm_fifo.c
+++ b/src/svm/svm_fifo.c
@@ -109,7 +109,7 @@ svm_fifo_replay (u8 * s, svm_fifo_t * f, u8 no_read, u8 verbose)
#endif
dummy_fifo = svm_fifo_create (f->nitems);
- memset (f->data, 0xFF, f->nitems);
+ clib_memset (f->data, 0xFF, f->nitems);
vec_validate (data, f->nitems);
for (i = 0; i < vec_len (data); i++)
@@ -209,7 +209,7 @@ svm_fifo_create (u32 data_size_in_bytes)
if (f == 0)
return 0;
- memset (f, 0, sizeof (*f));
+ clib_memset (f, 0, sizeof (*f));
f->nitems = data_size_in_bytes;
f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
f->ct_session_index = SVM_FIFO_INVALID_SESSION_INDEX;
@@ -480,7 +480,7 @@ CLIB_MARCH_FN (svm_fifo_enqueue_nowait, int, svm_fifo_t * f, u32 max_bytes,
first_copy_bytes = ((nitems - f->tail) < total_copy_bytes)
? (nitems - f->tail) : total_copy_bytes;
- clib_memcpy (&f->data[f->tail], copy_from_here, first_copy_bytes);
+ _clib_memcpy (&f->data[f->tail], copy_from_here, first_copy_bytes);
f->tail += first_copy_bytes;
f->tail = (f->tail == nitems) ? 0 : f->tail;
@@ -488,8 +488,8 @@ CLIB_MARCH_FN (svm_fifo_enqueue_nowait, int, svm_fifo_t * f, u32 max_bytes,
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- clib_memcpy (&f->data[f->tail], copy_from_here + first_copy_bytes,
- second_copy_bytes);
+ _clib_memcpy (&f->data[f->tail], copy_from_here + first_copy_bytes,
+ second_copy_bytes);
f->tail += second_copy_bytes;
f->tail = (f->tail == nitems) ? 0 : f->tail;
}
@@ -566,7 +566,8 @@ CLIB_MARCH_FN (svm_fifo_enqueue_with_offset, int, svm_fifo_t * f,
first_copy_bytes = ((nitems - normalized_offset) < total_copy_bytes)
? (nitems - normalized_offset) : total_copy_bytes;
- clib_memcpy (&f->data[normalized_offset], copy_from_here, first_copy_bytes);
+ _clib_memcpy (&f->data[normalized_offset], copy_from_here,
+ first_copy_bytes);
/* Number of bytes in second copy segment, if any */
second_copy_bytes = total_copy_bytes - first_copy_bytes;
@@ -577,8 +578,8 @@ CLIB_MARCH_FN (svm_fifo_enqueue_with_offset, int, svm_fifo_t * f,
ASSERT (normalized_offset == 0);
- clib_memcpy (&f->data[normalized_offset],
- copy_from_here + first_copy_bytes, second_copy_bytes);
+ _clib_memcpy (&f->data[normalized_offset],
+ copy_from_here + first_copy_bytes, second_copy_bytes);
}
return (0);
@@ -602,11 +603,11 @@ svm_fifo_overwrite_head (svm_fifo_t * f, u8 * data, u32 len)
first_chunk = f->nitems - f->head;
ASSERT (len <= f->nitems);
if (len <= first_chunk)
- clib_memcpy (&f->data[f->head], data, len);
+ _clib_memcpy (&f->data[f->head], data, len);
else
{
- clib_memcpy (&f->data[f->head], data, first_chunk);
- clib_memcpy (&f->data[0], data + first_chunk, len - first_chunk);
+ _clib_memcpy (&f->data[f->head], data, first_chunk);
+ _clib_memcpy (&f->data[0], data + first_chunk, len - first_chunk);
}
}
#endif
@@ -632,7 +633,7 @@ CLIB_MARCH_FN (svm_fifo_dequeue_nowait, int, svm_fifo_t * f, u32 max_bytes,
/* Number of bytes in first copy segment */
first_copy_bytes = ((nitems - f->head) < total_copy_bytes)
? (nitems - f->head) : total_copy_bytes;
- clib_memcpy (copy_here, &f->data[f->head], first_copy_bytes);
+ _clib_memcpy (copy_here, &f->data[f->head], first_copy_bytes);
f->head += first_copy_bytes;
f->head = (f->head == nitems) ? 0 : f->head;
@@ -640,8 +641,8 @@ CLIB_MARCH_FN (svm_fifo_dequeue_nowait, int, svm_fifo_t * f, u32 max_bytes,
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- clib_memcpy (copy_here + first_copy_bytes,
- &f->data[f->head], second_copy_bytes);
+ _clib_memcpy (copy_here + first_copy_bytes,
+ &f->data[f->head], second_copy_bytes);
f->head += second_copy_bytes;
f->head = (f->head == nitems) ? 0 : f->head;
}
@@ -699,14 +700,14 @@ CLIB_MARCH_FN (svm_fifo_peek, int, svm_fifo_t * f, u32 relative_offset,
first_copy_bytes =
((nitems - real_head) < total_copy_bytes) ?
(nitems - real_head) : total_copy_bytes;
- clib_memcpy (copy_here, &f->data[real_head], first_copy_bytes);
+ _clib_memcpy (copy_here, &f->data[real_head], first_copy_bytes);
/* Number of bytes in second copy segment, if any */
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- clib_memcpy (copy_here + first_copy_bytes, &f->data[0],
- second_copy_bytes);
+ _clib_memcpy (copy_here + first_copy_bytes, &f->data[0],
+ second_copy_bytes);
}
}
return total_copy_bytes;
diff --git a/src/svm/svm_fifo_segment.c b/src/svm/svm_fifo_segment.c
index dcfc0dffb80..a42225c8345 100644
--- a/src/svm/svm_fifo_segment.c
+++ b/src/svm/svm_fifo_segment.c
@@ -190,7 +190,7 @@ svm_fifo_segment_init (svm_fifo_segment_private_t * s)
oldheap = ssvm_push_heap (sh);
fsh = clib_mem_alloc (sizeof (*fsh));
- memset (fsh, 0, sizeof (*fsh));
+ clib_memset (fsh, 0, sizeof (*fsh));
s->h = sh->opaque[0] = fsh;
ssvm_pop_heap (oldheap);
@@ -211,7 +211,7 @@ svm_fifo_segment_create (svm_fifo_segment_create_args_t * a)
/* Allocate a fresh segment */
pool_get (sm->segments, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
s->ssvm.ssvm_size = a->segment_size;
s->ssvm.i_am_master = 1;
@@ -247,7 +247,7 @@ svm_fifo_segment_create_process_private (svm_fifo_segment_create_args_t * a)
u32 pagesize = clib_mem_get_page_size ();
pool_get (sm->segments, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
rnd_size = (a->segment_size + (pagesize - 1)) & ~pagesize;
@@ -278,7 +278,7 @@ svm_fifo_segment_create_process_private (svm_fifo_segment_create_args_t * a)
sh = clib_mem_alloc_aligned (sizeof (*sh), CLIB_CACHE_LINE_BYTES);
s->ssvm.sh = sh;
- memset (sh, 0, sizeof (*sh));
+ clib_memset (sh, 0, sizeof (*sh));
sh->heap = heap;
svm_fifo_segment_init (s);
@@ -299,7 +299,7 @@ svm_fifo_segment_attach (svm_fifo_segment_create_args_t * a)
/* Allocate a fresh segment */
pool_get (sm->segments, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
s->ssvm.ssvm_size = a->segment_size;
s->ssvm.my_pid = getpid ();
@@ -329,7 +329,7 @@ svm_fifo_segment_delete (svm_fifo_segment_private_t * s)
svm_fifo_segment_main_t *sm = &svm_fifo_segment_main;
ssvm_delete (&s->ssvm);
- memset (s, 0xfe, sizeof (*s));
+ clib_memset (s, 0xfe, sizeof (*s));
pool_put (sm->segments, s);
}
@@ -387,7 +387,7 @@ svm_fifo_segment_alloc_fifo (svm_fifo_segment_private_t * s,
{
fsh->free_fifos[freelist_index] = f->next;
/* (re)initialize the fifo, as in svm_fifo_create */
- memset (f, 0, sizeof (*f));
+ clib_memset (f, 0, sizeof (*f));
f->nitems = data_size_in_bytes;
f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
f->ct_session_index = SVM_FIFO_INVALID_SESSION_INDEX;
diff --git a/src/svm/svmdb.c b/src/svm/svmdb.c
index 03aa1f17494..f2aea5a0d49 100644
--- a/src/svm/svmdb.c
+++ b/src/svm/svmdb.c
@@ -325,7 +325,7 @@ local_set_variable_nolock (svmdb_client_t * client,
{
svmdb_value_t *newvalue;
pool_get (shm->values, newvalue);
- memset (newvalue, 0, sizeof (*newvalue));
+ clib_memset (newvalue, 0, sizeof (*newvalue));
newvalue->elsize = elsize;
vec_alloc (newvalue->value, vec_len (val) * elsize);
clib_memcpy (newvalue->value, val, vec_len (val) * elsize);
@@ -651,7 +651,7 @@ svmdb_local_find_or_add_vec_variable (svmdb_client_t * client,
h = shm->namespaces[SVMDB_NAMESPACE_VEC];
pool_get (shm->values, newvalue);
- memset (newvalue, 0, sizeof (*newvalue));
+ clib_memset (newvalue, 0, sizeof (*newvalue));
newvalue->elsize = 1;
vec_alloc (newvalue->value, nbytes);
_vec_len (newvalue->value) = nbytes;
diff --git a/src/svm/svmdbtool.c b/src/svm/svmdbtool.c
index a0af15fcbbf..d50ca7be95c 100644
--- a/src/svm/svmdbtool.c
+++ b/src/svm/svmdbtool.c
@@ -55,7 +55,7 @@ map_arg_setup (char *chroot_path)
svmdbtool_main_t *sm = &svmdbtool_main;
svmdb_map_args_t *ma = &sm->map_args;
- memset (ma, 0, sizeof (*ma));
+ clib_memset (ma, 0, sizeof (*ma));
ma->root_path = chroot_path;
ma->size = sm->size;
ma->uid = sm->uid;
@@ -269,7 +269,7 @@ test_reg (char *chroot_path, u8 * vbl)
ma = map_arg_setup (chroot_path);
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.sa_sigaction = sigaction_handler;
sa.sa_flags = SA_SIGINFO;
if (sigaction (SIGUSR2, &sa, 0) < 0)
@@ -278,7 +278,7 @@ test_reg (char *chroot_path, u8 * vbl)
return;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
c = svmdb_map (ma);
diff --git a/src/svm/svmtool.c b/src/svm/svmtool.c
index 63577d97fd9..6d1a2b1da49 100644
--- a/src/svm/svmtool.c
+++ b/src/svm/svmtool.c
@@ -190,7 +190,7 @@ svm_map_region_nolock (svm_map_region_args_t * a)
{
clib_warning ("rp->mutex LOCKED by pid %d, tag %d, cleared...",
rp->mutex_owner_pid, rp->mutex_owner_tag);
- memset (&rp->mutex, 0, sizeof (rp->mutex));
+ clib_memset (&rp->mutex, 0, sizeof (rp->mutex));
}
else
@@ -339,7 +339,7 @@ subregion_repair (char *chroot_path)
for (i = 0; i < vec_len (svm_names); i++)
{
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
a.root_path = chroot_path;
a.name = (char *) svm_names[i];
fformat (stdout, "Checking %s region...\n", a.name);
@@ -422,7 +422,7 @@ repair (char *chroot_path, int crash_root_region)
{
clib_warning ("root_rp->mutex LOCKED by pid %d, tag %d, cleared...",
root_rp->mutex_owner_pid, root_rp->mutex_owner_tag);
- memset (&root_rp->mutex, 0, sizeof (root_rp->mutex));
+ clib_memset (&root_rp->mutex, 0, sizeof (root_rp->mutex));
goto out;
}
else
diff --git a/src/svm/test_svm_fifo1.c b/src/svm/test_svm_fifo1.c
index d5b2c98dfc3..243f8b61673 100644
--- a/src/svm/test_svm_fifo1.c
+++ b/src/svm/test_svm_fifo1.c
@@ -26,7 +26,7 @@ hello_world (int verbose)
u8 *retrieved_data = 0;
clib_error_t *error = 0;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = "fifo-test1";
a->segment_size = 256 << 10;
@@ -79,7 +79,7 @@ master (int verbose)
u8 *retrieved_data = 0;
int i;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = "fifo-test1";
a->segment_size = 256 << 10;
@@ -115,7 +115,7 @@ mempig (int verbose)
int rv;
int i;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = "fifo-test1";
a->segment_size = 256 << 10;
@@ -173,7 +173,7 @@ offset (int verbose)
u32 *recovered_data = 0;
int i;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = "fifo-test1";
a->segment_size = 256 << 10;
@@ -234,7 +234,7 @@ slave (int verbose)
u8 *retrieved_data = 0;
int i;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = "fifo-test1";
diff --git a/src/svm/test_svm_message_queue.c b/src/svm/test_svm_message_queue.c
index 9441c593ef2..d51252769b5 100644
--- a/src/svm/test_svm_message_queue.c
+++ b/src/svm/test_svm_message_queue.c
@@ -35,7 +35,7 @@ test1 (int verbose)
void *oldheap;
int i;
- memset (ssvm, 0, sizeof (*ssvm));
+ clib_memset (ssvm, 0, sizeof (*ssvm));
ssvm->ssvm_size = 1 << 20;
ssvm->i_am_master = 1;