From a1e7407397d7a66bf4df9e77a90527295ad950fc Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 18 Dec 2013 01:04:39 +0400 Subject: [PATCH] service: move constants to cr-service-const.h Such constants as CR_MAX_MSG_SIZE and CR_DEFAULT_SERVICE_ADDRESS are need to be used in both service and lib. Signed-off-by: Ruslan Kuprieiev Signed-off-by: Pavel Emelyanov --- cr-service.c | 7 ++++--- include/cr-service-const.h | 7 +++++++ include/cr-service.h | 3 --- 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 include/cr-service-const.h diff --git a/cr-service.c b/cr-service.c index 2c1a9f0de..f1dbddb74 100644 --- a/cr-service.c +++ b/cr-service.c @@ -19,16 +19,17 @@ #include "log.h" #include "pstree.h" #include "cr-service.h" +#include "cr-service-const.h" #include "sd-daemon.h" unsigned int service_sk_ino = -1; static int recv_criu_msg(int socket_fd, CriuReq **msg) { - unsigned char buf[MAX_MSG_SIZE]; + unsigned char buf[CR_MAX_MSG_SIZE]; int len; - len = read(socket_fd, buf, MAX_MSG_SIZE); + len = read(socket_fd, buf, CR_MAX_MSG_SIZE); if (len == -1) { pr_perror("Can't read request"); return -1; @@ -45,7 +46,7 @@ static int recv_criu_msg(int socket_fd, CriuReq **msg) static int send_criu_msg(int socket_fd, CriuResp *msg) { - unsigned char buf[MAX_MSG_SIZE]; + unsigned char buf[CR_MAX_MSG_SIZE]; int len; len = criu_resp__get_packed_size(msg); diff --git a/include/cr-service-const.h b/include/cr-service-const.h new file mode 100644 index 000000000..668882b54 --- /dev/null +++ b/include/cr-service-const.h @@ -0,0 +1,7 @@ +#ifndef __CR_SERVICE_CONST_H__ +#define __CR_SERVICE_CONST_H__ + +#define CR_MAX_MSG_SIZE 1024 +#define CR_DEFAULT_SERVICE_ADDRESS "/var/run/criu_service.socket" + +#endif /* __CR_SERVICE_CONST_H__ */ diff --git a/include/cr-service.h b/include/cr-service.h index 5c38ac303..e9e825568 100644 --- a/include/cr-service.h +++ b/include/cr-service.h @@ -3,9 +3,6 @@ #include "protobuf/rpc.pb-c.h" -#define CR_DEFAULT_SERVICE_ADDRESS "/var/run/criu_service.socket" -#define MAX_MSG_SIZE 1024 - extern int cr_service(bool deamon_mode); extern int send_criu_dump_resp(int socket_fd, bool success, bool restored);