struct hlist_node;

struct hlist_node {
	struct hlist_node *        next;                 /*     0     8 */
	struct hlist_node * *      pprev;                /*     8     8 */

	/* size: 16, cachelines: 1 */
	/* last cacheline: 16 bytes */
};
typedef struct {
	int                        counter;              /*     0     4 */

	/* size: 4, cachelines: 1 */
	/* last cacheline: 4 bytes */
} atomic_t;
struct proto;

struct sock_common {
	short unsigned int         skc_family;           /*     0     2 */
	volatile unsigned char     skc_state;            /*     2     1 */
	unsigned char              skc_reuse;            /*     3     1 */
	int                        skc_bound_dev_if;     /*     4     4 */
	struct hlist_node          skc_node;             /*     8    16 */
	struct hlist_node          skc_bind_node;        /*    24    16 */
	atomic_t                   skc_refcnt;           /*    40     4 */
	unsigned int               skc_hash;             /*    44     4 */
	struct proto *             skc_prot;             /*    48     8 */

	/* size: 56, cachelines: 1 */
	/* last cacheline: 56 bytes */
};
typedef struct {
	unsigned int               slock;                /*     0     4 */

	/* size: 4, cachelines: 1 */
	/* last cacheline: 4 bytes */
} raw_spinlock_t;

typedef struct {
	raw_spinlock_t             raw_lock;             /*     0     4 */

	/* size: 4, cachelines: 1 */
	/* last cacheline: 4 bytes */
} spinlock_t;
struct sock_iocb;
struct list_head;

struct list_head {
	struct list_head *         next;                 /*     0     8 */
	struct list_head *         prev;                 /*     8     8 */

	/* size: 16, cachelines: 1 */
	/* last cacheline: 16 bytes */
};

struct __wait_queue_head {
	spinlock_t                 lock;                 /*     0     4 */

	/* XXX 4 bytes hole, try to pack */

	struct list_head           task_list;            /*     8    16 */

	/* size: 24, cachelines: 1 */
	/* sum members: 20, holes: 1, sum holes: 4 */
	/* last cacheline: 24 bytes */
};
typedef struct __wait_queue_head wait_queue_head_t;

typedef struct {
	spinlock_t                 slock;                /*     0     4 */

	/* XXX 4 bytes hole, try to pack */

	struct sock_iocb *         owner;                /*     8     8 */
	wait_queue_head_t          wq;                   /*    16    24 */

	/* size: 40, cachelines: 1 */
	/* sum members: 36, holes: 1, sum holes: 4 */
	/* last cacheline: 40 bytes */
} socket_lock_t;
struct sk_buff;

struct dst_entry;
struct xfrm_policy;
typedef struct {
	unsigned int               lock;                 /*     0     4 */

	/* size: 4, cachelines: 1 */
	/* last cacheline: 4 bytes */
} raw_rwlock_t;

typedef struct {
	raw_rwlock_t               raw_lock;             /*     0     4 */

	/* size: 4, cachelines: 1 */
	/* last cacheline: 4 bytes */
} rwlock_t;
typedef unsigned int __u32;

struct sk_buff_head {
	struct sk_buff *           next;                 /*     0     8 */
	struct sk_buff *           prev;                 /*     8     8 */
	__u32                      qlen;                 /*    16     4 */
	spinlock_t                 lock;                 /*    20     4 */

	/* size: 24, cachelines: 1 */
	/* last cacheline: 24 bytes */
};
typedef unsigned int gfp_t;
struct ucred {
	__u32                      pid;                  /*     0     4 */
	__u32                      uid;                  /*     4     4 */
	__u32                      gid;                  /*     8     4 */

	/* size: 12, cachelines: 1 */
	/* last cacheline: 12 bytes */
};
struct sk_filter;
struct tvec_t_base_s;

struct timer_list {
	struct list_head           entry;                /*     0    16 */
	long unsigned int          expires;              /*    16     8 */
	void                       (*function)(long unsigned int); /*    24     8 */
	long unsigned int          data;                 /*    32     8 */
	struct tvec_t_base_s *     base;                 /*    40     8 */
	void *                     start_site;           /*    48     8 */
	char                       start_comm[16];       /*    56    16 */
	/* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */
	int                        start_pid;            /*    72     4 */

	/* size: 80, cachelines: 2 */
	/* padding: 4 */
	/* last cacheline: 16 bytes */
};
typedef long long int s64;

union ktime {
	s64                        tv64;               /*           8 */
};
typedef union ktime ktime_t;
struct socket;
struct page;
struct sock;


struct sock {
	struct sock_common         __sk_common;          /*     0    56 */
	unsigned char              sk_shutdown:2;        /*    56     1 */
	unsigned char              sk_no_check:2;        /*    56     1 */
	unsigned char              sk_userlocks:4;       /*    56     1 */
	unsigned char              sk_protocol;          /*    57     1 */
	short unsigned int         sk_type;              /*    58     2 */
	int                        sk_rcvbuf;            /*    60     4 */
	/* --- cacheline 1 boundary (64 bytes) --- */
	socket_lock_t              sk_lock;              /*    64    40 */
	struct {
		struct sk_buff *   head;                 /*   104     8 */
		struct sk_buff *   tail;                 /*   112     8 */
	} sk_backlog;                                    /*   104    16 */
	wait_queue_head_t *        sk_sleep;             /*   120     8 */
	/* --- cacheline 2 boundary (128 bytes) --- */
	struct dst_entry *         sk_dst_cache;         /*   128     8 */
	struct xfrm_policy *       sk_policy[2];         /*   136    16 */
	rwlock_t                   sk_dst_lock;          /*   152     4 */
	atomic_t                   sk_rmem_alloc;        /*   156     4 */
	atomic_t                   sk_wmem_alloc;        /*   160     4 */
	atomic_t                   sk_omem_alloc;        /*   164     4 */
	int                        sk_sndbuf;            /*   168     4 */

	/* XXX 4 bytes hole, try to pack */

	struct sk_buff_head        sk_receive_queue;     /*   176    24 */
	/* --- cacheline 3 boundary (192 bytes) was 8 bytes ago --- */
	struct sk_buff_head        sk_write_queue;       /*   200    24 */
	struct sk_buff_head        sk_async_wait_queue;  /*   224    24 */
	int                        sk_wmem_queued;       /*   248     4 */
	int                        sk_forward_alloc;     /*   252     4 */
	/* --- cacheline 4 boundary (256 bytes) --- */
	gfp_t                      sk_allocation;        /*   256     4 */
	int                        sk_route_caps;        /*   260     4 */
	int                        sk_gso_type;          /*   264     4 */
	int                        sk_rcvlowat;          /*   268     4 */
	long unsigned int          sk_flags;             /*   272     8 */
	long unsigned int          sk_lingertime;        /*   280     8 */
	struct sk_buff_head        sk_error_queue;       /*   288    24 */
	struct proto *             sk_prot_creator;      /*   312     8 */
	/* --- cacheline 5 boundary (320 bytes) --- */
	rwlock_t                   sk_callback_lock;     /*   320     4 */
	int                        sk_err;               /*   324     4 */
	int                        sk_err_soft;          /*   328     4 */
	short unsigned int         sk_ack_backlog;       /*   332     2 */
	short unsigned int         sk_max_ack_backlog;   /*   334     2 */
	__u32                      sk_priority;          /*   336     4 */
	struct ucred               sk_peercred;          /*   340    12 */
	long int                   sk_rcvtimeo;          /*   352     8 */
	long int                   sk_sndtimeo;          /*   360     8 */
	struct sk_filter *         sk_filter;            /*   368     8 */
	void *                     sk_protinfo;          /*   376     8 */
	/* --- cacheline 6 boundary (384 bytes) --- */
	struct timer_list          sk_timer;             /*   384    80 */

	/* XXX last struct has 4 bytes of padding */

	/* --- cacheline 7 boundary (448 bytes) was 16 bytes ago --- */
	ktime_t                    sk_stamp;             /*   464     8 */
	struct socket *            sk_socket;            /*   472     8 */
	void *                     sk_user_data;         /*   480     8 */
	struct page *              sk_sndmsg_page;       /*   488     8 */
	struct sk_buff *           sk_send_head;         /*   496     8 */
	__u32                      sk_sndmsg_off;        /*   504     4 */
	int                        sk_write_pending;     /*   508     4 */
	/* --- cacheline 8 boundary (512 bytes) --- */
	void *                     sk_security;          /*   512     8 */
	void                       (*sk_state_change)(struct sock *); /*   520     8 */
	void                       (*sk_data_ready)(struct sock *, int); /*   528     8 */
	void                       (*sk_write_space)(struct sock *); /*   536     8 */
	void                       (*sk_error_report)(struct sock *); /*   544     8 */
	int                        (*sk_backlog_rcv)(struct sock *, struct sk_buff *); /*   552     8 */
	void                       (*sk_destruct)(struct sock *); /*   560     8 */

	/* size: 568, cachelines: 9 */
	/* sum members: 564, holes: 1, sum holes: 4 */
	/* paddings: 1, sum paddings: 4 */
	/* last cacheline: 56 bytes */
};

struct ctracer__mini_sock {
	unsigned char              sk_shutdown:2;        /*     0     1 */
	unsigned char              sk_no_check:2;        /*     0     1 */
	unsigned char              sk_userlocks:4;       /*     0     1 */
	unsigned char              sk_protocol;          /*     1     1 */
	short unsigned int         sk_type;              /*     2     2 */
	int                        sk_rcvbuf;            /*     4     4 */
	int                        sk_write_pending;     /*     8     4 */
	int                        sk_sndbuf;            /*    12     4 */
	long int                   sk_sndtimeo;          /*    16     8 */
	int                        sk_wmem_queued;       /*    24     4 */
	int                        sk_forward_alloc;     /*    28     4 */
	short unsigned int         sk_max_ack_backlog;   /*    32     2 */
	short unsigned int         sk_ack_backlog;       /*    34     2 */
	int                        sk_route_caps;        /*    36     4 */
	int                        sk_gso_type;          /*    40     4 */
	int                        sk_rcvlowat;          /*    44     4 */
	long unsigned int          sk_flags;             /*    48     8 */
	long unsigned int          sk_lingertime;        /*    56     8 */
	/* --- cacheline 1 boundary (64 bytes) --- */
	int                        sk_err_soft;          /*    64     4 */
	int                        sk_err;               /*    68     4 */
	long int                   sk_rcvtimeo;          /*    72     8 */

	/* size: 80, cachelines: 2 */
	/* last cacheline: 16 bytes */
};

void ctracer__class_state(const void *from, void *to)
{
	const struct sock *obj = from;
	struct ctracer__mini_sock *mini_obj = to;

	mini_obj->sk_shutdown        = obj->sk_shutdown;
	mini_obj->sk_no_check        = obj->sk_no_check;
	mini_obj->sk_userlocks       = obj->sk_userlocks;
	mini_obj->sk_protocol        = obj->sk_protocol;
	mini_obj->sk_type            = obj->sk_type;
	mini_obj->sk_rcvbuf          = obj->sk_rcvbuf;
	mini_obj->sk_write_pending   = obj->sk_write_pending;
	mini_obj->sk_sndbuf          = obj->sk_sndbuf;
	mini_obj->sk_sndtimeo        = obj->sk_sndtimeo;
	mini_obj->sk_wmem_queued     = obj->sk_wmem_queued;
	mini_obj->sk_forward_alloc   = obj->sk_forward_alloc;
	mini_obj->sk_max_ack_backlog = obj->sk_max_ack_backlog;
	mini_obj->sk_ack_backlog     = obj->sk_ack_backlog;
	mini_obj->sk_route_caps      = obj->sk_route_caps;
	mini_obj->sk_gso_type        = obj->sk_gso_type;
	mini_obj->sk_rcvlowat        = obj->sk_rcvlowat;
	mini_obj->sk_flags           = obj->sk_flags;
	mini_obj->sk_lingertime      = obj->sk_lingertime;
	mini_obj->sk_err_soft        = obj->sk_err_soft;
	mini_obj->sk_err             = obj->sk_err;
	mini_obj->sk_rcvtimeo        = obj->sk_rcvtimeo;
}

