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