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
);
176 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
177 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
179 * When the callback is invoked, status indicates the result:
182 * -errno : An error occured.
183 * data is the error string.
185 EXTERN
int nfs_mount_async(struct nfs_context
*nfs
, const char *server
, const char *exportname
, nfs_cb cb
, void *private_data
);
189 * 0 : The operation was successfull.
190 * -errno : The command failed.
192 EXTERN
int nfs_mount(struct nfs_context
*nfs
, const char *server
, const char *exportname
);
201 * Async stat(<filename>)
203 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
204 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
206 * When the callback is invoked, status indicates the result:
208 * data is struct stat *
209 * -errno : An error occured.
210 * data is the error string.
213 EXTERN
int nfs_stat_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
215 * Sync stat(<filename>)
217 * 0 : The operation was successfull.
218 * -errno : The command failed.
221 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct __stat64
*st
);
223 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct stat
*st
);
230 * Async fstat(nfsfh *)
232 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
233 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
235 * When the callback is invoked, status indicates the result:
237 * data is struct stat *
238 * -errno : An error occured.
239 * data is the error string.
241 EXTERN
int nfs_fstat_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
243 * Sync fstat(nfsfh *)
245 * 0 : The operation was successfull.
246 * -errno : The command failed.
249 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct __stat64
*st
);
251 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct stat
*st
);
260 * Async open(<filename>)
262 * mode is a combination of the flags : O_RDOLNY, O_WRONLY, O_RDWR , O_SYNC
265 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
266 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
268 * When the callback is invoked, status indicates the result:
270 * data is a struct *nfsfh;
271 * The nfsfh is close using nfs_close().
272 * -errno : An error occured.
273 * data is the error string.
275 EXTERN
int nfs_open_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
277 * Sync stat(<filename>)
279 * 0 : The operation was successfull. *nfsfh is filled in.
280 * -errno : The command failed.
282 EXTERN
int nfs_open(struct nfs_context
*nfs
, const char *path
, int mode
, struct nfsfh
**nfsfh
);
294 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
295 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
297 * When the callback is invoked, status indicates the result:
300 * -errno : An error occured.
301 * data is the error string.
303 EXTERN
int nfs_close_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
307 * 0 : The operation was successfull.
308 * -errno : The command failed.
310 EXTERN
int nfs_close(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
320 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
321 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
323 * When the callback is invoked, status indicates the result:
325 * status is numer of bytes read.
326 * data is a pointer to the returned data.
327 * -errno : An error occured.
328 * data is the error string.
330 EXTERN
int nfs_pread_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, nfs_cb cb
, void *private_data
);
334 * >=0 : numer of bytes read.
335 * -errno : An error occured.
337 EXTERN
int nfs_pread(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
348 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
349 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
351 * When the callback is invoked, status indicates the result:
353 * status is numer of bytes read.
354 * data is a pointer to the returned data.
355 * -errno : An error occured.
356 * data is the error string.
358 EXTERN
int nfs_read_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, nfs_cb cb
, void *private_data
);
362 * >=0 : numer of bytes read.
363 * -errno : An error occured.
365 EXTERN
int nfs_read(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
377 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
378 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
380 * When the callback is invoked, status indicates the result:
382 * status is numer of bytes written.
383 * -errno : An error occured.
384 * data is the error string.
386 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
);
390 * >=0 : numer of bytes written.
391 * -errno : An error occured.
393 EXTERN
int nfs_pwrite(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
403 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
404 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
406 * When the callback is invoked, status indicates the result:
408 * status is numer of bytes written.
409 * -errno : An error occured.
410 * data is the error string.
412 EXTERN
int nfs_write_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
, nfs_cb cb
, void *private_data
);
416 * >=0 : numer of bytes written.
417 * -errno : An error occured.
419 EXTERN
int nfs_write(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
429 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
430 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
432 * When the callback is invoked, status indicates the result:
434 * data is uint64_t * for the current position.
435 * -errno : An error occured.
436 * data is the error string.
438 EXTERN
int nfs_lseek_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, nfs_cb cb
, void *private_data
);
442 * >=0 : numer of bytes read.
443 * -errno : An error occured.
445 EXTERN
int nfs_lseek(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, uint64_t *current_offset
);
455 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
456 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
458 * When the callback is invoked, status indicates the result:
460 * -errno : An error occured.
461 * data is the error string.
463 EXTERN
int nfs_fsync_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
468 * -errno : An error occured.
470 EXTERN
int nfs_fsync(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
481 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
482 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
484 * When the callback is invoked, status indicates the result:
486 * -errno : An error occured.
487 * data is the error string.
489 EXTERN
int nfs_truncate_async(struct nfs_context
*nfs
, const char *path
, uint64_t length
, nfs_cb cb
, void *private_data
);
494 * -errno : An error occured.
496 EXTERN
int nfs_truncate(struct nfs_context
*nfs
, const char *path
, uint64_t length
);
507 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
508 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
510 * When the callback is invoked, status indicates the result:
512 * -errno : An error occured.
513 * data is the error string.
515 EXTERN
int nfs_ftruncate_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
, nfs_cb cb
, void *private_data
);
520 * -errno : An error occured.
522 EXTERN
int nfs_ftruncate(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
);
536 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
537 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
539 * When the callback is invoked, status indicates the result:
541 * -errno : An error occured.
542 * data is the error string.
544 EXTERN
int nfs_mkdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
549 * -errno : An error occured.
551 EXTERN
int nfs_mkdir(struct nfs_context
*nfs
, const char *path
);
562 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
563 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
565 * When the callback is invoked, status indicates the result:
567 * -errno : An error occured.
568 * data is the error string.
570 EXTERN
int nfs_rmdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
575 * -errno : An error occured.
577 EXTERN
int nfs_rmdir(struct nfs_context
*nfs
, const char *path
);
589 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
590 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
592 * When the callback is invoked, status indicates the result:
594 * data is a struct *nfsfh;
595 * -errno : An error occured.
596 * data is the error string.
598 EXTERN
int nfs_creat_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
603 * -errno : An error occured.
605 EXTERN
int nfs_creat(struct nfs_context
*nfs
, const char *path
, int mode
, struct nfsfh
**nfsfh
);
615 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
616 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
618 * When the callback is invoked, status indicates the result:
620 * -errno : An error occured.
621 * data is the error string.
623 EXTERN
int nfs_mknod_async(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
, nfs_cb cb
, void *private_data
);
628 * -errno : An error occured.
630 EXTERN
int nfs_mknod(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
);
641 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
642 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
644 * When the callback is invoked, status indicates the result:
647 * -errno : An error occured.
648 * data is the error string.
650 EXTERN
int nfs_unlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
655 * -errno : An error occured.
657 EXTERN
int nfs_unlink(struct nfs_context
*nfs
, const char *path
);
670 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
671 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
673 * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
675 * When the callback is invoked, status indicates the result:
677 * data is struct nfsdir *
678 * -errno : An error occured.
679 * data is the error string.
681 EXTERN
int nfs_opendir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
686 * -errno : An error occured.
688 EXTERN
int nfs_opendir(struct nfs_context
*nfs
, const char *path
, struct nfsdir
**nfsdir
);
696 struct nfsdirent
*next
;
700 /* Some extra fields we get for free through the READDIRPLUS3 call.
701 You need libnfs-raw-nfs.h for type/mode constants */
702 uint32_t type
; /* NF3REG, NF3DIR, NF3BLK, ... */
705 struct timeval atime
;
706 struct timeval mtime
;
707 struct timeval ctime
;
712 * nfs_readdir() never blocks, so no special sync/async versions are available
714 EXTERN
struct nfsdirent
*nfs_readdir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
722 * nfs_closedir() never blocks, so no special sync/async versions are available
724 EXTERN
void nfs_closedir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
732 * Async statvfs(<dirname>)
734 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
735 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
737 * When the callback is invoked, status indicates the result:
739 * data is struct statvfs *
740 * -errno : An error occured.
741 * data is the error string.
744 EXTERN
int nfs_statvfs_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
746 * Sync statvfs(<dirname>)
748 * 0 : The operation was successfull.
749 * -errno : The command failed.
751 EXTERN
int nfs_statvfs(struct nfs_context
*nfs
, const char *path
, struct statvfs
*svfs
);
758 * Async readlink(<name>)
760 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
761 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
763 * When the callback is invoked, status indicates the result:
766 * data is only valid during the callback and is automatically freed when the callback returns.
767 * -errno : An error occured.
768 * data is the error string.
771 EXTERN
int nfs_readlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
773 * Sync readlink(<name>)
775 * 0 : The operation was successfull.
776 * -errno : The command failed.
778 EXTERN
int nfs_readlink(struct nfs_context
*nfs
, const char *path
, char *buf
, int bufsize
);
786 * Async chmod(<name>)
788 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
789 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
791 * When the callback is invoked, status indicates the result:
794 * -errno : An error occured.
795 * data is the error string.
797 EXTERN
int nfs_chmod_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
801 * 0 : The operation was successfull.
802 * -errno : The command failed.
804 EXTERN
int nfs_chmod(struct nfs_context
*nfs
, const char *path
, int mode
);
812 * Async fchmod(<handle>)
814 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
815 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
817 * When the callback is invoked, status indicates the result:
820 * -errno : An error occured.
821 * data is the error string.
823 EXTERN
int nfs_fchmod_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
, nfs_cb cb
, void *private_data
);
825 * Sync fchmod(<handle>)
827 * 0 : The operation was successfull.
828 * -errno : The command failed.
830 EXTERN
int nfs_fchmod(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
);
838 * Async chown(<name>)
840 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
841 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
843 * When the callback is invoked, status indicates the result:
846 * -errno : An error occured.
847 * data is the error string.
849 EXTERN
int nfs_chown_async(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
853 * 0 : The operation was successfull.
854 * -errno : The command failed.
856 EXTERN
int nfs_chown(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
);
864 * Async fchown(<handle>)
866 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
867 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
869 * When the callback is invoked, status indicates the result:
872 * -errno : An error occured.
873 * data is the error string.
875 EXTERN
int nfs_fchown_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
877 * Sync fchown(<handle>)
879 * 0 : The operation was successfull.
880 * -errno : The command failed.
882 EXTERN
int nfs_fchown(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
);
891 * Async utimes(<path>)
893 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
894 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
896 * When the callback is invoked, status indicates the result:
899 * -errno : An error occured.
900 * data is the error string.
902 EXTERN
int nfs_utimes_async(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
, nfs_cb cb
, void *private_data
);
904 * Sync utimes(<path>)
906 * 0 : The operation was successfull.
907 * -errno : The command failed.
909 EXTERN
int nfs_utimes(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
);
916 * Async utime(<path>)
918 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
919 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
921 * When the callback is invoked, status indicates the result:
924 * -errno : An error occured.
925 * data is the error string.
928 EXTERN
int nfs_utime_async(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
, nfs_cb cb
, void *private_data
);
932 * 0 : The operation was successfull.
933 * -errno : The command failed.
935 EXTERN
int nfs_utime(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
);
944 * Async access(<path>)
946 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
947 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
949 * When the callback is invoked, status indicates the result:
952 * -errno : An error occured.
953 * data is the error string.
955 EXTERN
int nfs_access_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
957 * Sync access(<path>)
959 * 0 : The operation was successfull.
960 * -errno : The command failed.
962 EXTERN
int nfs_access(struct nfs_context
*nfs
, const char *path
, int mode
);
971 * Async symlink(<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.
982 EXTERN
int nfs_symlink_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
984 * Sync symlink(<path>)
986 * 0 : The operation was successfull.
987 * -errno : The command failed.
989 EXTERN
int nfs_symlink(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
996 * Async rename(<oldpath>, <newpath>)
998 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
999 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1001 * When the callback is invoked, status indicates the result:
1004 * -errno : An error occured.
1005 * data is the error string.
1007 EXTERN
int nfs_rename_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1009 * Sync rename(<oldpath>, <newpath>)
1011 * 0 : The operation was successfull.
1012 * -errno : The command failed.
1014 EXTERN
int nfs_rename(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1022 * Async link(<oldpath>, <newpath>)
1024 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1025 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1027 * When the callback is invoked, status indicates the result:
1030 * -errno : An error occured.
1031 * data is the error string.
1033 EXTERN
int nfs_link_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1035 * Sync link(<oldpath>, <newpath>)
1037 * 0 : The operation was successfull.
1038 * -errno : The command failed.
1040 EXTERN
int nfs_link(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1047 * Async getexports()
1048 * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
1049 * returned structures.
1051 * This function will return the list of exports from an NFS server.
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:
1059 * data is a pointer to an exports pointer:
1060 * exports export = *(exports *)data;
1061 * -errno : An error occured.
1062 * data is the error string.
1064 EXTERN
int mount_getexports_async(struct rpc_context
*rpc
, const char *server
, rpc_cb cb
, void *private_data
);
1066 * Sync getexports(<server>)
1068 * NULL : something failed
1069 * exports export : a linked list of exported directories
1071 * returned data must be freed by calling mount_free_export_list(exportnode);
1073 EXTERN
struct exportnode
*mount_getexports(const char *server
);
1075 EXTERN
void mount_free_export_list(struct exportnode
*exports
);
1078 //qqq replace later with lseek(cur, 0)
1079 uint64_t nfs_get_current_offset(struct nfsfh
*nfsfh
);
1085 struct nfs_server_list
{
1086 struct nfs_server_list
*next
;
1091 * Sync find_local_servers(<server>)
1092 * This function will probe all local networks for NFS server. This function will
1093 * block for one second while awaiting for all nfs servers to respond.
1096 * NULL : something failed
1098 * struct nfs_server_list : a linked list of all discovered servers
1100 * returned data must be freed by nfs_free_srvr_list(srv);
1102 struct nfs_server_list
*nfs_find_local_servers(void);
1103 void free_nfs_srvr_list(struct nfs_server_list
*srv
);