Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * interface to the SCLP-read/write driver
0004  *
0005  * Copyright IBM Corporation 1999, 2009
0006  *
0007  * Author(s): Martin Peschke <mpeschke@de.ibm.com>
0008  *        Martin Schwidefsky <schwidefsky@de.ibm.com>
0009  */
0010 
0011 #ifndef __SCLP_RW_H__
0012 #define __SCLP_RW_H__
0013 
0014 #include <linux/list.h>
0015 
0016 struct mto {
0017     u16 length;
0018     u16 type;
0019     u16 line_type_flags;
0020     u8  alarm_control;
0021     u8  _reserved[3];
0022 } __attribute__((packed));
0023 
0024 struct go {
0025     u16 length;
0026     u16 type;
0027     u32 domid;
0028     u8  hhmmss_time[8];
0029     u8  th_time[3];
0030     u8  reserved_0;
0031     u8  dddyyyy_date[7];
0032     u8  _reserved_1;
0033     u16 general_msg_flags;
0034     u8  _reserved_2[10];
0035     u8  originating_system_name[8];
0036     u8  job_guest_name[8];
0037 } __attribute__((packed));
0038 
0039 struct mdb_header {
0040     u16 length;
0041     u16 type;
0042     u32 tag;
0043     u32 revision_code;
0044 } __attribute__((packed));
0045 
0046 struct mdb {
0047     struct mdb_header header;
0048     struct go go;
0049     struct mto mto;
0050 } __attribute__((packed));
0051 
0052 struct msg_buf {
0053     struct evbuf_header header;
0054     struct mdb mdb;
0055 } __attribute__((packed));
0056 
0057 /* The number of empty mto buffers that can be contained in a single sccb. */
0058 #define NR_EMPTY_MSG_PER_SCCB ((PAGE_SIZE - sizeof(struct sclp_buffer) - \
0059             sizeof(struct sccb_header)) / sizeof(struct msg_buf))
0060 
0061 /*
0062  * data structure for information about list of SCCBs (only for writing),
0063  * will be located at the end of a SCCBs page
0064  */
0065 struct sclp_buffer {
0066     struct list_head list;      /* list_head for sccb_info chain */
0067     struct sclp_req request;
0068     void *sccb;
0069     struct msg_buf *current_msg;
0070     char *current_line;
0071     int current_length;
0072     int retry_count;
0073     /* output format settings */
0074     unsigned short columns;
0075     unsigned short htab;
0076     /* statistics about this buffer */
0077     unsigned int char_sum;      /* # chars in sccb */
0078     unsigned int messages;      /* # messages in sccb */
0079     /* Callback that is called after reaching final status. */
0080     void (*callback)(struct sclp_buffer *, int);
0081 };
0082 
0083 int sclp_rw_init(void);
0084 struct sclp_buffer *sclp_make_buffer(void *, unsigned short, unsigned short);
0085 void *sclp_unmake_buffer(struct sclp_buffer *);
0086 int sclp_buffer_space(struct sclp_buffer *);
0087 int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int);
0088 int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int));
0089 unsigned int sclp_chars_in_buffer(struct sclp_buffer *);
0090 
0091 #endif  /* __SCLP_RW_H__ */