Commit 9ede9253 authored by Martin Wührer's avatar Martin Wührer Committed by Andrei Vagin

c-lib: simplify service set by removing set_service_comm().

This commit removes the functions criu_(local_)set_service_comm().
These functions are not neccessary, because if
set_service_address(), set_service_fd() or
set_service_binary() has been called it is already clear, which
service comm type should be used.

Furhtermore, this commit reduces the number of misuses.
E.g. if set_service_comm() was set to socket, but a binary was given
via set_service_binary().
Signed-off-by: 's avatarMartin Wührer <martin.wuehrer@artech.at>
parent 29af538d
...@@ -49,19 +49,10 @@ void criu_free_service(criu_opts *opts) ...@@ -49,19 +49,10 @@ void criu_free_service(criu_opts *opts)
} }
} }
void criu_local_set_service_comm(criu_opts *opts, enum criu_service_comm comm)
{
opts->service_comm = comm;
}
void criu_set_service_comm(enum criu_service_comm comm)
{
criu_local_set_service_comm(global_opts, comm);
}
int criu_local_set_service_address(criu_opts *opts, const char *path) int criu_local_set_service_address(criu_opts *opts, const char *path)
{ {
criu_free_service(opts); criu_free_service(opts);
opts->service_comm = CRIU_COMM_SK;
if (path) { if (path) {
opts->service_address = strdup(path); opts->service_address = strdup(path);
} else { } else {
...@@ -81,6 +72,7 @@ int criu_set_service_address(const char *path) ...@@ -81,6 +72,7 @@ int criu_set_service_address(const char *path)
void criu_local_set_service_fd(criu_opts *opts, int fd) void criu_local_set_service_fd(criu_opts *opts, int fd)
{ {
criu_free_service(opts); criu_free_service(opts);
opts->service_comm = CRIU_COMM_FD;
opts->service_fd = fd; opts->service_fd = fd;
} }
...@@ -92,6 +84,7 @@ void criu_set_service_fd(int fd) ...@@ -92,6 +84,7 @@ void criu_set_service_fd(int fd)
int criu_local_set_service_binary(criu_opts *opts, const char *path) int criu_local_set_service_binary(criu_opts *opts, const char *path)
{ {
criu_free_service(opts); criu_free_service(opts);
opts->service_comm = CRIU_COMM_BIN;
if (path) { if (path) {
opts->service_binary = strdup(path); opts->service_binary = strdup(path);
} else { } else {
......
...@@ -45,12 +45,6 @@ int criu_set_service_address(const char *path); ...@@ -45,12 +45,6 @@ int criu_set_service_address(const char *path);
void criu_set_service_fd(int fd); void criu_set_service_fd(int fd);
int criu_set_service_binary(const char *path); int criu_set_service_binary(const char *path);
/*
* You can choose if you want libcriu to connect to service socket
* by itself, use provided file descriptor or spawn swrk by itself
*/
void criu_set_service_comm(enum criu_service_comm);
/* /*
* Set opts to defaults. _Must_ be called first before using any functions from * Set opts to defaults. _Must_ be called first before using any functions from
* the list down below. 0 on success, -1 on fail. * the list down below. 0 on success, -1 on fail.
...@@ -165,7 +159,6 @@ void criu_local_free_opts(criu_opts *opts); ...@@ -165,7 +159,6 @@ void criu_local_free_opts(criu_opts *opts);
int criu_local_set_service_address(criu_opts *opts, const char *path); int criu_local_set_service_address(criu_opts *opts, const char *path);
void criu_local_set_service_fd(criu_opts *opts, int fd); void criu_local_set_service_fd(criu_opts *opts, int fd);
void criu_local_set_service_comm(criu_opts *opts, enum criu_service_comm);
void criu_local_set_service_fd(criu_opts *opts, int fd); void criu_local_set_service_fd(criu_opts *opts, int fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment