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