chan_user.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
  4. */
  5. #ifndef __CHAN_USER_H__
  6. #define __CHAN_USER_H__
  7. #include <init.h>
  8. #include <linux/types.h>
  9. struct chan_opts {
  10. void (*const announce)(char *dev_name, int dev);
  11. char *xterm_title;
  12. int raw;
  13. };
  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, __u8 *, void *);
  20. int (*write)(int, const __u8 *, size_t, 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, __u8 *c_out, void *unused);
  30. extern int generic_write(int fd, const __u8 *buf, size_t 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_port;
  36. extern void register_winch(int fd, struct tty_port *port);
  37. extern void register_winch_irq(int fd, int tty_fd, int pid,
  38. struct tty_port *port, 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