debuggers.hg

view xen/include/public/io/fsif.h @ 19810:aaab04808ee7

Introduce mechanism to check standard conformance of headers

While pretty simplistic, it appears to serve the purpose at the moment
(i.e. it spotted two places where a GNU extension was used withou
proper preprocessor conditionals). The "simplistic" here includes that
the checking gets only done for native builds, and ia64 gets excluded
due to its arch-specific header intentionally (for whatever reason)
checking that anonymous struct/unions can be used.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jun 17 07:21:03 2009 +0100 (2009-06-17)
parents 2725f82a7dca
children
line source
1 /******************************************************************************
2 * fsif.h
3 *
4 * Interface to FS level split device drivers.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Copyright (c) 2007, Grzegorz Milos, <gm281@cam.ac.uk>.
25 */
27 #ifndef __XEN_PUBLIC_IO_FSIF_H__
28 #define __XEN_PUBLIC_IO_FSIF_H__
30 #include "ring.h"
31 #include "../grant_table.h"
33 #define REQ_FILE_OPEN 1
34 #define REQ_FILE_CLOSE 2
35 #define REQ_FILE_READ 3
36 #define REQ_FILE_WRITE 4
37 #define REQ_STAT 5
38 #define REQ_FILE_TRUNCATE 6
39 #define REQ_REMOVE 7
40 #define REQ_RENAME 8
41 #define REQ_CREATE 9
42 #define REQ_DIR_LIST 10
43 #define REQ_CHMOD 11
44 #define REQ_FS_SPACE 12
45 #define REQ_FILE_SYNC 13
47 struct fsif_open_request {
48 grant_ref_t gref;
49 };
51 struct fsif_close_request {
52 uint32_t fd;
53 };
55 struct fsif_read_request {
56 uint32_t fd;
57 int32_t pad;
58 uint64_t len;
59 uint64_t offset;
60 grant_ref_t grefs[1]; /* Variable length */
61 };
63 struct fsif_write_request {
64 uint32_t fd;
65 int32_t pad;
66 uint64_t len;
67 uint64_t offset;
68 grant_ref_t grefs[1]; /* Variable length */
69 };
71 struct fsif_stat_request {
72 uint32_t fd;
73 };
75 /* This structure is a copy of some fields from stat structure, returned
76 * via the ring. */
77 struct fsif_stat_response {
78 int32_t stat_mode;
79 uint32_t stat_uid;
80 uint32_t stat_gid;
81 int32_t stat_ret;
82 int64_t stat_size;
83 int64_t stat_atime;
84 int64_t stat_mtime;
85 int64_t stat_ctime;
86 };
88 struct fsif_truncate_request {
89 uint32_t fd;
90 int32_t pad;
91 int64_t length;
92 };
94 struct fsif_remove_request {
95 grant_ref_t gref;
96 };
98 struct fsif_rename_request {
99 uint16_t old_name_offset;
100 uint16_t new_name_offset;
101 grant_ref_t gref;
102 };
104 struct fsif_create_request {
105 int8_t directory;
106 int8_t pad;
107 int16_t pad2;
108 int32_t mode;
109 grant_ref_t gref;
110 };
112 struct fsif_list_request {
113 uint32_t offset;
114 grant_ref_t gref;
115 };
117 #define NR_FILES_SHIFT 0
118 #define NR_FILES_SIZE 16 /* 16 bits for the number of files mask */
119 #define NR_FILES_MASK (((1ULL << NR_FILES_SIZE) - 1) << NR_FILES_SHIFT)
120 #define ERROR_SIZE 32 /* 32 bits for the error mask */
121 #define ERROR_SHIFT (NR_FILES_SIZE + NR_FILES_SHIFT)
122 #define ERROR_MASK (((1ULL << ERROR_SIZE) - 1) << ERROR_SHIFT)
123 #define HAS_MORE_SHIFT (ERROR_SHIFT + ERROR_SIZE)
124 #define HAS_MORE_FLAG (1ULL << HAS_MORE_SHIFT)
126 struct fsif_chmod_request {
127 uint32_t fd;
128 int32_t mode;
129 };
131 struct fsif_space_request {
132 grant_ref_t gref;
133 };
135 struct fsif_sync_request {
136 uint32_t fd;
137 };
140 /* FS operation request */
141 struct fsif_request {
142 uint8_t type; /* Type of the request */
143 uint8_t pad;
144 uint16_t id; /* Request ID, copied to the response */
145 uint32_t pad2;
146 union {
147 struct fsif_open_request fopen;
148 struct fsif_close_request fclose;
149 struct fsif_read_request fread;
150 struct fsif_write_request fwrite;
151 struct fsif_stat_request fstat;
152 struct fsif_truncate_request ftruncate;
153 struct fsif_remove_request fremove;
154 struct fsif_rename_request frename;
155 struct fsif_create_request fcreate;
156 struct fsif_list_request flist;
157 struct fsif_chmod_request fchmod;
158 struct fsif_space_request fspace;
159 struct fsif_sync_request fsync;
160 } u;
161 };
162 typedef struct fsif_request fsif_request_t;
164 /* FS operation response */
165 struct fsif_response {
166 uint16_t id;
167 uint16_t pad1;
168 uint32_t pad2;
169 union {
170 uint64_t ret_val;
171 struct fsif_stat_response fstat;
172 } u;
173 };
175 typedef struct fsif_response fsif_response_t;
177 #define FSIF_RING_ENTRY_SIZE 64
179 #define FSIF_NR_READ_GNTS ((FSIF_RING_ENTRY_SIZE - sizeof(struct fsif_read_request)) / \
180 sizeof(grant_ref_t) + 1)
181 #define FSIF_NR_WRITE_GNTS ((FSIF_RING_ENTRY_SIZE - sizeof(struct fsif_write_request)) / \
182 sizeof(grant_ref_t) + 1)
184 DEFINE_RING_TYPES(fsif, struct fsif_request, struct fsif_response);
186 #define STATE_INITIALISED "init"
187 #define STATE_READY "ready"
188 #define STATE_CLOSING "closing"
189 #define STATE_CLOSED "closed"
192 #endif