2debb8b7660e9a6130e1b50bd920c47a9081e478
[deb_libnfs.git] / include / libnfs.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 highlevel interface to access NFS resources using a posix-like interface
19 */
20 #include <stdint.h>
21
22 struct nfs_context;
23
24 /*
25 * Used for interfacing the async version of the api into an external eventsystem
26 */
27 int nfs_get_fd(struct nfs_context *nfs);
28 int nfs_which_events(struct nfs_context *nfs);
29 int nfs_service(struct nfs_context *nfs, int revents);
30
31 /*
32 * Used if you need different credentials than the default for the current user.
33 */
34 struct AUTH;
35 void nfs_set_auth(struct nfs_context *nfs, struct AUTH *auth);
36
37
38 /*
39 * When an operation failed, this function can extract a detailed error string.
40 */
41 char *nfs_get_error(struct nfs_context *nfs);
42
43
44 /*
45 * Callback for all ASYNC nfs functions
46 */
47 typedef void (*nfs_cb)(int err, struct nfs_context *nfs, void *data, void *private_data);
48
49
50
51
52 /*
53 * NFS CONTEXT.
54 */
55 /*
56 * Create an NFS c, the context.
57 * Function returns
58 * NULL : Failed to create a context.
59 * *nfs : A pointer to an nfs context.
60 */
61 struct nfs_context *nfs_init_context(void);
62 /*
63 * Destroy an nfs context.
64 */
65 void nfs_destroy_context(struct nfs_context *nfs);
66
67
68 struct nfsfh;
69
70
71 /*
72 * MOUNT THE EXPORT
73 */
74 /*
75 * Async nfs mount.
76 * Function returns
77 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
78 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
79 *
80 * When the callback is invoked, status indicates the result:
81 * 0 : Success.
82 * data is NULL
83 * -errno : An error occured.
84 * data is the error string.
85 */
86 int nfs_mount_async(struct nfs_context *nfs, const char *server, const char *export, nfs_cb cb, void *private_data);
87 /*
88 * Sync nfs mount.
89 * Function returns
90 * 0 : The operation was successfull.
91 * -errno : The command failed.
92 */
93 int nfs_mount_sync(struct nfs_context *nfs, const char *server, const char *export);
94
95
96
97
98 /*
99 * STAT()
100 */
101 /*
102 * Async stat(<filename>)
103 * Function returns
104 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
105 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
106 *
107 * When the callback is invoked, status indicates the result:
108 * 0 : Success.
109 * data is struct stat *
110 * -errno : An error occured.
111 * data is the error string.
112 */
113 struct stat;
114 int nfs_stat_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
115 /*
116 * Sync stat(<filename>)
117 * Function returns
118 * 0 : The operation was successfull.
119 * -errno : The command failed.
120 */
121 int nfs_stat_sync(struct nfs_context *nfs, const char *path, struct stat *st);
122
123
124 /*
125 * FSTAT()
126 */
127 /*
128 * Async fstat(nfsfh *)
129 * Function returns
130 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
131 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
132 *
133 * When the callback is invoked, status indicates the result:
134 * 0 : Success.
135 * data is struct stat *
136 * -errno : An error occured.
137 * data is the error string.
138 */
139 int nfs_fstat_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
140 /*
141 * Sync fstat(nfsfh *)
142 * Function returns
143 * 0 : The operation was successfull.
144 * -errno : The command failed.
145 */
146 int nfs_fstat_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat *st);
147
148
149
150 /*
151 * OPEN()
152 */
153 /*
154 * Async open(<filename>)
155 *
156 * mode is a combination of the flags : O_RDOLNY, O_WRONLY, O_RDWR , O_SYNC
157 *
158 * Function returns
159 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
160 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
161 *
162 * When the callback is invoked, status indicates the result:
163 * 0 : Success.
164 * data is a struct *nfsfh;
165 * The nfsfh is close using nfs_close().
166 * -errno : An error occured.
167 * data is the error string.
168 */
169 int nfs_open_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
170 /*
171 * Sync stat(<filename>)
172 * Function returns
173 * 0 : The operation was successfull. *nfsfh is filled in.
174 * -errno : The command failed.
175 */
176 int nfs_open_sync(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
177
178
179
180
181 /*
182 * CLOSE
183 */
184 /*
185 * Async close(nfsfh)
186 *
187 * Function returns
188 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
189 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
190 *
191 * When the callback is invoked, status indicates the result:
192 * 0 : Success.
193 * data is NULL.
194 * -errno : An error occured.
195 * data is the error string.
196 */
197 int nfs_close_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
198 /*
199 * Sync close(nfsfh)
200 * Function returns
201 * 0 : The operation was successfull.
202 * -errno : The command failed.
203 */
204 int nfs_close_sync(struct nfs_context *nfs, struct nfsfh *nfsfh);
205
206
207 /*
208 * PREAD()
209 */
210 /*
211 * Async pread()
212 *
213 * Function returns
214 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
215 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
216 *
217 * When the callback is invoked, status indicates the result:
218 * >=0 : Success.
219 * status is numer of bytes read.
220 * data is a pointer to the returned data.
221 * -errno : An error occured.
222 * data is the error string.
223 */
224 int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, nfs_cb cb, void *private_data);
225 /*
226 * Sync pread()
227 * Function returns
228 * >=0 : numer of bytes read.
229 * -errno : An error occured.
230 */
231 int nfs_pread_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf);
232
233
234
235 /*
236 * READ()
237 */
238 /*
239 * Async read()
240 *
241 * Function returns
242 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
243 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
244 *
245 * When the callback is invoked, status indicates the result:
246 * >=0 : Success.
247 * status is numer of bytes read.
248 * data is a pointer to the returned data.
249 * -errno : An error occured.
250 * data is the error string.
251 */
252 int nfs_read_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, nfs_cb cb, void *private_data);
253 /*
254 * Sync read()
255 * Function returns
256 * >=0 : numer of bytes read.
257 * -errno : An error occured.
258 */
259 int nfs_read_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf);
260
261
262
263
264 /*
265 * PWRITE()
266 */
267 /*
268 * Async pwrite()
269 *
270 * Function returns
271 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
272 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
273 *
274 * When the callback is invoked, status indicates the result:
275 * >=0 : Success.
276 * status is numer of bytes written.
277 * -errno : An error occured.
278 * data is the error string.
279 */
280 int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf, nfs_cb cb, void *private_data);
281 /*
282 * Sync pwrite()
283 * Function returns
284 * >=0 : numer of bytes written.
285 * -errno : An error occured.
286 */
287 int nfs_pwrite_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf);
288
289
290 /*
291 * WRITE()
292 */
293 /*
294 * Async write()
295 *
296 * Function returns
297 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
298 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
299 *
300 * When the callback is invoked, status indicates the result:
301 * >=0 : Success.
302 * status is numer of bytes written.
303 * -errno : An error occured.
304 * data is the error string.
305 */
306 int nfs_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf, nfs_cb cb, void *private_data);
307 /*
308 * Sync write()
309 * Function returns
310 * >=0 : numer of bytes written.
311 * -errno : An error occured.
312 */
313 int nfs_write_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf);
314
315
316 /*
317 * LSEEK()
318 */
319 /*
320 * Async lseek()
321 *
322 * Function returns
323 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
324 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
325 *
326 * When the callback is invoked, status indicates the result:
327 * >=0 : Success.
328 * data is off_t * for the current position.
329 * -errno : An error occured.
330 * data is the error string.
331 */
332 int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, nfs_cb cb, void *private_data);
333 /*
334 * Sync lseek()
335 * Function returns
336 * >=0 : numer of bytes read.
337 * -errno : An error occured.
338 */
339 int nfs_lseek_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, off_t *current_offset);
340
341
342 /*
343 * FSYNC()
344 */
345 /*
346 * Async fsync()
347 *
348 * Function returns
349 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
350 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
351 *
352 * When the callback is invoked, status indicates the result:
353 * 0 : Success.
354 * -errno : An error occured.
355 * data is the error string.
356 */
357 int nfs_fsync_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
358 /*
359 * Sync fsync()
360 * Function returns
361 * 0 : Success
362 * -errno : An error occured.
363 */
364 int nfs_fsync_sync(struct nfs_context *nfs, struct nfsfh *nfsfh);
365
366
367
368 /*
369 * TRUNCATE()
370 */
371 /*
372 * Async truncate()
373 *
374 * Function returns
375 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
376 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
377 *
378 * When the callback is invoked, status indicates the result:
379 * 0 : Success.
380 * -errno : An error occured.
381 * data is the error string.
382 */
383 int nfs_truncate_async(struct nfs_context *nfs, const char *path, off_t length, nfs_cb cb, void *private_data);
384 /*
385 * Sync truncate()
386 * Function returns
387 * 0 : Success
388 * -errno : An error occured.
389 */
390 int nfs_truncate_sync(struct nfs_context *nfs, const char *path, off_t length);
391
392
393
394 /*
395 * FTRUNCATE()
396 */
397 /*
398 * Async ftruncate()
399 *
400 * Function returns
401 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
402 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
403 *
404 * When the callback is invoked, status indicates the result:
405 * 0 : Success.
406 * -errno : An error occured.
407 * data is the error string.
408 */
409 int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length, nfs_cb cb, void *private_data);
410 /*
411 * Sync ftruncate()
412 * Function returns
413 * 0 : Success
414 * -errno : An error occured.
415 */
416 int nfs_ftruncate_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length);
417
418
419
420
421
422
423 /*
424 * MKDIR()
425 */
426 /*
427 * Async mkdir()
428 *
429 * Function returns
430 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
431 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
432 *
433 * When the callback is invoked, status indicates the result:
434 * 0 : Success.
435 * -errno : An error occured.
436 * data is the error string.
437 */
438 int nfs_mkdir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
439 /*
440 * Sync mkdir()
441 * Function returns
442 * 0 : Success
443 * -errno : An error occured.
444 */
445 int nfs_mkdir_sync(struct nfs_context *nfs, const char *path);
446
447
448
449 /*
450 * RMDIR()
451 */
452 /*
453 * Async rmdir()
454 *
455 * Function returns
456 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
457 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
458 *
459 * When the callback is invoked, status indicates the result:
460 * 0 : Success.
461 * -errno : An error occured.
462 * data is the error string.
463 */
464 int nfs_rmdir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
465 /*
466 * Sync rmdir()
467 * Function returns
468 * 0 : Success
469 * -errno : An error occured.
470 */
471 int nfs_rmdir_sync(struct nfs_context *nfs, const char *path);
472
473
474
475
476 /*
477 * CREAT()
478 */
479 /*
480 * Async creat()
481 *
482 * Function returns
483 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
484 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
485 *
486 * When the callback is invoked, status indicates the result:
487 * 0 : Success.
488 * data is a struct *nfsfh;
489 * -errno : An error occured.
490 * data is the error string.
491 */
492 int nfs_creat_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
493 /*
494 * Sync creat()
495 * Function returns
496 * 0 : Success
497 * -errno : An error occured.
498 */
499 int nfs_creat_sync(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
500
501
502
503
504
505 /*
506 * UNLINK()
507 */
508 /*
509 * Async unlink()
510 *
511 * Function returns
512 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
513 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
514 *
515 * When the callback is invoked, status indicates the result:
516 * 0 : Success.
517 * data is NULL
518 * -errno : An error occured.
519 * data is the error string.
520 */
521 int nfs_unlink_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
522 /*
523 * Sync unlink()
524 * Function returns
525 * 0 : Success
526 * -errno : An error occured.
527 */
528 int nfs_unlink_sync(struct nfs_context *nfs, const char *path);
529
530
531
532
533 /*
534 * OPENDIR()
535 */
536 struct nfsdir;
537 /*
538 * Async opendir()
539 *
540 * Function returns
541 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
542 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
543 *
544 * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
545 *
546 * When the callback is invoked, status indicates the result:
547 * 0 : Success.
548 * data is struct nfsdir *
549 * -errno : An error occured.
550 * data is the error string.
551 */
552 int nfs_opendir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
553 /*
554 * Sync opendir()
555 * Function returns
556 * 0 : Success
557 * -errno : An error occured.
558 */
559 int nfs_opendir_sync(struct nfs_context *nfs, const char *path, struct nfsdir **nfsdir);
560
561
562
563 /*
564 * READDIR()
565 */
566 struct nfsdirent {
567 struct nfsdirent *next;
568 char *name;
569 uint64_t inode;
570 };
571 /*
572 * nfs_readdir() never blocks, so no special sync/async versions are available
573 */
574 struct nfsdirent *nfs_readdir(struct nfs_context *nfs, struct nfsdir *nfsdir);
575
576
577
578 /*
579 * READDIR()
580 */
581 /*
582 * nfs_closedir() never blocks, so no special sync/async versions are available
583 */
584 void nfs_closedir(struct nfs_context *nfs, struct nfsdir *nfsdir);
585
586
587
588 /*
589 * STATVFS()
590 */
591 /*
592 * Async statvfs(<dirname>)
593 * Function returns
594 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
595 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
596 *
597 * When the callback is invoked, status indicates the result:
598 * 0 : Success.
599 * data is struct statvfs *
600 * -errno : An error occured.
601 * data is the error string.
602 */
603 struct statvfs;
604 int nfs_statvfs_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
605 /*
606 * Sync statvfs(<dirname>)
607 * Function returns
608 * 0 : The operation was successfull.
609 * -errno : The command failed.
610 */
611 int nfs_statvfs_sync(struct nfs_context *nfs, const char *path, struct statvfs *svfs);
612
613
614 /*
615 * READLINK()
616 */
617 /*
618 * Async readlink(<name>)
619 * Function returns
620 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
621 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
622 *
623 * When the callback is invoked, status indicates the result:
624 * 0 : Success.
625 * data is a char *
626 * data is only valid during the callback and is automatically freed when the callback returns.
627 * -errno : An error occured.
628 * data is the error string.
629 */
630 struct statvfs;
631 int nfs_readlink_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
632 /*
633 * Sync readlink(<name>)
634 * Function returns
635 * 0 : The operation was successfull.
636 * -errno : The command failed.
637 */
638 int nfs_readlink_sync(struct nfs_context *nfs, const char *path, char *buf, int bufsize);
639
640
641
642 /*
643 * CHMOD()
644 */
645 /*
646 * Async chmod(<name>)
647 * Function returns
648 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
649 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
650 *
651 * When the callback is invoked, status indicates the result:
652 * 0 : Success.
653 * data is NULL
654 * -errno : An error occured.
655 * data is the error string.
656 */
657 int nfs_chmod_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
658 /*
659 * Sync chmod(<name>)
660 * Function returns
661 * 0 : The operation was successfull.
662 * -errno : The command failed.
663 */
664 int nfs_chmod_sync(struct nfs_context *nfs, const char *path, int mode);
665
666
667
668 /*
669 * FCHMOD()
670 */
671 /*
672 * Async fchmod(<handle>)
673 * Function returns
674 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
675 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
676 *
677 * When the callback is invoked, status indicates the result:
678 * 0 : Success.
679 * data is NULL
680 * -errno : An error occured.
681 * data is the error string.
682 */
683 int nfs_fchmod_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode, nfs_cb cb, void *private_data);
684 /*
685 * Sync fchmod(<handle>)
686 * Function returns
687 * 0 : The operation was successfull.
688 * -errno : The command failed.
689 */
690 int nfs_fchmod_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode);
691
692
693
694 /*
695 * CHOWN()
696 */
697 /*
698 * Async chown(<name>)
699 * Function returns
700 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
701 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
702 *
703 * When the callback is invoked, status indicates the result:
704 * 0 : Success.
705 * data is NULL
706 * -errno : An error occured.
707 * data is the error string.
708 */
709 int nfs_chown_async(struct nfs_context *nfs, const char *path, int uid, int gid, nfs_cb cb, void *private_data);
710 /*
711 * Sync chown(<name>)
712 * Function returns
713 * 0 : The operation was successfull.
714 * -errno : The command failed.
715 */
716 int nfs_chown_sync(struct nfs_context *nfs, const char *path, int uid, int gid);
717
718
719
720 /*
721 * FCHOWN()
722 */
723 /*
724 * Async fchown(<handle>)
725 * Function returns
726 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
727 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
728 *
729 * When the callback is invoked, status indicates the result:
730 * 0 : Success.
731 * data is NULL
732 * -errno : An error occured.
733 * data is the error string.
734 */
735 int nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid, nfs_cb cb, void *private_data);
736 /*
737 * Sync fchown(<handle>)
738 * Function returns
739 * 0 : The operation was successfull.
740 * -errno : The command failed.
741 */
742 int nfs_fchown_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid);
743
744
745
746
747 /*
748 * UTIMES()
749 */
750 /*
751 * Async utimes(<path>)
752 * Function returns
753 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
754 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
755 *
756 * When the callback is invoked, status indicates the result:
757 * 0 : Success.
758 * data is NULL
759 * -errno : An error occured.
760 * data is the error string.
761 */
762 int nfs_utimes_async(struct nfs_context *nfs, const char *path, struct timeval *times, nfs_cb cb, void *private_data);
763 /*
764 * Sync utimes(<path>)
765 * Function returns
766 * 0 : The operation was successfull.
767 * -errno : The command failed.
768 */
769 int nfs_utimes_sync(struct nfs_context *nfs, const char *path, struct timeval *times);
770
771
772 /*
773 * UTIME()
774 */
775 /*
776 * Async utime(<path>)
777 * Function returns
778 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
779 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
780 *
781 * When the callback is invoked, status indicates the result:
782 * 0 : Success.
783 * data is NULL
784 * -errno : An error occured.
785 * data is the error string.
786 */
787 struct utimbuf;
788 int nfs_utime_async(struct nfs_context *nfs, const char *path, struct utimbuf *times, nfs_cb cb, void *private_data);
789 /*
790 * Sync utime(<path>)
791 * Function returns
792 * 0 : The operation was successfull.
793 * -errno : The command failed.
794 */
795 int nfs_utime_sync(struct nfs_context *nfs, const char *path, struct utimbuf *times);
796
797
798
799
800 /*
801 * ACCESS()
802 */
803 /*
804 * Async access(<path>)
805 * Function returns
806 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
807 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
808 *
809 * When the callback is invoked, status indicates the result:
810 * 0 : Success.
811 * data is NULL
812 * -errno : An error occured.
813 * data is the error string.
814 */
815 int nfs_access_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
816 /*
817 * Sync access(<path>)
818 * Function returns
819 * 0 : The operation was successfull.
820 * -errno : The command failed.
821 */
822 int nfs_access_sync(struct nfs_context *nfs, const char *path, int mode);
823
824
825
826
827 /*
828 * SYMLINK()
829 */
830 /*
831 * Async symlink(<path>)
832 * Function returns
833 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
834 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
835 *
836 * When the callback is invoked, status indicates the result:
837 * 0 : Success.
838 * data is NULL
839 * -errno : An error occured.
840 * data is the error string.
841 */
842 int nfs_symlink_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
843 /*
844 * Sync symlink(<path>)
845 * Function returns
846 * 0 : The operation was successfull.
847 * -errno : The command failed.
848 */
849 int nfs_symlink_sync(struct nfs_context *nfs, const char *oldpath, const char *newpath);
850
851
852 /*
853 * RENAME()
854 */
855 /*
856 * Async rename(<oldpath>, <newpath>)
857 * Function returns
858 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
859 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
860 *
861 * When the callback is invoked, status indicates the result:
862 * 0 : Success.
863 * data is NULL
864 * -errno : An error occured.
865 * data is the error string.
866 */
867 int nfs_rename_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
868 /*
869 * Sync rename(<oldpath>, <newpath>)
870 * Function returns
871 * 0 : The operation was successfull.
872 * -errno : The command failed.
873 */
874 int nfs_rename_sync(struct nfs_context *nfs, const char *oldpath, const char *newpath);
875
876
877
878 /*
879 * LINK()
880 */
881 /*
882 * Async link(<oldpath>, <newpath>)
883 * Function returns
884 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
885 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
886 *
887 * When the callback is invoked, status indicates the result:
888 * 0 : Success.
889 * data is NULL
890 * -errno : An error occured.
891 * data is the error string.
892 */
893 int nfs_link_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
894 /*
895 * Sync link(<oldpath>, <newpath>)
896 * Function returns
897 * 0 : The operation was successfull.
898 * -errno : The command failed.
899 */
900 int nfs_link_sync(struct nfs_context *nfs, const char *oldpath, const char *newpath);
901
902
903
904 //qqq replace later with lseek(cur, 0)
905 off_t nfs_get_current_offset(struct nfsfh *nfsfh);