tuxonice_netlink.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * kernel/power/tuxonice_netlink.h
  3. *
  4. * Copyright (C) 2004-2014 Nigel Cunningham (nigel at tuxonice net)
  5. *
  6. * This file is released under the GPLv2.
  7. *
  8. * Declarations for functions for communicating with a userspace helper
  9. * via netlink.
  10. */
  11. #include <linux/netlink.h>
  12. #include <net/sock.h>
  13. #define NETLINK_MSG_BASE 0x10
  14. #define NETLINK_MSG_READY 0x10
  15. #define NETLINK_MSG_NOFREEZE_ME 0x16
  16. #define NETLINK_MSG_GET_DEBUGGING 0x19
  17. #define NETLINK_MSG_CLEANUP 0x24
  18. #define NETLINK_MSG_NOFREEZE_ACK 0x27
  19. #define NETLINK_MSG_IS_DEBUGGING 0x28
  20. struct user_helper_data {
  21. int (*rcv_msg)(struct sk_buff *skb, struct nlmsghdr *nlh);
  22. void (*not_ready)(void);
  23. struct sock *nl;
  24. u32 sock_seq;
  25. pid_t pid;
  26. char *comm;
  27. char program[256];
  28. int pool_level;
  29. int pool_limit;
  30. struct sk_buff *emerg_skbs;
  31. int skb_size;
  32. int netlink_id;
  33. char *name;
  34. struct user_helper_data *next;
  35. struct completion wait_for_process;
  36. u32 interface_version;
  37. int must_init;
  38. int debug;
  39. };
  40. #ifdef CONFIG_NET
  41. int toi_netlink_setup(struct user_helper_data *uhd);
  42. void toi_netlink_close(struct user_helper_data *uhd);
  43. void toi_send_netlink_message(struct user_helper_data *uhd,
  44. int type, void *params, size_t len);
  45. void toi_netlink_close_complete(struct user_helper_data *uhd);
  46. #else
  47. static inline int toi_netlink_setup(struct user_helper_data *uhd)
  48. {
  49. return 0;
  50. }
  51. static inline void toi_netlink_close(struct user_helper_data *uhd) { };
  52. static inline void toi_send_netlink_message(struct user_helper_data *uhd,
  53. int type, void *params, size_t len) { };
  54. static inline void toi_netlink_close_complete(struct user_helper_data *uhd)
  55. { };
  56. #endif