[CRIU] [PATCH v5 03/11] sk-queue: Allow to dump a skb sender
Pavel Emelyanov
xemul at virtuozzo.com
Tue Jun 28 05:21:38 PDT 2016
On 06/16/2016 04:53 PM, Kirill Tkhai wrote:
> Add a possibility to dump a packet sender using a method get_sender,
> passed by caller.
>
> v5: Delete USK_EMPTY_Q flag
>
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
> criu/include/sk-queue.h | 4 +++-
> criu/sk-queue.c | 42 ++++++++++++++++++++++++++++++++++--------
> criu/sk-unix.c | 2 +-
> 3 files changed, 38 insertions(+), 10 deletions(-)
>
> diff --git a/criu/include/sk-queue.h b/criu/include/sk-queue.h
> index e0a47af..5fd2e01 100644
> --- a/criu/include/sk-queue.h
> +++ b/criu/include/sk-queue.h
> @@ -1,8 +1,10 @@
> #ifndef __CR_SK_QUEUE_H__
> #define __CR_SK_QUEUE_H__
>
> +#define SK_NONAME_SENDER (~0ULL)
> +
> extern struct collect_image_info sk_queues_cinfo;
> -extern int dump_sk_queue(int sock_fd, int sock_id);
> +extern int dump_sk_queue(int sock_fd, int sock_id, u64 (*get_sender)(const char *, int));
> extern int restore_sk_queue(int fd, unsigned int peer_id);
>
> #endif /* __CR_SK_QUEUE_H__ */
> diff --git a/criu/sk-queue.c b/criu/sk-queue.c
> index 50854d7..ded9ca9 100644
> --- a/criu/sk-queue.c
> +++ b/criu/sk-queue.c
> @@ -59,12 +59,15 @@ struct collect_image_info sk_queues_cinfo = {
> .collect = collect_one_packet,
> };
>
> -int dump_sk_queue(int sock_fd, int sock_id)
> +/* Currently known the longest possible sender name thru all socket types */
> +#define MAX_MSG_NAME_LEN (sizeof (struct sockaddr_un))
> +
> +int dump_sk_queue(int sock_fd, int sock_id, u64 (*get_sender)(const char *, int))
Any reason why this is a function pointer, rather than bool dump_sender_ino ?
> {
> - SkPacketEntry pe = SK_PACKET_ENTRY__INIT;
> int ret, size, orig_peek_off;
> - void *data;
> + void *data, *mem;
> socklen_t tmp;
> + u64 next;
>
> /*
> * Save original peek offset.
More information about the CRIU
mailing list