chan_user.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef __CHAN_USER_H__
  6. #define __CHAN_USER_H__
  7. #include "init.h"
  8. struct chan_opts {
  9. void (*const announce)(char *dev_name, int dev);
  10. char *xterm_title;
  11. const int raw;
  12. };
  13. enum chan_init_pri { INIT_STATIC, INIT_ALL, INIT_ONE };
  14. struct chan_ops {
  15. char *type;
  16. void *(*init)(char *, int, const struct chan_opts *);
  17. int (*open)(int, int, int, void *, char **);
  18. void (*close)(int, void *);
  19. int (*read)(int, char *, void *);
  20. int (*write)(int, const char *, int, void *);
  21. int (*console_write)(int, const char *, int);
  22. int (*window_size)(int, void *, unsigned short *, unsigned short *);
  23. void (*free)(void *);
  24. int winch;
  25. };
  26. extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
  27. tty_ops, xterm_ops;
  28. extern void generic_close(int fd, void *unused);
  29. extern int generic_read(int fd, char *c_out, void *unused);
  30. extern int generic_write(int fd, const char *buf, int n, void *unused);
  31. extern int generic_console_write(int fd, const char *buf, int n);
  32. extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
  33. unsigned short *cols_out);
  34. extern void generic_free(void *data);
  35. struct tty_struct;
  36. extern void register_winch(int fd, struct tty_struct *tty);
  37. extern void register_winch_irq(int fd, int tty_fd, int pid,
  38. struct tty_struct *tty, unsigned long stack);
  39. #define __channel_help(fn, prefix) \
  40. __uml_help(fn, prefix "[0-9]*=<channel description>\n" \
  41. " Attach a console or serial line to a host channel. See\n" \
  42. " http://user-mode-linux.sourceforge.net/old/input.html for a complete\n" \
  43. " description of this switch.\n\n" \
  44. );
  45. #endif