Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 : : */
4 : :
5 : : #include "spdk/stdinc.h"
6 : : #include "spdk/fsdev.h"
7 : : #include "spdk/fsdev_module.h"
8 : : #include "fsdev_internal.h"
9 : :
10 : : #define CALL_USR_CLB(_fsdev_io, ch, type, ...) \
11 : : do { \
12 : : type *usr_cb_fn = _fsdev_io->internal.usr_cb_fn; \
13 : : usr_cb_fn(_fsdev_io->internal.usr_cb_arg, ch, _fsdev_io->internal.status, ## __VA_ARGS__); \
14 : : } while (0)
15 : :
16 : : #define CALL_USR_NO_STATUS_CLB(_fsdev_io, ch, type, ...) \
17 : : do { \
18 : : type *usr_cb_fn = _fsdev_io->internal.usr_cb_fn; \
19 : : usr_cb_fn(_fsdev_io->internal.usr_cb_arg, ch, ## __VA_ARGS__); \
20 : : } while (0)
21 : :
22 : : static struct spdk_fsdev_io *
23 : 524406 : fsdev_io_get_and_fill(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
24 : : void *usr_cb_fn, void *usr_cb_arg, spdk_fsdev_io_completion_cb cb_fn, void *cb_arg,
25 : : enum spdk_fsdev_io_type type)
26 : : {
27 : : struct spdk_fsdev_io *fsdev_io;
28 : 524406 : struct spdk_fsdev_channel *channel = __io_ch_to_fsdev_ch(ch);
29 : :
30 : 524406 : fsdev_io = fsdev_channel_get_io(channel);
31 [ - + ]: 524406 : if (!fsdev_io) {
32 : 0 : return NULL;
33 : : }
34 : :
35 [ # # # # ]: 524406 : fsdev_io->fsdev = spdk_fsdev_desc_get_fsdev(desc);
36 [ # # # # : 524406 : fsdev_io->internal.ch = channel;
# # ]
37 [ # # # # : 524406 : fsdev_io->internal.desc = desc;
# # ]
38 [ # # # # : 524406 : fsdev_io->internal.type = type;
# # ]
39 [ # # # # : 524406 : fsdev_io->internal.unique = unique;
# # ]
40 [ # # # # : 524406 : fsdev_io->internal.usr_cb_fn = usr_cb_fn;
# # ]
41 [ # # # # : 524406 : fsdev_io->internal.usr_cb_arg = usr_cb_arg;
# # ]
42 [ # # # # : 524406 : fsdev_io->internal.cb_arg = cb_arg;
# # ]
43 [ # # # # : 524406 : fsdev_io->internal.cb_fn = cb_fn;
# # ]
44 [ # # # # : 524406 : fsdev_io->internal.status = -ENOSYS;
# # ]
45 [ # # # # : 524406 : fsdev_io->internal.in_submit_request = false;
# # ]
46 : :
47 : 524406 : return fsdev_io;
48 : 0 : }
49 : :
50 : : static inline void
51 : 524406 : fsdev_io_free(struct spdk_fsdev_io *fsdev_io)
52 : : {
53 : 524406 : spdk_fsdev_free_io(fsdev_io);
54 : 524406 : }
55 : :
56 : : static void
57 : 5 : _spdk_fsdev_mount_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
58 : : {
59 : 5 : struct spdk_io_channel *ch = cb_arg;
60 : :
61 [ # # # # : 5 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_mount_cpl_cb, &fsdev_io->u_out.mount.opts,
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # ]
62 : : fsdev_io->u_out.mount.root_fobject);
63 : :
64 : 5 : fsdev_io_free(fsdev_io);
65 : 5 : }
66 : :
67 : : int
68 : 5 : spdk_fsdev_mount(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch,
69 : : uint64_t unique, const struct spdk_fsdev_mount_opts *opts,
70 : : spdk_fsdev_mount_cpl_cb cb_fn, void *cb_arg)
71 : : {
72 : : struct spdk_fsdev_io *fsdev_io;
73 : :
74 : 5 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_mount_cb, ch,
75 : : SPDK_FSDEV_IO_MOUNT);
76 [ - + ]: 5 : if (!fsdev_io) {
77 : 0 : return -ENOBUFS;
78 : : }
79 : :
80 [ # # # # : 5 : fsdev_io->u_in.mount.opts = *opts;
# # ]
81 : :
82 : 5 : fsdev_io_submit(fsdev_io);
83 : 5 : return 0;
84 : 0 : }
85 : :
86 : : static void
87 : 3 : _spdk_fsdev_umount_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
88 : : {
89 : 3 : struct spdk_io_channel *ch = cb_arg;
90 : :
91 [ # # # # : 3 : CALL_USR_NO_STATUS_CLB(fsdev_io, ch, spdk_fsdev_umount_cpl_cb);
# # # # #
# # # # #
# # ]
92 : :
93 : 3 : fsdev_io_free(fsdev_io);
94 : 3 : }
95 : :
96 : : int
97 : 3 : spdk_fsdev_umount(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch,
98 : : uint64_t unique, spdk_fsdev_umount_cpl_cb cb_fn, void *cb_arg)
99 : : {
100 : : struct spdk_fsdev_io *fsdev_io;
101 : :
102 : 3 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_umount_cb, ch,
103 : : SPDK_FSDEV_IO_UMOUNT);
104 [ - + ]: 3 : if (!fsdev_io) {
105 : 0 : return -ENOBUFS;
106 : : }
107 : :
108 : 3 : fsdev_io_submit(fsdev_io);
109 : 3 : return 0;
110 : :
111 : 0 : }
112 : :
113 : : static void
114 : 12 : _spdk_fsdev_lookup_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
115 : : {
116 : 12 : struct spdk_io_channel *ch = cb_arg;
117 : :
118 [ # # # # : 12 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_lookup_cpl_cb, fsdev_io->u_out.lookup.fobject,
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # ]
119 : : &fsdev_io->u_out.lookup.attr);
120 : :
121 [ # # # # : 12 : free(fsdev_io->u_in.lookup.name);
# # # # ]
122 : 12 : fsdev_io_free(fsdev_io);
123 : 12 : }
124 : :
125 : : int
126 : 12 : spdk_fsdev_lookup(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
127 : : struct spdk_fsdev_file_object *parent_fobject, const char *name,
128 : : spdk_fsdev_lookup_cpl_cb cb_fn, void *cb_arg)
129 : : {
130 : : struct spdk_fsdev_io *fsdev_io;
131 : :
132 : 12 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_lookup_cb, ch,
133 : : SPDK_FSDEV_IO_LOOKUP);
134 [ - + ]: 12 : if (!fsdev_io) {
135 : 0 : return -ENOBUFS;
136 : : }
137 : :
138 [ - + # # : 12 : fsdev_io->u_in.lookup.name = strdup(name);
# # # # #
# ]
139 [ - + # # : 12 : if (!fsdev_io->u_in.lookup.name) {
# # # # #
# ]
140 : 0 : fsdev_io_free(fsdev_io);
141 : 0 : return -ENOMEM;
142 : : }
143 : :
144 [ # # # # : 12 : fsdev_io->u_in.lookup.parent_fobject = parent_fobject;
# # # # ]
145 : :
146 : 12 : fsdev_io_submit(fsdev_io);
147 : 12 : return 0;
148 : 0 : }
149 : :
150 : : static void
151 : 7 : _spdk_fsdev_forget_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
152 : : {
153 : 7 : struct spdk_io_channel *ch = cb_arg;
154 : :
155 [ # # # # : 7 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_forget_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
156 : :
157 : 7 : fsdev_io_free(fsdev_io);
158 : 7 : }
159 : :
160 : : int
161 : 7 : spdk_fsdev_forget(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
162 : : struct spdk_fsdev_file_object *fobject, uint64_t nlookup,
163 : : spdk_fsdev_forget_cpl_cb cb_fn, void *cb_arg)
164 : : {
165 : : struct spdk_fsdev_io *fsdev_io;
166 : :
167 : 7 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_forget_cb, ch,
168 : : SPDK_FSDEV_IO_FORGET);
169 [ - + ]: 7 : if (!fsdev_io) {
170 : 0 : return -ENOBUFS;
171 : : }
172 : :
173 [ # # # # : 7 : fsdev_io->u_in.forget.fobject = fobject;
# # # # ]
174 [ # # # # : 7 : fsdev_io->u_in.forget.nlookup = nlookup;
# # # # ]
175 : :
176 : 7 : fsdev_io_submit(fsdev_io);
177 : 7 : return 0;
178 : 0 : }
179 : :
180 : : static void
181 : 19 : _spdk_fsdev_getattr_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
182 : : {
183 : 19 : struct spdk_io_channel *ch = cb_arg;
184 : :
185 [ # # # # : 19 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_getattr_cpl_cb, &fsdev_io->u_out.getattr.attr);
# # # # #
# # # # #
# # # # #
# # # # #
# # # # ]
186 : :
187 : 19 : fsdev_io_free(fsdev_io);
188 : 19 : }
189 : :
190 : : int
191 : 19 : spdk_fsdev_getattr(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
192 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle,
193 : : spdk_fsdev_getattr_cpl_cb cb_fn, void *cb_arg)
194 : : {
195 : : struct spdk_fsdev_io *fsdev_io;
196 : :
197 : 19 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_getattr_cb, ch,
198 : : SPDK_FSDEV_IO_GETATTR);
199 [ - + ]: 19 : if (!fsdev_io) {
200 : 0 : return -ENOBUFS;
201 : : }
202 : :
203 [ # # # # : 19 : fsdev_io->u_in.getattr.fobject = fobject;
# # # # ]
204 [ # # # # : 19 : fsdev_io->u_in.getattr.fhandle = fhandle;
# # # # ]
205 : :
206 : 19 : fsdev_io_submit(fsdev_io);
207 : 19 : return 0;
208 : 0 : }
209 : :
210 : : static void
211 : 4 : _spdk_fsdev_setattr_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
212 : : {
213 : 4 : struct spdk_io_channel *ch = cb_arg;
214 : :
215 [ # # # # : 4 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_setattr_cpl_cb, &fsdev_io->u_out.setattr.attr);
# # # # #
# # # # #
# # # # #
# # # # #
# # # # ]
216 : :
217 : 4 : fsdev_io_free(fsdev_io);
218 : 4 : }
219 : :
220 : : int
221 : 4 : spdk_fsdev_setattr(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
222 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle,
223 : : const struct spdk_fsdev_file_attr *attr, uint32_t to_set,
224 : : spdk_fsdev_setattr_cpl_cb cb_fn, void *cb_arg)
225 : : {
226 : : struct spdk_fsdev_io *fsdev_io;
227 : :
228 : 4 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_setattr_cb, ch,
229 : : SPDK_FSDEV_IO_SETATTR);
230 [ - + ]: 4 : if (!fsdev_io) {
231 : 0 : return -ENOBUFS;
232 : : }
233 : :
234 [ # # # # : 4 : fsdev_io->u_in.setattr.fobject = fobject;
# # # # ]
235 [ # # # # : 4 : fsdev_io->u_in.setattr.fhandle = fhandle;
# # # # ]
236 [ # # # # : 4 : fsdev_io->u_in.setattr.attr = *attr;
# # ]
237 [ # # # # : 4 : fsdev_io->u_in.setattr.to_set = to_set;
# # # # ]
238 : :
239 : 4 : fsdev_io_submit(fsdev_io);
240 : 4 : return 0;
241 : 0 : }
242 : :
243 : : static void
244 : 2 : _spdk_fsdev_readlink_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
245 : : {
246 : 2 : struct spdk_io_channel *ch = cb_arg;
247 : :
248 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_readlink_cpl_cb, fsdev_io->u_out.readlink.linkname);
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# ]
249 : :
250 [ # # # # : 2 : free(fsdev_io->u_out.readlink.linkname);
# # # # ]
251 : 2 : fsdev_io_free(fsdev_io);
252 : 2 : }
253 : :
254 : : int
255 : 2 : spdk_fsdev_readlink(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
256 : : struct spdk_fsdev_file_object *fobject, spdk_fsdev_readlink_cpl_cb cb_fn, void *cb_arg)
257 : : {
258 : : struct spdk_fsdev_io *fsdev_io;
259 : :
260 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_readlink_cb, ch,
261 : : SPDK_FSDEV_IO_READLINK);
262 [ - + ]: 2 : if (!fsdev_io) {
263 : 0 : return -ENOBUFS;
264 : : }
265 : :
266 [ # # # # : 2 : fsdev_io->u_in.readlink.fobject = fobject;
# # # # ]
267 [ # # # # : 2 : fsdev_io->u_out.readlink.linkname = NULL;
# # # # ]
268 : :
269 : 2 : fsdev_io_submit(fsdev_io);
270 : 2 : return 0;
271 : 0 : }
272 : :
273 : : static void
274 : 2 : _spdk_fsdev_symlink_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
275 : : {
276 : 2 : struct spdk_io_channel *ch = cb_arg;
277 : :
278 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_symlink_cpl_cb, fsdev_io->u_out.symlink.fobject,
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # ]
279 : : &fsdev_io->u_out.symlink.attr);
280 : :
281 [ # # # # : 2 : free(fsdev_io->u_in.symlink.target);
# # # # ]
282 [ # # # # : 2 : free(fsdev_io->u_in.symlink.linkpath);
# # # # ]
283 : :
284 : 2 : fsdev_io_free(fsdev_io);
285 : 2 : }
286 : :
287 : : int
288 : 2 : spdk_fsdev_symlink(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
289 : : struct spdk_fsdev_file_object *parent_fobject, const char *target, const char *linkpath,
290 : : uid_t euid, gid_t egid, spdk_fsdev_symlink_cpl_cb cb_fn, void *cb_arg)
291 : : {
292 : : struct spdk_fsdev_io *fsdev_io;
293 : :
294 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_symlink_cb, ch,
295 : : SPDK_FSDEV_IO_SYMLINK);
296 [ - + ]: 2 : if (!fsdev_io) {
297 : 0 : return -ENOBUFS;
298 : : }
299 : :
300 [ - + # # : 2 : fsdev_io->u_in.symlink.target = strdup(target);
# # # # #
# ]
301 [ - + # # : 2 : if (!fsdev_io->u_in.symlink.target) {
# # # # #
# ]
302 : 0 : fsdev_io_free(fsdev_io);
303 : 0 : return -ENOMEM;
304 : : }
305 : :
306 [ - + # # : 2 : fsdev_io->u_in.symlink.linkpath = strdup(linkpath);
# # # # #
# ]
307 [ - + ]: 2 : if (!fsdev_io) {
308 : 0 : fsdev_io_free(fsdev_io);
309 [ # # # # : 0 : free(fsdev_io->u_in.symlink.target);
# # # # ]
310 : 0 : return -ENOMEM;
311 : : }
312 : :
313 [ # # # # : 2 : fsdev_io->u_in.symlink.parent_fobject = parent_fobject;
# # # # ]
314 [ # # # # : 2 : fsdev_io->u_in.symlink.euid = euid;
# # # # ]
315 [ # # # # : 2 : fsdev_io->u_in.symlink.egid = egid;
# # # # ]
316 : :
317 : 2 : fsdev_io_submit(fsdev_io);
318 : 2 : return 0;
319 : 0 : }
320 : :
321 : : static void
322 : 2 : _spdk_fsdev_mknod_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
323 : : {
324 : 2 : struct spdk_io_channel *ch = cb_arg;
325 : :
326 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_mknod_cpl_cb, fsdev_io->u_out.mknod.fobject,
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # ]
327 : : &fsdev_io->u_out.mknod.attr);
328 : :
329 [ # # # # : 2 : free(fsdev_io->u_in.mknod.name);
# # # # ]
330 : :
331 : 2 : fsdev_io_free(fsdev_io);
332 : 2 : }
333 : :
334 : : int
335 : 2 : spdk_fsdev_mknod(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
336 : : struct spdk_fsdev_file_object *parent_fobject, const char *name, mode_t mode, dev_t rdev,
337 : : uid_t euid, gid_t egid, spdk_fsdev_mknod_cpl_cb cb_fn, void *cb_arg)
338 : : {
339 : : struct spdk_fsdev_io *fsdev_io;
340 : :
341 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_mknod_cb, ch,
342 : : SPDK_FSDEV_IO_MKNOD);
343 [ - + ]: 2 : if (!fsdev_io) {
344 : 0 : return -ENOBUFS;
345 : : }
346 : :
347 [ - + # # : 2 : fsdev_io->u_in.mknod.name = strdup(name);
# # # # #
# ]
348 [ - + # # : 2 : if (!fsdev_io->u_in.mknod.name) {
# # # # #
# ]
349 : 0 : fsdev_io_free(fsdev_io);
350 : 0 : return -ENOMEM;
351 : : }
352 : :
353 [ # # # # : 2 : fsdev_io->u_in.mknod.parent_fobject = parent_fobject;
# # # # ]
354 [ # # # # : 2 : fsdev_io->u_in.mknod.mode = mode;
# # # # ]
355 [ # # # # : 2 : fsdev_io->u_in.mknod.rdev = rdev;
# # # # ]
356 [ # # # # : 2 : fsdev_io->u_in.mknod.euid = euid;
# # # # ]
357 [ # # # # : 2 : fsdev_io->u_in.mknod.egid = egid;
# # # # ]
358 : :
359 : 2 : fsdev_io_submit(fsdev_io);
360 : 2 : return 0;
361 : 0 : }
362 : :
363 : : static void
364 : 2 : _spdk_fsdev_mkdir_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
365 : : {
366 : 2 : struct spdk_io_channel *ch = cb_arg;
367 : :
368 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_mkdir_cpl_cb, fsdev_io->u_out.mkdir.fobject,
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # ]
369 : : &fsdev_io->u_out.mkdir.attr);
370 : :
371 [ # # # # : 2 : free(fsdev_io->u_in.mkdir.name);
# # # # ]
372 : :
373 : 2 : fsdev_io_free(fsdev_io);
374 : 2 : }
375 : :
376 : : int
377 : 2 : spdk_fsdev_mkdir(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
378 : : struct spdk_fsdev_file_object *parent_fobject, const char *name, mode_t mode,
379 : : uid_t euid, gid_t egid, spdk_fsdev_mkdir_cpl_cb cb_fn, void *cb_arg)
380 : : {
381 : : struct spdk_fsdev_io *fsdev_io;
382 : :
383 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_mkdir_cb, ch,
384 : : SPDK_FSDEV_IO_MKDIR);
385 [ - + ]: 2 : if (!fsdev_io) {
386 : 0 : return -ENOBUFS;
387 : : }
388 : :
389 [ - + # # : 2 : fsdev_io->u_in.mkdir.name = strdup(name);
# # # # #
# ]
390 [ - + # # : 2 : if (!fsdev_io->u_in.mkdir.name) {
# # # # #
# ]
391 : 0 : fsdev_io_free(fsdev_io);
392 : 0 : return -ENOMEM;
393 : : }
394 : :
395 [ # # # # : 2 : fsdev_io->u_in.mkdir.parent_fobject = parent_fobject;
# # # # ]
396 [ # # # # : 2 : fsdev_io->u_in.mkdir.mode = mode;
# # # # ]
397 [ # # # # : 2 : fsdev_io->u_in.mkdir.euid = euid;
# # # # ]
398 [ # # # # : 2 : fsdev_io->u_in.mkdir.egid = egid;
# # # # ]
399 : :
400 : 2 : fsdev_io_submit(fsdev_io);
401 : 2 : return 0;
402 : 0 : }
403 : :
404 : : static void
405 : 2 : _spdk_fsdev_unlink_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
406 : : {
407 : 2 : struct spdk_io_channel *ch = cb_arg;
408 : :
409 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_unlink_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
410 : :
411 [ # # # # : 2 : free(fsdev_io->u_in.unlink.name);
# # # # ]
412 : :
413 : 2 : fsdev_io_free(fsdev_io);
414 : 2 : }
415 : :
416 : : int
417 : 2 : spdk_fsdev_unlink(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
418 : : struct spdk_fsdev_file_object *parent_fobject, const char *name,
419 : : spdk_fsdev_unlink_cpl_cb cb_fn, void *cb_arg)
420 : : {
421 : : struct spdk_fsdev_io *fsdev_io;
422 : :
423 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_unlink_cb, ch,
424 : : SPDK_FSDEV_IO_UNLINK);
425 [ - + ]: 2 : if (!fsdev_io) {
426 : 0 : return -ENOBUFS;
427 : : }
428 : :
429 [ - + # # : 2 : fsdev_io->u_in.unlink.name = strdup(name);
# # # # #
# ]
430 [ - + # # : 2 : if (!fsdev_io->u_in.unlink.name) {
# # # # #
# ]
431 : 0 : fsdev_io_free(fsdev_io);
432 : 0 : return -ENOMEM;
433 : : }
434 : :
435 [ # # # # : 2 : fsdev_io->u_in.unlink.parent_fobject = parent_fobject;
# # # # ]
436 : :
437 : 2 : fsdev_io_submit(fsdev_io);
438 : 2 : return 0;
439 : 0 : }
440 : :
441 : : static void
442 : 2 : _spdk_fsdev_rmdir_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
443 : : {
444 : 2 : struct spdk_io_channel *ch = cb_arg;
445 : :
446 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_rmdir_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
447 : :
448 [ # # # # : 2 : free(fsdev_io->u_in.rmdir.name);
# # # # ]
449 : :
450 : 2 : fsdev_io_free(fsdev_io);
451 : 2 : }
452 : :
453 : : int
454 : 2 : spdk_fsdev_rmdir(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
455 : : struct spdk_fsdev_file_object *parent_fobject, const char *name,
456 : : spdk_fsdev_rmdir_cpl_cb cb_fn, void *cb_arg)
457 : : {
458 : : struct spdk_fsdev_io *fsdev_io;
459 : :
460 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_rmdir_cb, ch,
461 : : SPDK_FSDEV_IO_RMDIR);
462 [ - + ]: 2 : if (!fsdev_io) {
463 : 0 : return -ENOBUFS;
464 : : }
465 : :
466 [ - + # # : 2 : fsdev_io->u_in.rmdir.name = strdup(name);
# # # # #
# ]
467 [ - + # # : 2 : if (!fsdev_io->u_in.rmdir.name) {
# # # # #
# ]
468 : 0 : fsdev_io_free(fsdev_io);
469 : 0 : return -ENOMEM;
470 : : }
471 : :
472 [ # # # # : 2 : fsdev_io->u_in.rmdir.parent_fobject = parent_fobject;
# # # # ]
473 : :
474 : 2 : fsdev_io_submit(fsdev_io);
475 : 2 : return 0;
476 : 0 : }
477 : :
478 : : static void
479 : 2 : _spdk_fsdev_rename_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
480 : : {
481 : 2 : struct spdk_io_channel *ch = cb_arg;
482 : :
483 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_rename_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
484 : :
485 [ # # # # : 2 : free(fsdev_io->u_in.rename.name);
# # # # ]
486 [ # # # # : 2 : free(fsdev_io->u_in.rename.new_name);
# # # # ]
487 : :
488 : 2 : fsdev_io_free(fsdev_io);
489 : 2 : }
490 : :
491 : : int
492 : 2 : spdk_fsdev_rename(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
493 : : struct spdk_fsdev_file_object *parent_fobject, const char *name,
494 : : struct spdk_fsdev_file_object *new_parent_fobject, const char *new_name,
495 : : uint32_t flags, spdk_fsdev_rename_cpl_cb cb_fn, void *cb_arg)
496 : : {
497 : : struct spdk_fsdev_io *fsdev_io;
498 : :
499 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_rename_cb, ch,
500 : : SPDK_FSDEV_IO_RENAME);
501 [ - + ]: 2 : if (!fsdev_io) {
502 : 0 : return -ENOBUFS;
503 : : }
504 : :
505 [ - + # # : 2 : fsdev_io->u_in.rename.name = strdup(name);
# # # # #
# ]
506 [ - + # # : 2 : if (!fsdev_io->u_in.rename.name) {
# # # # #
# ]
507 : 0 : fsdev_io_free(fsdev_io);
508 : 0 : return -ENOMEM;
509 : : }
510 : :
511 [ - + # # : 2 : fsdev_io->u_in.rename.new_name = strdup(new_name);
# # # # #
# ]
512 [ - + # # : 2 : if (!fsdev_io->u_in.rename.new_name) {
# # # # #
# ]
513 [ # # # # : 0 : free(fsdev_io->u_in.rename.name);
# # # # ]
514 : 0 : fsdev_io_free(fsdev_io);
515 : 0 : return -ENOMEM;
516 : : }
517 : :
518 [ # # # # : 2 : fsdev_io->u_in.rename.parent_fobject = parent_fobject;
# # # # ]
519 [ # # # # : 2 : fsdev_io->u_in.rename.new_parent_fobject = new_parent_fobject;
# # # # ]
520 [ # # # # : 2 : fsdev_io->u_in.rename.flags = flags;
# # # # ]
521 : :
522 : 2 : fsdev_io_submit(fsdev_io);
523 : 2 : return 0;
524 : 0 : }
525 : :
526 : : static void
527 : 2 : _spdk_fsdev_link_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
528 : : {
529 : 2 : struct spdk_io_channel *ch = cb_arg;
530 : :
531 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_link_cpl_cb, fsdev_io->u_out.link.fobject,
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # ]
532 : : &fsdev_io->u_out.link.attr);
533 : :
534 [ # # # # : 2 : free(fsdev_io->u_in.link.name);
# # # # ]
535 : :
536 : 2 : fsdev_io_free(fsdev_io);
537 : 2 : }
538 : :
539 : : int
540 : 2 : spdk_fsdev_link(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
541 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_object *new_parent_fobject,
542 : : const char *name, spdk_fsdev_link_cpl_cb cb_fn, void *cb_arg)
543 : : {
544 : : struct spdk_fsdev_io *fsdev_io;
545 : :
546 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_link_cb, ch,
547 : : SPDK_FSDEV_IO_LINK);
548 [ - + ]: 2 : if (!fsdev_io) {
549 : 0 : return -ENOBUFS;
550 : : }
551 : :
552 [ - + # # : 2 : fsdev_io->u_in.link.name = strdup(name);
# # # # #
# ]
553 [ - + # # : 2 : if (!fsdev_io->u_in.link.name) {
# # # # #
# ]
554 : 0 : fsdev_io_free(fsdev_io);
555 : 0 : return -ENOMEM;
556 : : }
557 : :
558 [ # # # # : 2 : fsdev_io->u_in.link.fobject = fobject;
# # # # ]
559 [ # # # # : 2 : fsdev_io->u_in.link.new_parent_fobject = new_parent_fobject;
# # # # ]
560 : :
561 : 2 : fsdev_io_submit(fsdev_io);
562 : 2 : return 0;
563 : 0 : }
564 : :
565 : : static void
566 : 3 : _spdk_fsdev_fopen_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
567 : : {
568 : 3 : struct spdk_io_channel *ch = cb_arg;
569 : :
570 [ # # # # : 3 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_fopen_cpl_cb, fsdev_io->u_out.open.fhandle);
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# ]
571 : :
572 : 3 : fsdev_io_free(fsdev_io);
573 : 3 : }
574 : :
575 : : int
576 : 3 : spdk_fsdev_fopen(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
577 : : struct spdk_fsdev_file_object *fobject, uint32_t flags,
578 : : spdk_fsdev_fopen_cpl_cb cb_fn, void *cb_arg)
579 : : {
580 : : struct spdk_fsdev_io *fsdev_io;
581 : :
582 : 3 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_fopen_cb, ch,
583 : : SPDK_FSDEV_IO_OPEN);
584 [ - + ]: 3 : if (!fsdev_io) {
585 : 0 : return -ENOBUFS;
586 : : }
587 : :
588 [ # # # # : 3 : fsdev_io->u_in.open.fobject = fobject;
# # # # ]
589 [ # # # # : 3 : fsdev_io->u_in.open.flags = flags;
# # # # ]
590 : :
591 : 3 : fsdev_io_submit(fsdev_io);
592 : 3 : return 0;
593 : 0 : }
594 : :
595 : : static void
596 : 131042 : _spdk_fsdev_read_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
597 : : {
598 : 131042 : struct spdk_io_channel *ch = cb_arg;
599 : :
600 [ # # # # : 131042 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_read_cpl_cb, fsdev_io->u_out.read.data_size);
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# ]
601 : :
602 : 131042 : fsdev_io_free(fsdev_io);
603 : 131042 : }
604 : :
605 : : int
606 : 131042 : spdk_fsdev_read(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
607 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle,
608 : : size_t size, uint64_t offs, uint32_t flags,
609 : : struct iovec *iov, uint32_t iovcnt, struct spdk_fsdev_io_opts *opts,
610 : : spdk_fsdev_read_cpl_cb cb_fn, void *cb_arg)
611 : : {
612 : : struct spdk_fsdev_io *fsdev_io;
613 : :
614 : 131042 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_read_cb, ch,
615 : : SPDK_FSDEV_IO_READ);
616 [ - + ]: 131042 : if (!fsdev_io) {
617 : 0 : return -ENOBUFS;
618 : : }
619 : :
620 [ # # # # : 131042 : fsdev_io->u_in.read.fobject = fobject;
# # # # ]
621 [ # # # # : 131042 : fsdev_io->u_in.read.fhandle = fhandle;
# # # # ]
622 [ # # # # : 131042 : fsdev_io->u_in.read.size = size;
# # # # ]
623 [ # # # # : 131042 : fsdev_io->u_in.read.offs = offs;
# # # # ]
624 [ # # # # : 131042 : fsdev_io->u_in.read.flags = flags;
# # # # ]
625 [ # # # # : 131042 : fsdev_io->u_in.read.iov = iov;
# # # # ]
626 [ # # # # : 131042 : fsdev_io->u_in.read.iovcnt = iovcnt;
# # # # ]
627 [ # # # # : 131042 : fsdev_io->u_in.read.opts = opts;
# # # # ]
628 : :
629 : 131042 : fsdev_io_submit(fsdev_io);
630 : 131042 : return 0;
631 : 0 : }
632 : :
633 : : static void
634 : 393250 : _spdk_fsdev_write_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
635 : : {
636 : 393250 : struct spdk_io_channel *ch = cb_arg;
637 : :
638 [ # # # # : 393250 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_write_cpl_cb, fsdev_io->u_out.write.data_size);
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# ]
639 : :
640 : 393250 : fsdev_io_free(fsdev_io);
641 : 393250 : }
642 : :
643 : : int
644 : 393250 : spdk_fsdev_write(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
645 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle,
646 : : size_t size, uint64_t offs, uint64_t flags,
647 : : const struct iovec *iov, uint32_t iovcnt, struct spdk_fsdev_io_opts *opts,
648 : : spdk_fsdev_write_cpl_cb cb_fn, void *cb_arg)
649 : : {
650 : : struct spdk_fsdev_io *fsdev_io;
651 : :
652 : 393250 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_write_cb, ch,
653 : : SPDK_FSDEV_IO_WRITE);
654 [ - + ]: 393250 : if (!fsdev_io) {
655 : 0 : return -ENOBUFS;
656 : : }
657 : :
658 [ # # # # : 393250 : fsdev_io->u_in.write.fobject = fobject;
# # # # ]
659 [ # # # # : 393250 : fsdev_io->u_in.write.fhandle = fhandle;
# # # # ]
660 [ # # # # : 393250 : fsdev_io->u_in.write.size = size;
# # # # ]
661 [ # # # # : 393250 : fsdev_io->u_in.write.offs = offs;
# # # # ]
662 [ # # # # : 393250 : fsdev_io->u_in.write.flags = flags;
# # # # ]
663 [ # # # # : 393250 : fsdev_io->u_in.write.iov = iov;
# # # # ]
664 [ # # # # : 393250 : fsdev_io->u_in.write.iovcnt = iovcnt;
# # # # ]
665 [ # # # # : 393250 : fsdev_io->u_in.write.opts = opts;
# # # # ]
666 : :
667 : 393250 : fsdev_io_submit(fsdev_io);
668 : 393250 : return 0;
669 : 0 : }
670 : :
671 : : static void
672 : 3 : _spdk_fsdev_statfs_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
673 : : {
674 : 3 : struct spdk_io_channel *ch = cb_arg;
675 : :
676 [ # # # # : 3 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_statfs_cpl_cb, &fsdev_io->u_out.statfs.statfs);
# # # # #
# # # # #
# # # # #
# # # # #
# # # # ]
677 : :
678 : 3 : fsdev_io_free(fsdev_io);
679 : 3 : }
680 : :
681 : : int
682 : 3 : spdk_fsdev_statfs(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
683 : : struct spdk_fsdev_file_object *fobject, spdk_fsdev_statfs_cpl_cb cb_fn, void *cb_arg)
684 : : {
685 : : struct spdk_fsdev_io *fsdev_io;
686 : :
687 : 3 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_statfs_cb, ch,
688 : : SPDK_FSDEV_IO_STATFS);
689 [ - + ]: 3 : if (!fsdev_io) {
690 : 0 : return -ENOBUFS;
691 : : }
692 : :
693 [ # # # # : 3 : fsdev_io->u_in.statfs.fobject = fobject;
# # # # ]
694 : :
695 : 3 : fsdev_io_submit(fsdev_io);
696 : 3 : return 0;
697 : 0 : }
698 : :
699 : : static void
700 : 4 : _spdk_fsdev_release_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
701 : : {
702 : 4 : struct spdk_io_channel *ch = cb_arg;
703 : :
704 [ # # # # : 4 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_release_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
705 : :
706 : 4 : fsdev_io_free(fsdev_io);
707 : 4 : }
708 : :
709 : : int
710 : 4 : spdk_fsdev_release(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
711 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle,
712 : : spdk_fsdev_release_cpl_cb cb_fn, void *cb_arg)
713 : : {
714 : : struct spdk_fsdev_io *fsdev_io;
715 : :
716 : 4 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_release_cb, ch,
717 : : SPDK_FSDEV_IO_RELEASE);
718 [ - + ]: 4 : if (!fsdev_io) {
719 : 0 : return -ENOBUFS;
720 : : }
721 : :
722 [ # # # # : 4 : fsdev_io->u_in.release.fobject = fobject;
# # # # ]
723 [ # # # # : 4 : fsdev_io->u_in.release.fhandle = fhandle;
# # # # ]
724 : :
725 : 4 : fsdev_io_submit(fsdev_io);
726 : 4 : return 0;
727 : 0 : }
728 : :
729 : : static void
730 : 3 : _spdk_fsdev_fsync_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
731 : : {
732 : 3 : struct spdk_io_channel *ch = cb_arg;
733 : :
734 [ # # # # : 3 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_fsync_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
735 : :
736 : 3 : fsdev_io_free(fsdev_io);
737 : 3 : }
738 : :
739 : : int
740 : 3 : spdk_fsdev_fsync(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
741 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle, bool datasync,
742 : : spdk_fsdev_fsync_cpl_cb cb_fn, void *cb_arg)
743 : : {
744 : : struct spdk_fsdev_io *fsdev_io;
745 : :
746 : 3 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_fsync_cb, ch,
747 : : SPDK_FSDEV_IO_FSYNC);
748 [ - + ]: 3 : if (!fsdev_io) {
749 : 0 : return -ENOBUFS;
750 : : }
751 : :
752 [ # # # # : 3 : fsdev_io->u_in.fsync.fobject = fobject;
# # # # ]
753 [ # # # # : 3 : fsdev_io->u_in.fsync.fhandle = fhandle;
# # # # ]
754 [ # # # # : 3 : fsdev_io->u_in.fsync.datasync = datasync;
# # # # #
# ]
755 : :
756 : 3 : fsdev_io_submit(fsdev_io);
757 : 3 : return 0;
758 : 0 : }
759 : :
760 : : static void
761 : 2 : _spdk_fsdev_setxattr_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
762 : : {
763 : 2 : struct spdk_io_channel *ch = cb_arg;
764 : :
765 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_setxattr_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
766 : :
767 [ # # # # : 2 : free(fsdev_io->u_in.setxattr.value);
# # # # ]
768 [ # # # # : 2 : free(fsdev_io->u_in.setxattr.name);
# # # # ]
769 : :
770 : 2 : fsdev_io_free(fsdev_io);
771 : 2 : }
772 : :
773 : : int
774 : 2 : spdk_fsdev_setxattr(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
775 : : struct spdk_fsdev_file_object *fobject, const char *name, const char *value, size_t size,
776 : : uint32_t flags, spdk_fsdev_setxattr_cpl_cb cb_fn, void *cb_arg)
777 : : {
778 : : struct spdk_fsdev_io *fsdev_io;
779 : :
780 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_setxattr_cb, ch,
781 : : SPDK_FSDEV_IO_SETXATTR);
782 [ - + ]: 2 : if (!fsdev_io) {
783 : 0 : return -ENOBUFS;
784 : : }
785 : :
786 [ - + # # : 2 : fsdev_io->u_in.setxattr.name = strdup(name);
# # # # #
# ]
787 [ - + # # : 2 : if (!fsdev_io->u_in.setxattr.name) {
# # # # #
# ]
788 : 0 : fsdev_io_free(fsdev_io);
789 : 0 : return -ENOMEM;
790 : : }
791 : :
792 [ # # # # : 2 : fsdev_io->u_in.setxattr.value = malloc(size);
# # # # ]
793 [ - + # # : 2 : if (!fsdev_io->u_in.setxattr.value) {
# # # # #
# ]
794 [ # # # # : 0 : free(fsdev_io->u_in.setxattr.name);
# # # # ]
795 : 0 : fsdev_io_free(fsdev_io);
796 : 0 : return -ENOMEM;
797 : : }
798 : :
799 [ - + - + : 2 : memcpy(fsdev_io->u_in.setxattr.value, value, size);
# # # # #
# # # ]
800 [ # # # # : 2 : fsdev_io->u_in.setxattr.fobject = fobject;
# # # # ]
801 [ # # # # : 2 : fsdev_io->u_in.setxattr.size = size;
# # # # ]
802 [ # # # # : 2 : fsdev_io->u_in.setxattr.flags = flags;
# # # # ]
803 : :
804 : 2 : fsdev_io_submit(fsdev_io);
805 : 2 : return 0;
806 : 0 : }
807 : :
808 : : static void
809 : 3 : _spdk_fsdev_getxattr_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
810 : : {
811 : 3 : struct spdk_io_channel *ch = cb_arg;
812 : :
813 [ # # # # : 3 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_getxattr_cpl_cb, fsdev_io->u_out.getxattr.value_size);
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# ]
814 : :
815 [ # # # # : 3 : free(fsdev_io->u_in.getxattr.name);
# # # # ]
816 : :
817 : 3 : fsdev_io_free(fsdev_io);
818 : 3 : }
819 : :
820 : : int
821 : 3 : spdk_fsdev_getxattr(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
822 : : struct spdk_fsdev_file_object *fobject, const char *name, void *buffer, size_t size,
823 : : spdk_fsdev_getxattr_cpl_cb cb_fn, void *cb_arg)
824 : : {
825 : : struct spdk_fsdev_io *fsdev_io;
826 : :
827 : 3 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_getxattr_cb, ch,
828 : : SPDK_FSDEV_IO_GETXATTR);
829 [ - + ]: 3 : if (!fsdev_io) {
830 : 0 : return -ENOBUFS;
831 : : }
832 : :
833 [ - + # # : 3 : fsdev_io->u_in.getxattr.name = strdup(name);
# # # # #
# ]
834 [ - + # # : 3 : if (!fsdev_io->u_in.getxattr.name) {
# # # # #
# ]
835 : 0 : fsdev_io_free(fsdev_io);
836 : 0 : return -ENOMEM;
837 : : }
838 : :
839 [ # # # # : 3 : fsdev_io->u_in.getxattr.fobject = fobject;
# # # # ]
840 [ # # # # : 3 : fsdev_io->u_in.getxattr.buffer = buffer;
# # # # ]
841 [ # # # # : 3 : fsdev_io->u_in.getxattr.size = size;
# # # # ]
842 : :
843 : 3 : fsdev_io_submit(fsdev_io);
844 : 3 : return 0;
845 : 0 : }
846 : :
847 : : static void
848 : 4 : _spdk_fsdev_listxattr_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
849 : : {
850 : 4 : struct spdk_io_channel *ch = cb_arg;
851 : :
852 [ - + # # : 4 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_listxattr_cpl_cb, fsdev_io->u_out.listxattr.data_size,
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# ]
853 : : fsdev_io->u_out.listxattr.size_only);
854 : :
855 : 4 : fsdev_io_free(fsdev_io);
856 : 4 : }
857 : :
858 : : int
859 : 4 : spdk_fsdev_listxattr(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
860 : : struct spdk_fsdev_file_object *fobject, char *buffer, size_t size,
861 : : spdk_fsdev_listxattr_cpl_cb cb_fn, void *cb_arg)
862 : : {
863 : : struct spdk_fsdev_io *fsdev_io;
864 : :
865 : 4 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_listxattr_cb, ch,
866 : : SPDK_FSDEV_IO_LISTXATTR);
867 [ - + ]: 4 : if (!fsdev_io) {
868 : 0 : return -ENOBUFS;
869 : : }
870 : :
871 [ # # # # : 4 : fsdev_io->u_in.listxattr.fobject = fobject;
# # # # ]
872 [ # # # # : 4 : fsdev_io->u_in.listxattr.buffer = buffer;
# # # # ]
873 [ # # # # : 4 : fsdev_io->u_in.listxattr.size = size;
# # # # ]
874 : :
875 : 4 : fsdev_io_submit(fsdev_io);
876 : 4 : return 0;
877 : 0 : }
878 : :
879 : : static void
880 : 2 : _spdk_fsdev_removexattr_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
881 : : {
882 : 2 : struct spdk_io_channel *ch = cb_arg;
883 : :
884 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_removexattr_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
885 : :
886 [ # # # # : 2 : free(fsdev_io->u_in.removexattr.name);
# # # # ]
887 : :
888 : 2 : fsdev_io_free(fsdev_io);
889 : 2 : }
890 : :
891 : : int
892 : 2 : spdk_fsdev_removexattr(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
893 : : struct spdk_fsdev_file_object *fobject, const char *name,
894 : : spdk_fsdev_removexattr_cpl_cb cb_fn, void *cb_arg)
895 : : {
896 : : struct spdk_fsdev_io *fsdev_io;
897 : :
898 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_removexattr_cb, ch,
899 : : SPDK_FSDEV_IO_REMOVEXATTR);
900 [ - + ]: 2 : if (!fsdev_io) {
901 : 0 : return -ENOBUFS;
902 : : }
903 : :
904 [ - + # # : 2 : fsdev_io->u_in.removexattr.name = strdup(name);
# # # # #
# ]
905 [ - + # # : 2 : if (!fsdev_io->u_in.removexattr.name) {
# # # # #
# ]
906 : 0 : fsdev_io_free(fsdev_io);
907 : 0 : return -ENOMEM;
908 : : }
909 : :
910 [ # # # # : 2 : fsdev_io->u_in.removexattr.fobject = fobject;
# # # # ]
911 : :
912 : 2 : fsdev_io_submit(fsdev_io);
913 : 2 : return 0;
914 : 0 : }
915 : :
916 : : static void
917 : 4 : _spdk_fsdev_flush_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
918 : : {
919 : 4 : struct spdk_io_channel *ch = cb_arg;
920 : :
921 [ # # # # : 4 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_flush_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
922 : :
923 : 4 : fsdev_io_free(fsdev_io);
924 : 4 : }
925 : :
926 : : int
927 : 4 : spdk_fsdev_flush(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
928 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle,
929 : : spdk_fsdev_flush_cpl_cb cb_fn, void *cb_arg)
930 : : {
931 : : struct spdk_fsdev_io *fsdev_io;
932 : :
933 : 4 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_flush_cb, ch,
934 : : SPDK_FSDEV_IO_FLUSH);
935 [ - + ]: 4 : if (!fsdev_io) {
936 : 0 : return -ENOBUFS;
937 : : }
938 : :
939 [ # # # # : 4 : fsdev_io->u_in.flush.fobject = fobject;
# # # # ]
940 [ # # # # : 4 : fsdev_io->u_in.flush.fhandle = fhandle;
# # # # ]
941 : :
942 : 4 : fsdev_io_submit(fsdev_io);
943 : 4 : return 0;
944 : 0 : }
945 : :
946 : : static void
947 : 2 : _spdk_fsdev_opendir_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
948 : : {
949 : 2 : struct spdk_io_channel *ch = cb_arg;
950 : :
951 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_opendir_cpl_cb, fsdev_io->u_out.opendir.fhandle);
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# ]
952 : :
953 : 2 : fsdev_io_free(fsdev_io);
954 : 2 : }
955 : :
956 : : int
957 : 2 : spdk_fsdev_opendir(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
958 : : struct spdk_fsdev_file_object *fobject, uint32_t flags,
959 : : spdk_fsdev_opendir_cpl_cb cb_fn, void *cb_arg)
960 : : {
961 : : struct spdk_fsdev_io *fsdev_io;
962 : :
963 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_opendir_cb, ch,
964 : : SPDK_FSDEV_IO_OPENDIR);
965 [ - + ]: 2 : if (!fsdev_io) {
966 : 0 : return -ENOBUFS;
967 : : }
968 : :
969 [ # # # # : 2 : fsdev_io->u_in.opendir.fobject = fobject;
# # # # ]
970 [ # # # # : 2 : fsdev_io->u_in.opendir.flags = flags;
# # # # ]
971 : :
972 : 2 : fsdev_io_submit(fsdev_io);
973 : 2 : return 0;
974 : 0 : }
975 : :
976 : : static int
977 : 40 : _spdk_fsdev_readdir_entry_clb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
978 : : {
979 [ # # # # : 40 : spdk_fsdev_readdir_entry_cb *usr_entry_cb_fn = fsdev_io->u_in.readdir.usr_entry_cb_fn;
# # # # ]
980 : 40 : struct spdk_io_channel *ch = cb_arg;
981 : :
982 [ # # # # : 80 : return usr_entry_cb_fn(fsdev_io->internal.usr_cb_arg, ch, fsdev_io->u_out.readdir.name,
# # # # #
# # # # #
# # # # ]
983 [ # # # # : 40 : fsdev_io->u_out.readdir.fobject, &fsdev_io->u_out.readdir.attr, fsdev_io->u_out.readdir.offset);
# # # # #
# # # # #
# # # # #
# # # ]
984 : : }
985 : :
986 : : static void
987 : 2 : _spdk_fsdev_readdir_emum_clb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
988 : : {
989 : 2 : struct spdk_io_channel *ch = cb_arg;
990 : :
991 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_readdir_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
992 : :
993 : 2 : fsdev_io_free(fsdev_io);
994 : 2 : }
995 : :
996 : : int
997 : 2 : spdk_fsdev_readdir(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
998 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle, uint64_t offset,
999 : : spdk_fsdev_readdir_entry_cb entry_cb_fn, spdk_fsdev_readdir_cpl_cb cpl_cb_fn, void *cb_arg)
1000 : : {
1001 : : struct spdk_fsdev_io *fsdev_io;
1002 : :
1003 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cpl_cb_fn, cb_arg,
1004 : 0 : _spdk_fsdev_readdir_emum_clb, ch, SPDK_FSDEV_IO_READDIR);
1005 [ - + ]: 2 : if (!fsdev_io) {
1006 : 0 : return -ENOBUFS;
1007 : : }
1008 : :
1009 [ # # # # : 2 : fsdev_io->u_in.readdir.fobject = fobject;
# # # # ]
1010 [ # # # # : 2 : fsdev_io->u_in.readdir.fhandle = fhandle;
# # # # ]
1011 [ # # # # : 2 : fsdev_io->u_in.readdir.offset = offset;
# # # # ]
1012 [ # # # # : 2 : fsdev_io->u_in.readdir.entry_cb_fn = _spdk_fsdev_readdir_entry_clb;
# # # # ]
1013 [ # # # # : 2 : fsdev_io->u_in.readdir.usr_entry_cb_fn = entry_cb_fn;
# # # # ]
1014 : :
1015 : 2 : fsdev_io_submit(fsdev_io);
1016 : 2 : return 0;
1017 : 0 : }
1018 : :
1019 : : static void
1020 : 2 : _spdk_fsdev_releasedir_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
1021 : : {
1022 : 2 : struct spdk_io_channel *ch = cb_arg;
1023 : :
1024 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_releasedir_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
1025 : :
1026 : 2 : fsdev_io_free(fsdev_io);
1027 : 2 : }
1028 : :
1029 : : int
1030 : 2 : spdk_fsdev_releasedir(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
1031 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle,
1032 : : spdk_fsdev_releasedir_cpl_cb cb_fn, void *cb_arg)
1033 : : {
1034 : : struct spdk_fsdev_io *fsdev_io;
1035 : :
1036 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_releasedir_cb, ch,
1037 : : SPDK_FSDEV_IO_RELEASEDIR);
1038 [ - + ]: 2 : if (!fsdev_io) {
1039 : 0 : return -ENOBUFS;
1040 : : }
1041 : :
1042 [ # # # # : 2 : fsdev_io->u_in.releasedir.fobject = fobject;
# # # # ]
1043 [ # # # # : 2 : fsdev_io->u_in.releasedir.fhandle = fhandle;
# # # # ]
1044 : :
1045 : 2 : fsdev_io_submit(fsdev_io);
1046 : 2 : return 0;
1047 : 0 : }
1048 : :
1049 : : static void
1050 : 2 : _spdk_fsdev_fsyncdir_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
1051 : : {
1052 : 2 : struct spdk_io_channel *ch = cb_arg;
1053 : :
1054 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_fsyncdir_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
1055 : :
1056 : 2 : fsdev_io_free(fsdev_io);
1057 : 2 : }
1058 : :
1059 : : int
1060 : 2 : spdk_fsdev_fsyncdir(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
1061 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle, bool datasync,
1062 : : spdk_fsdev_fsyncdir_cpl_cb cb_fn, void *cb_arg)
1063 : : {
1064 : : struct spdk_fsdev_io *fsdev_io;
1065 : :
1066 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_fsyncdir_cb, ch,
1067 : : SPDK_FSDEV_IO_FSYNCDIR);
1068 [ - + ]: 2 : if (!fsdev_io) {
1069 : 0 : return -ENOBUFS;
1070 : : }
1071 : :
1072 [ # # # # : 2 : fsdev_io->u_in.fsyncdir.fobject = fobject;
# # # # ]
1073 [ # # # # : 2 : fsdev_io->u_in.fsyncdir.fhandle = fhandle;
# # # # ]
1074 [ # # # # : 2 : fsdev_io->u_in.fsyncdir.datasync = datasync;
# # # # #
# ]
1075 : :
1076 : 2 : fsdev_io_submit(fsdev_io);
1077 : 2 : return 0;
1078 : 0 : }
1079 : :
1080 : : static void
1081 : 2 : _spdk_fsdev_flock_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
1082 : : {
1083 : 2 : struct spdk_io_channel *ch = cb_arg;
1084 : :
1085 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_flock_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
1086 : :
1087 : 2 : fsdev_io_free(fsdev_io);
1088 : 2 : }
1089 : :
1090 : : int
1091 : 2 : spdk_fsdev_flock(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
1092 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle, int operation,
1093 : : spdk_fsdev_flock_cpl_cb cb_fn, void *cb_arg)
1094 : : {
1095 : : struct spdk_fsdev_io *fsdev_io;
1096 : :
1097 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_flock_cb, ch,
1098 : : SPDK_FSDEV_IO_FLOCK);
1099 [ - + ]: 2 : if (!fsdev_io) {
1100 : 0 : return -ENOBUFS;
1101 : : }
1102 : :
1103 [ # # # # : 2 : fsdev_io->u_in.flock.fobject = fobject;
# # # # ]
1104 [ # # # # : 2 : fsdev_io->u_in.flock.fhandle = fhandle;
# # # # ]
1105 [ # # # # : 2 : fsdev_io->u_in.flock.operation = operation;
# # # # ]
1106 : :
1107 : 2 : fsdev_io_submit(fsdev_io);
1108 : 2 : return 0;
1109 : 0 : }
1110 : :
1111 : : static void
1112 : 3 : _spdk_fsdev_create_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
1113 : : {
1114 : 3 : struct spdk_io_channel *ch = cb_arg;
1115 : :
1116 [ # # # # : 3 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_create_cpl_cb, fsdev_io->u_out.create.fobject,
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # #
# ]
1117 : : &fsdev_io->u_out.create.attr, fsdev_io->u_out.create.fhandle);
1118 : :
1119 [ # # # # : 3 : free(fsdev_io->u_in.create.name);
# # # # ]
1120 : :
1121 : 3 : fsdev_io_free(fsdev_io);
1122 : 3 : }
1123 : :
1124 : : int
1125 : 3 : spdk_fsdev_create(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
1126 : : struct spdk_fsdev_file_object *parent_fobject, const char *name, mode_t mode, uint32_t flags,
1127 : : mode_t umask, uid_t euid, gid_t egid, spdk_fsdev_create_cpl_cb cb_fn, void *cb_arg)
1128 : : {
1129 : : struct spdk_fsdev_io *fsdev_io;
1130 : :
1131 : 3 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_create_cb, ch,
1132 : : SPDK_FSDEV_IO_CREATE);
1133 [ - + ]: 3 : if (!fsdev_io) {
1134 : 0 : return -ENOBUFS;
1135 : : }
1136 : :
1137 [ - + # # : 3 : fsdev_io->u_in.create.name = strdup(name);
# # # # #
# ]
1138 [ - + # # : 3 : if (!fsdev_io->u_in.create.name) {
# # # # #
# ]
1139 : 0 : fsdev_io_free(fsdev_io);
1140 : 0 : return -ENOMEM;
1141 : : }
1142 : :
1143 [ # # # # : 3 : fsdev_io->u_in.create.parent_fobject = parent_fobject;
# # # # ]
1144 [ # # # # : 3 : fsdev_io->u_in.create.mode = mode;
# # # # ]
1145 [ # # # # : 3 : fsdev_io->u_in.create.flags = flags;
# # # # ]
1146 [ # # # # : 3 : fsdev_io->u_in.create.umask = umask;
# # # # ]
1147 [ # # # # : 3 : fsdev_io->u_in.create.euid = euid;
# # # # ]
1148 [ # # # # : 3 : fsdev_io->u_in.create.egid = egid;
# # # # ]
1149 : :
1150 : 3 : fsdev_io_submit(fsdev_io);
1151 : 3 : return 0;
1152 : 0 : }
1153 : :
1154 : : static void
1155 : 2 : _spdk_fsdev_interrupt_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
1156 : : {
1157 : 2 : struct spdk_io_channel *ch = cb_arg;
1158 : :
1159 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_abort_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
1160 : :
1161 : 2 : fsdev_io_free(fsdev_io);
1162 : 2 : }
1163 : :
1164 : : int
1165 : 2 : spdk_fsdev_abort(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch,
1166 : : uint64_t unique_to_abort, spdk_fsdev_abort_cpl_cb cb_fn, void *cb_arg)
1167 : : {
1168 : : struct spdk_fsdev_io *fsdev_io;
1169 : :
1170 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, 0, cb_fn, cb_arg, _spdk_fsdev_interrupt_cb, ch,
1171 : : SPDK_FSDEV_IO_ABORT);
1172 [ - + ]: 2 : if (!fsdev_io) {
1173 : 0 : return -ENOBUFS;
1174 : : }
1175 : :
1176 [ # # # # : 2 : fsdev_io->u_in.abort.unique_to_abort = unique_to_abort;
# # # # ]
1177 : :
1178 : 2 : fsdev_io_submit(fsdev_io);
1179 : 2 : return 0;
1180 : 0 : }
1181 : :
1182 : : static void
1183 : 3 : _spdk_fsdev_fallocate_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
1184 : : {
1185 : 3 : struct spdk_io_channel *ch = cb_arg;
1186 : :
1187 [ # # # # : 3 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_fallocate_cpl_cb);
# # # # #
# # # # #
# # # # #
# # # ]
1188 : :
1189 : 3 : fsdev_io_free(fsdev_io);
1190 : 3 : }
1191 : :
1192 : : int
1193 : 3 : spdk_fsdev_fallocate(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch, uint64_t unique,
1194 : : struct spdk_fsdev_file_object *fobject, struct spdk_fsdev_file_handle *fhandle,
1195 : : int mode, off_t offset, off_t length,
1196 : : spdk_fsdev_fallocate_cpl_cb cb_fn, void *cb_arg)
1197 : : {
1198 : : struct spdk_fsdev_io *fsdev_io;
1199 : :
1200 : 3 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_fallocate_cb, ch,
1201 : : SPDK_FSDEV_IO_FALLOCATE);
1202 [ - + ]: 3 : if (!fsdev_io) {
1203 : 0 : return -ENOBUFS;
1204 : : }
1205 : :
1206 [ # # # # : 3 : fsdev_io->u_in.fallocate.fobject = fobject;
# # # # ]
1207 [ # # # # : 3 : fsdev_io->u_in.fallocate.fhandle = fhandle;
# # # # ]
1208 [ # # # # : 3 : fsdev_io->u_in.fallocate.mode = mode;
# # # # ]
1209 [ # # # # : 3 : fsdev_io->u_in.fallocate.offset = offset;
# # # # ]
1210 [ # # # # : 3 : fsdev_io->u_in.fallocate.length = length;
# # # # ]
1211 : :
1212 : 3 : fsdev_io_submit(fsdev_io);
1213 : 3 : return 0;
1214 : 0 : }
1215 : :
1216 : : static void
1217 : 2 : _spdk_fsdev_copy_file_range_cb(struct spdk_fsdev_io *fsdev_io, void *cb_arg)
1218 : : {
1219 : 2 : struct spdk_io_channel *ch = cb_arg;
1220 : :
1221 [ # # # # : 2 : CALL_USR_CLB(fsdev_io, ch, spdk_fsdev_copy_file_range_cpl_cb,
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# ]
1222 : : fsdev_io->u_out.copy_file_range.data_size);
1223 : :
1224 : 2 : fsdev_io_free(fsdev_io);
1225 : 2 : }
1226 : :
1227 : : int
1228 : 2 : spdk_fsdev_copy_file_range(struct spdk_fsdev_desc *desc, struct spdk_io_channel *ch,
1229 : : uint64_t unique,
1230 : : struct spdk_fsdev_file_object *fobject_in, struct spdk_fsdev_file_handle *fhandle_in, off_t off_in,
1231 : : struct spdk_fsdev_file_object *fobject_out, struct spdk_fsdev_file_handle *fhandle_out,
1232 : : off_t off_out, size_t len, uint32_t flags,
1233 : : spdk_fsdev_copy_file_range_cpl_cb cb_fn, void *cb_arg)
1234 : : {
1235 : : struct spdk_fsdev_io *fsdev_io;
1236 : :
1237 : 2 : fsdev_io = fsdev_io_get_and_fill(desc, ch, unique, cb_fn, cb_arg, _spdk_fsdev_copy_file_range_cb,
1238 : 0 : ch,
1239 : : SPDK_FSDEV_IO_COPY_FILE_RANGE);
1240 [ - + ]: 2 : if (!fsdev_io) {
1241 : 0 : return -ENOBUFS;
1242 : : }
1243 : :
1244 [ # # # # : 2 : fsdev_io->u_in.copy_file_range.fobject_in = fobject_in;
# # # # ]
1245 [ # # # # : 2 : fsdev_io->u_in.copy_file_range.fhandle_in = fhandle_in;
# # # # ]
1246 [ # # # # : 2 : fsdev_io->u_in.copy_file_range.off_in = off_in;
# # # # ]
1247 [ # # # # : 2 : fsdev_io->u_in.copy_file_range.fobject_out = fobject_out;
# # # # ]
1248 [ # # # # : 2 : fsdev_io->u_in.copy_file_range.fhandle_out = fhandle_out;
# # # # ]
1249 [ # # # # : 2 : fsdev_io->u_in.copy_file_range.off_out = off_out;
# # # # ]
1250 [ # # # # : 2 : fsdev_io->u_in.copy_file_range.len = len;
# # # # ]
1251 [ # # # # : 2 : fsdev_io->u_in.copy_file_range.flags = flags;
# # # # ]
1252 : :
1253 : 2 : fsdev_io_submit(fsdev_io);
1254 : 2 : return 0;
1255 : 0 : }
|