1 /******************************************************************************
4 * Interface to FS level split device drivers.
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:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
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.
24 * Copyright (c) 2007, Grzegorz Milos, <gm281@cam.ac.uk>.
27 #ifndef __XEN_PUBLIC_IO_FSIF_H__
28 #define __XEN_PUBLIC_IO_FSIF_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
38 #define REQ_FILE_TRUNCATE 6
42 #define REQ_DIR_LIST 10
44 #define REQ_FS_SPACE 12
45 #define REQ_FILE_SYNC 13
47 struct fsif_open_request
{
51 struct fsif_close_request
{
55 struct fsif_read_request
{
60 grant_ref_t grefs
[1]; /* Variable length */
63 struct fsif_write_request
{
68 grant_ref_t grefs
[1]; /* Variable length */
71 struct fsif_stat_request
{
75 /* This structure is a copy of some fields from stat structure, returned
77 struct fsif_stat_response
{
88 struct fsif_truncate_request
{
94 struct fsif_remove_request
{
98 struct fsif_rename_request
{
99 uint16_t old_name_offset
;
100 uint16_t new_name_offset
;
104 struct fsif_create_request
{
112 struct fsif_list_request
{
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
{
131 struct fsif_space_request
{
135 struct fsif_sync_request
{
140 /* FS operation request */
141 struct fsif_request
{
142 uint8_t type
; /* Type of the request */
144 uint16_t id
; /* Request ID, copied to the response */
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
;
162 typedef struct fsif_request fsif_request_t
;
164 /* FS operation response */
165 struct fsif_response
{
171 struct fsif_stat_response fstat
;
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"