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 :
329 * O_RDOLNY, O_WRONLY, O_RDWR , O_SYNC, O_APPEND
332 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
333 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
335 * Supported flags are
340 * O_TRUNC (Only valid with O_RDWR or O_WRONLY. Ignored otherwise.)
342 * When the callback is invoked, status indicates the result:
344 * data is a struct *nfsfh;
345 * The nfsfh is close using nfs_close().
346 * -errno : An error occured.
347 * data is the error string.
349 EXTERN
int nfs_open_async(struct nfs_context
*nfs
, const char *path
, int flags
, nfs_cb cb
, void *private_data
);
351 * Sync open(<filename>)
353 * 0 : The operation was successfull. *nfsfh is filled in.
354 * -errno : The command failed.
356 EXTERN
int nfs_open(struct nfs_context
*nfs
, const char *path
, int flags
, struct nfsfh
**nfsfh
);
368 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
369 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
371 * When the callback is invoked, status indicates the result:
374 * -errno : An error occured.
375 * data is the error string.
377 EXTERN
int nfs_close_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
381 * 0 : The operation was successfull.
382 * -errno : The command failed.
384 EXTERN
int nfs_close(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
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 read.
400 * data is a pointer to the returned data.
401 * -errno : An error occured.
402 * data is the error string.
404 EXTERN
int nfs_pread_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, nfs_cb cb
, void *private_data
);
408 * >=0 : numer of bytes read.
409 * -errno : An error occured.
411 EXTERN
int nfs_pread(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
422 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
423 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
425 * When the callback is invoked, status indicates the result:
427 * status is numer of bytes read.
428 * data is a pointer to the returned data.
429 * -errno : An error occured.
430 * data is the error string.
432 EXTERN
int nfs_read_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, nfs_cb cb
, void *private_data
);
436 * >=0 : numer of bytes read.
437 * -errno : An error occured.
439 EXTERN
int nfs_read(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
451 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
452 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
454 * When the callback is invoked, status indicates the result:
456 * status is numer of bytes written.
457 * -errno : An error occured.
458 * data is the error string.
460 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
);
464 * >=0 : numer of bytes written.
465 * -errno : An error occured.
467 EXTERN
int nfs_pwrite(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
477 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
478 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
480 * When the callback is invoked, status indicates the result:
482 * status is numer of bytes written.
483 * -errno : An error occured.
484 * data is the error string.
486 EXTERN
int nfs_write_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
, nfs_cb cb
, void *private_data
);
490 * >=0 : numer of bytes written.
491 * -errno : An error occured.
493 EXTERN
int nfs_write(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
503 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
504 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
506 * When the callback is invoked, status indicates the result:
508 * data is uint64_t * for the current position.
509 * -errno : An error occured.
510 * data is the error string.
512 EXTERN
int nfs_lseek_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int64_t offset
, int whence
, nfs_cb cb
, void *private_data
);
516 * >=0 : numer of bytes read.
517 * -errno : An error occured.
519 EXTERN
int nfs_lseek(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int64_t offset
, int whence
, uint64_t *current_offset
);
529 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
530 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
532 * When the callback is invoked, status indicates the result:
534 * -errno : An error occured.
535 * data is the error string.
537 EXTERN
int nfs_fsync_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
542 * -errno : An error occured.
544 EXTERN
int nfs_fsync(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
555 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
556 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
558 * When the callback is invoked, status indicates the result:
560 * -errno : An error occured.
561 * data is the error string.
563 EXTERN
int nfs_truncate_async(struct nfs_context
*nfs
, const char *path
, uint64_t length
, nfs_cb cb
, void *private_data
);
568 * -errno : An error occured.
570 EXTERN
int nfs_truncate(struct nfs_context
*nfs
, const char *path
, uint64_t length
);
581 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
582 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
584 * When the callback is invoked, status indicates the result:
586 * -errno : An error occured.
587 * data is the error string.
589 EXTERN
int nfs_ftruncate_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
, nfs_cb cb
, void *private_data
);
594 * -errno : An error occured.
596 EXTERN
int nfs_ftruncate(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
);
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 * -errno : An error occured.
616 * data is the error string.
618 EXTERN
int nfs_mkdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
623 * -errno : An error occured.
625 EXTERN
int nfs_mkdir(struct nfs_context
*nfs
, const char *path
);
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_rmdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
649 * -errno : An error occured.
651 EXTERN
int nfs_rmdir(struct nfs_context
*nfs
, const char *path
);
663 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
664 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
666 * When the callback is invoked, status indicates the result:
668 * data is a struct *nfsfh;
669 * -errno : An error occured.
670 * data is the error string.
672 EXTERN
int nfs_creat_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
677 * -errno : An error occured.
679 EXTERN
int nfs_creat(struct nfs_context
*nfs
, const char *path
, int mode
, struct nfsfh
**nfsfh
);
689 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
690 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
692 * When the callback is invoked, status indicates the result:
694 * -errno : An error occured.
695 * data is the error string.
697 EXTERN
int nfs_mknod_async(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
, nfs_cb cb
, void *private_data
);
702 * -errno : An error occured.
704 EXTERN
int nfs_mknod(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
);
715 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
716 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
718 * When the callback is invoked, status indicates the result:
721 * -errno : An error occured.
722 * data is the error string.
724 EXTERN
int nfs_unlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
729 * -errno : An error occured.
731 EXTERN
int nfs_unlink(struct nfs_context
*nfs
, const char *path
);
744 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
745 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
747 * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
749 * When the callback is invoked, status indicates the result:
751 * data is struct nfsdir *
752 * -errno : An error occured.
753 * data is the error string.
755 EXTERN
int nfs_opendir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
760 * -errno : An error occured.
762 EXTERN
int nfs_opendir(struct nfs_context
*nfs
, const char *path
, struct nfsdir
**nfsdir
);
770 struct nfsdirent
*next
;
774 /* Some extra fields we get for free through the READDIRPLUS3 call.
775 You need libnfs-raw-nfs.h for type/mode constants */
776 uint32_t type
; /* NF3REG, NF3DIR, NF3BLK, ... */
779 struct timeval atime
;
780 struct timeval mtime
;
781 struct timeval ctime
;
786 * nfs_readdir() never blocks, so no special sync/async versions are available
788 EXTERN
struct nfsdirent
*nfs_readdir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
796 * nfs_closedir() never blocks, so no special sync/async versions are available
798 EXTERN
void nfs_closedir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
805 * Async chdir(<path>)
808 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
809 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
811 * When the callback is invoked, status indicates the result:
814 * -errno : An error occured.
815 * data is the error string.
817 EXTERN
int nfs_chdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
821 * 0 : The operation was successfull.
822 * -errno : The command failed.
824 EXTERN
int nfs_chdir(struct nfs_context
*nfs
, const char *path
);
830 * nfs_getcwd() never blocks, so no special sync/async versions are available
834 * This function returns a pointer to the current working directory.
835 * This pointer is only stable until the next [f]chdir or when the
836 * context is destroyed.
839 * 0 : The operation was successfull and *cwd is filled in.
840 * -errno : The command failed.
842 EXTERN
void nfs_getcwd(struct nfs_context
*nfs
, const char **cwd
);
849 * Async statvfs(<dirname>)
851 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
852 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
854 * When the callback is invoked, status indicates the result:
856 * data is struct statvfs *
857 * -errno : An error occured.
858 * data is the error string.
861 EXTERN
int nfs_statvfs_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
863 * Sync statvfs(<dirname>)
865 * 0 : The operation was successfull.
866 * -errno : The command failed.
868 EXTERN
int nfs_statvfs(struct nfs_context
*nfs
, const char *path
, struct statvfs
*svfs
);
875 * Async readlink(<name>)
877 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
878 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
880 * When the callback is invoked, status indicates the result:
883 * data is only valid during the callback and is automatically freed when the callback returns.
884 * -errno : An error occured.
885 * data is the error string.
888 EXTERN
int nfs_readlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
890 * Sync readlink(<name>)
892 * 0 : The operation was successfull.
893 * -errno : The command failed.
895 EXTERN
int nfs_readlink(struct nfs_context
*nfs
, const char *path
, char *buf
, int bufsize
);
903 * Async chmod(<name>)
905 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
906 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
908 * When the callback is invoked, status indicates the result:
911 * -errno : An error occured.
912 * data is the error string.
914 EXTERN
int nfs_chmod_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
918 * 0 : The operation was successfull.
919 * -errno : The command failed.
921 EXTERN
int nfs_chmod(struct nfs_context
*nfs
, const char *path
, int mode
);
929 * Async fchmod(<handle>)
931 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
932 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
934 * When the callback is invoked, status indicates the result:
937 * -errno : An error occured.
938 * data is the error string.
940 EXTERN
int nfs_fchmod_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
, nfs_cb cb
, void *private_data
);
942 * Sync fchmod(<handle>)
944 * 0 : The operation was successfull.
945 * -errno : The command failed.
947 EXTERN
int nfs_fchmod(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
);
955 * Async chown(<name>)
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_chown_async(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
970 * 0 : The operation was successfull.
971 * -errno : The command failed.
973 EXTERN
int nfs_chown(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
);
981 * Async fchown(<handle>)
983 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
984 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
986 * When the callback is invoked, status indicates the result:
989 * -errno : An error occured.
990 * data is the error string.
992 EXTERN
int nfs_fchown_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
994 * Sync fchown(<handle>)
996 * 0 : The operation was successfull.
997 * -errno : The command failed.
999 EXTERN
int nfs_fchown(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
);
1008 * Async utimes(<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_utimes_async(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
, nfs_cb cb
, void *private_data
);
1021 * Sync utimes(<path>)
1023 * 0 : The operation was successfull.
1024 * -errno : The command failed.
1026 EXTERN
int nfs_utimes(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
);
1033 * Async utime(<path>)
1035 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1036 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1038 * When the callback is invoked, status indicates the result:
1041 * -errno : An error occured.
1042 * data is the error string.
1045 EXTERN
int nfs_utime_async(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
, nfs_cb cb
, void *private_data
);
1047 * Sync utime(<path>)
1049 * 0 : The operation was successfull.
1050 * -errno : The command failed.
1052 EXTERN
int nfs_utime(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
);
1061 * Async access(<path>)
1063 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1064 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1066 * When the callback is invoked, status indicates the result:
1069 * -errno : An error occured.
1070 * data is the error string.
1072 EXTERN
int nfs_access_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
1074 * Sync access(<path>)
1076 * 0 : The operation was successfull.
1077 * -errno : The command failed.
1079 EXTERN
int nfs_access(struct nfs_context
*nfs
, const char *path
, int mode
);
1088 * Async symlink(<path>)
1090 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1091 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1093 * When the callback is invoked, status indicates the result:
1096 * -errno : An error occured.
1097 * data is the error string.
1099 EXTERN
int nfs_symlink_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1101 * Sync symlink(<path>)
1103 * 0 : The operation was successfull.
1104 * -errno : The command failed.
1106 EXTERN
int nfs_symlink(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1113 * Async rename(<oldpath>, <newpath>)
1115 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1116 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1118 * When the callback is invoked, status indicates the result:
1121 * -errno : An error occured.
1122 * data is the error string.
1124 EXTERN
int nfs_rename_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1126 * Sync rename(<oldpath>, <newpath>)
1128 * 0 : The operation was successfull.
1129 * -errno : The command failed.
1131 EXTERN
int nfs_rename(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1139 * Async link(<oldpath>, <newpath>)
1141 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1142 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1144 * When the callback is invoked, status indicates the result:
1147 * -errno : An error occured.
1148 * data is the error string.
1150 EXTERN
int nfs_link_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1152 * Sync link(<oldpath>, <newpath>)
1154 * 0 : The operation was successfull.
1155 * -errno : The command failed.
1157 EXTERN
int nfs_link(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1164 * Async getexports()
1165 * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
1166 * returned structures.
1168 * This function will return the list of exports from an NFS server.
1171 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1172 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1174 * When the callback is invoked, status indicates the result:
1176 * data is a pointer to an exports pointer:
1177 * exports export = *(exports *)data;
1178 * -errno : An error occured.
1179 * data is the error string.
1181 EXTERN
int mount_getexports_async(struct rpc_context
*rpc
, const char *server
, rpc_cb cb
, void *private_data
);
1183 * Sync getexports(<server>)
1185 * NULL : something failed
1186 * exports export : a linked list of exported directories
1188 * returned data must be freed by calling mount_free_export_list(exportnode);
1190 EXTERN
struct exportnode
*mount_getexports(const char *server
);
1192 EXTERN
void mount_free_export_list(struct exportnode
*exports
);
1195 //qqq replace later with lseek(cur, 0)
1196 uint64_t nfs_get_current_offset(struct nfsfh
*nfsfh
);
1202 struct nfs_server_list
{
1203 struct nfs_server_list
*next
;
1208 * Sync find_local_servers(<server>)
1209 * This function will probe all local networks for NFS server. This function will
1210 * block for one second while awaiting for all nfs servers to respond.
1213 * NULL : something failed
1215 * struct nfs_server_list : a linked list of all discovered servers
1217 * returned data must be freed by nfs_free_srvr_list(srv);
1219 struct nfs_server_list
*nfs_find_local_servers(void);
1220 void free_nfs_srvr_list(struct nfs_server_list
*srv
);
1226 #endif /* !_LIBNFS_H_ */