0725de6cee91205b667201fe57926938a4e7b7a8
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
31 #if defined(__APPLE__) && defined(__MACH__)
49 #define EXTERN __declspec( dllexport )
78 * Used for interfacing the async version of the api into an external eventsystem
80 EXTERN
int nfs_get_fd(struct nfs_context
*nfs
);
81 EXTERN
int nfs_which_events(struct nfs_context
*nfs
);
82 EXTERN
int nfs_service(struct nfs_context
*nfs
, int revents
);
83 EXTERN
int nfs_queue_length(struct nfs_context
*nfs
);
86 * Used if you need different credentials than the default for the current user.
89 EXTERN
void nfs_set_auth(struct nfs_context
*nfs
, struct AUTH
*auth
);
92 * When an operation failed, this function can extract a detailed error string.
94 EXTERN
char *nfs_get_error(struct nfs_context
*nfs
);
98 * Callback for all ASYNC nfs functions
100 typedef void (*nfs_cb
)(int err
, struct nfs_context
*nfs
, void *data
, void *private_data
);
103 * Callback for all ASYNC rpc functions
105 typedef void (*rpc_cb
)(struct rpc_context
*rpc
, int status
, void *data
, void *private_data
);
113 * Create an NFS c, the context.
115 * NULL : Failed to create a context.
116 * *nfs : A pointer to an nfs context.
118 EXTERN
struct nfs_context
*nfs_init_context(void);
120 * Destroy an nfs context.
122 EXTERN
void nfs_destroy_context(struct nfs_context
*nfs
);
126 * URL parsing functions.
127 * These functions all parse a URL of the form
128 * nfs://server/path/file?argv=val[&arg=val]*
129 * and returns a nfs_url.
131 * Apart from parsing the URL the functions will also update
132 * the nfs context to reflect settings controlled via url arguments.
134 * Current URL arguments are :
135 * tcp-syncnt=<int> : Number of SYNs to send during the seccion establish
136 * before failing settin up the tcp connection to the
138 * uid=<int> : UID value to use when talking to the server.
139 * default it 65534 on Windows and getuid() on unixen.
140 * gid=<int> : GID value to use when talking to the server.
141 * default it 65534 on Windows and getgid() on unixen.
144 * Parse a complete NFS URL including, server, path and
145 * filename. Fail if any component is missing.
147 EXTERN
struct nfs_url
*nfs_parse_url_full(struct nfs_context
*nfs
, const char *url
);
150 * Parse an NFS URL, but do not split path and file. File
151 * in the resulting struct remains NULL.
153 EXTERN
struct nfs_url
*nfs_parse_url_dir(struct nfs_context
*nfs
, const char *url
);
156 * Parse an NFS URL, but do not fail if file, path or even server is missing.
157 * Check elements of the resulting struct for NULL.
159 EXTERN
struct nfs_url
*nfs_parse_url_incomplete(struct nfs_context
*nfs
, const char *url
);
163 * Free the URL struct returned by the nfs_parse_url_* functions.
165 EXTERN
void nfs_destroy_url(struct nfs_url
*url
);
171 * Get the maximum supported READ3 size by the server
173 EXTERN
uint64_t nfs_get_readmax(struct nfs_context
*nfs
);
176 * Get the maximum supported WRITE3 size by the server
178 EXTERN
uint64_t nfs_get_writemax(struct nfs_context
*nfs
);
181 * MODIFY CONNECT PARAMTERS
184 EXTERN
void nfs_set_tcp_syncnt(struct nfs_context
*nfs
, int v
);
185 EXTERN
void nfs_set_uid(struct nfs_context
*nfs
, int uid
);
186 EXTERN
void nfs_set_gid(struct nfs_context
*nfs
, int gid
);
194 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
195 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
197 * When the callback is invoked, status indicates the result:
200 * -errno : An error occured.
201 * data is the error string.
203 EXTERN
int nfs_mount_async(struct nfs_context
*nfs
, const char *server
, const char *exportname
, nfs_cb cb
, void *private_data
);
207 * 0 : The operation was successfull.
208 * -errno : The command failed.
210 EXTERN
int nfs_mount(struct nfs_context
*nfs
, const char *server
, const char *exportname
);
219 * Async stat(<filename>)
221 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
222 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
224 * When the callback is invoked, status indicates the result:
226 * data is struct stat *
227 * -errno : An error occured.
228 * data is the error string.
230 /* This function is deprecated. Use nfs_stat64_async() instead */
232 EXTERN
int nfs_stat_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
234 * Sync stat(<filename>)
236 * 0 : The operation was successfull.
237 * -errno : The command failed.
239 /* This function is deprecated. Use nfs_stat64() instead */
241 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct __stat64
*st
);
243 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct stat
*st
);
248 * 64 bit version if stat. All fields are always 64bit.
249 * Use these functions instead of nfs_stat[_async](), especially if you
250 * have weird stat structures.
264 uint64_t nfs_blksize
;
272 * Async stat(<filename>)
274 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
275 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
277 * When the callback is invoked, status indicates the result:
279 * data is struct nfs_stat_64 *
280 * -errno : An error occured.
281 * data is the error string.
283 EXTERN
int nfs_stat64_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
285 * Sync stat(<filename>)
287 * 0 : The operation was successfull.
288 * -errno : The command failed.
290 EXTERN
int nfs_stat64(struct nfs_context
*nfs
, const char *path
, struct nfs_stat_64
*st
);
296 * Async fstat(nfsfh *)
298 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
299 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
301 * When the callback is invoked, status indicates the result:
303 * data is struct stat *
304 * -errno : An error occured.
305 * data is the error string.
307 EXTERN
int nfs_fstat_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
309 * Sync fstat(nfsfh *)
311 * 0 : The operation was successfull.
312 * -errno : The command failed.
315 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct __stat64
*st
);
317 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct stat
*st
);
326 * Async open(<filename>)
328 * mode is a combination of the flags : O_RDOLNY, O_WRONLY, O_RDWR , O_SYNC
331 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
332 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
334 * Supported flags are
338 * O_TRUNC (Only valid with O_RDWR or O_WRONLY. Ignored otherwise.)
340 * When the callback is invoked, status indicates the result:
342 * data is a struct *nfsfh;
343 * The nfsfh is close using nfs_close().
344 * -errno : An error occured.
345 * data is the error string.
347 EXTERN
int nfs_open_async(struct nfs_context
*nfs
, const char *path
, int flags
, nfs_cb cb
, void *private_data
);
349 * Sync open(<filename>)
351 * 0 : The operation was successfull. *nfsfh is filled in.
352 * -errno : The command failed.
354 EXTERN
int nfs_open(struct nfs_context
*nfs
, const char *path
, int flags
, struct nfsfh
**nfsfh
);
366 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
367 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
369 * When the callback is invoked, status indicates the result:
372 * -errno : An error occured.
373 * data is the error string.
375 EXTERN
int nfs_close_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
379 * 0 : The operation was successfull.
380 * -errno : The command failed.
382 EXTERN
int nfs_close(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
392 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
393 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
395 * When the callback is invoked, status indicates the result:
397 * status is numer of bytes read.
398 * data is a pointer to the returned data.
399 * -errno : An error occured.
400 * data is the error string.
402 EXTERN
int nfs_pread_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, nfs_cb cb
, void *private_data
);
406 * >=0 : numer of bytes read.
407 * -errno : An error occured.
409 EXTERN
int nfs_pread(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 read.
426 * data is a pointer to the returned data.
427 * -errno : An error occured.
428 * data is the error string.
430 EXTERN
int nfs_read_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, nfs_cb cb
, void *private_data
);
434 * >=0 : numer of bytes read.
435 * -errno : An error occured.
437 EXTERN
int nfs_read(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
449 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
450 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
452 * When the callback is invoked, status indicates the result:
454 * status is numer of bytes written.
455 * -errno : An error occured.
456 * data is the error string.
458 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
);
462 * >=0 : numer of bytes written.
463 * -errno : An error occured.
465 EXTERN
int nfs_pwrite(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
475 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
476 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
478 * When the callback is invoked, status indicates the result:
480 * status is numer of bytes written.
481 * -errno : An error occured.
482 * data is the error string.
484 EXTERN
int nfs_write_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
, nfs_cb cb
, void *private_data
);
488 * >=0 : numer of bytes written.
489 * -errno : An error occured.
491 EXTERN
int nfs_write(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
501 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
502 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
504 * When the callback is invoked, status indicates the result:
506 * data is uint64_t * for the current position.
507 * -errno : An error occured.
508 * data is the error string.
510 EXTERN
int nfs_lseek_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int64_t offset
, int whence
, nfs_cb cb
, void *private_data
);
514 * >=0 : numer of bytes read.
515 * -errno : An error occured.
517 EXTERN
int nfs_lseek(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int64_t offset
, int whence
, uint64_t *current_offset
);
527 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
528 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
530 * When the callback is invoked, status indicates the result:
532 * -errno : An error occured.
533 * data is the error string.
535 EXTERN
int nfs_fsync_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
540 * -errno : An error occured.
542 EXTERN
int nfs_fsync(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
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_truncate_async(struct nfs_context
*nfs
, const char *path
, uint64_t length
, nfs_cb cb
, void *private_data
);
566 * -errno : An error occured.
568 EXTERN
int nfs_truncate(struct nfs_context
*nfs
, const char *path
, uint64_t length
);
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_ftruncate_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
, nfs_cb cb
, void *private_data
);
592 * -errno : An error occured.
594 EXTERN
int nfs_ftruncate(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
);
608 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
609 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
611 * When the callback is invoked, status indicates the result:
613 * -errno : An error occured.
614 * data is the error string.
616 EXTERN
int nfs_mkdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
621 * -errno : An error occured.
623 EXTERN
int nfs_mkdir(struct nfs_context
*nfs
, const char *path
);
634 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
635 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
637 * When the callback is invoked, status indicates the result:
639 * -errno : An error occured.
640 * data is the error string.
642 EXTERN
int nfs_rmdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
647 * -errno : An error occured.
649 EXTERN
int nfs_rmdir(struct nfs_context
*nfs
, const char *path
);
661 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
662 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
664 * When the callback is invoked, status indicates the result:
666 * data is a struct *nfsfh;
667 * -errno : An error occured.
668 * data is the error string.
670 EXTERN
int nfs_creat_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
675 * -errno : An error occured.
677 EXTERN
int nfs_creat(struct nfs_context
*nfs
, const char *path
, int mode
, struct nfsfh
**nfsfh
);
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 the callback is invoked, status indicates the result:
692 * -errno : An error occured.
693 * data is the error string.
695 EXTERN
int nfs_mknod_async(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
, nfs_cb cb
, void *private_data
);
700 * -errno : An error occured.
702 EXTERN
int nfs_mknod(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
);
713 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
714 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
716 * When the callback is invoked, status indicates the result:
719 * -errno : An error occured.
720 * data is the error string.
722 EXTERN
int nfs_unlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
727 * -errno : An error occured.
729 EXTERN
int nfs_unlink(struct nfs_context
*nfs
, const char *path
);
742 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
743 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
745 * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
747 * When the callback is invoked, status indicates the result:
749 * data is struct nfsdir *
750 * -errno : An error occured.
751 * data is the error string.
753 EXTERN
int nfs_opendir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
758 * -errno : An error occured.
760 EXTERN
int nfs_opendir(struct nfs_context
*nfs
, const char *path
, struct nfsdir
**nfsdir
);
768 struct nfsdirent
*next
;
772 /* Some extra fields we get for free through the READDIRPLUS3 call.
773 You need libnfs-raw-nfs.h for type/mode constants */
774 uint32_t type
; /* NF3REG, NF3DIR, NF3BLK, ... */
777 struct timeval atime
;
778 struct timeval mtime
;
779 struct timeval ctime
;
784 * nfs_readdir() never blocks, so no special sync/async versions are available
786 EXTERN
struct nfsdirent
*nfs_readdir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
794 * nfs_closedir() never blocks, so no special sync/async versions are available
796 EXTERN
void nfs_closedir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
803 * Async chdir(<path>)
806 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
807 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
809 * When the callback is invoked, status indicates the result:
812 * -errno : An error occured.
813 * data is the error string.
815 EXTERN
int nfs_chdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
819 * 0 : The operation was successfull.
820 * -errno : The command failed.
822 EXTERN
int nfs_chdir(struct nfs_context
*nfs
, const char *path
);
828 * nfs_getcwd() never blocks, so no special sync/async versions are available
832 * This function returns a pointer to the current working directory.
833 * This pointer is only stable until the next [f]chdir or when the
834 * context is destroyed.
837 * 0 : The operation was successfull and *cwd is filled in.
838 * -errno : The command failed.
840 EXTERN
void nfs_getcwd(struct nfs_context
*nfs
, const char **cwd
);
847 * Async statvfs(<dirname>)
849 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
850 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
852 * When the callback is invoked, status indicates the result:
854 * data is struct statvfs *
855 * -errno : An error occured.
856 * data is the error string.
859 EXTERN
int nfs_statvfs_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
861 * Sync statvfs(<dirname>)
863 * 0 : The operation was successfull.
864 * -errno : The command failed.
866 EXTERN
int nfs_statvfs(struct nfs_context
*nfs
, const char *path
, struct statvfs
*svfs
);
873 * Async readlink(<name>)
875 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
876 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
878 * When the callback is invoked, status indicates the result:
881 * data is only valid during the callback and is automatically freed when the callback returns.
882 * -errno : An error occured.
883 * data is the error string.
886 EXTERN
int nfs_readlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
888 * Sync readlink(<name>)
890 * 0 : The operation was successfull.
891 * -errno : The command failed.
893 EXTERN
int nfs_readlink(struct nfs_context
*nfs
, const char *path
, char *buf
, int bufsize
);
901 * Async chmod(<name>)
903 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
904 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
906 * When the callback is invoked, status indicates the result:
909 * -errno : An error occured.
910 * data is the error string.
912 EXTERN
int nfs_chmod_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
916 * 0 : The operation was successfull.
917 * -errno : The command failed.
919 EXTERN
int nfs_chmod(struct nfs_context
*nfs
, const char *path
, int mode
);
927 * Async fchmod(<handle>)
929 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
930 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
932 * When the callback is invoked, status indicates the result:
935 * -errno : An error occured.
936 * data is the error string.
938 EXTERN
int nfs_fchmod_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
, nfs_cb cb
, void *private_data
);
940 * Sync fchmod(<handle>)
942 * 0 : The operation was successfull.
943 * -errno : The command failed.
945 EXTERN
int nfs_fchmod(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
);
953 * Async chown(<name>)
955 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
956 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
958 * When the callback is invoked, status indicates the result:
961 * -errno : An error occured.
962 * data is the error string.
964 EXTERN
int nfs_chown_async(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
968 * 0 : The operation was successfull.
969 * -errno : The command failed.
971 EXTERN
int nfs_chown(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
);
979 * Async fchown(<handle>)
981 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
982 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
984 * When the callback is invoked, status indicates the result:
987 * -errno : An error occured.
988 * data is the error string.
990 EXTERN
int nfs_fchown_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
992 * Sync fchown(<handle>)
994 * 0 : The operation was successfull.
995 * -errno : The command failed.
997 EXTERN
int nfs_fchown(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
);
1006 * Async utimes(<path>)
1008 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1009 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1011 * When the callback is invoked, status indicates the result:
1014 * -errno : An error occured.
1015 * data is the error string.
1017 EXTERN
int nfs_utimes_async(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
, nfs_cb cb
, void *private_data
);
1019 * Sync utimes(<path>)
1021 * 0 : The operation was successfull.
1022 * -errno : The command failed.
1024 EXTERN
int nfs_utimes(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
);
1031 * Async utime(<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.
1043 EXTERN
int nfs_utime_async(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
, nfs_cb cb
, void *private_data
);
1045 * Sync utime(<path>)
1047 * 0 : The operation was successfull.
1048 * -errno : The command failed.
1050 EXTERN
int nfs_utime(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
);
1059 * Async access(<path>)
1061 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1062 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1064 * When the callback is invoked, status indicates the result:
1067 * -errno : An error occured.
1068 * data is the error string.
1070 EXTERN
int nfs_access_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
1072 * Sync access(<path>)
1074 * 0 : The operation was successfull.
1075 * -errno : The command failed.
1077 EXTERN
int nfs_access(struct nfs_context
*nfs
, const char *path
, int mode
);
1086 * Async symlink(<path>)
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_symlink_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1099 * Sync symlink(<path>)
1101 * 0 : The operation was successfull.
1102 * -errno : The command failed.
1104 EXTERN
int nfs_symlink(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1111 * Async rename(<oldpath>, <newpath>)
1113 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1114 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1116 * When the callback is invoked, status indicates the result:
1119 * -errno : An error occured.
1120 * data is the error string.
1122 EXTERN
int nfs_rename_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1124 * Sync rename(<oldpath>, <newpath>)
1126 * 0 : The operation was successfull.
1127 * -errno : The command failed.
1129 EXTERN
int nfs_rename(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1137 * Async link(<oldpath>, <newpath>)
1139 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1140 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1142 * When the callback is invoked, status indicates the result:
1145 * -errno : An error occured.
1146 * data is the error string.
1148 EXTERN
int nfs_link_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1150 * Sync link(<oldpath>, <newpath>)
1152 * 0 : The operation was successfull.
1153 * -errno : The command failed.
1155 EXTERN
int nfs_link(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1162 * Async getexports()
1163 * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
1164 * returned structures.
1166 * This function will return the list of exports from an NFS server.
1169 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1170 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1172 * When the callback is invoked, status indicates the result:
1174 * data is a pointer to an exports pointer:
1175 * exports export = *(exports *)data;
1176 * -errno : An error occured.
1177 * data is the error string.
1179 EXTERN
int mount_getexports_async(struct rpc_context
*rpc
, const char *server
, rpc_cb cb
, void *private_data
);
1181 * Sync getexports(<server>)
1183 * NULL : something failed
1184 * exports export : a linked list of exported directories
1186 * returned data must be freed by calling mount_free_export_list(exportnode);
1188 EXTERN
struct exportnode
*mount_getexports(const char *server
);
1190 EXTERN
void mount_free_export_list(struct exportnode
*exports
);
1193 //qqq replace later with lseek(cur, 0)
1194 uint64_t nfs_get_current_offset(struct nfsfh
*nfsfh
);
1200 struct nfs_server_list
{
1201 struct nfs_server_list
*next
;
1206 * Sync find_local_servers(<server>)
1207 * This function will probe all local networks for NFS server. This function will
1208 * block for one second while awaiting for all nfs servers to respond.
1211 * NULL : something failed
1213 * struct nfs_server_list : a linked list of all discovered servers
1215 * returned data must be freed by nfs_free_srvr_list(srv);
1217 struct nfs_server_list
*nfs_find_local_servers(void);
1218 void free_nfs_srvr_list(struct nfs_server_list
*srv
);
1224 #endif /* !_LIBNFS_H_ */