sclp_rw.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * drivers/s390/char/sclp_rw.h
  3. * interface to the SCLP-read/write driver
  4. *
  5. * S390 version
  6. * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
  7. * Author(s): Martin Peschke <mpeschke@de.ibm.com>
  8. * Martin Schwidefsky <schwidefsky@de.ibm.com>
  9. */
  10. #ifndef __SCLP_RW_H__
  11. #define __SCLP_RW_H__
  12. #include <linux/list.h>
  13. struct mto {
  14. u16 length;
  15. u16 type;
  16. u16 line_type_flags;
  17. u8 alarm_control;
  18. u8 _reserved[3];
  19. } __attribute__((packed));
  20. struct go {
  21. u16 length;
  22. u16 type;
  23. u32 domid;
  24. u8 hhmmss_time[8];
  25. u8 th_time[3];
  26. u8 reserved_0;
  27. u8 dddyyyy_date[7];
  28. u8 _reserved_1;
  29. u16 general_msg_flags;
  30. u8 _reserved_2[10];
  31. u8 originating_system_name[8];
  32. u8 job_guest_name[8];
  33. } __attribute__((packed));
  34. struct mdb_header {
  35. u16 length;
  36. u16 type;
  37. u32 tag;
  38. u32 revision_code;
  39. } __attribute__((packed));
  40. struct mdb {
  41. struct mdb_header header;
  42. struct go go;
  43. } __attribute__((packed));
  44. struct msg_buf {
  45. struct evbuf_header header;
  46. struct mdb mdb;
  47. } __attribute__((packed));
  48. struct write_sccb {
  49. struct sccb_header header;
  50. struct msg_buf msg_buf;
  51. } __attribute__((packed));
  52. /* The number of empty mto buffers that can be contained in a single sccb. */
  53. #define NR_EMPTY_MTO_PER_SCCB ((PAGE_SIZE - sizeof(struct sclp_buffer) - \
  54. sizeof(struct write_sccb)) / sizeof(struct mto))
  55. /*
  56. * data structure for information about list of SCCBs (only for writing),
  57. * will be located at the end of a SCCBs page
  58. */
  59. struct sclp_buffer {
  60. struct list_head list; /* list_head for sccb_info chain */
  61. struct sclp_req request;
  62. struct write_sccb *sccb;
  63. char *current_line;
  64. int current_length;
  65. int retry_count;
  66. /* output format settings */
  67. unsigned short columns;
  68. unsigned short htab;
  69. /* statistics about this buffer */
  70. unsigned int mto_char_sum; /* # chars in sccb */
  71. unsigned int mto_number; /* # mtos in sccb */
  72. /* Callback that is called after reaching final status. */
  73. void (*callback)(struct sclp_buffer *, int);
  74. };
  75. int sclp_rw_init(void);
  76. struct sclp_buffer *sclp_make_buffer(void *, unsigned short, unsigned short);
  77. void *sclp_unmake_buffer(struct sclp_buffer *);
  78. int sclp_buffer_space(struct sclp_buffer *);
  79. int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int);
  80. int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int));
  81. void sclp_set_columns(struct sclp_buffer *, unsigned short);
  82. void sclp_set_htab(struct sclp_buffer *, unsigned short);
  83. int sclp_chars_in_buffer(struct sclp_buffer *);
  84. #endif /* __SCLP_RW_H__ */