mconsole.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
  3. * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
  4. * Licensed under the GPL
  5. */
  6. #ifndef __MCONSOLE_H__
  7. #define __MCONSOLE_H__
  8. #ifndef __KERNEL__
  9. #include <stdint.h>
  10. #define u32 uint32_t
  11. #endif
  12. #define MCONSOLE_MAGIC (0xcafebabe)
  13. #define MCONSOLE_MAX_DATA (512)
  14. #define MCONSOLE_VERSION 2
  15. struct mconsole_request {
  16. u32 magic;
  17. u32 version;
  18. u32 len;
  19. char data[MCONSOLE_MAX_DATA];
  20. };
  21. struct mconsole_reply {
  22. u32 err;
  23. u32 more;
  24. u32 len;
  25. char data[MCONSOLE_MAX_DATA];
  26. };
  27. struct mconsole_notify {
  28. u32 magic;
  29. u32 version;
  30. enum { MCONSOLE_SOCKET, MCONSOLE_PANIC, MCONSOLE_HANG,
  31. MCONSOLE_USER_NOTIFY } type;
  32. u32 len;
  33. char data[MCONSOLE_MAX_DATA];
  34. };
  35. struct mc_request;
  36. enum mc_context { MCONSOLE_INTR, MCONSOLE_PROC };
  37. struct mconsole_command
  38. {
  39. char *command;
  40. void (*handler)(struct mc_request *req);
  41. enum mc_context context;
  42. };
  43. struct mc_request
  44. {
  45. int len;
  46. int as_interrupt;
  47. int originating_fd;
  48. unsigned int originlen;
  49. unsigned char origin[128]; /* sockaddr_un */
  50. struct mconsole_request request;
  51. struct mconsole_command *cmd;
  52. };
  53. extern char mconsole_socket_name[];
  54. extern int mconsole_unlink_socket(void);
  55. extern int mconsole_reply(struct mc_request *req, char *reply, int err,
  56. int more);
  57. extern void mconsole_version(struct mc_request *req);
  58. extern void mconsole_help(struct mc_request *req);
  59. extern void mconsole_halt(struct mc_request *req);
  60. extern void mconsole_reboot(struct mc_request *req);
  61. extern void mconsole_config(struct mc_request *req);
  62. extern void mconsole_remove(struct mc_request *req);
  63. extern void mconsole_sysrq(struct mc_request *req);
  64. extern void mconsole_cad(struct mc_request *req);
  65. extern void mconsole_stop(struct mc_request *req);
  66. extern void mconsole_go(struct mc_request *req);
  67. extern void mconsole_log(struct mc_request *req);
  68. extern void mconsole_proc(struct mc_request *req);
  69. extern int mconsole_get_request(int fd, struct mc_request *req);
  70. extern int mconsole_notify(char *sock_name, int type, const void *data,
  71. int len);
  72. extern char *mconsole_notify_socket(void);
  73. extern void lock_notify(void);
  74. extern void unlock_notify(void);
  75. #endif
  76. /*
  77. * Overrides for Emacs so that we follow Linus's tabbing style.
  78. * Emacs will notice this stuff at the end of the file and automatically
  79. * adjust the settings for this buffer only. This must remain at the end
  80. * of the file.
  81. * ---------------------------------------------------------------------------
  82. * Local variables:
  83. * c-file-style: "linux"
  84. * End:
  85. */