mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
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: Martin Wührer <martin.wuehrer@artech.at>
This commit is contained in:
parent
29af538da7
commit
9ede9253f5
2 changed files with 3 additions and 17 deletions
13
lib/c/criu.c
13
lib/c/criu.c
|
|
@ -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)
|
||||
{
|
||||
criu_free_service(opts);
|
||||
opts->service_comm = CRIU_COMM_SK;
|
||||
if (path) {
|
||||
opts->service_address = strdup(path);
|
||||
} else {
|
||||
|
|
@ -81,6 +72,7 @@ int criu_set_service_address(const char *path)
|
|||
void criu_local_set_service_fd(criu_opts *opts, int fd)
|
||||
{
|
||||
criu_free_service(opts);
|
||||
opts->service_comm = CRIU_COMM_FD;
|
||||
opts->service_fd = fd;
|
||||
}
|
||||
|
||||
|
|
@ -92,6 +84,7 @@ void criu_set_service_fd(int fd)
|
|||
int criu_local_set_service_binary(criu_opts *opts, const char *path)
|
||||
{
|
||||
criu_free_service(opts);
|
||||
opts->service_comm = CRIU_COMM_BIN;
|
||||
if (path) {
|
||||
opts->service_binary = strdup(path);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -45,12 +45,6 @@ int criu_set_service_address(const char *path);
|
|||
void criu_set_service_fd(int fd);
|
||||
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
|
||||
* the list down below. 0 on success, -1 on fail.
|
||||
|
|
@ -165,7 +159,6 @@ void criu_local_free_opts(criu_opts *opts);
|
|||
|
||||
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_comm(criu_opts *opts, enum criu_service_comm);
|
||||
|
||||
void criu_local_set_service_fd(criu_opts *opts, int fd);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue