sclp_rw.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * interface to the SCLP-read/write driver
  4. *
  5. * Copyright IBM Corporation 1999, 2009
  6. *
  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. struct mto mto;
  44. } __attribute__((packed));
  45. struct msg_buf {
  46. struct evbuf_header header;
  47. struct mdb mdb;
  48. } __attribute__((packed));
  49. /* The number of empty mto buffers that can be contained in a single sccb. */
  50. #define NR_EMPTY_MSG_PER_SCCB ((PAGE_SIZE - sizeof(struct sclp_buffer) - \
  51. sizeof(struct sccb_header)) / sizeof(struct msg_buf))
  52. /*
  53. * data structure for information about list of SCCBs (only for writing),
  54. * will be located at the end of a SCCBs page
  55. */
  56. struct sclp_buffer {
  57. struct list_head list; /* list_head for sccb_info chain */
  58. struct sclp_req request;
  59. void *sccb;
  60. struct msg_buf *current_msg;
  61. char *current_line;
  62. int current_length;
  63. int retry_count;
  64. /* output format settings */
  65. unsigned short columns;
  66. unsigned short htab;
  67. /* statistics about this buffer */
  68. unsigned int char_sum; /* # chars in sccb */
  69. unsigned int messages; /* # messages in sccb */
  70. /* Callback that is called after reaching final status. */
  71. void (*callback)(struct sclp_buffer *, int);
  72. };
  73. int sclp_rw_init(void);
  74. struct sclp_buffer *sclp_make_buffer(void *, unsigned short, unsigned short);
  75. void *sclp_unmake_buffer(struct sclp_buffer *);
  76. int sclp_buffer_space(struct sclp_buffer *);
  77. int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int);
  78. int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int));
  79. unsigned int sclp_chars_in_buffer(struct sclp_buffer *);
  80. #endif /* __SCLP_RW_H__ */