Add example for how to call MOUNT/EXPORT and get the exports list using the raw lowle...
[deb_libnfs.git] / include / libnfs.h
CommitLineData
84004dbf
RS
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
22struct nfs_context;
23
24/*
25 * Used for interfacing the async version of the api into an external eventsystem
26 */
27int nfs_get_fd(struct nfs_context *nfs);
28int nfs_which_events(struct nfs_context *nfs);
29int 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 */
34struct AUTH;
35void 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 */
41char *nfs_get_error(struct nfs_context *nfs);
42
43
44/*
45 * Callback for all ASYNC nfs functions
46 */
47typedef 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 */
61struct nfs_context *nfs_init_context(void);
62/*
63 * Destroy an nfs context.
64 */
65void nfs_destroy_context(struct nfs_context *nfs);
66
67
68struct nfsfh;
69
17ef62fa
RS
70/*
71 * Get the maximum supported READ3 size by the server
72 */
73size_t nfs_get_readmax(struct nfs_context *nfs);
74
75/*
76 * Get the maximum supported WRITE3 size by the server
77 */
78size_t nfs_get_writemax(struct nfs_context *nfs);
79
84004dbf
RS
80
81/*
82 * MOUNT THE EXPORT
83 */
84/*
85 * Async nfs mount.
86 * Function returns
87 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
88 * <0 : An error occured 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 occured.
94 * data is the error string.
95 */
d6ced294 96int nfs_mount_async(struct nfs_context *nfs, const char *server, const char *exportname, nfs_cb cb, void *private_data);
84004dbf
RS
97/*
98 * Sync nfs mount.
99 * Function returns
100 * 0 : The operation was successfull.
101 * -errno : The command failed.
102 */
e2ba5764 103int nfs_mount(struct nfs_context *nfs, const char *server, const char *exportname);
84004dbf
RS
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 occured 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 occured.
121 * data is the error string.
122 */
123struct stat;
124int 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 successfull.
129 * -errno : The command failed.
130 */
e2ba5764 131int nfs_stat(struct nfs_context *nfs, const char *path, struct stat *st);
84004dbf
RS
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 occured 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 occured.
147 * data is the error string.
148 */
149int 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 successfull.
154 * -errno : The command failed.
155 */
e2ba5764 156int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat *st);
84004dbf
RS
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 occured 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 occured.
177 * data is the error string.
178 */
179int nfs_open_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
180/*
181 * Sync stat(<filename>)
182 * Function returns
183 * 0 : The operation was successfull. *nfsfh is filled in.
184 * -errno : The command failed.
185 */
e2ba5764 186int nfs_open(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
84004dbf
RS
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 occured 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 occured.
205 * data is the error string.
206 */
207int 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 successfull.
212 * -errno : The command failed.
213 */
e2ba5764 214int nfs_close(struct nfs_context *nfs, struct nfsfh *nfsfh);
84004dbf
RS
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 occured 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 occured.
232 * data is the error string.
233 */
234int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, 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 occured.
240 */
e2ba5764 241int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf);
84004dbf
RS
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 occured 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 occured.
260 * data is the error string.
261 */
262int 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 occured.
268 */
e2ba5764 269int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf);
84004dbf
RS
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 occured 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 occured.
288 * data is the error string.
289 */
290int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, 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 occured.
296 */
e2ba5764 297int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf);
84004dbf
RS
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 occured 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 occured.
314 * data is the error string.
315 */
316int 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 occured.
322 */
e2ba5764 323int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf);
84004dbf
RS
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 occured 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 off_t * for the current position.
339 * -errno : An error occured.
340 * data is the error string.
341 */
342int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, 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 occured.
348 */
e2ba5764 349int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, off_t *current_offset);
84004dbf
RS
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 occured 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 occured.
365 * data is the error string.
366 */
367int 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 occured.
373 */
e2ba5764 374int nfs_fsync(struct nfs_context *nfs, struct nfsfh *nfsfh);
84004dbf
RS
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 occured 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 occured.
391 * data is the error string.
392 */
393int nfs_truncate_async(struct nfs_context *nfs, const char *path, off_t length, nfs_cb cb, void *private_data);
394/*
395 * Sync truncate()
396 * Function returns
397 * 0 : Success
398 * -errno : An error occured.
399 */
e2ba5764 400int nfs_truncate(struct nfs_context *nfs, const char *path, off_t length);
84004dbf
RS
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 occured 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 occured.
417 * data is the error string.
418 */
419int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length, nfs_cb cb, void *private_data);
420/*
421 * Sync ftruncate()
422 * Function returns
423 * 0 : Success
424 * -errno : An error occured.
425 */
e2ba5764 426int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length);
84004dbf
RS
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 occured 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 occured.
446 * data is the error string.
447 */
448int 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 occured.
454 */
e2ba5764 455int nfs_mkdir(struct nfs_context *nfs, const char *path);
84004dbf
RS
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 occured 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 occured.
472 * data is the error string.
473 */
474int 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 occured.
480 */
e2ba5764 481int nfs_rmdir(struct nfs_context *nfs, const char *path);
84004dbf
RS
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 occured 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 occured.
500 * data is the error string.
501 */
502int 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 occured.
508 */
e2ba5764 509int nfs_creat(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
84004dbf
RS
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 occured 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 occured.
529 * data is the error string.
530 */
531int 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 occured.
537 */
e2ba5764 538int nfs_unlink(struct nfs_context *nfs, const char *path);
84004dbf
RS
539
540
541
542
543/*
544 * OPENDIR()
545 */
546struct 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 occured 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 occured.
560 * data is the error string.
561 */
562int 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 occured.
568 */
e2ba5764 569int nfs_opendir(struct nfs_context *nfs, const char *path, struct nfsdir **nfsdir);
84004dbf
RS
570
571
572
573/*
574 * READDIR()
575 */
576struct 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 */
584struct 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 */
594void 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 occured 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 occured.
611 * data is the error string.
612 */
613struct statvfs;
614int 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 successfull.
619 * -errno : The command failed.
620 */
e2ba5764 621int nfs_statvfs(struct nfs_context *nfs, const char *path, struct statvfs *svfs);
84004dbf
RS
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 occured 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 occured.
638 * data is the error string.
639 */
640struct statvfs;
641int 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 successfull.
646 * -errno : The command failed.
647 */
e2ba5764 648int nfs_readlink(struct nfs_context *nfs, const char *path, char *buf, int bufsize);
84004dbf
RS
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 occured 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 occured.
665 * data is the error string.
666 */
667int 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 successfull.
672 * -errno : The command failed.
673 */
e2ba5764 674int nfs_chmod(struct nfs_context *nfs, const char *path, int mode);
84004dbf
RS
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 occured 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 occured.
691 * data is the error string.
692 */
693int 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 successfull.
698 * -errno : The command failed.
699 */
e2ba5764 700int nfs_fchmod(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode);
84004dbf
RS
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 occured 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 occured.
717 * data is the error string.
718 */
719int 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 successfull.
724 * -errno : The command failed.
725 */
e2ba5764 726int nfs_chown(struct nfs_context *nfs, const char *path, int uid, int gid);
84004dbf
RS
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 occured 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 occured.
743 * data is the error string.
744 */
745int 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 successfull.
750 * -errno : The command failed.
751 */
e2ba5764 752int nfs_fchown(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid);
84004dbf
RS
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 occured 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 occured.
770 * data is the error string.
771 */
772int 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 successfull.
777 * -errno : The command failed.
778 */
e2ba5764 779int nfs_utimes(struct nfs_context *nfs, const char *path, struct timeval *times);
84004dbf
RS
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 occured 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 occured.
795 * data is the error string.
796 */
797struct utimbuf;
798int 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 successfull.
803 * -errno : The command failed.
804 */
e2ba5764 805int nfs_utime(struct nfs_context *nfs, const char *path, struct utimbuf *times);
84004dbf
RS
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 occured 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 occured.
823 * data is the error string.
824 */
825int 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 successfull.
830 * -errno : The command failed.
831 */
e2ba5764 832int nfs_access(struct nfs_context *nfs, const char *path, int mode);
84004dbf
RS
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 occured 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 occured.
850 * data is the error string.
851 */
852int 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 successfull.
857 * -errno : The command failed.
858 */
e2ba5764 859int nfs_symlink(struct nfs_context *nfs, const char *oldpath, const char *newpath);
84004dbf
RS
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 occured 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 occured.
875 * data is the error string.
876 */
877int 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 successfull.
882 * -errno : The command failed.
883 */
e2ba5764 884int nfs_rename(struct nfs_context *nfs, const char *oldpath, const char *newpath);
84004dbf
RS
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 occured 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 occured.
901 * data is the error string.
902 */
903int 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 successfull.
908 * -errno : The command failed.
909 */
e2ba5764 910int nfs_link(struct nfs_context *nfs, const char *oldpath, const char *newpath);
84004dbf
RS
911
912
913
914//qqq replace later with lseek(cur, 0)
915off_t nfs_get_current_offset(struct nfsfh *nfsfh);