[CRIU] [PATCH 3/5] service: move constants to cr-service-const.h

Ruslan Kuprieiev kupruser at gmail.com
Tue Dec 10 10:11:42 PST 2013


Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 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 a82ef9e..14af29f 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -18,16 +18,17 @@
 #include "util.h"
 #include "log.h"
 #include "pstree.h"
+#include "cr-service-const.h"
 #include "cr-service.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;
@@ -44,7 +45,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 0000000..668882b
--- /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 5c38ac3..e9e8255 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);
-- 
1.8.3.2



More information about the CRIU mailing list