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
42 #define EXTERN __declspec( dllexport )
71 * Used for interfacing the async version of the api into an external eventsystem
73 EXTERN
int nfs_get_fd(struct nfs_context
*nfs
);
74 EXTERN
int nfs_which_events(struct nfs_context
*nfs
);
75 EXTERN
int nfs_service(struct nfs_context
*nfs
, int revents
);
76 EXTERN
int nfs_queue_length(struct nfs_context
*nfs
);
79 * Used if you need different credentials than the default for the current user.
82 EXTERN
void nfs_set_auth(struct nfs_context
*nfs
, struct AUTH
*auth
);
85 * When an operation failed, this function can extract a detailed error string.
87 EXTERN
char *nfs_get_error(struct nfs_context
*nfs
);
91 * Callback for all ASYNC nfs functions
93 typedef void (*nfs_cb
)(int err
, struct nfs_context
*nfs
, void *data
, void *private_data
);
96 * Callback for all ASYNC rpc functions
98 typedef void (*rpc_cb
)(struct rpc_context
*rpc
, int status
, void *data
, void *private_data
);
106 * Create an NFS c, the context.
108 * NULL : Failed to create a context.
109 * *nfs : A pointer to an nfs context.
111 EXTERN
struct nfs_context
*nfs_init_context(void);
113 * Destroy an nfs context.
115 EXTERN
void nfs_destroy_context(struct nfs_context
*nfs
);
119 * URL parsing functions.
120 * These functions all parse a URL of the form
121 * nfs://server/path/file?argv=val[&arg=val]*
122 * and returns a nfs_url.
124 * Apart from parsing the URL the functions will also update
125 * the nfs context to reflect settings controlled via url arguments.
127 * Current URL arguments are :
128 * tcp-syncnt=<int> : Number of SYNs to send during the seccion establish
129 * before failing settin up the tcp connection to the
131 * uid=<int> : UID value to use when talking to the server.
132 * default it 65534 on Windows and getuid() on unixen.
133 * gid=<int> : GID value to use when talking to the server.
134 * default it 65534 on Windows and getgid() on unixen.
137 * Parse a complete NFS URL including, server, path and
138 * filename. Fail if any component is missing.
140 EXTERN
struct nfs_url
*nfs_parse_url_full(struct nfs_context
*nfs
, const char *url
);
143 * Parse an NFS URL, but do not split path and file. File
144 * in the resulting struct remains NULL.
146 EXTERN
struct nfs_url
*nfs_parse_url_dir(struct nfs_context
*nfs
, const char *url
);
149 * Parse an NFS URL, but do not fail if file, path or even server is missing.
150 * Check elements of the resulting struct for NULL.
152 EXTERN
struct nfs_url
*nfs_parse_url_incomplete(struct nfs_context
*nfs
, const char *url
);
156 * Free the URL struct returned by the nfs_parse_url_* functions.
158 EXTERN
void nfs_destroy_url(struct nfs_url
*url
);
164 * Get the maximum supported READ3 size by the server
166 EXTERN
uint64_t nfs_get_readmax(struct nfs_context
*nfs
);
169 * Get the maximum supported WRITE3 size by the server
171 EXTERN
uint64_t nfs_get_writemax(struct nfs_context
*nfs
);
174 * MODIFY CONNECT PARAMTERS
177 EXTERN
void nfs_set_tcp_syncnt(struct nfs_context
*nfs
, int v
);
178 EXTERN
void nfs_set_uid(struct nfs_context
*nfs
, int uid
);
179 EXTERN
void nfs_set_gid(struct nfs_context
*nfs
, int gid
);
187 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
188 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
190 * When the callback is invoked, status indicates the result:
193 * -errno : An error occured.
194 * data is the error string.
196 EXTERN
int nfs_mount_async(struct nfs_context
*nfs
, const char *server
, const char *exportname
, nfs_cb cb
, void *private_data
);
200 * 0 : The operation was successfull.
201 * -errno : The command failed.
203 EXTERN
int nfs_mount(struct nfs_context
*nfs
, const char *server
, const char *exportname
);
212 * Async stat(<filename>)
214 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
215 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
217 * When the callback is invoked, status indicates the result:
219 * data is struct stat *
220 * -errno : An error occured.
221 * data is the error string.
224 EXTERN
int nfs_stat_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
226 * Sync stat(<filename>)
228 * 0 : The operation was successfull.
229 * -errno : The command failed.
232 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct __stat64
*st
);
234 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct stat
*st
);
241 * Async fstat(nfsfh *)
243 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
244 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
246 * When the callback is invoked, status indicates the result:
248 * data is struct stat *
249 * -errno : An error occured.
250 * data is the error string.
252 EXTERN
int nfs_fstat_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
254 * Sync fstat(nfsfh *)
256 * 0 : The operation was successfull.
257 * -errno : The command failed.
260 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct __stat64
*st
);
262 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct stat
*st
);
271 * Async open(<filename>)
273 * mode is a combination of the flags : O_RDOLNY, O_WRONLY, O_RDWR , O_SYNC
276 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
277 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
279 * Supported flags are
283 * O_TRUNC (Only valid with O_RDWR or O_WRONLY. Ignored otherwise.)
285 * When the callback is invoked, status indicates the result:
287 * data is a struct *nfsfh;
288 * The nfsfh is close using nfs_close().
289 * -errno : An error occured.
290 * data is the error string.
292 EXTERN
int nfs_open_async(struct nfs_context
*nfs
, const char *path
, int flags
, nfs_cb cb
, void *private_data
);
294 * Sync open(<filename>)
296 * 0 : The operation was successfull. *nfsfh is filled in.
297 * -errno : The command failed.
299 EXTERN
int nfs_open(struct nfs_context
*nfs
, const char *path
, int flags
, struct nfsfh
**nfsfh
);
311 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
312 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
314 * When the callback is invoked, status indicates the result:
317 * -errno : An error occured.
318 * data is the error string.
320 EXTERN
int nfs_close_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
324 * 0 : The operation was successfull.
325 * -errno : The command failed.
327 EXTERN
int nfs_close(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
337 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
338 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
340 * When the callback is invoked, status indicates the result:
342 * status is numer of bytes read.
343 * data is a pointer to the returned data.
344 * -errno : An error occured.
345 * data is the error string.
347 EXTERN
int nfs_pread_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, nfs_cb cb
, void *private_data
);
351 * >=0 : numer of bytes read.
352 * -errno : An error occured.
354 EXTERN
int nfs_pread(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
365 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
366 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
368 * When the callback is invoked, status indicates the result:
370 * status is numer of bytes read.
371 * data is a pointer to the returned data.
372 * -errno : An error occured.
373 * data is the error string.
375 EXTERN
int nfs_read_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, nfs_cb cb
, void *private_data
);
379 * >=0 : numer of bytes read.
380 * -errno : An error occured.
382 EXTERN
int nfs_read(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
394 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
395 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
397 * When the callback is invoked, status indicates the result:
399 * status is numer of bytes written.
400 * -errno : An error occured.
401 * data is the error string.
403 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
);
407 * >=0 : numer of bytes written.
408 * -errno : An error occured.
410 EXTERN
int nfs_pwrite(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
420 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
421 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
423 * When the callback is invoked, status indicates the result:
425 * status is numer of bytes written.
426 * -errno : An error occured.
427 * data is the error string.
429 EXTERN
int nfs_write_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
, nfs_cb cb
, void *private_data
);
433 * >=0 : numer of bytes written.
434 * -errno : An error occured.
436 EXTERN
int nfs_write(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
446 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
447 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
449 * When the callback is invoked, status indicates the result:
451 * data is uint64_t * for the current position.
452 * -errno : An error occured.
453 * data is the error string.
455 EXTERN
int nfs_lseek_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, nfs_cb cb
, void *private_data
);
459 * >=0 : numer of bytes read.
460 * -errno : An error occured.
462 EXTERN
int nfs_lseek(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, uint64_t *current_offset
);
472 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
473 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
475 * When the callback is invoked, status indicates the result:
477 * -errno : An error occured.
478 * data is the error string.
480 EXTERN
int nfs_fsync_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
485 * -errno : An error occured.
487 EXTERN
int nfs_fsync(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
498 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
499 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
501 * When the callback is invoked, status indicates the result:
503 * -errno : An error occured.
504 * data is the error string.
506 EXTERN
int nfs_truncate_async(struct nfs_context
*nfs
, const char *path
, uint64_t length
, nfs_cb cb
, void *private_data
);
511 * -errno : An error occured.
513 EXTERN
int nfs_truncate(struct nfs_context
*nfs
, const char *path
, uint64_t length
);
524 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
525 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
527 * When the callback is invoked, status indicates the result:
529 * -errno : An error occured.
530 * data is the error string.
532 EXTERN
int nfs_ftruncate_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
, nfs_cb cb
, void *private_data
);
537 * -errno : An error occured.
539 EXTERN
int nfs_ftruncate(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
);
553 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
554 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
556 * When the callback is invoked, status indicates the result:
558 * -errno : An error occured.
559 * data is the error string.
561 EXTERN
int nfs_mkdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
566 * -errno : An error occured.
568 EXTERN
int nfs_mkdir(struct nfs_context
*nfs
, const char *path
);
579 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
580 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
582 * When the callback is invoked, status indicates the result:
584 * -errno : An error occured.
585 * data is the error string.
587 EXTERN
int nfs_rmdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
592 * -errno : An error occured.
594 EXTERN
int nfs_rmdir(struct nfs_context
*nfs
, const char *path
);
606 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
607 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
609 * When the callback is invoked, status indicates the result:
611 * data is a struct *nfsfh;
612 * -errno : An error occured.
613 * data is the error string.
615 EXTERN
int nfs_creat_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
620 * -errno : An error occured.
622 EXTERN
int nfs_creat(struct nfs_context
*nfs
, const char *path
, int mode
, struct nfsfh
**nfsfh
);
632 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
633 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
635 * When the callback is invoked, status indicates the result:
637 * -errno : An error occured.
638 * data is the error string.
640 EXTERN
int nfs_mknod_async(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
, nfs_cb cb
, void *private_data
);
645 * -errno : An error occured.
647 EXTERN
int nfs_mknod(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
);
658 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
659 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
661 * When the callback is invoked, status indicates the result:
664 * -errno : An error occured.
665 * data is the error string.
667 EXTERN
int nfs_unlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
672 * -errno : An error occured.
674 EXTERN
int nfs_unlink(struct nfs_context
*nfs
, const char *path
);
687 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
688 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
690 * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
692 * When the callback is invoked, status indicates the result:
694 * data is struct nfsdir *
695 * -errno : An error occured.
696 * data is the error string.
698 EXTERN
int nfs_opendir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
703 * -errno : An error occured.
705 EXTERN
int nfs_opendir(struct nfs_context
*nfs
, const char *path
, struct nfsdir
**nfsdir
);
713 struct nfsdirent
*next
;
717 /* Some extra fields we get for free through the READDIRPLUS3 call.
718 You need libnfs-raw-nfs.h for type/mode constants */
719 uint32_t type
; /* NF3REG, NF3DIR, NF3BLK, ... */
722 struct timeval atime
;
723 struct timeval mtime
;
724 struct timeval ctime
;
729 * nfs_readdir() never blocks, so no special sync/async versions are available
731 EXTERN
struct nfsdirent
*nfs_readdir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
739 * nfs_closedir() never blocks, so no special sync/async versions are available
741 EXTERN
void nfs_closedir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
748 * Async chdir(<path>)
751 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
752 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
754 * When the callback is invoked, status indicates the result:
757 * -errno : An error occured.
758 * data is the error string.
760 EXTERN
int nfs_chdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
764 * 0 : The operation was successfull.
765 * -errno : The command failed.
767 EXTERN
int nfs_chdir(struct nfs_context
*nfs
, const char *path
);
773 * nfs_getcwd() never blocks, so no special sync/async versions are available
777 * This function returns a pointer to the current working directory.
778 * This pointer is only stable until the next [f]chdir or when the
779 * context is destroyed.
782 * 0 : The operation was successfull and *cwd is filled in.
783 * -errno : The command failed.
785 EXTERN
void nfs_getcwd(struct nfs_context
*nfs
, const char **cwd
);
792 * Async statvfs(<dirname>)
794 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
795 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
797 * When the callback is invoked, status indicates the result:
799 * data is struct statvfs *
800 * -errno : An error occured.
801 * data is the error string.
804 EXTERN
int nfs_statvfs_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
806 * Sync statvfs(<dirname>)
808 * 0 : The operation was successfull.
809 * -errno : The command failed.
811 EXTERN
int nfs_statvfs(struct nfs_context
*nfs
, const char *path
, struct statvfs
*svfs
);
818 * Async readlink(<name>)
820 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
821 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
823 * When the callback is invoked, status indicates the result:
826 * data is only valid during the callback and is automatically freed when the callback returns.
827 * -errno : An error occured.
828 * data is the error string.
831 EXTERN
int nfs_readlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
833 * Sync readlink(<name>)
835 * 0 : The operation was successfull.
836 * -errno : The command failed.
838 EXTERN
int nfs_readlink(struct nfs_context
*nfs
, const char *path
, char *buf
, int bufsize
);
846 * Async chmod(<name>)
848 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
849 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
851 * When the callback is invoked, status indicates the result:
854 * -errno : An error occured.
855 * data is the error string.
857 EXTERN
int nfs_chmod_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
861 * 0 : The operation was successfull.
862 * -errno : The command failed.
864 EXTERN
int nfs_chmod(struct nfs_context
*nfs
, const char *path
, int mode
);
872 * Async fchmod(<handle>)
874 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
875 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
877 * When the callback is invoked, status indicates the result:
880 * -errno : An error occured.
881 * data is the error string.
883 EXTERN
int nfs_fchmod_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
, nfs_cb cb
, void *private_data
);
885 * Sync fchmod(<handle>)
887 * 0 : The operation was successfull.
888 * -errno : The command failed.
890 EXTERN
int nfs_fchmod(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
);
898 * Async chown(<name>)
900 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
901 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
903 * When the callback is invoked, status indicates the result:
906 * -errno : An error occured.
907 * data is the error string.
909 EXTERN
int nfs_chown_async(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
913 * 0 : The operation was successfull.
914 * -errno : The command failed.
916 EXTERN
int nfs_chown(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
);
924 * Async fchown(<handle>)
926 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
927 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
929 * When the callback is invoked, status indicates the result:
932 * -errno : An error occured.
933 * data is the error string.
935 EXTERN
int nfs_fchown_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
937 * Sync fchown(<handle>)
939 * 0 : The operation was successfull.
940 * -errno : The command failed.
942 EXTERN
int nfs_fchown(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
);
951 * Async utimes(<path>)
953 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
954 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
956 * When the callback is invoked, status indicates the result:
959 * -errno : An error occured.
960 * data is the error string.
962 EXTERN
int nfs_utimes_async(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
, nfs_cb cb
, void *private_data
);
964 * Sync utimes(<path>)
966 * 0 : The operation was successfull.
967 * -errno : The command failed.
969 EXTERN
int nfs_utimes(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
);
976 * Async utime(<path>)
978 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
979 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
981 * When the callback is invoked, status indicates the result:
984 * -errno : An error occured.
985 * data is the error string.
988 EXTERN
int nfs_utime_async(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
, nfs_cb cb
, void *private_data
);
992 * 0 : The operation was successfull.
993 * -errno : The command failed.
995 EXTERN
int nfs_utime(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
);
1004 * Async access(<path>)
1006 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1007 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1009 * When the callback is invoked, status indicates the result:
1012 * -errno : An error occured.
1013 * data is the error string.
1015 EXTERN
int nfs_access_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
1017 * Sync access(<path>)
1019 * 0 : The operation was successfull.
1020 * -errno : The command failed.
1022 EXTERN
int nfs_access(struct nfs_context
*nfs
, const char *path
, int mode
);
1031 * Async symlink(<path>)
1033 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1034 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1036 * When the callback is invoked, status indicates the result:
1039 * -errno : An error occured.
1040 * data is the error string.
1042 EXTERN
int nfs_symlink_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1044 * Sync symlink(<path>)
1046 * 0 : The operation was successfull.
1047 * -errno : The command failed.
1049 EXTERN
int nfs_symlink(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1056 * Async rename(<oldpath>, <newpath>)
1058 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1059 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1061 * When the callback is invoked, status indicates the result:
1064 * -errno : An error occured.
1065 * data is the error string.
1067 EXTERN
int nfs_rename_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1069 * Sync rename(<oldpath>, <newpath>)
1071 * 0 : The operation was successfull.
1072 * -errno : The command failed.
1074 EXTERN
int nfs_rename(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1082 * Async link(<oldpath>, <newpath>)
1084 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1085 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1087 * When the callback is invoked, status indicates the result:
1090 * -errno : An error occured.
1091 * data is the error string.
1093 EXTERN
int nfs_link_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1095 * Sync link(<oldpath>, <newpath>)
1097 * 0 : The operation was successfull.
1098 * -errno : The command failed.
1100 EXTERN
int nfs_link(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1107 * Async getexports()
1108 * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
1109 * returned structures.
1111 * This function will return the list of exports from an NFS server.
1114 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1115 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1117 * When the callback is invoked, status indicates the result:
1119 * data is a pointer to an exports pointer:
1120 * exports export = *(exports *)data;
1121 * -errno : An error occured.
1122 * data is the error string.
1124 EXTERN
int mount_getexports_async(struct rpc_context
*rpc
, const char *server
, rpc_cb cb
, void *private_data
);
1126 * Sync getexports(<server>)
1128 * NULL : something failed
1129 * exports export : a linked list of exported directories
1131 * returned data must be freed by calling mount_free_export_list(exportnode);
1133 EXTERN
struct exportnode
*mount_getexports(const char *server
);
1135 EXTERN
void mount_free_export_list(struct exportnode
*exports
);
1138 //qqq replace later with lseek(cur, 0)
1139 uint64_t nfs_get_current_offset(struct nfsfh
*nfsfh
);
1145 struct nfs_server_list
{
1146 struct nfs_server_list
*next
;
1151 * Sync find_local_servers(<server>)
1152 * This function will probe all local networks for NFS server. This function will
1153 * block for one second while awaiting for all nfs servers to respond.
1156 * NULL : something failed
1158 * struct nfs_server_list : a linked list of all discovered servers
1160 * returned data must be freed by nfs_free_srvr_list(srv);
1162 struct nfs_server_list
*nfs_find_local_servers(void);
1163 void free_nfs_srvr_list(struct nfs_server_list
*srv
);
1165 #endif /* !_LIBNFS_H_ */