A sprinkling of const in vlibmemory/api.h and friends
Change-Id: I953ebb37eeec7de0c4a6b00258c3c67a83cbc020
Signed-off-by: Neale Ranns <nranns@cisco.com>
diff --git a/src/svm/svm.c b/src/svm/svm.c
index e4ca98e..97add5a 100644
--- a/src/svm/svm.c
+++ b/src/svm/svm.c
@@ -796,7 +796,7 @@
}
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 @@
}
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 @@
* 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 0b87dbc..06797fa 100644
--- a/src/svm/svm.h
+++ b/src/svm/svm.h
@@ -69,8 +69,8 @@
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 @@
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 e02628a..e35be8a 100644
--- a/src/svm/svmdb.h
+++ b/src/svm/svmdb.h
@@ -83,7 +83,7 @@
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 a62fa64..7538050 100644
--- a/src/vlibapi/api.h
+++ b/src/vlibapi/api.h
@@ -127,7 +127,7 @@
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 @@
/* 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 @@
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 6774e3d..0817f38 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -828,7 +828,7 @@
}
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 @@
}
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 8e44c20..c195e18 100644
--- a/src/vlibmemory/api.h
+++ b/src/vlibmemory/api.h
@@ -123,20 +123,20 @@
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_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 25b06f6..d48a4fa 100644
--- a/src/vlibmemory/memory_client.c
+++ b/src/vlibmemory/memory_client.c
@@ -155,7 +155,7 @@
}
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 @@
int
-vl_client_api_map (char *region_name)
+vl_client_api_map (const char *region_name)
{
int rv;
@@ -354,7 +354,8 @@
}
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 @@
}
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 @@
}
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 6cea5df..aea9033 100644
--- a/src/vlibmemory/memory_shared.c
+++ b/src/vlibmemory/memory_shared.c
@@ -257,7 +257,7 @@
}
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 @@
}
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 43574de..29a5c2c 100644
--- a/src/vlibmemory/memory_vlib.c
+++ b/src/vlibmemory/memory_vlib.c
@@ -361,7 +361,7 @@
* 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 @@
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 d48e4ef..ac09cd1 100644
--- a/src/vpp/api/api_main.c
+++ b/src/vpp/api/api_main.c
@@ -211,7 +211,7 @@
}
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;