debuggers.hg

view xen/include/public/io/fsif.h @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children 5c0bf00e371d 463e410fb0fd
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, Sun Microsystems, Inc.
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 grant_ref_t gref;
58 uint64_t len;
59 uint64_t offset;
60 };
62 struct fsif_write_request {
63 uint32_t fd;
64 grant_ref_t gref;
65 uint64_t len;
66 uint64_t offset;
67 };
69 struct fsif_stat_request {
70 uint32_t fd;
71 grant_ref_t gref;
72 };
74 /* This structure is a copy of some fields from stat structure, writen to the
75 * granted page. */
76 struct fsif_stat_response {
77 int32_t stat_mode;
78 uint32_t stat_uid;
79 uint32_t stat_gid;
80 int32_t pad;
81 int64_t stat_size;
82 int64_t stat_atime;
83 int64_t stat_mtime;
84 int64_t stat_ctime;
85 };
87 struct fsif_truncate_request {
88 uint32_t fd;
89 int32_t pad;
90 int64_t length;
91 };
93 struct fsif_remove_request {
94 grant_ref_t gref;
95 };
97 struct fsif_rename_request {
98 uint16_t old_name_offset;
99 uint16_t new_name_offset;
100 grant_ref_t gref;
101 };
103 struct fsif_create_request {
104 int8_t directory;
105 int8_t pad;
106 int16_t pad2;
107 int32_t mode;
108 grant_ref_t gref;
109 };
111 struct fsif_list_request {
112 uint32_t offset;
113 grant_ref_t gref;
114 };
116 #define NR_FILES_SHIFT 0
117 #define NR_FILES_SIZE 16 /* 16 bits for the number of files mask */
118 #define NR_FILES_MASK (((1ULL << NR_FILES_SIZE) - 1) << NR_FILES_SHIFT)
119 #define ERROR_SIZE 32 /* 32 bits for the error mask */
120 #define ERROR_SHIFT (NR_FILES_SIZE + NR_FILES_SHIFT)
121 #define ERROR_MASK (((1ULL << ERROR_SIZE) - 1) << ERROR_SHIFT)
122 #define HAS_MORE_SHIFT (ERROR_SHIFT + ERROR_SIZE)
123 #define HAS_MORE_FLAG (1ULL << HAS_MORE_SHIFT)
125 struct fsif_chmod_request {
126 uint32_t fd;
127 int32_t mode;
128 };
130 struct fsif_space_request {
131 grant_ref_t gref;
132 };
134 struct fsif_sync_request {
135 uint32_t fd;
136 };
139 /* FS operation request */
140 struct fsif_request {
141 uint8_t type; /* Type of the request */
142 uint8_t pad;
143 uint16_t id; /* Request ID, copied to the response */
144 uint32_t pad2;
145 union {
146 struct fsif_open_request fopen;
147 struct fsif_close_request fclose;
148 struct fsif_read_request fread;
149 struct fsif_write_request fwrite;
150 struct fsif_stat_request fstat;
151 struct fsif_truncate_request ftruncate;
152 struct fsif_remove_request fremove;
153 struct fsif_rename_request frename;
154 struct fsif_create_request fcreate;
155 struct fsif_list_request flist;
156 struct fsif_chmod_request fchmod;
157 struct fsif_space_request fspace;
158 struct fsif_sync_request fsync;
159 } u;
160 };
161 typedef struct fsif_request fsif_request_t;
163 /* FS operation response */
164 struct fsif_response {
165 uint16_t id;
166 uint16_t pad1;
167 uint32_t pad2;
168 uint64_t ret_val;
169 };
171 typedef struct fsif_response fsif_response_t;
174 DEFINE_RING_TYPES(fsif, struct fsif_request, struct fsif_response);
176 #define STATE_INITIALISED "init"
177 #define STATE_READY "ready"
181 #endif