mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-03 15:55:53 +00:00
sk-queue: Use sk_packet_entry as a reference
Need for PB transition. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
65570d9559
commit
a8c2bd0c5d
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
struct sk_packet {
|
struct sk_packet {
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
struct sk_packet_entry entry;
|
struct sk_packet_entry *entry;
|
||||||
off_t img_off;
|
off_t img_off;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
13
sk-queue.c
13
sk-queue.c
@@ -33,12 +33,16 @@ int read_sk_queues(void)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
ret = -1;
|
||||||
pkt = xmalloc(sizeof(*pkt));
|
pkt = xmalloc(sizeof(*pkt));
|
||||||
if (!pkt) {
|
if (!pkt) {
|
||||||
pr_err("Failed to allocate packet header\n");
|
pr_err("Failed to allocate packet header\n");
|
||||||
return -ENOMEM;
|
break;
|
||||||
}
|
}
|
||||||
ret = read_img_eof(fd, &pkt->entry);
|
pkt->entry = xmalloc(sizeof(*pkt->entry));
|
||||||
|
if (!pkt->entry)
|
||||||
|
break;
|
||||||
|
ret = read_img_eof(fd, pkt->entry);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -48,9 +52,10 @@ int read_sk_queues(void)
|
|||||||
* will be broken.
|
* will be broken.
|
||||||
*/
|
*/
|
||||||
list_add_tail(&pkt->list, &packets_list);
|
list_add_tail(&pkt->list, &packets_list);
|
||||||
lseek(fd, pkt->entry.length, SEEK_CUR);
|
lseek(fd, pkt->entry->length, SEEK_CUR);
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
xfree(pkt ? pkt->entry : NULL);
|
||||||
xfree(pkt);
|
xfree(pkt);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -191,7 +196,7 @@ int restore_sk_queue(int fd, unsigned int peer_id)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
list_for_each_entry_safe(pkt, tmp, &packets_list, list) {
|
list_for_each_entry_safe(pkt, tmp, &packets_list, list) {
|
||||||
struct sk_packet_entry *entry = &pkt->entry;
|
struct sk_packet_entry *entry = pkt->entry;
|
||||||
|
|
||||||
if (entry->id_for != peer_id)
|
if (entry->id_for != peer_id)
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user