mconsole_kern.h 968 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
  4. */
  5. #ifndef __MCONSOLE_KERN_H__
  6. #define __MCONSOLE_KERN_H__
  7. #include <linux/list.h>
  8. #include "mconsole.h"
  9. struct mconsole_entry {
  10. struct list_head list;
  11. struct mc_request request;
  12. };
  13. /* All these methods are called in process context. */
  14. struct mc_device {
  15. struct list_head list;
  16. char *name;
  17. int (*config)(char *, char **);
  18. int (*get_config)(char *, char *, int, char **);
  19. int (*id)(char **, int *, int *);
  20. int (*remove)(int, char **);
  21. };
  22. #define CONFIG_CHUNK(str, size, current, chunk, end) \
  23. do { \
  24. current += strlen(chunk); \
  25. if(current >= size) \
  26. str = NULL; \
  27. if(str != NULL){ \
  28. strcpy(str, chunk); \
  29. str += strlen(chunk); \
  30. } \
  31. if(end) \
  32. current++; \
  33. } while(0)
  34. #ifdef CONFIG_MCONSOLE
  35. extern void mconsole_register_dev(struct mc_device *new);
  36. #else
  37. static inline void mconsole_register_dev(struct mc_device *new)
  38. {
  39. }
  40. #endif
  41. #endif