1 /******************************************************************************
2 * Xen Hypervisor Filesystem
3 *
4 * Copyright (c) 2019, SUSE Software Solutions Germany GmbH
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 */
25
26 #ifndef __XEN_PUBLIC_HYPFS_H__
27 #define __XEN_PUBLIC_HYPFS_H__
28
29 #include "xen.h"
30
31 /*
32 * Definitions for the __HYPERVISOR_hypfs_op hypercall.
33 */
34
35 /* Highest version number of the hypfs interface currently defined. */
36 #define XEN_HYPFS_VERSION 1
37
38 /* Maximum length of a path in the filesystem. */
39 #define XEN_HYPFS_MAX_PATHLEN 1024
40
41 struct xen_hypfs_direntry {
42 uint8_t type;
43 #define XEN_HYPFS_TYPE_DIR 0
44 #define XEN_HYPFS_TYPE_BLOB 1
45 #define XEN_HYPFS_TYPE_STRING 2
46 #define XEN_HYPFS_TYPE_UINT 3
47 #define XEN_HYPFS_TYPE_INT 4
48 #define XEN_HYPFS_TYPE_BOOL 5
49 uint8_t encoding;
50 #define XEN_HYPFS_ENC_PLAIN 0
51 #define XEN_HYPFS_ENC_GZIP 1
52 uint16_t pad; /* Returned as 0. */
53 uint32_t content_len; /* Current length of data. */
54 uint32_t max_write_len; /* Max. length for writes (0 if read-only). */
55 };
56
57 struct xen_hypfs_dirlistentry {
58 struct xen_hypfs_direntry e;
59 /* Offset in bytes to next entry (0 == this is the last entry). */
60 uint16_t off_next;
61 /* Zero terminated entry name, possibly with some padding for alignment. */
62 char name[XEN_FLEX_ARRAY_DIM];
63 };
64
65 /*
66 * Hypercall operations.
67 */
68
69 /*
70 * XEN_HYPFS_OP_get_version
71 *
72 * Read highest interface version supported by the hypervisor.
73 *
74 * arg1 - arg4: all 0/NULL
75 *
76 * Possible return values:
77 * >0: highest supported interface version
78 * <0: negative Xen errno value
79 */
80 #define XEN_HYPFS_OP_get_version 0
81
82 /*
83 * XEN_HYPFS_OP_read
84 *
85 * Read a filesystem entry.
86 *
87 * Returns the direntry and contents of an entry in the buffer supplied by the
88 * caller (struct xen_hypfs_direntry with the contents following directly
89 * after it).
90 * The data buffer must be at least the size of the direntry returned. If the
91 * data buffer was not large enough for all the data -ENOBUFS and no entry
92 * data is returned, but the direntry will contain the needed size for the
93 * returned data.
94 * The format of the contents is according to its entry type and encoding.
95 * The contents of a directory are multiple struct xen_hypfs_dirlistentry
96 * items.
97 *
98 * arg1: XEN_GUEST_HANDLE(path name)
99 * arg2: length of path name (including trailing zero byte)
100 * arg3: XEN_GUEST_HANDLE(data buffer written by hypervisor)
101 * arg4: data buffer size
102 *
103 * Possible return values:
104 * 0: success
105 * <0 : negative Xen errno value
106 */
107 #define XEN_HYPFS_OP_read 1
108
109 /*
110 * XEN_HYPFS_OP_write_contents
111 *
112 * Write contents of a filesystem entry.
113 *
114 * Writes an entry with the contents of a buffer supplied by the caller.
115 * The data type and encoding can't be changed. The size can be changed only
116 * for blobs and strings.
117 *
118 * arg1: XEN_GUEST_HANDLE(path name)
119 * arg2: length of path name (including trailing zero byte)
120 * arg3: XEN_GUEST_HANDLE(content buffer read by hypervisor)
121 * arg4: content buffer size
122 *
123 * Possible return values:
124 * 0: success
125 * <0 : negative Xen errno value
126 */
127 #define XEN_HYPFS_OP_write_contents 2
128
129 #endif /* __XEN_PUBLIC_HYPFS_H__ */
Cache object: 89b94afe27de3b2c5351e21a338ef45f
|