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. const unsigned long tramp_stack;
  13. const int in_kernel;
  14. };
  15. enum chan_init_pri { INIT_STATIC, INIT_ALL, INIT_ONE };
  16. struct chan_ops {
  17. char *type;
  18. void *(*init)(char *, int, const struct chan_opts *);
  19. int (*open)(int, int, int, void *, char **);
  20. void (*close)(int, void *);
  21. int (*read)(int, char *, void *);
  22. int (*write)(int, const char *, int, void *);
  23. int (*console_write)(int, const char *, int);
  24. int (*window_size)(int, void *, unsigned short *, unsigned short *);
  25. void (*free)(void *);
  26. int winch;
  27. };
  28. extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
  29. tty_ops, xterm_ops;
  30. extern void generic_close(int fd, void *unused);
  31. extern int generic_read(int fd, char *c_out, void *unused);
  32. extern int generic_write(int fd, const char *buf, int n, void *unused);
  33. extern int generic_console_write(int fd, const char *buf, int n);
  34. extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
  35. unsigned short *cols_out);
  36. extern void generic_free(void *data);
  37. struct tty_struct;
  38. extern void register_winch(int fd, struct tty_struct *tty);
  39. extern void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty);
  40. #define __channel_help(fn, prefix) \
  41. __uml_help(fn, prefix "[0-9]*=<channel description>\n" \
  42. " Attach a console or serial line to a host channel. See\n" \
  43. " http://user-mode-linux.sourceforge.net/input.html for a complete\n" \
  44. " description of this switch.\n\n" \
  45. );
  46. #endif