1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/**
* Copyright (C) Mellanox Technologies Ltd. 2020. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
/* This header file defines API for manipulating VFS object tree structure */
/**
* Structure to describe the vfs node.
*/
typedef struct ucs_vfs_path_info_t;
/**
* Function type to fill information about an object to the string buffer.
*
* @param [in] obj Pointer to the object.
* @param [inout] strb String buffer filled with the object's information.
* @param [in] arg_ptr Optional pointer argument passed to the function.
* @param [in] arg_u64 Optional numeric argument passed to the function.
*/
typedef void ;
/**
* Function type to update object property with data from the buffer.
*
* @param [in] obj Pointer to the object.
* @param [in] buffer String buffer filled with the object's information.
* @param [in] size The size of buffer.
* @param [in] arg_ptr Optional pointer argument passed to the function.
* @param [in] arg_u64 Optional numeric argument passed to the function.
*
* @return UCS_OK or an error if cannot update the object property.
*/
typedef ;
/**
* Function to update representation of object in VFS.
*
* @param [in] obj Pointer to the object to be updated.
*/
typedef void ;
/**
* Function to process VFS nodes during reading of the parent directory.
*
* @param [in] name Path to directory.
* @param [in] arg Pointer to the arguments.
*/
typedef void ;
/**
* Add directory representing object in VFS. If @a parent_obj is NULL, the mount
* directory will be used as the base for @a rel_path. If directory with
* specified name already exists, the pointer value will be added to directory
* name.
*
* @param [in] parent_obj Pointer to the parent object. @a rel_path is relative
* to @a parent_obj directory.
* @param [in] obj Pointer to the object to be represented in VFS.
* @param [in] rel_path Format string which specifies relative path
* @a obj directory.
*
* @return UCS_ERR_ALREADY_EXISTS if directory with specified name already
* exists for given @a obj.
* UCS_ERR_INVALID_PARAM if node for @a parent_obj does not exist.
* UCS_ERR_NO_MEMORY if cannot create a new node for directory.
* UCS_OK otherwise.
*/
ucs_status_t ;
/**
* Add read-only file describing object features in VFS. If @a obj is NULL, the
* mount directory will be used as the base for @a rel_path.
*
* @param [in] obj Pointer to the object. @a rel_path is relative to @a obj
* directory.
* @param [in] read_cb Callback method that reads the content of the file.
* @param [in] arg_ptr Optional pointer argument that is passed to the callback
* method.
* @param [in] arg_u64 Optional numeric argument that is passed to the callback
* method.
* @param [in] rel_path Format string which specifies relative path to the file.
*
* @return UCS_ERR_ALREADY_EXISTS if file with specified name already exists.
* UCS_ERR_INVALID_PARAM if node for @a obj does not exist.
* UCS_ERR_NO_MEMORY if cannot create a new node for read-only
* file.
* UCS_OK otherwise.
*/
ucs_status_t ;
/**
* Add read-write file describing an object feature in VFS. If @a obj is NULL,
* the mount directory will be used as the base for @a rel_path.
*
* @param [in] obj Pointer to the object. @a rel_path is relative to @a obj
* directory.
* @param [in] read_cb Callback method that reads the content of the file.
* @param [in] write_cb Callback method that writes the content to the file.
* @param [in] arg_ptr Optional pointer argument that is passed to the callback
* methods.
* @param [in] arg_u64 Optional numeric argument that is passed to the callback
* methods.
* @param [in] rel_path Format string which specifies relative path to the file.
*
* @return UCS_ERR_ALREADY_EXISTS if file with specified name already exists.
* UCS_ERR_INVALID_PARAM if node for @a obj does not exist.
* UCS_ERR_NO_MEMORY if cannot create a new node for read-only
* file.
* UCS_OK otherwise.
*/
ucs_status_t
;
/**
* Add symbolic link to directory representing @a target_obj. If @a obj is NULL,
* the mount directory will be used as the base for @a rel_path.
*
* @param [in] obj Pointer to the object. @a rel_path is relative to
* @a obj directory.
* @param [in] target_obj Pointer to object to be linked.
* @param [in] rel_path Format string which specifies relative path to the
* symbolic link.
*
* @return UCS_ERR_ALREADY_EXISTS if file with specified name already exists.
* UCS_ERR_INVALID_PARAM if node for @a obj or for @a target_obj does
* not exist.
* UCS_ERR_NO_MEMORY if cannot create a new node for symbolic link.
* UCS_OK otherwise.
*/
ucs_status_t
;
/**
* Recursively remove directories and files associated with the object and its
* children from VFS. The method removes all empty parent sub-directories.
*
* @param [in] obj Pointer to the object to be deleted with its children from
* VFS.
*/
void ;
/**
* Invalidate VFS node and set method to update the node.
*
* @param [in] obj Pointer to the object to be invalidate.
* @param [in] refresh_cb Method to update the node associated with the object.
*/
void ;
/**
* Fill information about VFS node corresponding to the specified path.
*
* @param [in] path String which specifies path to find the node in VFS.
* @param [out] info VFS object information.
*
* @return UCS_OK VFS node corresponding to specified path exists.
* UCS_ERR_NO_ELEM Otherwise.
*
* @note The content of the file defined by ucs_vfs_file_show_cb_t of the node.
* The method initiates refresh of the node defined by
* ucs_vfs_refresh_cb_t of the node.
*/
ucs_status_t ;
/**
* Read the content of VFS node corresponding to the specified path. The content
* of the file defined by ucs_vfs_file_show_cb_t of the node.
*
* @param [in] path String which specifies path to find the node in VFS.
* @param [inout] strb String buffer to be filled by the content of the
* file.
*
* @return UCS_OK VFS node corresponding to specified path exists and
* the node is a file.
* @return UCS_ERR_NO_ELEM Otherwise.
*/
ucs_status_t
;
/**
* Write the content to VFS node corresponding to the specified path.
*
* @param [in] path String which specifies path to find the node in VFS.
* @param [in] buf String buffer filled with the content of the file.
* @param [in] size The size of the buffer.
*
* @return UCS_ERR_NO_ELEM if node with specified path does not exists or
* the node is not a RW file.
* UCS_ERR_INVALID_PARAM if cannot write content of the buffer to the
* file.
* UCS_OK otherwise.
*/
ucs_status_t
;
/**
* Invoke callback @a dir_cb for children of VFS node corresponding to the
* specified path.
*
* @param [in] path String which specifies path to find the node in VFS.
* @param [in] dir_cb Callback method to be invoked for each child of the
* VFS node.
* @param [in] arg Arguments to be passed to the callback method.
*
* @return UCS_OK VFS node corresponding to specified path exists and
* the node is a directory.
* UCS_ERR_NO_ELEM Otherwise.
*
* @note The method initiates refresh of the node defined by
* ucs_vfs_refresh_cb_t of the node.
*/
ucs_status_t ;
/**
* Fill the string buffer @a strb with the target of a symbolic link.
*
* @param [in] path String which specifies path to the symbolic link node
* in VFS.
* @param [inout] strb String buffer to be filled with relative path to the
* target.
*
* @return UCS_OK VFS node corresponding to specified path exists and
* the node is a symbolic link.
* UCS_ERR_NO_ELEM Otherwise.
*/
ucs_status_t ;