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
46 #define EXTERN __declspec( dllexport )
75 * Used for interfacing the async version of the api into an external eventsystem
77 EXTERN
int nfs_get_fd(struct nfs_context
*nfs
);
78 EXTERN
int nfs_which_events(struct nfs_context
*nfs
);
79 EXTERN
int nfs_service(struct nfs_context
*nfs
, int revents
);
80 EXTERN
int nfs_queue_length(struct nfs_context
*nfs
);
83 * Used if you need different credentials than the default for the current user.
86 EXTERN
void nfs_set_auth(struct nfs_context
*nfs
, struct AUTH
*auth
);
89 * When an operation failed, this function can extract a detailed error string.
91 EXTERN
char *nfs_get_error(struct nfs_context
*nfs
);
95 * Callback for all ASYNC nfs functions
97 typedef void (*nfs_cb
)(int err
, struct nfs_context
*nfs
, void *data
, void *private_data
);
100 * Callback for all ASYNC rpc functions
102 typedef void (*rpc_cb
)(struct rpc_context
*rpc
, int status
, void *data
, void *private_data
);
110 * Create an NFS c, the context.
112 * NULL : Failed to create a context.
113 * *nfs : A pointer to an nfs context.
115 EXTERN
struct nfs_context
*nfs_init_context(void);
117 * Destroy an nfs context.
119 EXTERN
void nfs_destroy_context(struct nfs_context
*nfs
);
123 * URL parsing functions.
124 * These functions all parse a URL of the form
125 * nfs://server/path/file?argv=val[&arg=val]*
126 * and returns a nfs_url.
128 * Apart from parsing the URL the functions will also update
129 * the nfs context to reflect settings controlled via url arguments.
131 * Current URL arguments are :
132 * tcp-syncnt=<int> : Number of SYNs to send during the seccion establish
133 * before failing settin up the tcp connection to the
135 * uid=<int> : UID value to use when talking to the server.
136 * default it 65534 on Windows and getuid() on unixen.
137 * gid=<int> : GID value to use when talking to the server.
138 * default it 65534 on Windows and getgid() on unixen.
141 * Parse a complete NFS URL including, server, path and
142 * filename. Fail if any component is missing.
144 EXTERN
struct nfs_url
*nfs_parse_url_full(struct nfs_context
*nfs
, const char *url
);
147 * Parse an NFS URL, but do not split path and file. File
148 * in the resulting struct remains NULL.
150 EXTERN
struct nfs_url
*nfs_parse_url_dir(struct nfs_context
*nfs
, const char *url
);
153 * Parse an NFS URL, but do not fail if file, path or even server is missing.
154 * Check elements of the resulting struct for NULL.
156 EXTERN
struct nfs_url
*nfs_parse_url_incomplete(struct nfs_context
*nfs
, const char *url
);
160 * Free the URL struct returned by the nfs_parse_url_* functions.
162 EXTERN
void nfs_destroy_url(struct nfs_url
*url
);
168 * Get the maximum supported READ3 size by the server
170 EXTERN
uint64_t nfs_get_readmax(struct nfs_context
*nfs
);
173 * Get the maximum supported WRITE3 size by the server
175 EXTERN
uint64_t nfs_get_writemax(struct nfs_context
*nfs
);
178 * MODIFY CONNECT PARAMTERS
181 EXTERN
void nfs_set_tcp_syncnt(struct nfs_context
*nfs
, int v
);
182 EXTERN
void nfs_set_uid(struct nfs_context
*nfs
, int uid
);
183 EXTERN
void nfs_set_gid(struct nfs_context
*nfs
, int gid
);
191 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
192 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
194 * When the callback is invoked, status indicates the result:
197 * -errno : An error occured.
198 * data is the error string.
200 EXTERN
int nfs_mount_async(struct nfs_context
*nfs
, const char *server
, const char *exportname
, nfs_cb cb
, void *private_data
);
204 * 0 : The operation was successfull.
205 * -errno : The command failed.
207 EXTERN
int nfs_mount(struct nfs_context
*nfs
, const char *server
, const char *exportname
);
216 * Async stat(<filename>)
218 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
219 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
221 * When the callback is invoked, status indicates the result:
223 * data is struct stat *
224 * -errno : An error occured.
225 * data is the error string.
228 EXTERN
int nfs_stat_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
230 * Sync stat(<filename>)
232 * 0 : The operation was successfull.
233 * -errno : The command failed.
236 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct __stat64
*st
);
238 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct stat
*st
);
245 * Async fstat(nfsfh *)
247 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
248 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
250 * When the callback is invoked, status indicates the result:
252 * data is struct stat *
253 * -errno : An error occured.
254 * data is the error string.
256 EXTERN
int nfs_fstat_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
258 * Sync fstat(nfsfh *)
260 * 0 : The operation was successfull.
261 * -errno : The command failed.
264 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct __stat64
*st
);
266 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct stat
*st
);
275 * Async open(<filename>)
277 * mode is a combination of the flags : O_RDOLNY, O_WRONLY, O_RDWR , O_SYNC
280 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
281 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
283 * Supported flags are
287 * O_TRUNC (Only valid with O_RDWR or O_WRONLY. Ignored otherwise.)
289 * When the callback is invoked, status indicates the result:
291 * data is a struct *nfsfh;
292 * The nfsfh is close using nfs_close().
293 * -errno : An error occured.
294 * data is the error string.
296 EXTERN
int nfs_open_async(struct nfs_context
*nfs
, const char *path
, int flags
, nfs_cb cb
, void *private_data
);
298 * Sync open(<filename>)
300 * 0 : The operation was successfull. *nfsfh is filled in.
301 * -errno : The command failed.
303 EXTERN
int nfs_open(struct nfs_context
*nfs
, const char *path
, int flags
, struct nfsfh
**nfsfh
);
315 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
316 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
318 * When the callback is invoked, status indicates the result:
321 * -errno : An error occured.
322 * data is the error string.
324 EXTERN
int nfs_close_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
328 * 0 : The operation was successfull.
329 * -errno : The command failed.
331 EXTERN
int nfs_close(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
341 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
342 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
344 * When the callback is invoked, status indicates the result:
346 * status is numer of bytes read.
347 * data is a pointer to the returned data.
348 * -errno : An error occured.
349 * data is the error string.
351 EXTERN
int nfs_pread_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, nfs_cb cb
, void *private_data
);
355 * >=0 : numer of bytes read.
356 * -errno : An error occured.
358 EXTERN
int nfs_pread(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
369 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
370 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
372 * When the callback is invoked, status indicates the result:
374 * status is numer of bytes read.
375 * data is a pointer to the returned data.
376 * -errno : An error occured.
377 * data is the error string.
379 EXTERN
int nfs_read_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, nfs_cb cb
, void *private_data
);
383 * >=0 : numer of bytes read.
384 * -errno : An error occured.
386 EXTERN
int nfs_read(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
398 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
399 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
401 * When the callback is invoked, status indicates the result:
403 * status is numer of bytes written.
404 * -errno : An error occured.
405 * data is the error string.
407 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
);
411 * >=0 : numer of bytes written.
412 * -errno : An error occured.
414 EXTERN
int nfs_pwrite(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
424 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
425 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
427 * When the callback is invoked, status indicates the result:
429 * status is numer of bytes written.
430 * -errno : An error occured.
431 * data is the error string.
433 EXTERN
int nfs_write_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
, nfs_cb cb
, void *private_data
);
437 * >=0 : numer of bytes written.
438 * -errno : An error occured.
440 EXTERN
int nfs_write(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
450 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
451 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
453 * When the callback is invoked, status indicates the result:
455 * data is uint64_t * for the current position.
456 * -errno : An error occured.
457 * data is the error string.
459 EXTERN
int nfs_lseek_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, nfs_cb cb
, void *private_data
);
463 * >=0 : numer of bytes read.
464 * -errno : An error occured.
466 EXTERN
int nfs_lseek(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, uint64_t *current_offset
);
476 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
477 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
479 * When the callback is invoked, status indicates the result:
481 * -errno : An error occured.
482 * data is the error string.
484 EXTERN
int nfs_fsync_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
489 * -errno : An error occured.
491 EXTERN
int nfs_fsync(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
502 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
503 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
505 * When the callback is invoked, status indicates the result:
507 * -errno : An error occured.
508 * data is the error string.
510 EXTERN
int nfs_truncate_async(struct nfs_context
*nfs
, const char *path
, uint64_t length
, nfs_cb cb
, void *private_data
);
515 * -errno : An error occured.
517 EXTERN
int nfs_truncate(struct nfs_context
*nfs
, const char *path
, uint64_t length
);
528 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
529 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
531 * When the callback is invoked, status indicates the result:
533 * -errno : An error occured.
534 * data is the error string.
536 EXTERN
int nfs_ftruncate_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
, nfs_cb cb
, void *private_data
);
541 * -errno : An error occured.
543 EXTERN
int nfs_ftruncate(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
);
557 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
558 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
560 * When the callback is invoked, status indicates the result:
562 * -errno : An error occured.
563 * data is the error string.
565 EXTERN
int nfs_mkdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
570 * -errno : An error occured.
572 EXTERN
int nfs_mkdir(struct nfs_context
*nfs
, const char *path
);
583 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
584 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
586 * When the callback is invoked, status indicates the result:
588 * -errno : An error occured.
589 * data is the error string.
591 EXTERN
int nfs_rmdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
596 * -errno : An error occured.
598 EXTERN
int nfs_rmdir(struct nfs_context
*nfs
, const char *path
);
610 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
611 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
613 * When the callback is invoked, status indicates the result:
615 * data is a struct *nfsfh;
616 * -errno : An error occured.
617 * data is the error string.
619 EXTERN
int nfs_creat_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
624 * -errno : An error occured.
626 EXTERN
int nfs_creat(struct nfs_context
*nfs
, const char *path
, int mode
, struct nfsfh
**nfsfh
);
636 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
637 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
639 * When the callback is invoked, status indicates the result:
641 * -errno : An error occured.
642 * data is the error string.
644 EXTERN
int nfs_mknod_async(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
, nfs_cb cb
, void *private_data
);
649 * -errno : An error occured.
651 EXTERN
int nfs_mknod(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
);
662 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
663 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
665 * When the callback is invoked, status indicates the result:
668 * -errno : An error occured.
669 * data is the error string.
671 EXTERN
int nfs_unlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
676 * -errno : An error occured.
678 EXTERN
int nfs_unlink(struct nfs_context
*nfs
, const char *path
);
691 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
692 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
694 * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
696 * When the callback is invoked, status indicates the result:
698 * data is struct nfsdir *
699 * -errno : An error occured.
700 * data is the error string.
702 EXTERN
int nfs_opendir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
707 * -errno : An error occured.
709 EXTERN
int nfs_opendir(struct nfs_context
*nfs
, const char *path
, struct nfsdir
**nfsdir
);
717 struct nfsdirent
*next
;
721 /* Some extra fields we get for free through the READDIRPLUS3 call.
722 You need libnfs-raw-nfs.h for type/mode constants */
723 uint32_t type
; /* NF3REG, NF3DIR, NF3BLK, ... */
726 struct timeval atime
;
727 struct timeval mtime
;
728 struct timeval ctime
;
733 * nfs_readdir() never blocks, so no special sync/async versions are available
735 EXTERN
struct nfsdirent
*nfs_readdir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
743 * nfs_closedir() never blocks, so no special sync/async versions are available
745 EXTERN
void nfs_closedir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
752 * Async chdir(<path>)
755 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
756 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
758 * When the callback is invoked, status indicates the result:
761 * -errno : An error occured.
762 * data is the error string.
764 EXTERN
int nfs_chdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
768 * 0 : The operation was successfull.
769 * -errno : The command failed.
771 EXTERN
int nfs_chdir(struct nfs_context
*nfs
, const char *path
);
777 * nfs_getcwd() never blocks, so no special sync/async versions are available
781 * This function returns a pointer to the current working directory.
782 * This pointer is only stable until the next [f]chdir or when the
783 * context is destroyed.
786 * 0 : The operation was successfull and *cwd is filled in.
787 * -errno : The command failed.
789 EXTERN
void nfs_getcwd(struct nfs_context
*nfs
, const char **cwd
);
796 * Async statvfs(<dirname>)
798 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
799 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
801 * When the callback is invoked, status indicates the result:
803 * data is struct statvfs *
804 * -errno : An error occured.
805 * data is the error string.
808 EXTERN
int nfs_statvfs_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
810 * Sync statvfs(<dirname>)
812 * 0 : The operation was successfull.
813 * -errno : The command failed.
815 EXTERN
int nfs_statvfs(struct nfs_context
*nfs
, const char *path
, struct statvfs
*svfs
);
822 * Async readlink(<name>)
824 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
825 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
827 * When the callback is invoked, status indicates the result:
830 * data is only valid during the callback and is automatically freed when the callback returns.
831 * -errno : An error occured.
832 * data is the error string.
835 EXTERN
int nfs_readlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
837 * Sync readlink(<name>)
839 * 0 : The operation was successfull.
840 * -errno : The command failed.
842 EXTERN
int nfs_readlink(struct nfs_context
*nfs
, const char *path
, char *buf
, int bufsize
);
850 * Async chmod(<name>)
852 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
853 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
855 * When the callback is invoked, status indicates the result:
858 * -errno : An error occured.
859 * data is the error string.
861 EXTERN
int nfs_chmod_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
865 * 0 : The operation was successfull.
866 * -errno : The command failed.
868 EXTERN
int nfs_chmod(struct nfs_context
*nfs
, const char *path
, int mode
);
876 * Async fchmod(<handle>)
878 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
879 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
881 * When the callback is invoked, status indicates the result:
884 * -errno : An error occured.
885 * data is the error string.
887 EXTERN
int nfs_fchmod_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
, nfs_cb cb
, void *private_data
);
889 * Sync fchmod(<handle>)
891 * 0 : The operation was successfull.
892 * -errno : The command failed.
894 EXTERN
int nfs_fchmod(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
);
902 * Async chown(<name>)
904 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
905 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
907 * When the callback is invoked, status indicates the result:
910 * -errno : An error occured.
911 * data is the error string.
913 EXTERN
int nfs_chown_async(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
917 * 0 : The operation was successfull.
918 * -errno : The command failed.
920 EXTERN
int nfs_chown(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
);
928 * Async fchown(<handle>)
930 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
931 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
933 * When the callback is invoked, status indicates the result:
936 * -errno : An error occured.
937 * data is the error string.
939 EXTERN
int nfs_fchown_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
941 * Sync fchown(<handle>)
943 * 0 : The operation was successfull.
944 * -errno : The command failed.
946 EXTERN
int nfs_fchown(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
);
955 * Async utimes(<path>)
957 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
958 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
960 * When the callback is invoked, status indicates the result:
963 * -errno : An error occured.
964 * data is the error string.
966 EXTERN
int nfs_utimes_async(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
, nfs_cb cb
, void *private_data
);
968 * Sync utimes(<path>)
970 * 0 : The operation was successfull.
971 * -errno : The command failed.
973 EXTERN
int nfs_utimes(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
);
980 * Async utime(<path>)
982 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
983 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
985 * When the callback is invoked, status indicates the result:
988 * -errno : An error occured.
989 * data is the error string.
992 EXTERN
int nfs_utime_async(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
, nfs_cb cb
, void *private_data
);
996 * 0 : The operation was successfull.
997 * -errno : The command failed.
999 EXTERN
int nfs_utime(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
);
1008 * Async access(<path>)
1010 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1011 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1013 * When the callback is invoked, status indicates the result:
1016 * -errno : An error occured.
1017 * data is the error string.
1019 EXTERN
int nfs_access_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
1021 * Sync access(<path>)
1023 * 0 : The operation was successfull.
1024 * -errno : The command failed.
1026 EXTERN
int nfs_access(struct nfs_context
*nfs
, const char *path
, int mode
);
1035 * Async symlink(<path>)
1037 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1038 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1040 * When the callback is invoked, status indicates the result:
1043 * -errno : An error occured.
1044 * data is the error string.
1046 EXTERN
int nfs_symlink_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1048 * Sync symlink(<path>)
1050 * 0 : The operation was successfull.
1051 * -errno : The command failed.
1053 EXTERN
int nfs_symlink(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1060 * Async rename(<oldpath>, <newpath>)
1062 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1063 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1065 * When the callback is invoked, status indicates the result:
1068 * -errno : An error occured.
1069 * data is the error string.
1071 EXTERN
int nfs_rename_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1073 * Sync rename(<oldpath>, <newpath>)
1075 * 0 : The operation was successfull.
1076 * -errno : The command failed.
1078 EXTERN
int nfs_rename(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1086 * Async link(<oldpath>, <newpath>)
1088 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1089 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1091 * When the callback is invoked, status indicates the result:
1094 * -errno : An error occured.
1095 * data is the error string.
1097 EXTERN
int nfs_link_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1099 * Sync link(<oldpath>, <newpath>)
1101 * 0 : The operation was successfull.
1102 * -errno : The command failed.
1104 EXTERN
int nfs_link(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1111 * Async getexports()
1112 * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
1113 * returned structures.
1115 * This function will return the list of exports from an NFS server.
1118 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1119 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1121 * When the callback is invoked, status indicates the result:
1123 * data is a pointer to an exports pointer:
1124 * exports export = *(exports *)data;
1125 * -errno : An error occured.
1126 * data is the error string.
1128 EXTERN
int mount_getexports_async(struct rpc_context
*rpc
, const char *server
, rpc_cb cb
, void *private_data
);
1130 * Sync getexports(<server>)
1132 * NULL : something failed
1133 * exports export : a linked list of exported directories
1135 * returned data must be freed by calling mount_free_export_list(exportnode);
1137 EXTERN
struct exportnode
*mount_getexports(const char *server
);
1139 EXTERN
void mount_free_export_list(struct exportnode
*exports
);
1142 //qqq replace later with lseek(cur, 0)
1143 uint64_t nfs_get_current_offset(struct nfsfh
*nfsfh
);
1149 struct nfs_server_list
{
1150 struct nfs_server_list
*next
;
1155 * Sync find_local_servers(<server>)
1156 * This function will probe all local networks for NFS server. This function will
1157 * block for one second while awaiting for all nfs servers to respond.
1160 * NULL : something failed
1162 * struct nfs_server_list : a linked list of all discovered servers
1164 * returned data must be freed by nfs_free_srvr_list(srv);
1166 struct nfs_server_list
*nfs_find_local_servers(void);
1167 void free_nfs_srvr_list(struct nfs_server_list
*srv
);
1173 #endif /* !_LIBNFS_H_ */