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