mconsole_kern.h 955 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  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