2 Copyright (C) 2010 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
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.
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.
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/>.
18 * This is the highlevel interface to access NFS resources using a posix-like interface
38 #define EXTERN __declspec( dllexport )
67 * Used for interfacing the async version of the api into an external eventsystem
69 EXTERN
int nfs_get_fd(struct nfs_context
*nfs
);
70 EXTERN
int nfs_which_events(struct nfs_context
*nfs
);
71 EXTERN
int nfs_service(struct nfs_context
*nfs
, int revents
);
72 EXTERN
int nfs_queue_length(struct nfs_context
*nfs
);
75 * Used if you need different credentials than the default for the current user.
78 EXTERN
void nfs_set_auth(struct nfs_context
*nfs
, struct AUTH
*auth
);
81 * When an operation failed, this function can extract a detailed error string.
83 EXTERN
char *nfs_get_error(struct nfs_context
*nfs
);
87 * Callback for all ASYNC nfs functions
89 typedef void (*nfs_cb
)(int err
, struct nfs_context
*nfs
, void *data
, void *private_data
);
92 * Callback for all ASYNC rpc functions
94 typedef void (*rpc_cb
)(struct rpc_context
*rpc
, int status
, void *data
, void *private_data
);
102 * Create an NFS c, the context.
104 * NULL : Failed to create a context.
105 * *nfs : A pointer to an nfs context.
107 EXTERN
struct nfs_context
*nfs_init_context(void);
109 * Destroy an nfs context.
111 EXTERN
void nfs_destroy_context(struct nfs_context
*nfs
);
115 * URL parsing functions.
116 * These functions all parse a URL of the form
117 * nfs://server/path/file?argv=val[&arg=val]*
118 * and returns a nfs_url.
120 * Apart from parsing the URL the functions will also update
121 * the nfs context to reflect settings controlled via url arguments.
123 * Current URL arguments are :
124 * tcp-syncnt=<int> : Number of SYNs to send during the seccion establish
125 * before failing settin up the tcp connection to the
127 * uid=<int> : UID value to use when talking to the server.
128 * default it 65534 on Windows and getuid() on unixen.
129 * gid=<int> : GID value to use when talking to the server.
130 * default it 65534 on Windows and getgid() on unixen.
133 * Parse a complete NFS URL including, server, path and
134 * filename. Fail if any component is missing.
136 EXTERN
struct nfs_url
*nfs_parse_url_full(struct nfs_context
*nfs
, const char *url
);
139 * Parse an NFS URL, but do not split path and file. File
140 * in the resulting struct remains NULL.
142 EXTERN
struct nfs_url
*nfs_parse_url_dir(struct nfs_context
*nfs
, const char *url
);
145 * Parse an NFS URL, but do not fail if file, path or even server is missing.
146 * Check elements of the resulting struct for NULL.
148 EXTERN
struct nfs_url
*nfs_parse_url_incomplete(struct nfs_context
*nfs
, const char *url
);
152 * Free the URL struct returned by the nfs_parse_url_* functions.
154 EXTERN
void nfs_destroy_url(struct nfs_url
*url
);
160 * Get the maximum supported READ3 size by the server
162 EXTERN
uint64_t nfs_get_readmax(struct nfs_context
*nfs
);
165 * Get the maximum supported WRITE3 size by the server
167 EXTERN
uint64_t nfs_get_writemax(struct nfs_context
*nfs
);
170 * MODIFY CONNECT PARAMTERS
173 EXTERN
void nfs_set_tcp_syncnt(struct nfs_context
*nfs
, int v
);
174 EXTERN
void nfs_set_uid(struct nfs_context
*nfs
, int uid
);
175 EXTERN
void nfs_set_gid(struct nfs_context
*nfs
, int gid
);
183 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
184 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
186 * When the callback is invoked, status indicates the result:
189 * -errno : An error occured.
190 * data is the error string.
192 EXTERN
int nfs_mount_async(struct nfs_context
*nfs
, const char *server
, const char *exportname
, nfs_cb cb
, void *private_data
);
196 * 0 : The operation was successfull.
197 * -errno : The command failed.
199 EXTERN
int nfs_mount(struct nfs_context
*nfs
, const char *server
, const char *exportname
);
208 * Async stat(<filename>)
210 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
211 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
213 * When the callback is invoked, status indicates the result:
215 * data is struct stat *
216 * -errno : An error occured.
217 * data is the error string.
220 EXTERN
int nfs_stat_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
222 * Sync stat(<filename>)
224 * 0 : The operation was successfull.
225 * -errno : The command failed.
228 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct __stat64
*st
);
230 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct stat
*st
);
237 * Async fstat(nfsfh *)
239 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
240 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
242 * When the callback is invoked, status indicates the result:
244 * data is struct stat *
245 * -errno : An error occured.
246 * data is the error string.
248 EXTERN
int nfs_fstat_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
250 * Sync fstat(nfsfh *)
252 * 0 : The operation was successfull.
253 * -errno : The command failed.
256 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct __stat64
*st
);
258 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct stat
*st
);
267 * Async open(<filename>)
269 * mode is a combination of the flags : O_RDOLNY, O_WRONLY, O_RDWR , O_SYNC
272 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
273 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
275 * When the callback is invoked, status indicates the result:
277 * data is a struct *nfsfh;
278 * The nfsfh is close using nfs_close().
279 * -errno : An error occured.
280 * data is the error string.
282 EXTERN
int nfs_open_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
284 * Sync stat(<filename>)
286 * 0 : The operation was successfull. *nfsfh is filled in.
287 * -errno : The command failed.
289 EXTERN
int nfs_open(struct nfs_context
*nfs
, const char *path
, int mode
, struct nfsfh
**nfsfh
);
301 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
302 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
304 * When the callback is invoked, status indicates the result:
307 * -errno : An error occured.
308 * data is the error string.
310 EXTERN
int nfs_close_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
314 * 0 : The operation was successfull.
315 * -errno : The command failed.
317 EXTERN
int nfs_close(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
327 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
328 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
330 * When the callback is invoked, status indicates the result:
332 * status is numer of bytes read.
333 * data is a pointer to the returned data.
334 * -errno : An error occured.
335 * data is the error string.
337 EXTERN
int nfs_pread_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, nfs_cb cb
, void *private_data
);
341 * >=0 : numer of bytes read.
342 * -errno : An error occured.
344 EXTERN
int nfs_pread(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
355 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
356 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
358 * When the callback is invoked, status indicates the result:
360 * status is numer of bytes read.
361 * data is a pointer to the returned data.
362 * -errno : An error occured.
363 * data is the error string.
365 EXTERN
int nfs_read_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, nfs_cb cb
, void *private_data
);
369 * >=0 : numer of bytes read.
370 * -errno : An error occured.
372 EXTERN
int nfs_read(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
384 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
385 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
387 * When the callback is invoked, status indicates the result:
389 * status is numer of bytes written.
390 * -errno : An error occured.
391 * data is the error string.
393 EXTERN
int nfs_pwrite_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
, nfs_cb cb
, void *private_data
);
397 * >=0 : numer of bytes written.
398 * -errno : An error occured.
400 EXTERN
int nfs_pwrite(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
410 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
411 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
413 * When the callback is invoked, status indicates the result:
415 * status is numer of bytes written.
416 * -errno : An error occured.
417 * data is the error string.
419 EXTERN
int nfs_write_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
, nfs_cb cb
, void *private_data
);
423 * >=0 : numer of bytes written.
424 * -errno : An error occured.
426 EXTERN
int nfs_write(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
436 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
437 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
439 * When the callback is invoked, status indicates the result:
441 * data is uint64_t * for the current position.
442 * -errno : An error occured.
443 * data is the error string.
445 EXTERN
int nfs_lseek_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, nfs_cb cb
, void *private_data
);
449 * >=0 : numer of bytes read.
450 * -errno : An error occured.
452 EXTERN
int nfs_lseek(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, uint64_t *current_offset
);
462 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
463 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
465 * When the callback is invoked, status indicates the result:
467 * -errno : An error occured.
468 * data is the error string.
470 EXTERN
int nfs_fsync_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
475 * -errno : An error occured.
477 EXTERN
int nfs_fsync(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
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.
491 * When the callback is invoked, status indicates the result:
493 * -errno : An error occured.
494 * data is the error string.
496 EXTERN
int nfs_truncate_async(struct nfs_context
*nfs
, const char *path
, uint64_t length
, nfs_cb cb
, void *private_data
);
501 * -errno : An error occured.
503 EXTERN
int nfs_truncate(struct nfs_context
*nfs
, const char *path
, uint64_t length
);
514 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
515 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
517 * When the callback is invoked, status indicates the result:
519 * -errno : An error occured.
520 * data is the error string.
522 EXTERN
int nfs_ftruncate_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
, nfs_cb cb
, void *private_data
);
527 * -errno : An error occured.
529 EXTERN
int nfs_ftruncate(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
);
543 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
544 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
546 * When the callback is invoked, status indicates the result:
548 * -errno : An error occured.
549 * data is the error string.
551 EXTERN
int nfs_mkdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
556 * -errno : An error occured.
558 EXTERN
int nfs_mkdir(struct nfs_context
*nfs
, const char *path
);
569 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
570 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
572 * When the callback is invoked, status indicates the result:
574 * -errno : An error occured.
575 * data is the error string.
577 EXTERN
int nfs_rmdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
582 * -errno : An error occured.
584 EXTERN
int nfs_rmdir(struct nfs_context
*nfs
, const char *path
);
596 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
597 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
599 * When the callback is invoked, status indicates the result:
601 * data is a struct *nfsfh;
602 * -errno : An error occured.
603 * data is the error string.
605 EXTERN
int nfs_creat_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
610 * -errno : An error occured.
612 EXTERN
int nfs_creat(struct nfs_context
*nfs
, const char *path
, int mode
, struct nfsfh
**nfsfh
);
622 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
623 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
625 * When the callback is invoked, status indicates the result:
627 * -errno : An error occured.
628 * data is the error string.
630 EXTERN
int nfs_mknod_async(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
, nfs_cb cb
, void *private_data
);
635 * -errno : An error occured.
637 EXTERN
int nfs_mknod(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
);
648 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
649 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
651 * When the callback is invoked, status indicates the result:
654 * -errno : An error occured.
655 * data is the error string.
657 EXTERN
int nfs_unlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
662 * -errno : An error occured.
664 EXTERN
int nfs_unlink(struct nfs_context
*nfs
, const char *path
);
677 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
678 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
680 * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
682 * When the callback is invoked, status indicates the result:
684 * data is struct nfsdir *
685 * -errno : An error occured.
686 * data is the error string.
688 EXTERN
int nfs_opendir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
693 * -errno : An error occured.
695 EXTERN
int nfs_opendir(struct nfs_context
*nfs
, const char *path
, struct nfsdir
**nfsdir
);
703 struct nfsdirent
*next
;
707 /* Some extra fields we get for free through the READDIRPLUS3 call.
708 You need libnfs-raw-nfs.h for type/mode constants */
709 uint32_t type
; /* NF3REG, NF3DIR, NF3BLK, ... */
712 struct timeval atime
;
713 struct timeval mtime
;
714 struct timeval ctime
;
719 * nfs_readdir() never blocks, so no special sync/async versions are available
721 EXTERN
struct nfsdirent
*nfs_readdir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
729 * nfs_closedir() never blocks, so no special sync/async versions are available
731 EXTERN
void nfs_closedir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
739 * Async statvfs(<dirname>)
741 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
742 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
744 * When the callback is invoked, status indicates the result:
746 * data is struct statvfs *
747 * -errno : An error occured.
748 * data is the error string.
751 EXTERN
int nfs_statvfs_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
753 * Sync statvfs(<dirname>)
755 * 0 : The operation was successfull.
756 * -errno : The command failed.
758 EXTERN
int nfs_statvfs(struct nfs_context
*nfs
, const char *path
, struct statvfs
*svfs
);
765 * Async readlink(<name>)
767 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
768 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
770 * When the callback is invoked, status indicates the result:
773 * data is only valid during the callback and is automatically freed when the callback returns.
774 * -errno : An error occured.
775 * data is the error string.
778 EXTERN
int nfs_readlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
780 * Sync readlink(<name>)
782 * 0 : The operation was successfull.
783 * -errno : The command failed.
785 EXTERN
int nfs_readlink(struct nfs_context
*nfs
, const char *path
, char *buf
, int bufsize
);
793 * Async chmod(<name>)
795 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
796 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
798 * When the callback is invoked, status indicates the result:
801 * -errno : An error occured.
802 * data is the error string.
804 EXTERN
int nfs_chmod_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
808 * 0 : The operation was successfull.
809 * -errno : The command failed.
811 EXTERN
int nfs_chmod(struct nfs_context
*nfs
, const char *path
, int mode
);
819 * Async fchmod(<handle>)
821 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
822 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
824 * When the callback is invoked, status indicates the result:
827 * -errno : An error occured.
828 * data is the error string.
830 EXTERN
int nfs_fchmod_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
, nfs_cb cb
, void *private_data
);
832 * Sync fchmod(<handle>)
834 * 0 : The operation was successfull.
835 * -errno : The command failed.
837 EXTERN
int nfs_fchmod(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
);
845 * Async chown(<name>)
847 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
848 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
850 * When the callback is invoked, status indicates the result:
853 * -errno : An error occured.
854 * data is the error string.
856 EXTERN
int nfs_chown_async(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
860 * 0 : The operation was successfull.
861 * -errno : The command failed.
863 EXTERN
int nfs_chown(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
);
871 * Async fchown(<handle>)
873 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
874 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
876 * When the callback is invoked, status indicates the result:
879 * -errno : An error occured.
880 * data is the error string.
882 EXTERN
int nfs_fchown_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
884 * Sync fchown(<handle>)
886 * 0 : The operation was successfull.
887 * -errno : The command failed.
889 EXTERN
int nfs_fchown(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
);
898 * Async utimes(<path>)
900 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
901 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
903 * When the callback is invoked, status indicates the result:
906 * -errno : An error occured.
907 * data is the error string.
909 EXTERN
int nfs_utimes_async(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
, nfs_cb cb
, void *private_data
);
911 * Sync utimes(<path>)
913 * 0 : The operation was successfull.
914 * -errno : The command failed.
916 EXTERN
int nfs_utimes(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
);
923 * Async utime(<path>)
925 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
926 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
928 * When the callback is invoked, status indicates the result:
931 * -errno : An error occured.
932 * data is the error string.
935 EXTERN
int nfs_utime_async(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
, nfs_cb cb
, void *private_data
);
939 * 0 : The operation was successfull.
940 * -errno : The command failed.
942 EXTERN
int nfs_utime(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
);
951 * Async access(<path>)
953 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
954 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
956 * When the callback is invoked, status indicates the result:
959 * -errno : An error occured.
960 * data is the error string.
962 EXTERN
int nfs_access_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
964 * Sync access(<path>)
966 * 0 : The operation was successfull.
967 * -errno : The command failed.
969 EXTERN
int nfs_access(struct nfs_context
*nfs
, const char *path
, int mode
);
978 * Async symlink(<path>)
980 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
981 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
983 * When the callback is invoked, status indicates the result:
986 * -errno : An error occured.
987 * data is the error string.
989 EXTERN
int nfs_symlink_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
991 * Sync symlink(<path>)
993 * 0 : The operation was successfull.
994 * -errno : The command failed.
996 EXTERN
int nfs_symlink(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1003 * Async rename(<oldpath>, <newpath>)
1005 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1006 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1008 * When the callback is invoked, status indicates the result:
1011 * -errno : An error occured.
1012 * data is the error string.
1014 EXTERN
int nfs_rename_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1016 * Sync rename(<oldpath>, <newpath>)
1018 * 0 : The operation was successfull.
1019 * -errno : The command failed.
1021 EXTERN
int nfs_rename(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1029 * Async link(<oldpath>, <newpath>)
1031 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1032 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1034 * When the callback is invoked, status indicates the result:
1037 * -errno : An error occured.
1038 * data is the error string.
1040 EXTERN
int nfs_link_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1042 * Sync link(<oldpath>, <newpath>)
1044 * 0 : The operation was successfull.
1045 * -errno : The command failed.
1047 EXTERN
int nfs_link(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1054 * Async getexports()
1055 * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
1056 * returned structures.
1058 * This function will return the list of exports from an NFS server.
1061 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1062 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1064 * When the callback is invoked, status indicates the result:
1066 * data is a pointer to an exports pointer:
1067 * exports export = *(exports *)data;
1068 * -errno : An error occured.
1069 * data is the error string.
1071 EXTERN
int mount_getexports_async(struct rpc_context
*rpc
, const char *server
, rpc_cb cb
, void *private_data
);
1073 * Sync getexports(<server>)
1075 * NULL : something failed
1076 * exports export : a linked list of exported directories
1078 * returned data must be freed by calling mount_free_export_list(exportnode);
1080 EXTERN
struct exportnode
*mount_getexports(const char *server
);
1082 EXTERN
void mount_free_export_list(struct exportnode
*exports
);
1085 //qqq replace later with lseek(cur, 0)
1086 uint64_t nfs_get_current_offset(struct nfsfh
*nfsfh
);
1092 struct nfs_server_list
{
1093 struct nfs_server_list
*next
;
1098 * Sync find_local_servers(<server>)
1099 * This function will probe all local networks for NFS server. This function will
1100 * block for one second while awaiting for all nfs servers to respond.
1103 * NULL : something failed
1105 * struct nfs_server_list : a linked list of all discovered servers
1107 * returned data must be freed by nfs_free_srvr_list(srv);
1109 struct nfs_server_list
*nfs_find_local_servers(void);
1110 void free_nfs_srvr_list(struct nfs_server_list
*srv
);