summaryrefslogtreecommitdiff
path: root/kernel/power/tuxonice_netlink.h
blob: 89e15459994790e8996d2ae9d458e7f716637dc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * kernel/power/tuxonice_netlink.h
 *
 * Copyright (C) 2004-2015 Nigel Cunningham (nigel at nigelcunningham com au)
 *
 * This file is released under the GPLv2.
 *
 * Declarations for functions for communicating with a userspace helper
 * via netlink.
 */

#include <linux/netlink.h>
#include <net/sock.h>

#define NETLINK_MSG_BASE 0x10

#define NETLINK_MSG_READY 0x10
#define	NETLINK_MSG_NOFREEZE_ME 0x16
#define NETLINK_MSG_GET_DEBUGGING 0x19
#define NETLINK_MSG_CLEANUP 0x24
#define NETLINK_MSG_NOFREEZE_ACK 0x27
#define NETLINK_MSG_IS_DEBUGGING 0x28

struct user_helper_data {
	int (*rcv_msg) (struct sk_buff *skb, struct nlmsghdr *nlh);
	void (*not_ready) (void);
	struct sock *nl;
	u32 sock_seq;
	pid_t pid;
	char *comm;
	char program[256];
	int pool_level;
	int pool_limit;
	struct sk_buff *emerg_skbs;
	int skb_size;
	int netlink_id;
	char *name;
	struct user_helper_data *next;
	struct completion wait_for_process;
	u32 interface_version;
	int must_init;
	int debug;
};

#ifdef CONFIG_NET
int toi_netlink_setup(struct user_helper_data *uhd);
void toi_netlink_close(struct user_helper_data *uhd);
void toi_send_netlink_message(struct user_helper_data *uhd,
		int type, void *params, size_t len);
void toi_netlink_close_complete(struct user_helper_data *uhd);
#else
static inline int toi_netlink_setup(struct user_helper_data *uhd)
{
	return 0;
}

static inline void toi_netlink_close(struct user_helper_data *uhd) { };
static inline void toi_send_netlink_message(struct user_helper_data *uhd,
		int type, void *params, size_t len) { };
static inline void toi_netlink_close_complete(struct user_helper_data *uhd)
	{ };
#endif