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
279 * O_TRUNC (Only valid with O_RDWR or O_WRONLY. Ignored otherwise.)
281 * When the callback is invoked, status indicates the result:
283 * data is a struct *nfsfh;
284 * The nfsfh is close using nfs_close().
285 * -errno : An error occured.
286 * data is the error string.
288 EXTERN
int nfs_open_async(struct nfs_context
*nfs
, const char *path
, int flags
, nfs_cb cb
, void *private_data
);
290 * Sync open(<filename>)
292 * 0 : The operation was successfull. *nfsfh is filled in.
293 * -errno : The command failed.
295 EXTERN
int nfs_open(struct nfs_context
*nfs
, const char *path
, int flags
, struct nfsfh
**nfsfh
);
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.
310 * When the callback is invoked, status indicates the result:
313 * -errno : An error occured.
314 * data is the error string.
316 EXTERN
int nfs_close_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
320 * 0 : The operation was successfull.
321 * -errno : The command failed.
323 EXTERN
int nfs_close(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
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.
336 * When the callback is invoked, status indicates the result:
338 * status is numer of bytes read.
339 * data is a pointer to the returned data.
340 * -errno : An error occured.
341 * data is the error string.
343 EXTERN
int nfs_pread_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, nfs_cb cb
, void *private_data
);
347 * >=0 : numer of bytes read.
348 * -errno : An error occured.
350 EXTERN
int nfs_pread(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
361 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
362 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
364 * When the callback is invoked, status indicates the result:
366 * status is numer of bytes read.
367 * data is a pointer to the returned data.
368 * -errno : An error occured.
369 * data is the error string.
371 EXTERN
int nfs_read_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, nfs_cb cb
, void *private_data
);
375 * >=0 : numer of bytes read.
376 * -errno : An error occured.
378 EXTERN
int nfs_read(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
390 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
391 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
393 * When the callback is invoked, status indicates the result:
395 * status is numer of bytes written.
396 * -errno : An error occured.
397 * data is the error string.
399 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
);
403 * >=0 : numer of bytes written.
404 * -errno : An error occured.
406 EXTERN
int nfs_pwrite(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
416 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
417 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
419 * When the callback is invoked, status indicates the result:
421 * status is numer of bytes written.
422 * -errno : An error occured.
423 * data is the error string.
425 EXTERN
int nfs_write_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
, nfs_cb cb
, void *private_data
);
429 * >=0 : numer of bytes written.
430 * -errno : An error occured.
432 EXTERN
int nfs_write(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
442 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
443 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
445 * When the callback is invoked, status indicates the result:
447 * data is uint64_t * for the current position.
448 * -errno : An error occured.
449 * data is the error string.
451 EXTERN
int nfs_lseek_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, nfs_cb cb
, void *private_data
);
455 * >=0 : numer of bytes read.
456 * -errno : An error occured.
458 EXTERN
int nfs_lseek(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, uint64_t *current_offset
);
468 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
469 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
471 * When the callback is invoked, status indicates the result:
473 * -errno : An error occured.
474 * data is the error string.
476 EXTERN
int nfs_fsync_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
481 * -errno : An error occured.
483 EXTERN
int nfs_fsync(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
494 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
495 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
497 * When the callback is invoked, status indicates the result:
499 * -errno : An error occured.
500 * data is the error string.
502 EXTERN
int nfs_truncate_async(struct nfs_context
*nfs
, const char *path
, uint64_t length
, nfs_cb cb
, void *private_data
);
507 * -errno : An error occured.
509 EXTERN
int nfs_truncate(struct nfs_context
*nfs
, const char *path
, uint64_t length
);
520 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
521 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
523 * When the callback is invoked, status indicates the result:
525 * -errno : An error occured.
526 * data is the error string.
528 EXTERN
int nfs_ftruncate_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
, nfs_cb cb
, void *private_data
);
533 * -errno : An error occured.
535 EXTERN
int nfs_ftruncate(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
);
549 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
550 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
552 * When the callback is invoked, status indicates the result:
554 * -errno : An error occured.
555 * data is the error string.
557 EXTERN
int nfs_mkdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
562 * -errno : An error occured.
564 EXTERN
int nfs_mkdir(struct nfs_context
*nfs
, const char *path
);
575 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
576 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
578 * When the callback is invoked, status indicates the result:
580 * -errno : An error occured.
581 * data is the error string.
583 EXTERN
int nfs_rmdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
588 * -errno : An error occured.
590 EXTERN
int nfs_rmdir(struct nfs_context
*nfs
, const char *path
);
602 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
603 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
605 * When the callback is invoked, status indicates the result:
607 * data is a struct *nfsfh;
608 * -errno : An error occured.
609 * data is the error string.
611 EXTERN
int nfs_creat_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
616 * -errno : An error occured.
618 EXTERN
int nfs_creat(struct nfs_context
*nfs
, const char *path
, int mode
, struct nfsfh
**nfsfh
);
628 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
629 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
631 * When the callback is invoked, status indicates the result:
633 * -errno : An error occured.
634 * data is the error string.
636 EXTERN
int nfs_mknod_async(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
, nfs_cb cb
, void *private_data
);
641 * -errno : An error occured.
643 EXTERN
int nfs_mknod(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
);
654 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
655 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
657 * When the callback is invoked, status indicates the result:
660 * -errno : An error occured.
661 * data is the error string.
663 EXTERN
int nfs_unlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
668 * -errno : An error occured.
670 EXTERN
int nfs_unlink(struct nfs_context
*nfs
, const char *path
);
683 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
684 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
686 * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
688 * When the callback is invoked, status indicates the result:
690 * data is struct nfsdir *
691 * -errno : An error occured.
692 * data is the error string.
694 EXTERN
int nfs_opendir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
699 * -errno : An error occured.
701 EXTERN
int nfs_opendir(struct nfs_context
*nfs
, const char *path
, struct nfsdir
**nfsdir
);
709 struct nfsdirent
*next
;
713 /* Some extra fields we get for free through the READDIRPLUS3 call.
714 You need libnfs-raw-nfs.h for type/mode constants */
715 uint32_t type
; /* NF3REG, NF3DIR, NF3BLK, ... */
718 struct timeval atime
;
719 struct timeval mtime
;
720 struct timeval ctime
;
725 * nfs_readdir() never blocks, so no special sync/async versions are available
727 EXTERN
struct nfsdirent
*nfs_readdir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
735 * nfs_closedir() never blocks, so no special sync/async versions are available
737 EXTERN
void nfs_closedir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
744 * Async chdir(<path>)
747 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
748 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
750 * When the callback is invoked, status indicates the result:
753 * -errno : An error occured.
754 * data is the error string.
756 EXTERN
int nfs_chdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
760 * 0 : The operation was successfull.
761 * -errno : The command failed.
763 EXTERN
int nfs_chdir(struct nfs_context
*nfs
, const char *path
);
769 * nfs_getcwd() never blocks, so no special sync/async versions are available
773 * This function returns a pointer to the current working directory.
774 * This pointer is only stable until the next [f]chdir or when the
775 * context is destroyed.
778 * 0 : The operation was successfull and *cwd is filled in.
779 * -errno : The command failed.
781 EXTERN
void nfs_getcwd(struct nfs_context
*nfs
, const char **cwd
);
788 * Async statvfs(<dirname>)
790 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
791 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
793 * When the callback is invoked, status indicates the result:
795 * data is struct statvfs *
796 * -errno : An error occured.
797 * data is the error string.
800 EXTERN
int nfs_statvfs_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
802 * Sync statvfs(<dirname>)
804 * 0 : The operation was successfull.
805 * -errno : The command failed.
807 EXTERN
int nfs_statvfs(struct nfs_context
*nfs
, const char *path
, struct statvfs
*svfs
);
814 * Async readlink(<name>)
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.
819 * When the callback is invoked, status indicates the result:
822 * data is only valid during the callback and is automatically freed when the callback returns.
823 * -errno : An error occured.
824 * data is the error string.
827 EXTERN
int nfs_readlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
829 * Sync readlink(<name>)
831 * 0 : The operation was successfull.
832 * -errno : The command failed.
834 EXTERN
int nfs_readlink(struct nfs_context
*nfs
, const char *path
, char *buf
, int bufsize
);
842 * Async chmod(<name>)
844 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
845 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
847 * When the callback is invoked, status indicates the result:
850 * -errno : An error occured.
851 * data is the error string.
853 EXTERN
int nfs_chmod_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
857 * 0 : The operation was successfull.
858 * -errno : The command failed.
860 EXTERN
int nfs_chmod(struct nfs_context
*nfs
, const char *path
, int mode
);
868 * Async fchmod(<handle>)
870 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
871 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
873 * When the callback is invoked, status indicates the result:
876 * -errno : An error occured.
877 * data is the error string.
879 EXTERN
int nfs_fchmod_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
, nfs_cb cb
, void *private_data
);
881 * Sync fchmod(<handle>)
883 * 0 : The operation was successfull.
884 * -errno : The command failed.
886 EXTERN
int nfs_fchmod(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
);
894 * Async chown(<name>)
896 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
897 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
899 * When the callback is invoked, status indicates the result:
902 * -errno : An error occured.
903 * data is the error string.
905 EXTERN
int nfs_chown_async(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
909 * 0 : The operation was successfull.
910 * -errno : The command failed.
912 EXTERN
int nfs_chown(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
);
920 * Async fchown(<handle>)
922 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
923 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
925 * When the callback is invoked, status indicates the result:
928 * -errno : An error occured.
929 * data is the error string.
931 EXTERN
int nfs_fchown_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
933 * Sync fchown(<handle>)
935 * 0 : The operation was successfull.
936 * -errno : The command failed.
938 EXTERN
int nfs_fchown(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
);
947 * Async utimes(<path>)
949 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
950 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
952 * When the callback is invoked, status indicates the result:
955 * -errno : An error occured.
956 * data is the error string.
958 EXTERN
int nfs_utimes_async(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
, nfs_cb cb
, void *private_data
);
960 * Sync utimes(<path>)
962 * 0 : The operation was successfull.
963 * -errno : The command failed.
965 EXTERN
int nfs_utimes(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
);
972 * Async utime(<path>)
974 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
975 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
977 * When the callback is invoked, status indicates the result:
980 * -errno : An error occured.
981 * data is the error string.
984 EXTERN
int nfs_utime_async(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
, nfs_cb cb
, void *private_data
);
988 * 0 : The operation was successfull.
989 * -errno : The command failed.
991 EXTERN
int nfs_utime(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
);
1000 * Async access(<path>)
1002 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1003 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1005 * When the callback is invoked, status indicates the result:
1008 * -errno : An error occured.
1009 * data is the error string.
1011 EXTERN
int nfs_access_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
1013 * Sync access(<path>)
1015 * 0 : The operation was successfull.
1016 * -errno : The command failed.
1018 EXTERN
int nfs_access(struct nfs_context
*nfs
, const char *path
, int mode
);
1027 * Async symlink(<path>)
1029 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1030 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1032 * When the callback is invoked, status indicates the result:
1035 * -errno : An error occured.
1036 * data is the error string.
1038 EXTERN
int nfs_symlink_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1040 * Sync symlink(<path>)
1042 * 0 : The operation was successfull.
1043 * -errno : The command failed.
1045 EXTERN
int nfs_symlink(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1052 * Async rename(<oldpath>, <newpath>)
1054 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1055 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1057 * When the callback is invoked, status indicates the result:
1060 * -errno : An error occured.
1061 * data is the error string.
1063 EXTERN
int nfs_rename_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1065 * Sync rename(<oldpath>, <newpath>)
1067 * 0 : The operation was successfull.
1068 * -errno : The command failed.
1070 EXTERN
int nfs_rename(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1078 * Async link(<oldpath>, <newpath>)
1080 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1081 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1083 * When the callback is invoked, status indicates the result:
1086 * -errno : An error occured.
1087 * data is the error string.
1089 EXTERN
int nfs_link_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1091 * Sync link(<oldpath>, <newpath>)
1093 * 0 : The operation was successfull.
1094 * -errno : The command failed.
1096 EXTERN
int nfs_link(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1103 * Async getexports()
1104 * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
1105 * returned structures.
1107 * This function will return the list of exports from an NFS server.
1110 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1111 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1113 * When the callback is invoked, status indicates the result:
1115 * data is a pointer to an exports pointer:
1116 * exports export = *(exports *)data;
1117 * -errno : An error occured.
1118 * data is the error string.
1120 EXTERN
int mount_getexports_async(struct rpc_context
*rpc
, const char *server
, rpc_cb cb
, void *private_data
);
1122 * Sync getexports(<server>)
1124 * NULL : something failed
1125 * exports export : a linked list of exported directories
1127 * returned data must be freed by calling mount_free_export_list(exportnode);
1129 EXTERN
struct exportnode
*mount_getexports(const char *server
);
1131 EXTERN
void mount_free_export_list(struct exportnode
*exports
);
1134 //qqq replace later with lseek(cur, 0)
1135 uint64_t nfs_get_current_offset(struct nfsfh
*nfsfh
);
1141 struct nfs_server_list
{
1142 struct nfs_server_list
*next
;
1147 * Sync find_local_servers(<server>)
1148 * This function will probe all local networks for NFS server. This function will
1149 * block for one second while awaiting for all nfs servers to respond.
1152 * NULL : something failed
1154 * struct nfs_server_list : a linked list of all discovered servers
1156 * returned data must be freed by nfs_free_srvr_list(srv);
1158 struct nfs_server_list
*nfs_find_local_servers(void);
1159 void free_nfs_srvr_list(struct nfs_server_list
*srv
);