b9138c9066409ea3fab16053a4ebca4c9a2d793d
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 * Supported flags are
280 * When the callback is invoked, status indicates the result:
282 * data is a struct *nfsfh;
283 * The nfsfh is close using nfs_close().
284 * -errno : An error occured.
285 * data is the error string.
287 EXTERN
int nfs_open_async(struct nfs_context
*nfs
, const char *path
, int flags
, nfs_cb cb
, void *private_data
);
289 * Sync open(<filename>)
291 * 0 : The operation was successfull. *nfsfh is filled in.
292 * -errno : The command failed.
294 EXTERN
int nfs_open(struct nfs_context
*nfs
, const char *path
, int flags
, struct nfsfh
**nfsfh
);
306 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
307 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
309 * When the callback is invoked, status indicates the result:
312 * -errno : An error occured.
313 * data is the error string.
315 EXTERN
int nfs_close_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
319 * 0 : The operation was successfull.
320 * -errno : The command failed.
322 EXTERN
int nfs_close(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
332 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
333 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
335 * When the callback is invoked, status indicates the result:
337 * status is numer of bytes read.
338 * data is a pointer to the returned data.
339 * -errno : An error occured.
340 * data is the error string.
342 EXTERN
int nfs_pread_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, nfs_cb cb
, void *private_data
);
346 * >=0 : numer of bytes read.
347 * -errno : An error occured.
349 EXTERN
int nfs_pread(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
360 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
361 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
363 * When the callback is invoked, status indicates the result:
365 * status is numer of bytes read.
366 * data is a pointer to the returned data.
367 * -errno : An error occured.
368 * data is the error string.
370 EXTERN
int nfs_read_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, nfs_cb cb
, void *private_data
);
374 * >=0 : numer of bytes read.
375 * -errno : An error occured.
377 EXTERN
int nfs_read(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
389 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
390 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
392 * When the callback is invoked, status indicates the result:
394 * status is numer of bytes written.
395 * -errno : An error occured.
396 * data is the error string.
398 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
);
402 * >=0 : numer of bytes written.
403 * -errno : An error occured.
405 EXTERN
int nfs_pwrite(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
415 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
416 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
418 * When the callback is invoked, status indicates the result:
420 * status is numer of bytes written.
421 * -errno : An error occured.
422 * data is the error string.
424 EXTERN
int nfs_write_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
, nfs_cb cb
, void *private_data
);
428 * >=0 : numer of bytes written.
429 * -errno : An error occured.
431 EXTERN
int nfs_write(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
441 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
442 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
444 * When the callback is invoked, status indicates the result:
446 * data is uint64_t * for the current position.
447 * -errno : An error occured.
448 * data is the error string.
450 EXTERN
int nfs_lseek_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, nfs_cb cb
, void *private_data
);
454 * >=0 : numer of bytes read.
455 * -errno : An error occured.
457 EXTERN
int nfs_lseek(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, uint64_t *current_offset
);
467 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
468 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
470 * When the callback is invoked, status indicates the result:
472 * -errno : An error occured.
473 * data is the error string.
475 EXTERN
int nfs_fsync_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
480 * -errno : An error occured.
482 EXTERN
int nfs_fsync(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
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.
496 * When the callback is invoked, status indicates the result:
498 * -errno : An error occured.
499 * data is the error string.
501 EXTERN
int nfs_truncate_async(struct nfs_context
*nfs
, const char *path
, uint64_t length
, nfs_cb cb
, void *private_data
);
506 * -errno : An error occured.
508 EXTERN
int nfs_truncate(struct nfs_context
*nfs
, const char *path
, uint64_t length
);
519 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
520 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
522 * When the callback is invoked, status indicates the result:
524 * -errno : An error occured.
525 * data is the error string.
527 EXTERN
int nfs_ftruncate_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
, nfs_cb cb
, void *private_data
);
532 * -errno : An error occured.
534 EXTERN
int nfs_ftruncate(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
);
548 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
549 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
551 * When the callback is invoked, status indicates the result:
553 * -errno : An error occured.
554 * data is the error string.
556 EXTERN
int nfs_mkdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
561 * -errno : An error occured.
563 EXTERN
int nfs_mkdir(struct nfs_context
*nfs
, const char *path
);
574 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
575 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
577 * When the callback is invoked, status indicates the result:
579 * -errno : An error occured.
580 * data is the error string.
582 EXTERN
int nfs_rmdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
587 * -errno : An error occured.
589 EXTERN
int nfs_rmdir(struct nfs_context
*nfs
, const char *path
);
601 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
602 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
604 * When the callback is invoked, status indicates the result:
606 * data is a struct *nfsfh;
607 * -errno : An error occured.
608 * data is the error string.
610 EXTERN
int nfs_creat_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
615 * -errno : An error occured.
617 EXTERN
int nfs_creat(struct nfs_context
*nfs
, const char *path
, int mode
, struct nfsfh
**nfsfh
);
627 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
628 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
630 * When the callback is invoked, status indicates the result:
632 * -errno : An error occured.
633 * data is the error string.
635 EXTERN
int nfs_mknod_async(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
, nfs_cb cb
, void *private_data
);
640 * -errno : An error occured.
642 EXTERN
int nfs_mknod(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
);
653 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
654 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
656 * When the callback is invoked, status indicates the result:
659 * -errno : An error occured.
660 * data is the error string.
662 EXTERN
int nfs_unlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
667 * -errno : An error occured.
669 EXTERN
int nfs_unlink(struct nfs_context
*nfs
, const char *path
);
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.
685 * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
687 * When the callback is invoked, status indicates the result:
689 * data is struct nfsdir *
690 * -errno : An error occured.
691 * data is the error string.
693 EXTERN
int nfs_opendir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
698 * -errno : An error occured.
700 EXTERN
int nfs_opendir(struct nfs_context
*nfs
, const char *path
, struct nfsdir
**nfsdir
);
708 struct nfsdirent
*next
;
712 /* Some extra fields we get for free through the READDIRPLUS3 call.
713 You need libnfs-raw-nfs.h for type/mode constants */
714 uint32_t type
; /* NF3REG, NF3DIR, NF3BLK, ... */
717 struct timeval atime
;
718 struct timeval mtime
;
719 struct timeval ctime
;
724 * nfs_readdir() never blocks, so no special sync/async versions are available
726 EXTERN
struct nfsdirent
*nfs_readdir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
734 * nfs_closedir() never blocks, so no special sync/async versions are available
736 EXTERN
void nfs_closedir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
743 * Async chdir(<path>)
746 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
747 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
749 * When the callback is invoked, status indicates the result:
752 * -errno : An error occured.
753 * data is the error string.
755 EXTERN
int nfs_chdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
759 * 0 : The operation was successfull.
760 * -errno : The command failed.
762 EXTERN
int nfs_chdir(struct nfs_context
*nfs
, const char *path
);
768 * nfs_getcwd() never blocks, so no special sync/async versions are available
772 * This function returns a pointer to the current working directory.
773 * This pointer is only stable until the next [f]chdir or when the
774 * context is destroyed.
777 * 0 : The operation was successfull and *cwd is filled in.
778 * -errno : The command failed.
780 EXTERN
void nfs_getcwd(struct nfs_context
*nfs
, const char **cwd
);
787 * Async statvfs(<dirname>)
789 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
790 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
792 * When the callback is invoked, status indicates the result:
794 * data is struct statvfs *
795 * -errno : An error occured.
796 * data is the error string.
799 EXTERN
int nfs_statvfs_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
801 * Sync statvfs(<dirname>)
803 * 0 : The operation was successfull.
804 * -errno : The command failed.
806 EXTERN
int nfs_statvfs(struct nfs_context
*nfs
, const char *path
, struct statvfs
*svfs
);
813 * Async readlink(<name>)
815 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
816 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
818 * When the callback is invoked, status indicates the result:
821 * data is only valid during the callback and is automatically freed when the callback returns.
822 * -errno : An error occured.
823 * data is the error string.
826 EXTERN
int nfs_readlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
828 * Sync readlink(<name>)
830 * 0 : The operation was successfull.
831 * -errno : The command failed.
833 EXTERN
int nfs_readlink(struct nfs_context
*nfs
, const char *path
, char *buf
, int bufsize
);
841 * Async chmod(<name>)
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.
846 * When the callback is invoked, status indicates the result:
849 * -errno : An error occured.
850 * data is the error string.
852 EXTERN
int nfs_chmod_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
856 * 0 : The operation was successfull.
857 * -errno : The command failed.
859 EXTERN
int nfs_chmod(struct nfs_context
*nfs
, const char *path
, int mode
);
867 * Async fchmod(<handle>)
869 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
870 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
872 * When the callback is invoked, status indicates the result:
875 * -errno : An error occured.
876 * data is the error string.
878 EXTERN
int nfs_fchmod_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
, nfs_cb cb
, void *private_data
);
880 * Sync fchmod(<handle>)
882 * 0 : The operation was successfull.
883 * -errno : The command failed.
885 EXTERN
int nfs_fchmod(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
);
893 * Async chown(<name>)
895 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
896 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
898 * When the callback is invoked, status indicates the result:
901 * -errno : An error occured.
902 * data is the error string.
904 EXTERN
int nfs_chown_async(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
908 * 0 : The operation was successfull.
909 * -errno : The command failed.
911 EXTERN
int nfs_chown(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
);
919 * Async fchown(<handle>)
921 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
922 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
924 * When the callback is invoked, status indicates the result:
927 * -errno : An error occured.
928 * data is the error string.
930 EXTERN
int nfs_fchown_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
932 * Sync fchown(<handle>)
934 * 0 : The operation was successfull.
935 * -errno : The command failed.
937 EXTERN
int nfs_fchown(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
);
946 * Async utimes(<path>)
948 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
949 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
951 * When the callback is invoked, status indicates the result:
954 * -errno : An error occured.
955 * data is the error string.
957 EXTERN
int nfs_utimes_async(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
, nfs_cb cb
, void *private_data
);
959 * Sync utimes(<path>)
961 * 0 : The operation was successfull.
962 * -errno : The command failed.
964 EXTERN
int nfs_utimes(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
);
971 * Async utime(<path>)
973 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
974 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
976 * When the callback is invoked, status indicates the result:
979 * -errno : An error occured.
980 * data is the error string.
983 EXTERN
int nfs_utime_async(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
, nfs_cb cb
, void *private_data
);
987 * 0 : The operation was successfull.
988 * -errno : The command failed.
990 EXTERN
int nfs_utime(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
);
999 * Async access(<path>)
1001 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1002 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1004 * When the callback is invoked, status indicates the result:
1007 * -errno : An error occured.
1008 * data is the error string.
1010 EXTERN
int nfs_access_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
1012 * Sync access(<path>)
1014 * 0 : The operation was successfull.
1015 * -errno : The command failed.
1017 EXTERN
int nfs_access(struct nfs_context
*nfs
, const char *path
, int mode
);
1026 * Async symlink(<path>)
1028 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1029 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1031 * When the callback is invoked, status indicates the result:
1034 * -errno : An error occured.
1035 * data is the error string.
1037 EXTERN
int nfs_symlink_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1039 * Sync symlink(<path>)
1041 * 0 : The operation was successfull.
1042 * -errno : The command failed.
1044 EXTERN
int nfs_symlink(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1051 * Async rename(<oldpath>, <newpath>)
1053 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1054 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1056 * When the callback is invoked, status indicates the result:
1059 * -errno : An error occured.
1060 * data is the error string.
1062 EXTERN
int nfs_rename_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1064 * Sync rename(<oldpath>, <newpath>)
1066 * 0 : The operation was successfull.
1067 * -errno : The command failed.
1069 EXTERN
int nfs_rename(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1077 * Async link(<oldpath>, <newpath>)
1079 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1080 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1082 * When the callback is invoked, status indicates the result:
1085 * -errno : An error occured.
1086 * data is the error string.
1088 EXTERN
int nfs_link_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1090 * Sync link(<oldpath>, <newpath>)
1092 * 0 : The operation was successfull.
1093 * -errno : The command failed.
1095 EXTERN
int nfs_link(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1102 * Async getexports()
1103 * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
1104 * returned structures.
1106 * This function will return the list of exports from an NFS server.
1109 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1110 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1112 * When the callback is invoked, status indicates the result:
1114 * data is a pointer to an exports pointer:
1115 * exports export = *(exports *)data;
1116 * -errno : An error occured.
1117 * data is the error string.
1119 EXTERN
int mount_getexports_async(struct rpc_context
*rpc
, const char *server
, rpc_cb cb
, void *private_data
);
1121 * Sync getexports(<server>)
1123 * NULL : something failed
1124 * exports export : a linked list of exported directories
1126 * returned data must be freed by calling mount_free_export_list(exportnode);
1128 EXTERN
struct exportnode
*mount_getexports(const char *server
);
1130 EXTERN
void mount_free_export_list(struct exportnode
*exports
);
1133 //qqq replace later with lseek(cur, 0)
1134 uint64_t nfs_get_current_offset(struct nfsfh
*nfsfh
);
1140 struct nfs_server_list
{
1141 struct nfs_server_list
*next
;
1146 * Sync find_local_servers(<server>)
1147 * This function will probe all local networks for NFS server. This function will
1148 * block for one second while awaiting for all nfs servers to respond.
1151 * NULL : something failed
1153 * struct nfs_server_list : a linked list of all discovered servers
1155 * returned data must be freed by nfs_free_srvr_list(srv);
1157 struct nfs_server_list
*nfs_find_local_servers(void);
1158 void free_nfs_srvr_list(struct nfs_server_list
*srv
);