aboutsummaryrefslogtreecommitdiffstats
path: root/svm/svmdb.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-07-18 14:23:36 -0400
committerDave Barach <dave@barachs.net>2016-07-18 14:29:04 -0400
commit98cfc1aab07d311b53b0171fad62a4031c96fcfd (patch)
tree7779590482e032169590f2a5d1c4f4fcab66678f /svm/svmdb.c
parent2221cd8dd18e66bcdb9bb9a4114ba0c3dddcd00c (diff)
Add uid/gid config parameters to shared-vm database map operator
So vpp_get_metrics and similar will not need to run as root Change-Id: I635e830834c82990ad84ddaae06f2e50e55fd616 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'svm/svmdb.c')
-rw-r--r--svm/svmdb.c36
1 files changed, 7 insertions, 29 deletions
diff --git a/svm/svmdb.c b/svm/svmdb.c
index b22d2fab1bb..c0680bc3279 100644
--- a/svm/svmdb.c
+++ b/svm/svmdb.c
@@ -66,8 +66,8 @@ region_unlock (svm_region_t * rp)
pthread_mutex_unlock (&rp->mutex);
}
-static svmdb_client_t *
-svmdb_map_internal (char *root_path, uword size)
+svmdb_client_t *
+svmdb_map (svmdb_map_args_t * dba)
{
svmdb_client_t *client = 0;
svm_map_region_args_t *a = 0;
@@ -78,12 +78,14 @@ svmdb_map_internal (char *root_path, uword size)
vec_validate (client, 0);
vec_validate (a, 0);
- svm_region_init_chroot (root_path);
+ svm_region_init_chroot_uid_gid (dba->root_path, dba->uid, dba->gid);
- a->root_path = root_path;
+ a->root_path = dba->root_path;
a->name = "/db";
- a->size = size ? size : SVMDB_DEFAULT_SIZE;
+ a->size = dba->size ? dba->size : SVMDB_DEFAULT_SIZE;
a->flags = SVM_FLAGS_MHEAP;
+ a->uid = dba->uid;
+ a->gid = dba->gid;
db_rp = client->db_rp = svm_region_find_or_create (a);
@@ -127,30 +129,6 @@ svmdb_map_internal (char *root_path, uword size)
return (client);
}
-svmdb_client_t *
-svmdb_map (void)
-{
- return svmdb_map_internal (0, 0);
-}
-
-svmdb_client_t *
-svmdb_map_size (uword size)
-{
- return svmdb_map_internal (0, size);
-}
-
-svmdb_client_t *
-svmdb_map_chroot (char *root_path)
-{
- return svmdb_map_internal (root_path, 0);
-}
-
-svmdb_client_t *
-svmdb_map_chroot_size (char *root_path, uword size)
-{
- return svmdb_map_internal (root_path, size);
-}
-
void
svmdb_unmap (svmdb_client_t * client)
{