[CRIU] [PATCH 1/4] soccr: Rename API calls to save/restore

Pavel Emelyanov xemul at virtuozzo.com
Wed Dec 14 01:40:58 PST 2016


Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/sk-tcp.c |  6 +++---
 soccr/soccr.c |  4 ++--
 soccr/soccr.h | 10 ++++------
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
index 210dc30..c20f9bc 100644
--- a/criu/sk-tcp.c
+++ b/criu/sk-tcp.c
@@ -123,7 +123,7 @@ static int dump_tcp_conn_state(struct inet_sk_desc *sk)
 	char *buf;
 	struct libsoccr_sk_data data;
 
-	ret = libsoccr_get_sk_data(socr, &data, sizeof(data));
+	ret = libsoccr_save(socr, &data, sizeof(data));
 	if (ret < 0)
 		goto err_r;
 	if (ret != sizeof(data)) {
@@ -350,7 +350,7 @@ static int restore_tcp_conn_state(int sk, struct libsoccr_sk *socr, struct inet_
 		goto err_c;
 
 	/*
-	 * O_NONBLOCK has to be set before libsoccr_set_sk_data_noq(),
+	 * O_NONBLOCK has to be set before libsoccr_restore(),
 	 * it is required to restore syn-sent sockets.
 	 */
 	if (restore_prepare_socket(sk))
@@ -359,7 +359,7 @@ static int restore_tcp_conn_state(int sk, struct libsoccr_sk *socr, struct inet_
 	if (read_tcp_queues(socr, &data, img))
 		goto err_c;
 
-	if (libsoccr_set_sk_data(socr, &data, sizeof(data)))
+	if (libsoccr_restore(socr, &data, sizeof(data)))
 		goto err_c;
 
 	if (tse->has_nodelay && tse->nodelay) {
diff --git a/soccr/soccr.c b/soccr/soccr.c
index 30a2ff8..fc5e280 100644
--- a/soccr/soccr.c
+++ b/soccr/soccr.c
@@ -327,7 +327,7 @@ err_recv:
  */
 #define SOCR_DATA_MIN_SIZE	(17 * sizeof(__u32))
 
-int libsoccr_get_sk_data(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsigned data_size)
+int libsoccr_save(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsigned data_size)
 {
 	struct tcp_info ti;
 
@@ -622,7 +622,7 @@ static int restore_fin_in_snd_queue(int sk, int acked)
 static int libsoccr_set_queue_bytes(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsigned data_size,
 		int queue, char *buf);
 
-int libsoccr_set_sk_data(struct libsoccr_sk *sk,
+int libsoccr_restore(struct libsoccr_sk *sk,
 		struct libsoccr_sk_data *data, unsigned data_size)
 {
 	int mstate = 1 << data->state;
diff --git a/soccr/soccr.h b/soccr/soccr.h
index 8c752af..3ab7b90 100644
--- a/soccr/soccr.h
+++ b/soccr/soccr.h
@@ -136,7 +136,7 @@ void libsoccr_resume(struct libsoccr_sk *sk);
  * Roughly the checkpoint steps for sockets in supported states are
  *
  * 	h = libsoccr_pause(sk);
- * 	libsoccr_get_sk_data(h, &data, sizeof(data))
+ * 	libsoccr_save(h, &data, sizeof(data))
  * 	inq = libsoccr_get_queue_bytes(h, TCP_RECV_QUEUE, 0)
  * 	outq = libsoccr_get_queue_bytes(h, TCP_SEND_QUEUE, 0)
  * 	getsocname(sk, &name, ...)
@@ -157,7 +157,7 @@ void libsoccr_resume(struct libsoccr_sk *sk);
  * data_size shows the size of a buffer. The returned value is the
  * amount of bytes put into data (the rest is zeroed with memcpy).
  */
-int libsoccr_get_sk_data(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsigned data_size);
+int libsoccr_save(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsigned data_size);
 
 /*
  * Get a pointer on the contents of queues. The amount of bytes is
@@ -184,9 +184,7 @@ char *libsoccr_get_queue_bytes(struct libsoccr_sk *sk, int queue_id, int steal);
  * 	sk = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
  *
  * 	h = libsoccr_pause(sk)
- * 	bind(sk, &name, ...)
- *
- * 	libsoccr_set_sk_data(h, &data, sizeof(data))
+ * 	libsoccr_restore(h, &data, sizeof(data))
  *
  * 	libsoccr_resume(h)
  *
@@ -197,6 +195,6 @@ char *libsoccr_get_queue_bytes(struct libsoccr_sk *sk, int queue_id, int steal);
 /*
  * Performs restore actions on bind()-ed socket
  */
-int libsoccr_set_sk_data(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsigned data_size);
+int libsoccr_restore(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsigned data_size);
 
 #endif
-- 
2.5.0



More information about the CRIU mailing list