406fcdfa0b4525bab3e582f5cdc0f6a903634cd6
2 Copyright (C) 2010 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, see <http://www.gnu.org/licenses/>.
18 * This is the highlevel interface to access NFS resources using a posix-like interface
46 #define EXTERN __declspec( dllexport )
75 * Used for interfacing the async version of the api into an external eventsystem
77 EXTERN
int nfs_get_fd(struct nfs_context
*nfs
);
78 EXTERN
int nfs_which_events(struct nfs_context
*nfs
);
79 EXTERN
int nfs_service(struct nfs_context
*nfs
, int revents
);
80 EXTERN
int nfs_queue_length(struct nfs_context
*nfs
);
83 * Used if you need different credentials than the default for the current user.
86 EXTERN
void nfs_set_auth(struct nfs_context
*nfs
, struct AUTH
*auth
);
89 * When an operation failed, this function can extract a detailed error string.
91 EXTERN
char *nfs_get_error(struct nfs_context
*nfs
);
95 * Callback for all ASYNC nfs functions
97 typedef void (*nfs_cb
)(int err
, struct nfs_context
*nfs
, void *data
, void *private_data
);
100 * Callback for all ASYNC rpc functions
102 typedef void (*rpc_cb
)(struct rpc_context
*rpc
, int status
, void *data
, void *private_data
);
110 * Create an NFS c, the context.
112 * NULL : Failed to create a context.
113 * *nfs : A pointer to an nfs context.
115 EXTERN
struct nfs_context
*nfs_init_context(void);
117 * Destroy an nfs context.
119 EXTERN
void nfs_destroy_context(struct nfs_context
*nfs
);
123 * URL parsing functions.
124 * These functions all parse a URL of the form
125 * nfs://server/path/file?argv=val[&arg=val]*
126 * and returns a nfs_url.
128 * Apart from parsing the URL the functions will also update
129 * the nfs context to reflect settings controlled via url arguments.
131 * Current URL arguments are :
132 * tcp-syncnt=<int> : Number of SYNs to send during the seccion establish
133 * before failing settin up the tcp connection to the
135 * uid=<int> : UID value to use when talking to the server.
136 * default it 65534 on Windows and getuid() on unixen.
137 * gid=<int> : GID value to use when talking to the server.
138 * default it 65534 on Windows and getgid() on unixen.
141 * Parse a complete NFS URL including, server, path and
142 * filename. Fail if any component is missing.
144 EXTERN
struct nfs_url
*nfs_parse_url_full(struct nfs_context
*nfs
, const char *url
);
147 * Parse an NFS URL, but do not split path and file. File
148 * in the resulting struct remains NULL.
150 EXTERN
struct nfs_url
*nfs_parse_url_dir(struct nfs_context
*nfs
, const char *url
);
153 * Parse an NFS URL, but do not fail if file, path or even server is missing.
154 * Check elements of the resulting struct for NULL.
156 EXTERN
struct nfs_url
*nfs_parse_url_incomplete(struct nfs_context
*nfs
, const char *url
);
160 * Free the URL struct returned by the nfs_parse_url_* functions.
162 EXTERN
void nfs_destroy_url(struct nfs_url
*url
);
168 * Get the maximum supported READ3 size by the server
170 EXTERN
uint64_t nfs_get_readmax(struct nfs_context
*nfs
);
173 * Get the maximum supported WRITE3 size by the server
175 EXTERN
uint64_t nfs_get_writemax(struct nfs_context
*nfs
);
178 * MODIFY CONNECT PARAMTERS
181 EXTERN
void nfs_set_tcp_syncnt(struct nfs_context
*nfs
, int v
);
182 EXTERN
void nfs_set_uid(struct nfs_context
*nfs
, int uid
);
183 EXTERN
void nfs_set_gid(struct nfs_context
*nfs
, int gid
);
191 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
192 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
194 * When the callback is invoked, status indicates the result:
197 * -errno : An error occured.
198 * data is the error string.
200 EXTERN
int nfs_mount_async(struct nfs_context
*nfs
, const char *server
, const char *exportname
, nfs_cb cb
, void *private_data
);
204 * 0 : The operation was successfull.
205 * -errno : The command failed.
207 EXTERN
int nfs_mount(struct nfs_context
*nfs
, const char *server
, const char *exportname
);
216 * Async stat(<filename>)
218 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
219 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
221 * When the callback is invoked, status indicates the result:
223 * data is struct stat *
224 * -errno : An error occured.
225 * data is the error string.
227 /* This function is deprecated. Use nfs_stat64_async() instead */
229 EXTERN
int nfs_stat_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
231 * Sync stat(<filename>)
233 * 0 : The operation was successfull.
234 * -errno : The command failed.
236 /* This function is deprecated. Use nfs_stat64() instead */
238 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct __stat64
*st
);
240 EXTERN
int nfs_stat(struct nfs_context
*nfs
, const char *path
, struct stat
*st
);
245 * 64 bit version if stat. All fields are always 64bit.
246 * Use these functions instead of nfs_stat[_async](), especially if you
247 * have weird stat structures.
261 uint64_t nfs_blksize
;
269 * Async stat(<filename>)
271 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
272 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
274 * When the callback is invoked, status indicates the result:
276 * data is struct nfs_stat_64 *
277 * -errno : An error occured.
278 * data is the error string.
280 EXTERN
int nfs_stat64_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
282 * Sync stat(<filename>)
284 * 0 : The operation was successfull.
285 * -errno : The command failed.
287 EXTERN
int nfs_stat64(struct nfs_context
*nfs
, const char *path
, struct nfs_stat_64
*st
);
293 * Async fstat(nfsfh *)
295 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
296 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
298 * When the callback is invoked, status indicates the result:
300 * data is struct stat *
301 * -errno : An error occured.
302 * data is the error string.
304 EXTERN
int nfs_fstat_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
306 * Sync fstat(nfsfh *)
308 * 0 : The operation was successfull.
309 * -errno : The command failed.
312 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct __stat64
*st
);
314 EXTERN
int nfs_fstat(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, struct stat
*st
);
323 * Async open(<filename>)
325 * mode is a combination of the flags : O_RDOLNY, O_WRONLY, O_RDWR , O_SYNC
328 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
329 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
331 * Supported flags are
335 * O_TRUNC (Only valid with O_RDWR or O_WRONLY. Ignored otherwise.)
337 * When the callback is invoked, status indicates the result:
339 * data is a struct *nfsfh;
340 * The nfsfh is close using nfs_close().
341 * -errno : An error occured.
342 * data is the error string.
344 EXTERN
int nfs_open_async(struct nfs_context
*nfs
, const char *path
, int flags
, nfs_cb cb
, void *private_data
);
346 * Sync open(<filename>)
348 * 0 : The operation was successfull. *nfsfh is filled in.
349 * -errno : The command failed.
351 EXTERN
int nfs_open(struct nfs_context
*nfs
, const char *path
, int flags
, struct nfsfh
**nfsfh
);
363 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
364 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
366 * When the callback is invoked, status indicates the result:
369 * -errno : An error occured.
370 * data is the error string.
372 EXTERN
int nfs_close_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
376 * 0 : The operation was successfull.
377 * -errno : The command failed.
379 EXTERN
int nfs_close(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
389 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
390 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
392 * When the callback is invoked, status indicates the result:
394 * status is numer of bytes read.
395 * data is a pointer to the returned data.
396 * -errno : An error occured.
397 * data is the error string.
399 EXTERN
int nfs_pread_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, nfs_cb cb
, void *private_data
);
403 * >=0 : numer of bytes read.
404 * -errno : An error occured.
406 EXTERN
int nfs_pread(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
417 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
418 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
420 * When the callback is invoked, status indicates the result:
422 * status is numer of bytes read.
423 * data is a pointer to the returned data.
424 * -errno : An error occured.
425 * data is the error string.
427 EXTERN
int nfs_read_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, nfs_cb cb
, void *private_data
);
431 * >=0 : numer of bytes read.
432 * -errno : An error occured.
434 EXTERN
int nfs_read(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 * status is numer of bytes written.
452 * -errno : An error occured.
453 * data is the error string.
455 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
);
459 * >=0 : numer of bytes written.
460 * -errno : An error occured.
462 EXTERN
int nfs_pwrite(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, uint64_t count
, char *buf
);
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 * status is numer of bytes written.
478 * -errno : An error occured.
479 * data is the error string.
481 EXTERN
int nfs_write_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
, nfs_cb cb
, void *private_data
);
485 * >=0 : numer of bytes written.
486 * -errno : An error occured.
488 EXTERN
int nfs_write(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t count
, char *buf
);
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 * data is uint64_t * for the current position.
504 * -errno : An error occured.
505 * data is the error string.
507 EXTERN
int nfs_lseek_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, nfs_cb cb
, void *private_data
);
511 * >=0 : numer of bytes read.
512 * -errno : An error occured.
514 EXTERN
int nfs_lseek(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t offset
, int whence
, uint64_t *current_offset
);
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_fsync_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, nfs_cb cb
, void *private_data
);
537 * -errno : An error occured.
539 EXTERN
int nfs_fsync(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
);
550 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
551 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
553 * When the callback is invoked, status indicates the result:
555 * -errno : An error occured.
556 * data is the error string.
558 EXTERN
int nfs_truncate_async(struct nfs_context
*nfs
, const char *path
, uint64_t length
, nfs_cb cb
, void *private_data
);
563 * -errno : An error occured.
565 EXTERN
int nfs_truncate(struct nfs_context
*nfs
, const char *path
, uint64_t length
);
576 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
577 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
579 * When the callback is invoked, status indicates the result:
581 * -errno : An error occured.
582 * data is the error string.
584 EXTERN
int nfs_ftruncate_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
, nfs_cb cb
, void *private_data
);
589 * -errno : An error occured.
591 EXTERN
int nfs_ftruncate(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, uint64_t length
);
605 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
606 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
608 * When the callback is invoked, status indicates the result:
610 * -errno : An error occured.
611 * data is the error string.
613 EXTERN
int nfs_mkdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
618 * -errno : An error occured.
620 EXTERN
int nfs_mkdir(struct nfs_context
*nfs
, const char *path
);
631 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
632 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
634 * When the callback is invoked, status indicates the result:
636 * -errno : An error occured.
637 * data is the error string.
639 EXTERN
int nfs_rmdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
644 * -errno : An error occured.
646 EXTERN
int nfs_rmdir(struct nfs_context
*nfs
, const char *path
);
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:
663 * data is a struct *nfsfh;
664 * -errno : An error occured.
665 * data is the error string.
667 EXTERN
int nfs_creat_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
672 * -errno : An error occured.
674 EXTERN
int nfs_creat(struct nfs_context
*nfs
, const char *path
, int mode
, struct nfsfh
**nfsfh
);
684 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
685 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
687 * When the callback is invoked, status indicates the result:
689 * -errno : An error occured.
690 * data is the error string.
692 EXTERN
int nfs_mknod_async(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
, nfs_cb cb
, void *private_data
);
697 * -errno : An error occured.
699 EXTERN
int nfs_mknod(struct nfs_context
*nfs
, const char *path
, int mode
, int dev
);
710 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
711 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
713 * When the callback is invoked, status indicates the result:
716 * -errno : An error occured.
717 * data is the error string.
719 EXTERN
int nfs_unlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
724 * -errno : An error occured.
726 EXTERN
int nfs_unlink(struct nfs_context
*nfs
, const char *path
);
739 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
740 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
742 * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
744 * When the callback is invoked, status indicates the result:
746 * data is struct nfsdir *
747 * -errno : An error occured.
748 * data is the error string.
750 EXTERN
int nfs_opendir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
755 * -errno : An error occured.
757 EXTERN
int nfs_opendir(struct nfs_context
*nfs
, const char *path
, struct nfsdir
**nfsdir
);
765 struct nfsdirent
*next
;
769 /* Some extra fields we get for free through the READDIRPLUS3 call.
770 You need libnfs-raw-nfs.h for type/mode constants */
771 uint32_t type
; /* NF3REG, NF3DIR, NF3BLK, ... */
774 struct timeval atime
;
775 struct timeval mtime
;
776 struct timeval ctime
;
781 * nfs_readdir() never blocks, so no special sync/async versions are available
783 EXTERN
struct nfsdirent
*nfs_readdir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
791 * nfs_closedir() never blocks, so no special sync/async versions are available
793 EXTERN
void nfs_closedir(struct nfs_context
*nfs
, struct nfsdir
*nfsdir
);
800 * Async chdir(<path>)
803 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
804 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
806 * When the callback is invoked, status indicates the result:
809 * -errno : An error occured.
810 * data is the error string.
812 EXTERN
int nfs_chdir_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
816 * 0 : The operation was successfull.
817 * -errno : The command failed.
819 EXTERN
int nfs_chdir(struct nfs_context
*nfs
, const char *path
);
825 * nfs_getcwd() never blocks, so no special sync/async versions are available
829 * This function returns a pointer to the current working directory.
830 * This pointer is only stable until the next [f]chdir or when the
831 * context is destroyed.
834 * 0 : The operation was successfull and *cwd is filled in.
835 * -errno : The command failed.
837 EXTERN
void nfs_getcwd(struct nfs_context
*nfs
, const char **cwd
);
844 * Async statvfs(<dirname>)
846 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
847 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
849 * When the callback is invoked, status indicates the result:
851 * data is struct statvfs *
852 * -errno : An error occured.
853 * data is the error string.
856 EXTERN
int nfs_statvfs_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
858 * Sync statvfs(<dirname>)
860 * 0 : The operation was successfull.
861 * -errno : The command failed.
863 EXTERN
int nfs_statvfs(struct nfs_context
*nfs
, const char *path
, struct statvfs
*svfs
);
870 * Async readlink(<name>)
872 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
873 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
875 * When the callback is invoked, status indicates the result:
878 * data is only valid during the callback and is automatically freed when the callback returns.
879 * -errno : An error occured.
880 * data is the error string.
883 EXTERN
int nfs_readlink_async(struct nfs_context
*nfs
, const char *path
, nfs_cb cb
, void *private_data
);
885 * Sync readlink(<name>)
887 * 0 : The operation was successfull.
888 * -errno : The command failed.
890 EXTERN
int nfs_readlink(struct nfs_context
*nfs
, const char *path
, char *buf
, int bufsize
);
898 * Async chmod(<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_chmod_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
913 * 0 : The operation was successfull.
914 * -errno : The command failed.
916 EXTERN
int nfs_chmod(struct nfs_context
*nfs
, const char *path
, int mode
);
924 * Async fchmod(<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_fchmod_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
, nfs_cb cb
, void *private_data
);
937 * Sync fchmod(<handle>)
939 * 0 : The operation was successfull.
940 * -errno : The command failed.
942 EXTERN
int nfs_fchmod(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int mode
);
950 * Async chown(<name>)
952 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
953 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
955 * When the callback is invoked, status indicates the result:
958 * -errno : An error occured.
959 * data is the error string.
961 EXTERN
int nfs_chown_async(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
965 * 0 : The operation was successfull.
966 * -errno : The command failed.
968 EXTERN
int nfs_chown(struct nfs_context
*nfs
, const char *path
, int uid
, int gid
);
976 * Async fchown(<handle>)
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.
987 EXTERN
int nfs_fchown_async(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
, nfs_cb cb
, void *private_data
);
989 * Sync fchown(<handle>)
991 * 0 : The operation was successfull.
992 * -errno : The command failed.
994 EXTERN
int nfs_fchown(struct nfs_context
*nfs
, struct nfsfh
*nfsfh
, int uid
, int gid
);
1003 * Async utimes(<path>)
1005 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1006 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1008 * When the callback is invoked, status indicates the result:
1011 * -errno : An error occured.
1012 * data is the error string.
1014 EXTERN
int nfs_utimes_async(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
, nfs_cb cb
, void *private_data
);
1016 * Sync utimes(<path>)
1018 * 0 : The operation was successfull.
1019 * -errno : The command failed.
1021 EXTERN
int nfs_utimes(struct nfs_context
*nfs
, const char *path
, struct timeval
*times
);
1028 * Async utime(<path>)
1030 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1031 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1033 * When the callback is invoked, status indicates the result:
1036 * -errno : An error occured.
1037 * data is the error string.
1040 EXTERN
int nfs_utime_async(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
, nfs_cb cb
, void *private_data
);
1042 * Sync utime(<path>)
1044 * 0 : The operation was successfull.
1045 * -errno : The command failed.
1047 EXTERN
int nfs_utime(struct nfs_context
*nfs
, const char *path
, struct utimbuf
*times
);
1056 * Async access(<path>)
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_access_async(struct nfs_context
*nfs
, const char *path
, int mode
, nfs_cb cb
, void *private_data
);
1069 * Sync access(<path>)
1071 * 0 : The operation was successfull.
1072 * -errno : The command failed.
1074 EXTERN
int nfs_access(struct nfs_context
*nfs
, const char *path
, int mode
);
1083 * Async symlink(<path>)
1085 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1086 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1088 * When the callback is invoked, status indicates the result:
1091 * -errno : An error occured.
1092 * data is the error string.
1094 EXTERN
int nfs_symlink_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1096 * Sync symlink(<path>)
1098 * 0 : The operation was successfull.
1099 * -errno : The command failed.
1101 EXTERN
int nfs_symlink(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1108 * Async rename(<oldpath>, <newpath>)
1110 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1111 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1113 * When the callback is invoked, status indicates the result:
1116 * -errno : An error occured.
1117 * data is the error string.
1119 EXTERN
int nfs_rename_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1121 * Sync rename(<oldpath>, <newpath>)
1123 * 0 : The operation was successfull.
1124 * -errno : The command failed.
1126 EXTERN
int nfs_rename(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1134 * Async link(<oldpath>, <newpath>)
1136 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1137 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1139 * When the callback is invoked, status indicates the result:
1142 * -errno : An error occured.
1143 * data is the error string.
1145 EXTERN
int nfs_link_async(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
, nfs_cb cb
, void *private_data
);
1147 * Sync link(<oldpath>, <newpath>)
1149 * 0 : The operation was successfull.
1150 * -errno : The command failed.
1152 EXTERN
int nfs_link(struct nfs_context
*nfs
, const char *oldpath
, const char *newpath
);
1159 * Async getexports()
1160 * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
1161 * returned structures.
1163 * This function will return the list of exports from an NFS server.
1166 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1167 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1169 * When the callback is invoked, status indicates the result:
1171 * data is a pointer to an exports pointer:
1172 * exports export = *(exports *)data;
1173 * -errno : An error occured.
1174 * data is the error string.
1176 EXTERN
int mount_getexports_async(struct rpc_context
*rpc
, const char *server
, rpc_cb cb
, void *private_data
);
1178 * Sync getexports(<server>)
1180 * NULL : something failed
1181 * exports export : a linked list of exported directories
1183 * returned data must be freed by calling mount_free_export_list(exportnode);
1185 EXTERN
struct exportnode
*mount_getexports(const char *server
);
1187 EXTERN
void mount_free_export_list(struct exportnode
*exports
);
1190 //qqq replace later with lseek(cur, 0)
1191 uint64_t nfs_get_current_offset(struct nfsfh
*nfsfh
);
1197 struct nfs_server_list
{
1198 struct nfs_server_list
*next
;
1203 * Sync find_local_servers(<server>)
1204 * This function will probe all local networks for NFS server. This function will
1205 * block for one second while awaiting for all nfs servers to respond.
1208 * NULL : something failed
1210 * struct nfs_server_list : a linked list of all discovered servers
1212 * returned data must be freed by nfs_free_srvr_list(srv);
1214 struct nfs_server_list
*nfs_find_local_servers(void);
1215 void free_nfs_srvr_list(struct nfs_server_list
*srv
);
1221 #endif /* !_LIBNFS_H_ */