summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-04-26 13:59:20 -0700
committerDave Barach <openvpp@barachs.net>2017-05-03 12:35:05 +0000
commite72be39cd0f498178fd62dfc0a0b0daa2b633f62 (patch)
tree7b18cfecc33966c9fcb7a8daf3743d97a72332c6
parent9e355523f30e46efd2b1550ae029b544dfe866c4 (diff)
A sprinkling of const in vlibmemory/api.h and friends
Change-Id: I953ebb37eeec7de0c4a6b00258c3c67a83cbc020 Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r--src/svm/svm.c6
-rw-r--r--src/svm/svm.h10
-rw-r--r--src/svm/svmdb.h2
-rw-r--r--src/vlibapi/api.h11
-rw-r--r--src/vlibapi/api_shared.c4
-rw-r--r--src/vlibmemory/api.h20
-rw-r--r--src/vlibmemory/memory_client.c16
-rw-r--r--src/vlibmemory/memory_shared.c4
-rw-r--r--src/vlibmemory/memory_vlib.c4
-rw-r--r--src/vpp/api/api_main.c2
10 files changed, 41 insertions, 38 deletions
diff --git a/src/svm/svm.c b/src/svm/svm.c
index e4ca98e1ed2..97add5a786c 100644
--- a/src/svm/svm.c
+++ b/src/svm/svm.c
@@ -796,7 +796,7 @@ svm_region_init (void)
}
void
-svm_region_init_chroot (char *root_path)
+svm_region_init_chroot (const char *root_path)
{
svm_map_region_args_t _a, *a = &_a;
@@ -813,7 +813,7 @@ svm_region_init_chroot (char *root_path)
}
void
-svm_region_init_chroot_uid_gid (char *root_path, int uid, int gid)
+svm_region_init_chroot_uid_gid (const char *root_path, int uid, int gid)
{
svm_map_region_args_t _a, *a = &_a;
@@ -1151,7 +1151,7 @@ svm_client_scan_this_region_nolock (svm_region_t * rp)
* Scan svm regions for dead clients
*/
void
-svm_client_scan (char *root_path)
+svm_client_scan (const char *root_path)
{
int i, j;
svm_main_region_t *mp;
diff --git a/src/svm/svm.h b/src/svm/svm.h
index 0b87dbcbc64..06797fa1a79 100644
--- a/src/svm/svm.h
+++ b/src/svm/svm.h
@@ -69,8 +69,8 @@ typedef struct svm_region_
typedef struct svm_map_region_args_
{
- char *root_path; /* NULL means use the truly global arena */
- char *name;
+ const char *root_path; /* NULL means use the truly global arena */
+ const char *name;
u64 baseva;
u64 size;
u64 pvt_heap_size;
@@ -115,12 +115,12 @@ typedef struct
void *svm_region_find_or_create (svm_map_region_args_t * a);
void svm_region_init (void);
-void svm_region_init_chroot (char *root_path);
-void svm_region_init_chroot_uid_gid (char *root_path, int uid, int gid);
+void svm_region_init_chroot (const char *root_path);
+void svm_region_init_chroot_uid_gid (const char *root_path, int uid, int gid);
void svm_region_init_args (svm_map_region_args_t * a);
void svm_region_exit (void);
void svm_region_unmap (void *rp_arg);
-void svm_client_scan (char *root_path);
+void svm_client_scan (const char *root_path);
void svm_client_scan_this_region_nolock (svm_region_t * rp);
u8 *shm_name_from_svm_map_region_args (svm_map_region_args_t * a);
diff --git a/src/svm/svmdb.h b/src/svm/svmdb.h
index e02628a0bb9..e35be8aa538 100644
--- a/src/svm/svmdb.h
+++ b/src/svm/svmdb.h
@@ -83,7 +83,7 @@ typedef struct
typedef struct
{
- char *root_path;
+ const char *root_path;
uword size;
u32 uid;
u32 gid;
diff --git a/src/vlibapi/api.h b/src/vlibapi/api.h
index a62fa64493e..7538050e7b2 100644
--- a/src/vlibapi/api.h
+++ b/src/vlibapi/api.h
@@ -127,7 +127,7 @@ typedef struct
void (**msg_cleanup_handlers) (void *);
void (**msg_endian_handlers) (void *);
void (**msg_print_handlers) (void *, void *);
- char **msg_names;
+ const char **msg_names;
u8 *message_bounce;
u8 *is_mp_safe;
struct ring_alloc_ *arings;
@@ -195,8 +195,8 @@ typedef struct
/* client side message index hash table */
uword *msg_index_by_name_and_crc;
- char *region_name;
- char *root_path;
+ const char *region_name;
+ const char *root_path;
/* Replay in progress? */
int replay_in_progress;
@@ -276,8 +276,9 @@ void vl_msg_api_register_pd_handler (void *handler,
int vl_msg_api_pd_handler (void *mp, int rv);
void vl_msg_api_set_first_available_msg_id (u16 first_avail);
-u16 vl_msg_api_get_msg_ids (char *name, int n);
-void vl_msg_api_add_msg_name_crc (api_main_t * am, char *string, u32 id);
+u16 vl_msg_api_get_msg_ids (const char *name, int n);
+void vl_msg_api_add_msg_name_crc (api_main_t * am, const char *string,
+ u32 id);
u32 vl_api_get_msg_index (u8 * name_and_crc);
/* node_serialize.c prototypes */
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index 6774e3ddb75..0817f38e40a 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -828,7 +828,7 @@ vl_msg_api_set_first_available_msg_id (u16 first_avail)
}
u16
-vl_msg_api_get_msg_ids (char *name, int n)
+vl_msg_api_get_msg_ids (const char *name, int n)
{
api_main_t *am = &api_main;
u8 *name_copy;
@@ -872,7 +872,7 @@ vl_msg_api_get_msg_ids (char *name, int n)
}
void
-vl_msg_api_add_msg_name_crc (api_main_t * am, char *string, u32 id)
+vl_msg_api_add_msg_name_crc (api_main_t * am, const char *string, u32 id)
{
uword *p;
diff --git a/src/vlibmemory/api.h b/src/vlibmemory/api.h
index 8e44c20d4ed..c195e1815bf 100644
--- a/src/vlibmemory/api.h
+++ b/src/vlibmemory/api.h
@@ -123,20 +123,20 @@ void *vl_msg_api_alloc_or_null (int nbytes);
void *vl_msg_api_alloc_as_if_client (int nbytes);
void *vl_msg_api_alloc_as_if_client_or_null (int nbytes);
void vl_msg_api_free (void *a);
-int vl_map_shmem (char *region_name, int is_vlib);
+int vl_map_shmem (const char *region_name, int is_vlib);
void vl_register_mapped_shmem_region (svm_region_t * rp);
void vl_unmap_shmem (void);
void vl_msg_api_send_shmem (unix_shared_memory_queue_t * q, u8 * elem);
void vl_msg_api_send_shmem_nolock (unix_shared_memory_queue_t * q, u8 * elem);
void vl_msg_api_send (vl_api_registration_t * rp, u8 * elem);
-int vl_client_connect (char *name, int ctx_quota, int input_queue_size);
+int vl_client_connect (const char *name, int ctx_quota, int input_queue_size);
void vl_client_disconnect (void);
unix_shared_memory_queue_t *vl_api_client_index_to_input_queue (u32 index);
vl_api_registration_t *vl_api_client_index_to_registration (u32 index);
-int vl_client_api_map (char *region_name);
+int vl_client_api_map (const char *region_name);
void vl_client_api_unmap (void);
-void vl_set_memory_region_name (char *name);
-void vl_set_memory_root_path (char *root_path);
+void vl_set_memory_region_name (const char *name);
+void vl_set_memory_root_path (const char *root_path);
void vl_set_memory_uid (int uid);
void vl_set_memory_gid (int gid);
void vl_set_global_memory_baseva (u64 baseva);
@@ -146,12 +146,12 @@ void vl_set_global_pvt_heap_size (u64 size);
void vl_set_api_pvt_heap_size (u64 size);
void vl_enable_disable_memory_api (vlib_main_t * vm, int yesno);
void vl_client_disconnect_from_vlib (void);
-int vl_client_connect_to_vlib (char *svm_name, char *client_name,
- int rx_queue_size);
-int vl_client_connect_to_vlib_no_rx_pthread (char *svm_name,
- char *client_name,
+int vl_client_connect_to_vlib (const char *svm_name,
+ const char *client_name, int rx_queue_size);
+int vl_client_connect_to_vlib_no_rx_pthread (const char *svm_name,
+ const char *client_name,
int rx_queue_size);
-u16 vl_client_get_first_plugin_msg_id (char *plugin_name);
+u16 vl_client_get_first_plugin_msg_id (const char *plugin_name);
void vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length);
diff --git a/src/vlibmemory/memory_client.c b/src/vlibmemory/memory_client.c
index 25b06f653ec..d48a4fa1d8e 100644
--- a/src/vlibmemory/memory_client.c
+++ b/src/vlibmemory/memory_client.c
@@ -155,7 +155,7 @@ noop_handler (void *notused)
}
int
-vl_client_connect (char *name, int ctx_quota, int input_queue_size)
+vl_client_connect (const char *name, int ctx_quota, int input_queue_size)
{
svm_region_t *svm;
vl_api_memclnt_create_t *mp;
@@ -326,7 +326,7 @@ _(MEMCLNT_DELETE_REPLY, memclnt_delete_reply)
int
-vl_client_api_map (char *region_name)
+vl_client_api_map (const char *region_name)
{
int rv;
@@ -354,7 +354,8 @@ vl_client_api_unmap (void)
}
static int
-connect_to_vlib_internal (char *svm_name, char *client_name,
+connect_to_vlib_internal (const char *svm_name,
+ const char *client_name,
int rx_queue_size, int want_pthread)
{
int rv = 0;
@@ -388,15 +389,16 @@ connect_to_vlib_internal (char *svm_name, char *client_name,
}
int
-vl_client_connect_to_vlib (char *svm_name, char *client_name,
- int rx_queue_size)
+vl_client_connect_to_vlib (const char *svm_name,
+ const char *client_name, int rx_queue_size)
{
return connect_to_vlib_internal (svm_name, client_name, rx_queue_size,
1 /* want pthread */ );
}
int
-vl_client_connect_to_vlib_no_rx_pthread (char *svm_name, char *client_name,
+vl_client_connect_to_vlib_no_rx_pthread (const char *svm_name,
+ const char *client_name,
int rx_queue_size)
{
return connect_to_vlib_internal (svm_name, client_name, rx_queue_size,
@@ -437,7 +439,7 @@ static void vl_api_get_first_msg_id_reply_t_handler
}
u16
-vl_client_get_first_plugin_msg_id (char *plugin_name)
+vl_client_get_first_plugin_msg_id (const char *plugin_name)
{
vl_api_get_first_msg_id_t *mp;
api_main_t *am = &api_main;
diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c
index 6cea5df9a34..aea903304a8 100644
--- a/src/vlibmemory/memory_shared.c
+++ b/src/vlibmemory/memory_shared.c
@@ -257,7 +257,7 @@ vl_msg_api_free_nolock (void *a)
}
void
-vl_set_memory_root_path (char *name)
+vl_set_memory_root_path (const char *name)
{
api_main_t *am = &api_main;
@@ -321,7 +321,7 @@ vl_set_api_pvt_heap_size (u64 size)
}
int
-vl_map_shmem (char *region_name, int is_vlib)
+vl_map_shmem (const char *region_name, int is_vlib)
{
svm_map_region_args_t _a, *a = &_a;
svm_region_t *vlib_rp, *root_rp;
diff --git a/src/vlibmemory/memory_vlib.c b/src/vlibmemory/memory_vlib.c
index 43574deadb7..29a5c2c2939 100644
--- a/src/vlibmemory/memory_vlib.c
+++ b/src/vlibmemory/memory_vlib.c
@@ -361,7 +361,7 @@ _(GET_FIRST_MSG_ID, get_first_msg_id)
* vl_api_init
*/
static int
-memory_api_init (char *region_name)
+memory_api_init (const char *region_name)
{
int rv;
vl_msg_api_msg_config_t cfg;
@@ -1202,7 +1202,7 @@ vlibmemory_init (vlib_main_t * vm)
VLIB_INIT_FUNCTION (vlibmemory_init);
void
-vl_set_memory_region_name (char *name)
+vl_set_memory_region_name (const char *name)
{
api_main_t *am = &api_main;
diff --git a/src/vpp/api/api_main.c b/src/vpp/api/api_main.c
index d48e4eff91d..ac09cd15335 100644
--- a/src/vpp/api/api_main.c
+++ b/src/vpp/api/api_main.c
@@ -211,7 +211,7 @@ api_cli_output (void *notused, const char *fmt, ...)
}
u16
-vl_client_get_first_plugin_msg_id (char *plugin_name)
+vl_client_get_first_plugin_msg_id (const char *plugin_name)
{
api_main_t *am = &api_main;
vl_api_msg_range_t *rp;