Initial support for NSM
[deb_libnfs.git] / include / nfsc / libnfs-raw.h
1 /*
2 Copyright (C) 2010 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, see <http://www.gnu.org/licenses/>.
16 */
17 /*
18 * This is the lowlevel interface to access NFS resources.
19 * Through this interface you have access to the full gamut of nfs and nfs related
20 * protocol as well as the XDR encoded/decoded structures.
21 */
22 #ifndef _LIBNFS_RAW_H_
23 #define _LIBNFS_RAW_H_
24
25 #include <stdint.h>
26 #include <nfsc/libnfs-zdr.h>
27
28 struct rpc_data {
29 int size;
30 unsigned char *data;
31 };
32
33 struct rpc_context;
34 struct rpc_context *rpc_init_context(void);
35 void rpc_destroy_context(struct rpc_context *rpc);
36
37 void rpc_set_auth(struct rpc_context *rpc, struct AUTH *auth);
38
39 int rpc_get_fd(struct rpc_context *rpc);
40 int rpc_which_events(struct rpc_context *rpc);
41 int rpc_service(struct rpc_context *rpc, int revents);
42 char *rpc_get_error(struct rpc_context *rpc);
43 int rpc_queue_length(struct rpc_context *rpc);
44
45 /* Utility function to get an RPC context from a NFS context. Useful for doing low level NFSACL
46 * calls on a NFS context.
47 */
48 struct rpc_context *nfs_get_rpc_context(struct nfs_context *nfs);
49
50 /* This function returns the nfs_fh3 structure from a nfsfh structure.
51 This allows to use a file onened with nfs_open() together with low-level
52 rpc functions that thake a nfs filehandle
53 */
54 struct nfs_fh3 *nfs_get_fh(struct nfsfh *nfsfh);
55
56 /* Control what the next XID value to be used on the context will be.
57 This can be used when multiple contexts are used to the same server
58 to avoid that the two contexts have xid collissions.
59 */
60 void rpc_set_next_xid(struct rpc_context *rpc, uint32_t xid);
61
62 #define RPC_STATUS_SUCCESS 0
63 #define RPC_STATUS_ERROR 1
64 #define RPC_STATUS_CANCEL 2
65
66 /*
67 * Async connection to the tcp port at server:port.
68 * Function returns
69 * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked.
70 * <0 : An error occured when trying to set up the connection. The callback will not be invoked.
71 *
72 * When the callback is invoked, status indicates the result:
73 * RPC_STATUS_SUCCESS : The tcp connection was successfully established.
74 * data is NULL.
75 * RPC_STATUS_ERROR : The connection failed to establish.
76 * data is the erro string.
77 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
78 * : data is NULL.
79 */
80 int rpc_connect_async(struct rpc_context *rpc, const char *server, int port, rpc_cb cb, void *private_data);
81 /*
82 * Async function to connect to a specific RPC program/version
83 * Function returns
84 * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked.
85 * <0 : An error occured when trying to set up the connection. The callback will not be invoked.
86 *
87 * When the callback is invoked, status indicates the result:
88 * RPC_STATUS_SUCCESS : The tcp connection was successfully established.
89 * data is NULL.
90 * RPC_STATUS_ERROR : The connection failed to establish.
91 * data is the erro string.
92 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
93 * : data is NULL.
94 */
95 int rpc_connect_program_async(struct rpc_context *rpc, char *server, int program, int version, rpc_cb cb, void *private_data);
96 /*
97 * When disconnecting a connection in flight. All commands in flight will be called with the callback
98 * and status RPC_STATUS_ERROR. Data will be the error string for the disconnection.
99 */
100 int rpc_disconnect(struct rpc_context *rpc, char *error);
101
102
103 /*
104 * PORTMAP FUNCTIONS
105 */
106
107 /*
108 * Call PORTMAPPER/NULL
109 * Function returns
110 * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked.
111 * <0 : An error occured when trying to set up the connection. The callback will not be invoked.
112 *
113 * When the callback is invoked, status indicates the result:
114 * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon.
115 * data is NULL.
116 * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper.
117 * data is the error string.
118 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
119 * data is NULL.
120 */
121 int rpc_pmap_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
122
123
124 /*
125 * Call PORTMAPPER/GETPORT.
126 * Function returns
127 * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked.
128 * <0 : An error occured when trying to set up the connection. The callback will not be invoked.
129 *
130 * When the callback is invoked, status indicates the result:
131 * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon.
132 * data is a (uint32_t *), containing the port returned.
133 * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper.
134 * data is the error string.
135 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
136 * data is NULL.
137 */
138 int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, int protocol, rpc_cb cb, void *private_data);
139
140 /*
141 * Call PORTMAPPER/SET
142 * Function returns
143 * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked.
144 * <0 : An error occured when trying to set up the connection. The callback will not be invoked.
145 *
146 * When the callback is invoked, status indicates the result:
147 * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon.
148 * data is a (uint32_t *), containing status
149 * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper.
150 * data is the error string.
151 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
152 * data is NULL.
153 */
154 int rpc_pmap_set_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data);
155
156 /*
157 * Call PORTMAPPER/UNSET
158 * Function returns
159 * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked.
160 * <0 : An error occured when trying to set up the connection. The callback will not be invoked.
161 *
162 * When the callback is invoked, status indicates the result:
163 * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon.
164 * data is a (uint32_t *), containing status
165 * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper.
166 * data is the error string.
167 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
168 * data is NULL.
169 */
170 int rpc_pmap_unset_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data);
171
172 /*
173 * Call PORTMAPPER/CALLIT.
174 * Function returns
175 * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked.
176 * <0 : An error occured when trying to set up the connection. The callback will not be invoked.
177 *
178 * When the callback is invoked, status indicates the result:
179 * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon
180 * data is a 'pmap_call_result' pointer.
181 * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper.
182 * data is the error string.
183 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
184 * data is NULL.
185 */
186 int rpc_pmap_callit_async(struct rpc_context *rpc, int program, int version, int procedure, char *data, int datalen, rpc_cb cb, void *private_data);
187
188 /*
189 * MOUNT FUNCTIONS
190 */
191 char *mountstat3_to_str(int stat);
192 int mountstat3_to_errno(int error);
193
194 /*
195 * Call MOUNT/NULL
196 * Function returns
197 * 0 : The call was initiated. The callback will be invoked when the call completes.
198 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
199 *
200 * When the callback is invoked, status indicates the result:
201 * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
202 * data is NULL.
203 * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
204 * data is the error string.
205 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
206 * data is NULL.
207 */
208 int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
209
210 /*
211 * Call MOUNT/MNT
212 * Function returns
213 * 0 : The call was initiated. The callback will be invoked when the call completes.
214 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
215 *
216 * When the callback is invoked, status indicates the result:
217 * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
218 * data is union mountres3.
219 * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
220 * data is the error string.
221 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
222 * data is NULL.
223 */
224 int rpc_mount_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data);
225
226 /*
227 * Call MOUNT/DUMP
228 * Function returns
229 * 0 : The call was initiated. The callback will be invoked when the call completes.
230 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
231 *
232 * When the callback is invoked, status indicates the result:
233 * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
234 * data is a mountlist.
235 * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
236 * data is the error string.
237 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
238 * data is NULL.
239 */
240 int rpc_mount_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
241
242 /*
243 * Call MOUNT/UMNT
244 * Function returns
245 * 0 : The call was initiated. The callback will be invoked when the call completes.
246 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
247 *
248 * When the callback is invoked, status indicates the result:
249 * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
250 * data NULL.
251 * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
252 * data is the error string.
253 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
254 * data is NULL.
255 */
256 int rpc_mount_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data);
257
258 /*
259 * Call MOUNT/UMNTALL
260 * Function returns
261 * 0 : The call was initiated. The callback will be invoked when the call completes.
262 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
263 *
264 * When the callback is invoked, status indicates the result:
265 * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
266 * data NULL.
267 * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
268 * data is the error string.
269 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
270 * data is NULL.
271 */
272 int rpc_mount_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
273
274 /*
275 * Call MOUNT/EXPORT
276 * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
277 * returned structures.
278 *
279 * Function returns
280 * 0 : The call was initiated. The callback will be invoked when the call completes.
281 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
282 *
283 * When the callback is invoked, status indicates the result:
284 * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
285 * data is a pointer to an exports pointer:
286 * exports export = *(exports *)data;
287 * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
288 * data is the error string.
289 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
290 * data is NULL.
291 */
292 int rpc_mount_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
293
294
295
296
297 /*
298 * NFS FUNCTIONS
299 */
300 struct nfs_fh3;
301 char *nfsstat3_to_str(int error);
302 int nfsstat3_to_errno(int error);
303
304 /*
305 * Call NFS/NULL
306 * Function returns
307 * 0 : The call was initiated. The callback will be invoked when the call completes.
308 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
309 *
310 * When the callback is invoked, status indicates the result:
311 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
312 * data is NULL.
313 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
314 * data is the error string.
315 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
316 * data is NULL.
317 */
318 int rpc_nfs_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
319
320 /*
321 * Call NFS/GETATTR
322 * Function returns
323 * 0 : The call was initiated. The callback will be invoked when the call completes.
324 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
325 *
326 * When the callback is invoked, status indicates the result:
327 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
328 * data is GETATTR3res
329 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
330 * data is the error string.
331 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
332 * data is NULL.
333 */
334 int rpc_nfs_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
335
336 /*
337 * Call NFS/PATHCONF
338 * Function returns
339 * 0 : The call was initiated. The callback will be invoked when the call completes.
340 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
341 *
342 * When the callback is invoked, status indicates the result:
343 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
344 * data is PATHCONF3res
345 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
346 * data is the error string.
347 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
348 * data is NULL.
349 */
350 int rpc_nfs_pathconf_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
351
352 /*
353 * Call NFS/LOOKUP
354 * Function returns
355 * 0 : The call was initiated. The callback will be invoked when the call completes.
356 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
357 *
358 * When the callback is invoked, status indicates the result:
359 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
360 * data is LOOKUP3res
361 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
362 * data is the error string.
363 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
364 * data is NULL.
365 */
366 int rpc_nfs_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data);
367
368 /*
369 * Call NFS/ACCESS
370 * Function returns
371 * 0 : The call was initiated. The callback will be invoked when the call completes.
372 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
373 *
374 * When the callback is invoked, status indicates the result:
375 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
376 * data is ACCESS3res
377 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
378 * data is the error string.
379 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
380 * data is NULL.
381 */
382 int rpc_nfs_access_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, int access, void *private_data);
383
384 /*
385 * Call NFS/READ
386 * Function returns
387 * 0 : The call was initiated. The callback will be invoked when the call completes.
388 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
389 *
390 * When the callback is invoked, status indicates the result:
391 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
392 * data is READ3res
393 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
394 * data is the error string.
395 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
396 * data is NULL.
397 */
398 int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t offset, uint64_t count, void *private_data);
399
400 /*
401 * Call NFS/WRITE
402 * Function returns
403 * 0 : The call was initiated. The callback will be invoked when the call completes.
404 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
405 *
406 * When the callback is invoked, status indicates the result:
407 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
408 * data is WRITE3res *
409 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
410 * data is the error string.
411 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
412 * data is NULL.
413 */
414 int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, uint64_t offset, uint64_t count, int stable_how, void *private_data);
415
416 /*
417 * Call NFS/COMMIT
418 * Function returns
419 * 0 : The call was initiated. The callback will be invoked when the call completes.
420 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
421 *
422 * When the callback is invoked, status indicates the result:
423 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
424 * data is COMMIT3res *
425 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
426 * data is the error string.
427 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
428 * data is NULL.
429 */
430 int rpc_nfs_commit_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
431
432
433 /*
434 * Call NFS/SETATTR
435 * Function returns
436 * 0 : The call was initiated. The callback will be invoked when the call completes.
437 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
438 *
439 * When the callback is invoked, status indicates the result:
440 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
441 * data is SETATTR3res *
442 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
443 * data is the error string.
444 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
445 * data is NULL.
446 */
447 struct SETATTR3args;
448 int rpc_nfs_setattr_async(struct rpc_context *rpc, rpc_cb cb, struct SETATTR3args *args, void *private_data);
449
450
451
452 /*
453 * Call NFS/MKDIR
454 * Function returns
455 * 0 : The call was initiated. The callback will be invoked when the call completes.
456 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
457 *
458 * When the callback is invoked, status indicates the result:
459 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
460 * data is MKDIR3res *
461 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
462 * data is the error string.
463 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
464 * data is NULL.
465 */
466 struct MKDIR3args;
467 int rpc_nfs_mkdir_async(struct rpc_context *rpc, rpc_cb cb, struct MKDIR3args *args, void *private_data);
468
469
470
471
472
473 /*
474 * Call NFS/RMDIR
475 * Function returns
476 * 0 : The call was initiated. The callback will be invoked when the call completes.
477 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
478 *
479 * When the callback is invoked, status indicates the result:
480 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
481 * data is RMDIR3res *
482 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
483 * data is the error string.
484 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
485 * data is NULL.
486 */
487 int rpc_nfs_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *dir, void *private_data);
488
489
490
491
492 /*
493 * Call NFS/CREATE
494 * Function returns
495 * 0 : The call was initiated. The callback will be invoked when the call completes.
496 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
497 *
498 * When the callback is invoked, status indicates the result:
499 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
500 * data is CREATE3res *
501 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
502 * data is the error string.
503 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
504 * data is NULL.
505 */
506 struct CREATE3args;
507 int rpc_nfs_create_async(struct rpc_context *rpc, rpc_cb cb, struct CREATE3args *args, void *private_data);
508
509
510 /*
511 * Call NFS/MKNOD
512 * Function returns
513 * 0 : The call was initiated. The callback will be invoked when the call completes.
514 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
515 *
516 * When the callback is invoked, status indicates the result:
517 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
518 * data is MKNOD3res *
519 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
520 * data is the error string.
521 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
522 * data is NULL.
523 */
524 int rpc_nfs_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *file, int mode, int major, int minor, void *private_data);
525
526
527 /*
528 * Call NFS/REMOVE
529 * Function returns
530 * 0 : The call was initiated. The callback will be invoked when the call completes.
531 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
532 *
533 * When the callback is invoked, status indicates the result:
534 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
535 * data is REMOVE3res *
536 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
537 * data is the error string.
538 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
539 * data is NULL.
540 */
541 int rpc_nfs_remove_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data);
542
543
544
545 /*
546 * Call NFS/READDIR
547 * Function returns
548 * 0 : The call was initiated. The callback will be invoked when the call completes.
549 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
550 *
551 * When the callback is invoked, status indicates the result:
552 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
553 * data is READDIR3res *
554 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
555 * data is the error string.
556 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
557 * data is NULL.
558 */
559 int rpc_nfs_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data);
560
561 /*
562 * Call NFS/READDIRPLUS
563 * Function returns
564 * 0 : The call was initiated. The callback will be invoked when the call completes.
565 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
566 *
567 * When the callback is invoked, status indicates the result:
568 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
569 * data is READDIRPLUS3res *
570 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
571 * data is the error string.
572 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
573 * data is NULL.
574 */
575 int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data);
576
577 /*
578 * Call NFS/FSSTAT
579 * Function returns
580 * 0 : The call was initiated. The callback will be invoked when the call completes.
581 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
582 *
583 * When the callback is invoked, status indicates the result:
584 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
585 * data is FSSTAT3res
586 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
587 * data is the error string.
588 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
589 * data is NULL.
590 */
591 int rpc_nfs_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
592
593
594
595 /*
596 * Call NFS/FSINFO
597 * Function returns
598 * 0 : The call was initiated. The callback will be invoked when the call completes.
599 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
600 *
601 * When the callback is invoked, status indicates the result:
602 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
603 * data is FSINFO3res
604 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
605 * data is the error string.
606 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
607 * data is NULL.
608 */
609 int rpc_nfs_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
610
611
612
613 /*
614 * Call NFS/READLINK
615 * Function returns
616 * 0 : The call was initiated. The callback will be invoked when the call completes.
617 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
618 *
619 * When the callback is invoked, status indicates the result:
620 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
621 * data is READLINK3res *
622 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
623 * data is the error string.
624 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
625 * data is NULL.
626 */
627 struct READLINK3args;
628 int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct READLINK3args *args, void *private_data);
629
630
631
632 /*
633 * Call NFS/SYMLINK
634 * Function returns
635 * 0 : The call was initiated. The callback will be invoked when the call completes.
636 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
637 *
638 * When the callback is invoked, status indicates the result:
639 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
640 * data is SYMLINK3res *
641 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
642 * data is the error string.
643 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
644 * data is NULL.
645 */
646 struct SYMLINK3args;
647 int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct SYMLINK3args *args, void *private_data);
648
649
650 /*
651 * Call NFS/RENAME
652 * Function returns
653 * 0 : The call was initiated. The callback will be invoked when the call completes.
654 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
655 *
656 * When the callback is invoked, status indicates the result:
657 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
658 * data is RENAME3res *
659 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
660 * data is the error string.
661 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
662 * data is NULL.
663 */
664 int rpc_nfs_rename_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *olddir, char *oldname, struct nfs_fh3 *newdir, char *newname, void *private_data);
665
666
667
668 /*
669 * Call NFS/LINK
670 * Function returns
671 * 0 : The call was initiated. The callback will be invoked when the call completes.
672 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
673 *
674 * When the callback is invoked, status indicates the result:
675 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
676 * data is LINK3res *
677 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
678 * data is the error string.
679 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
680 * data is NULL.
681 */
682 int rpc_nfs_link_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *file, struct nfs_fh3 *newdir, char *newname, void *private_data);
683
684
685
686
687 /*
688 * RQUOTA FUNCTIONS
689 */
690 char *rquotastat_to_str(int error);
691 int rquotastat_to_errno(int error);
692
693 /*
694 * Call RQUOTA1/NULL
695 * Function returns
696 * 0 : The call was initiated. The callback will be invoked when the call completes.
697 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
698 *
699 * When the callback is invoked, status indicates the result:
700 * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon.
701 * data is NULL.
702 * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon.
703 * data is the error string.
704 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
705 * data is NULL.
706 */
707 int rpc_rquota1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
708
709 /*
710 * Call RQUOTA1/GETQUOTA
711 * Function returns
712 * 0 : The call was initiated. The callback will be invoked when the call completes.
713 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
714 *
715 * When the callback is invoked, status indicates the result:
716 * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon.
717 * data is a RQUOTA1res structure.
718 * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon.
719 * data is the error string.
720 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
721 * data is NULL.
722 */
723 int rpc_rquota1_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data);
724
725 /*
726 * Call RQUOTA1/GETACTIVEQUOTA
727 * Function returns
728 * 0 : The call was initiated. The callback will be invoked when the call completes.
729 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
730 *
731 * When the callback is invoked, status indicates the result:
732 * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon.
733 * data is a RQUOTA1res structure.
734 * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon.
735 * data is the error string.
736 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
737 * data is NULL.
738 */
739 int rpc_rquota1_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data);
740
741
742
743
744 /*
745 * Call RQUOTA2/NULL
746 * Function returns
747 * 0 : The call was initiated. The callback will be invoked when the call completes.
748 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
749 *
750 * When the callback is invoked, status indicates the result:
751 * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon.
752 * data is NULL.
753 * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon.
754 * data is the error string.
755 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
756 * data is NULL.
757 */
758 int rpc_rquota2_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
759
760 /*
761 * Call RQUOTA2/GETQUOTA
762 * Function returns
763 * 0 : The call was initiated. The callback will be invoked when the call completes.
764 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
765 *
766 * When the callback is invoked, status indicates the result:
767 * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon.
768 * data is a RQUOTA1res structure.
769 * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon.
770 * data is the error string.
771 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
772 * data is NULL.
773 */
774 int rpc_rquota2_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int type, int uid, void *private_data);
775
776 /*
777 * Call RQUOTA2/GETACTIVEQUOTA
778 * Function returns
779 * 0 : The call was initiated. The callback will be invoked when the call completes.
780 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
781 *
782 * When the callback is invoked, status indicates the result:
783 * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon.
784 * data is a RQUOTA1res structure.
785 * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon.
786 * data is the error string.
787 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
788 * data is NULL.
789 */
790 int rpc_rquota2_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int type, int uid, void *private_data);
791
792
793
794
795
796
797 /*
798 * NFSACL functions
799 */
800
801 /*
802 * Call NFSACL/NULL
803 * Call the NULL procedure for the NFSACL
804 *
805 * Function returns
806 * 0 : The call was initiated. The callback will be invoked when the call completes.
807 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
808 *
809 * When the callback is invoked, status indicates the result:
810 * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon.
811 * data is NULL
812 * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon.
813 * data is the error string.
814 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
815 * data is NULL.
816 */
817 int rpc_nfsacl_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
818
819 /*
820 * Call NFSACL/GETACL
821 *
822 * Function returns
823 * 0 : The call was initiated. The callback will be invoked when the call completes.
824 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
825 *
826 * When the callback is invoked, status indicates the result:
827 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
828 * data is a GETACL3res pointer
829 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
830 * data is the error string.
831 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
832 * data is NULL.
833 */
834 struct GETACL3args;
835 int rpc_nfsacl_getacl_async(struct rpc_context *rpc, rpc_cb cb, struct GETACL3args *args, void *private_data);
836
837
838
839 /*
840 * Call NFSACL/SETACL
841 *
842 * Function returns
843 * 0 : The call was initiated. The callback will be invoked when the call completes.
844 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
845 *
846 * When the callback is invoked, status indicates the result:
847 * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
848 * data is a SETACL3res pointer
849 * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
850 * data is the error string.
851 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
852 * data is NULL.
853 */
854 struct SETACL3args;
855 int rpc_nfsacl_setacl_async(struct rpc_context *rpc, rpc_cb cb, struct SETACL3args *args, void *private_data);
856
857
858
859
860 /*
861 * NLM functions
862 */
863 char *nlmstat4_to_str(int stat);
864
865 /*
866 * Call NLM/NULL
867 * Call the NULL procedure for the NLM protocol
868 *
869 * Function returns
870 * 0 : The call was initiated. The callback will be invoked when the call completes.
871 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
872 *
873 * When the callback is invoked, status indicates the result:
874 * RPC_STATUS_SUCCESS : We got a successful response from the nlm daemon.
875 * data is NULL
876 * RPC_STATUS_ERROR : An error occured when trying to contact the nlm daemon.
877 * data is the error string.
878 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
879 * data is NULL.
880 */
881 int rpc_nlm4_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
882
883 /*
884 * Call NLM/TEST
885 * Call the TEST procedure for the NLM protocol
886 *
887 * Function returns
888 * 0 : The call was initiated. The callback will be invoked when the call completes.
889 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
890 *
891 * When the callback is invoked, status indicates the result:
892 * RPC_STATUS_SUCCESS : We got a successful response from the nlm daemon.
893 * data is NLM4_TESTres
894 * RPC_STATUS_ERROR : An error occured when trying to contact the nlm daemon.
895 * data is the error string.
896 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
897 * data is NULL.
898 */
899 struct NLM4_TESTargs;
900 int rpc_nlm4_test_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_TESTargs *args, void *private_data);
901
902 /*
903 * Call NLM/LOCK
904 * Call the LOCK procedure for the NLM protocol
905 *
906 * Function returns
907 * 0 : The call was initiated. The callback will be invoked when the call completes.
908 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
909 *
910 * When the callback is invoked, status indicates the result:
911 * RPC_STATUS_SUCCESS : We got a successful response from the nlm daemon.
912 * data is NLM4_LOCKres
913 * RPC_STATUS_ERROR : An error occured when trying to contact the nlm daemon.
914 * data is the error string.
915 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
916 * data is NULL.
917 */
918 struct NLM4_LOCKargs;
919 int rpc_nlm4_lock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_LOCKargs *args, void *private_data);
920
921 /*
922 * Call NLM/CANCEL
923 * Call the CANCEL procedure for the NLM protocol
924 *
925 * Function returns
926 * 0 : The call was initiated. The callback will be invoked when the call completes.
927 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
928 *
929 * When the callback is invoked, status indicates the result:
930 * RPC_STATUS_SUCCESS : We got a successful response from the nlm daemon.
931 * data is NLM4_CANCres
932 * RPC_STATUS_ERROR : An error occured when trying to contact the nlm daemon.
933 * data is the error string.
934 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
935 * data is NULL.
936 */
937 struct NLM4_CANCargs;
938 int rpc_nlm4_cancel_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_CANCargs *args, void *private_data);
939
940 /*
941 * Call NLM/UNLOCK
942 * Call the UNLOCK procedure for the NLM protocol
943 *
944 * Function returns
945 * 0 : The call was initiated. The callback will be invoked when the call completes.
946 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
947 *
948 * When the callback is invoked, status indicates the result:
949 * RPC_STATUS_SUCCESS : We got a successful response from the nlm daemon.
950 * data is NLM4_UNLOCKres
951 * RPC_STATUS_ERROR : An error occured when trying to contact the nlm daemon.
952 * data is the error string.
953 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
954 * data is NULL.
955 */
956 struct NLM4_UNLOCKargs;
957 int rpc_nlm4_unlock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_UNLOCKargs *args, void *private_data);
958
959 /*
960 * NSM functions
961 */
962 char *nsmstat1_to_str(int stat);
963
964 /*
965 * Call NSM/NULL
966 * Call the NULL procedure for the NSM protocol
967 *
968 * Function returns
969 * 0 : The call was initiated. The callback will be invoked when the call completes.
970 * <0 : An error occured when trying to set up the call. The callback will not be invoked.
971 *
972 * When the callback is invoked, status indicates the result:
973 * RPC_STATUS_SUCCESS : We got a successful response from the nsm daemon.
974 * data is NULL
975 * RPC_STATUS_ERROR : An error occured when trying to contact the nsm daemon.
976 * data is the error string.
977 * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
978 * data is NULL.
979 */
980 int rpc_nsm1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
981
982
983 #endif