1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000 Silicon Graphics, Inc.
7 * Define io syscalls supported by doio
17 #define LREAD 10 /* listio - single stride, single entry */
21 #define LSREAD 14 /* listio - multi-stride, single entry */
25 #define LEREAD 18 /* listio - single stride, multiple entry */
43 #define RESVSP 122 /* xfsctl(XFS_IOC_RESVSP) */
44 #define UNRESVSP 123 /* xfsctl(XFS_IOC_UNRESVSP) */
45 #define FSYNC2 125 /* fsync(2) */
46 #define FDATASYNC 126 /* fdatasync(2) */
47 #define DOIO_MAGIC 07116601
50 * Define various user flags (r_uflag field) that io requests can have
54 #define F_WORD_ALIGNED 0001 /* force request to be word aligned */
57 * define various doio exit status's
60 #define E_NORMAL 000 /* normal completion */
61 #define E_USAGE 001 /* cmdline usage error */
62 #define E_SETUP 002 /* any of a million setup conditions */
63 #define E_COMPARE 004 /* data compare error from doio child */
64 #define E_INTERNAL 010 /* various internal errors */
65 #define E_LOCKD 020 /* lockd startup/timeout errors */
66 #define E_SIGNAL 040 /* killed by signal */
69 * Define async io completion strategies supported by doio.
72 #define A_POLL 1 /* poll iosw for completion */
73 #define A_SIGNAL 2 /* get signal for completion */
74 #define A_RECALL 3 /* use recall(2) to wait */
75 #define A_RECALLA 4 /* use recalla(2) to wait */
76 #define A_RECALLS 5 /* use recalls(2) to wait */
77 #define A_SUSPEND 6 /* use aio_suspend(2) to wait */
78 #define A_CALLBACK 7 /* use a callback signal op. */
81 * Define individual structures for each syscall type. These will all be
82 * unionized into a single io_req structure which io generators fill in and
85 * Note: It is VERY important that the r_file, r_oflags, r_offset, and
86 * r_nbytes fields occupy the same record positions in the
87 * read_req, reada_req, write_req, and writea_req structures and
88 * that they have the same type. It is also that r_pattern
89 * has the same type/offset in the write_req and writea_req
92 * Since doio.c accesses all information through the r_data
93 * union in io_req, if the above assumptions hold, the above
94 * fields can be accessed without regard to structure type.
95 * This is an allowed assumption in C.
98 #define MAX_FNAME_LENGTH 128
101 char r_file[MAX_FNAME_LENGTH];
102 int r_oflags; /* open flags */
105 int r_uflags; /* user flags: mem alignment */
106 int r_aio_strat; /* asynch read completion strategy */
107 int r_nstrides; /* listio: multiple strides */
108 int r_nent; /* listio: multiple list entries */
112 char r_file[MAX_FNAME_LENGTH];
117 int r_uflags; /* user flags: mem alignment */
118 int r_aio_strat; /* asynch write completion strategy */
119 int r_nstrides; /* listio: multiple strides */
120 int r_nent; /* listio: multiple list entries */
133 char r_file[MAX_FNAME_LENGTH];
134 int r_cmd; /* LC_START or LC_WAIT */
135 int r_offset; /* file offset */
136 int r_opcode; /* LO_READ, or LO_WRITE */
137 int r_nbytes; /* bytes per stride */
138 int r_nstrides; /* how many strides to make */
139 int r_nent; /* how many listreq entries to make */
140 int r_filestride; /* always 0 for now */
141 int r_memstride; /* always 0 for now */
142 char r_pattern; /* for LO_WRITE operations */
143 int r_oflags; /* open(2) flags */
144 int r_aio_strat; /* async I/O completion strategy */
145 int r_uflags; /* user flags: memory alignment */
148 #define rw_req listio_req /* listio is superset of everything */
151 * Main structure for sending a request to doio. Any tools which form IO
152 * for doio must present it using one of these structures.
156 int r_type; /* must be one of the #defines above */
157 int r_magic; /* must be set to DOIO_MAGIC by requestor */
159 struct read_req read;
160 struct write_req write;
161 struct ssread_req ssread;
162 struct sswrite_req sswrite;
163 struct listio_req listio;