libnfs: Add lutimes
[deb_libnfs.git] / include / nfsc / libnfs.h
CommitLineData
84004dbf
RS
1/*
2 Copyright (C) 2010 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
3
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.
8
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.
13
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/>.
16*/
17/*
18 * This is the highlevel interface to access NFS resources using a posix-like interface
19 */
52014ebf
AR
20
21#ifndef _LIBNFS_H_
22#define _LIBNFS_H_
23
84004dbf 24#include <stdint.h>
252aa90d
CF
25#if defined(ANDROID)
26#include <sys/time.h>
27#endif
d7c6e9aa
RS
28#if defined(AROS)
29#include <sys/time.h>
30#endif
bd2f43c8
M
31#if defined(__APPLE__) && defined(__MACH__)
32#include <sys/time.h>
33#endif
84004dbf 34
d48be00c
AR
35#ifdef __cplusplus
36extern "C" {
37#endif
38
3ca2aac9
PL
39#define LIBNFS_FEATURE_READAHEAD
40#define NFS_BLKSIZE 4096
41
84004dbf 42struct nfs_context;
7f0242ca 43struct rpc_context;
84004dbf 44
d2ec73c7
PL
45struct nfs_url {
46 char *server;
47 char *path;
48 char *file;
49};
50
66ad6d84
RS
51#if defined(WIN32)
52#define EXTERN __declspec( dllexport )
53#else
52014ebf 54#define EXTERN
66ad6d84
RS
55#endif
56
eecdc4f3
RS
57#if defined(WIN32)
58struct statvfs {
59 uint32_t f_bsize;
60 uint32_t f_frsize;
61 uint64_t f_blocks;
62 uint64_t f_bfree;
63 uint64_t f_bavail;
64 uint32_t f_files;
65 uint32_t f_ffree;
66 uint32_t f_favail;
52014ebf 67 uint32_t f_fsid;
eecdc4f3
RS
68 uint32_t f_flag;
69 uint32_t f_namemax;
70};
71struct utimbuf {
72 time_t actime;
73 time_t modtime;
74};
75#define R_OK 4
76#define W_OK 2
77#define X_OK 1
78#endif
79
84004dbf
RS
80/*
81 * Used for interfacing the async version of the api into an external eventsystem
82 */
66ad6d84
RS
83EXTERN int nfs_get_fd(struct nfs_context *nfs);
84EXTERN int nfs_which_events(struct nfs_context *nfs);
85EXTERN int nfs_service(struct nfs_context *nfs, int revents);
83aa785d 86EXTERN int nfs_queue_length(struct nfs_context *nfs);
84004dbf
RS
87
88/*
89 * Used if you need different credentials than the default for the current user.
90 */
67ba2239
RS
91struct AUTH;
92EXTERN void nfs_set_auth(struct nfs_context *nfs, struct AUTH *auth);
84004dbf 93
84004dbf
RS
94/*
95 * When an operation failed, this function can extract a detailed error string.
96 */
66ad6d84 97EXTERN char *nfs_get_error(struct nfs_context *nfs);
84004dbf
RS
98
99
100/*
101 * Callback for all ASYNC nfs functions
102 */
103typedef void (*nfs_cb)(int err, struct nfs_context *nfs, void *data, void *private_data);
104
7f0242ca
RS
105/*
106 * Callback for all ASYNC rpc functions
107 */
108typedef void (*rpc_cb)(struct rpc_context *rpc, int status, void *data, void *private_data);
84004dbf
RS
109
110
111
112/*
113 * NFS CONTEXT.
114 */
115/*
116 * Create an NFS c, the context.
117 * Function returns
118 * NULL : Failed to create a context.
119 * *nfs : A pointer to an nfs context.
120 */
66ad6d84 121EXTERN struct nfs_context *nfs_init_context(void);
84004dbf
RS
122/*
123 * Destroy an nfs context.
124 */
66ad6d84 125EXTERN void nfs_destroy_context(struct nfs_context *nfs);
84004dbf
RS
126
127
0961765a
RS
128/*
129 * URL parsing functions.
52014ebf 130 * These functions all parse a URL of the form
0961765a
RS
131 * nfs://server/path/file?argv=val[&arg=val]*
132 * and returns a nfs_url.
133 *
134 * Apart from parsing the URL the functions will also update
135 * the nfs context to reflect settings controlled via url arguments.
136 *
137 * Current URL arguments are :
138 * tcp-syncnt=<int> : Number of SYNs to send during the seccion establish
139 * before failing settin up the tcp connection to the
140 * server.
141 * uid=<int> : UID value to use when talking to the server.
142 * default it 65534 on Windows and getuid() on unixen.
143 * gid=<int> : GID value to use when talking to the server.
144 * default it 65534 on Windows and getgid() on unixen.
145 */
d2ec73c7
PL
146/*
147 * Parse a complete NFS URL including, server, path and
148 * filename. Fail if any component is missing.
149 */
150EXTERN struct nfs_url *nfs_parse_url_full(struct nfs_context *nfs, const char *url);
151
152/*
153 * Parse an NFS URL, but do not split path and file. File
154 * in the resulting struct remains NULL.
155 */
156EXTERN struct nfs_url *nfs_parse_url_dir(struct nfs_context *nfs, const char *url);
157
158/*
159 * Parse an NFS URL, but do not fail if file, path or even server is missing.
160 * Check elements of the resulting struct for NULL.
161 */
162EXTERN struct nfs_url *nfs_parse_url_incomplete(struct nfs_context *nfs, const char *url);
163
164
165/*
166 * Free the URL struct returned by the nfs_parse_url_* functions.
167 */
168EXTERN void nfs_destroy_url(struct nfs_url *url);
169
170
84004dbf
RS
171struct nfsfh;
172
17ef62fa
RS
173/*
174 * Get the maximum supported READ3 size by the server
175 */
183451cf 176EXTERN uint64_t nfs_get_readmax(struct nfs_context *nfs);
17ef62fa
RS
177
178/*
179 * Get the maximum supported WRITE3 size by the server
180 */
183451cf 181EXTERN uint64_t nfs_get_writemax(struct nfs_context *nfs);
17ef62fa 182
d43a8953 183/*
52014ebf 184 * MODIFY CONNECT PARAMTERS
d43a8953
PL
185 */
186
187EXTERN void nfs_set_tcp_syncnt(struct nfs_context *nfs, int v);
188EXTERN void nfs_set_uid(struct nfs_context *nfs, int uid);
189EXTERN void nfs_set_gid(struct nfs_context *nfs, int gid);
3ca2aac9 190EXTERN void nfs_set_readahead(struct nfs_context *nfs, uint32_t v);
84004dbf
RS
191
192/*
193 * MOUNT THE EXPORT
194 */
195/*
196 * Async nfs mount.
197 * Function returns
198 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
199 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
200 *
201 * When the callback is invoked, status indicates the result:
202 * 0 : Success.
203 * data is NULL
204 * -errno : An error occured.
205 * data is the error string.
206 */
66ad6d84 207EXTERN int nfs_mount_async(struct nfs_context *nfs, const char *server, const char *exportname, nfs_cb cb, void *private_data);
84004dbf
RS
208/*
209 * Sync nfs mount.
210 * Function returns
211 * 0 : The operation was successfull.
212 * -errno : The command failed.
213 */
66ad6d84 214EXTERN int nfs_mount(struct nfs_context *nfs, const char *server, const char *exportname);
84004dbf
RS
215
216
217
218
219/*
220 * STAT()
221 */
222/*
223 * Async stat(<filename>)
224 * Function returns
225 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
226 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
227 *
228 * When the callback is invoked, status indicates the result:
229 * 0 : Success.
230 * data is struct stat *
231 * -errno : An error occured.
232 * data is the error string.
233 */
479302f7 234/* This function is deprecated. Use nfs_stat64_async() instead */
84004dbf 235struct stat;
66ad6d84 236EXTERN int nfs_stat_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
84004dbf
RS
237/*
238 * Sync stat(<filename>)
239 * Function returns
240 * 0 : The operation was successfull.
241 * -errno : The command failed.
242 */
479302f7 243/* This function is deprecated. Use nfs_stat64() instead */
be184101
M
244#ifdef WIN32
245EXTERN int nfs_stat(struct nfs_context *nfs, const char *path, struct __stat64 *st);
246#else
66ad6d84 247EXTERN int nfs_stat(struct nfs_context *nfs, const char *path, struct stat *st);
be184101 248#endif
84004dbf 249
479302f7
RS
250
251/* nfs_stat64
252 * 64 bit version if stat. All fields are always 64bit.
253 * Use these functions instead of nfs_stat[_async](), especially if you
254 * have weird stat structures.
255 */
256/*
257 * STAT()
258 */
259struct nfs_stat_64 {
260 uint64_t nfs_dev;
261 uint64_t nfs_ino;
262 uint64_t nfs_mode;
263 uint64_t nfs_nlink;
264 uint64_t nfs_uid;
265 uint64_t nfs_gid;
266 uint64_t nfs_rdev;
267 uint64_t nfs_size;
268 uint64_t nfs_blksize;
269 uint64_t nfs_blocks;
270 uint64_t nfs_atime;
271 uint64_t nfs_mtime;
272 uint64_t nfs_ctime;
fc08ac45
RL
273 uint64_t nfs_atime_nsec;
274 uint64_t nfs_mtime_nsec;
275 uint64_t nfs_ctime_nsec;
276 uint64_t nfs_used;
479302f7
RS
277};
278
279/*
280 * Async stat(<filename>)
281 * Function returns
282 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
283 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
284 *
285 * When the callback is invoked, status indicates the result:
286 * 0 : Success.
287 * data is struct nfs_stat_64 *
288 * -errno : An error occured.
289 * data is the error string.
290 */
291EXTERN int nfs_stat64_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
292/*
293 * Sync stat(<filename>)
294 * Function returns
295 * 0 : The operation was successfull.
296 * -errno : The command failed.
297 */
298EXTERN int nfs_stat64(struct nfs_context *nfs, const char *path, struct nfs_stat_64 *st);
299
bf769f96
RL
300/*
301 * Async stat(<filename>)
302 *
303 * Like stat except if the destination is a symbolic link, it acts on the
304 * symbolic link itself.
305 *
306 * Function returns
307 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
308 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
309 *
310 * When the callback is invoked, status indicates the result:
311 * 0 : Success.
312 * data is struct nfs_stat_64 *
313 * -errno : An error occured.
314 * data is the error string.
315 */
316EXTERN int nfs_lstat64_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
317/*
318 * Sync stat(<filename>)
319 *
320 * Like stat except if the destination is a symbolic link, it acts on the
321 * symbolic link itself.
322 *
323 * Function returns
324 * 0 : The operation was successfull.
325 * -errno : The command failed.
326 */
327EXTERN int nfs_lstat64(struct nfs_context *nfs, const char *path, struct nfs_stat_64 *st);
328
84004dbf
RS
329/*
330 * FSTAT()
331 */
332/*
333 * Async fstat(nfsfh *)
334 * Function returns
335 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
336 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
337 *
338 * When the callback is invoked, status indicates the result:
339 * 0 : Success.
340 * data is struct stat *
341 * -errno : An error occured.
342 * data is the error string.
343 */
3e020c15 344/* This function is deprecated. Use nfs_fstat64_async() instead */
66ad6d84 345EXTERN int nfs_fstat_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
84004dbf
RS
346/*
347 * Sync fstat(nfsfh *)
348 * Function returns
349 * 0 : The operation was successfull.
350 * -errno : The command failed.
351 */
be184101
M
352#ifdef WIN32
353EXTERN int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, struct __stat64 *st);
354#else
66ad6d84 355EXTERN int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat *st);
be184101 356#endif
84004dbf 357
3e020c15
RL
358/* nfs_fstat64
359 * 64 bit version of fstat. All fields are always 64bit.
360 * Use these functions instead of nfs_fstat[_async](), especially if you
361 * have weird stat structures.
362 */
363/*
364 * FSTAT()
365 */
366/*
367 * Async fstat(nfsfh *)
368 * Function returns
369 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
370 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
371 *
372 * When the callback is invoked, status indicates the result:
373 * 0 : Success.
374 * data is struct stat *
375 * -errno : An error occured.
376 * data is the error string.
377 */
378EXTERN int nfs_fstat64_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
379/*
380 * Sync fstat(nfsfh *)
381 * Function returns
382 * 0 : The operation was successfull.
383 * -errno : The command failed.
384 */
385EXTERN int nfs_fstat64(struct nfs_context *nfs, struct nfsfh *nfsfh, struct nfs_stat_64 *st);
386
84004dbf
RS
387
388
389/*
390 * OPEN()
391 */
392/*
393 * Async open(<filename>)
394 *
548e2bea 395 * mode is a combination of the flags :
00b29d10 396 * O_RDOLNY, O_WRONLY, O_RDWR , O_SYNC, O_APPEND, O_TRUNC
84004dbf
RS
397 *
398 * Function returns
399 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
400 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
401 *
3cea44dc 402 * Supported flags are
548e2bea 403 * O_APPEND
3cea44dc
RS
404 * O_RDONLY
405 * O_WRONLY
406 * O_RDWR
00b29d10 407 * O_SYNC
22a0f15b 408 * O_TRUNC (Only valid with O_RDWR or O_WRONLY. Ignored otherwise.)
3cea44dc 409 *
84004dbf
RS
410 * When the callback is invoked, status indicates the result:
411 * 0 : Success.
412 * data is a struct *nfsfh;
413 * The nfsfh is close using nfs_close().
414 * -errno : An error occured.
415 * data is the error string.
416 */
3cea44dc 417EXTERN int nfs_open_async(struct nfs_context *nfs, const char *path, int flags, nfs_cb cb, void *private_data);
84004dbf 418/*
f893b680 419 * Sync open(<filename>)
84004dbf
RS
420 * Function returns
421 * 0 : The operation was successfull. *nfsfh is filled in.
422 * -errno : The command failed.
423 */
3cea44dc 424EXTERN int nfs_open(struct nfs_context *nfs, const char *path, int flags, struct nfsfh **nfsfh);
84004dbf
RS
425
426
427
428
429/*
430 * CLOSE
431 */
432/*
433 * Async close(nfsfh)
434 *
435 * Function returns
436 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
437 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
438 *
439 * When the callback is invoked, status indicates the result:
440 * 0 : Success.
441 * data is NULL.
442 * -errno : An error occured.
443 * data is the error string.
444 */
66ad6d84 445EXTERN int nfs_close_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
84004dbf
RS
446/*
447 * Sync close(nfsfh)
448 * Function returns
449 * 0 : The operation was successfull.
450 * -errno : The command failed.
451 */
66ad6d84 452EXTERN int nfs_close(struct nfs_context *nfs, struct nfsfh *nfsfh);
84004dbf
RS
453
454
455/*
456 * PREAD()
457 */
458/*
459 * Async pread()
460 *
461 * Function returns
462 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
463 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
464 *
465 * When the callback is invoked, status indicates the result:
466 * >=0 : Success.
467 * status is numer of bytes read.
468 * data is a pointer to the returned data.
469 * -errno : An error occured.
470 * data is the error string.
471 */
183451cf 472EXTERN int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, nfs_cb cb, void *private_data);
84004dbf
RS
473/*
474 * Sync pread()
475 * Function returns
476 * >=0 : numer of bytes read.
477 * -errno : An error occured.
478 */
183451cf 479EXTERN int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf);
84004dbf
RS
480
481
482
483/*
484 * READ()
485 */
486/*
487 * Async read()
488 *
489 * Function returns
490 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
491 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
492 *
493 * When the callback is invoked, status indicates the result:
494 * >=0 : Success.
495 * status is numer of bytes read.
496 * data is a pointer to the returned data.
497 * -errno : An error occured.
498 * data is the error string.
499 */
183451cf 500EXTERN int nfs_read_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, nfs_cb cb, void *private_data);
84004dbf
RS
501/*
502 * Sync read()
503 * Function returns
504 * >=0 : numer of bytes read.
505 * -errno : An error occured.
506 */
183451cf 507EXTERN int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf);
84004dbf
RS
508
509
510
511
512/*
513 * PWRITE()
514 */
515/*
516 * Async pwrite()
517 *
518 * Function returns
519 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
520 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
521 *
522 * When the callback is invoked, status indicates the result:
523 * >=0 : Success.
524 * status is numer of bytes written.
525 * -errno : An error occured.
526 * data is the error string.
527 */
183451cf 528EXTERN 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);
84004dbf
RS
529/*
530 * Sync pwrite()
531 * Function returns
532 * >=0 : numer of bytes written.
533 * -errno : An error occured.
534 */
183451cf 535EXTERN int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf);
84004dbf
RS
536
537
538/*
539 * WRITE()
540 */
541/*
542 * Async write()
543 *
544 * Function returns
545 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
546 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
547 *
548 * When the callback is invoked, status indicates the result:
549 * >=0 : Success.
550 * status is numer of bytes written.
551 * -errno : An error occured.
552 * data is the error string.
553 */
183451cf 554EXTERN int nfs_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf, nfs_cb cb, void *private_data);
84004dbf
RS
555/*
556 * Sync write()
557 * Function returns
558 * >=0 : numer of bytes written.
559 * -errno : An error occured.
560 */
183451cf 561EXTERN int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf);
84004dbf
RS
562
563
564/*
565 * LSEEK()
566 */
567/*
568 * Async lseek()
569 *
570 * Function returns
571 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
572 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
573 *
574 * When the callback is invoked, status indicates the result:
575 * >=0 : Success.
183451cf 576 * data is uint64_t * for the current position.
84004dbf
RS
577 * -errno : An error occured.
578 * data is the error string.
579 */
1f1b6cb0 580EXTERN int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int64_t offset, int whence, nfs_cb cb, void *private_data);
84004dbf
RS
581/*
582 * Sync lseek()
583 * Function returns
584 * >=0 : numer of bytes read.
585 * -errno : An error occured.
586 */
1f1b6cb0 587EXTERN int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, int64_t offset, int whence, uint64_t *current_offset);
84004dbf
RS
588
589
590/*
591 * FSYNC()
592 */
593/*
594 * Async fsync()
595 *
596 * Function returns
597 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
598 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
599 *
600 * When the callback is invoked, status indicates the result:
601 * 0 : Success.
602 * -errno : An error occured.
603 * data is the error string.
604 */
66ad6d84 605EXTERN int nfs_fsync_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
84004dbf
RS
606/*
607 * Sync fsync()
608 * Function returns
609 * 0 : Success
610 * -errno : An error occured.
611 */
66ad6d84 612EXTERN int nfs_fsync(struct nfs_context *nfs, struct nfsfh *nfsfh);
84004dbf
RS
613
614
615
616/*
617 * TRUNCATE()
618 */
619/*
620 * Async truncate()
621 *
622 * Function returns
623 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
624 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
625 *
626 * When the callback is invoked, status indicates the result:
627 * 0 : Success.
628 * -errno : An error occured.
629 * data is the error string.
630 */
183451cf 631EXTERN int nfs_truncate_async(struct nfs_context *nfs, const char *path, uint64_t length, nfs_cb cb, void *private_data);
84004dbf
RS
632/*
633 * Sync truncate()
634 * Function returns
635 * 0 : Success
636 * -errno : An error occured.
637 */
183451cf 638EXTERN int nfs_truncate(struct nfs_context *nfs, const char *path, uint64_t length);
84004dbf
RS
639
640
641
642/*
643 * FTRUNCATE()
644 */
645/*
646 * Async ftruncate()
647 *
648 * Function returns
649 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
650 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
651 *
652 * When the callback is invoked, status indicates the result:
653 * 0 : Success.
654 * -errno : An error occured.
655 * data is the error string.
656 */
183451cf 657EXTERN int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length, nfs_cb cb, void *private_data);
84004dbf
RS
658/*
659 * Sync ftruncate()
660 * Function returns
661 * 0 : Success
662 * -errno : An error occured.
663 */
183451cf 664EXTERN int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length);
84004dbf
RS
665
666
667
668
669
670
671/*
672 * MKDIR()
673 */
674/*
675 * Async mkdir()
676 *
677 * Function returns
678 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
679 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
680 *
681 * When the callback is invoked, status indicates the result:
682 * 0 : Success.
683 * -errno : An error occured.
684 * data is the error string.
685 */
66ad6d84 686EXTERN int nfs_mkdir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
84004dbf
RS
687/*
688 * Sync mkdir()
689 * Function returns
690 * 0 : Success
691 * -errno : An error occured.
692 */
66ad6d84 693EXTERN int nfs_mkdir(struct nfs_context *nfs, const char *path);
84004dbf
RS
694
695
696
697/*
698 * RMDIR()
699 */
700/*
701 * Async rmdir()
702 *
703 * Function returns
704 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
705 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
706 *
707 * When the callback is invoked, status indicates the result:
708 * 0 : Success.
709 * -errno : An error occured.
710 * data is the error string.
711 */
66ad6d84 712EXTERN int nfs_rmdir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
84004dbf
RS
713/*
714 * Sync rmdir()
715 * Function returns
716 * 0 : Success
717 * -errno : An error occured.
718 */
66ad6d84 719EXTERN int nfs_rmdir(struct nfs_context *nfs, const char *path);
84004dbf
RS
720
721
722
723
724/*
725 * CREAT()
726 */
727/*
728 * Async creat()
729 *
730 * Function returns
731 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
732 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
733 *
734 * When the callback is invoked, status indicates the result:
735 * 0 : Success.
736 * data is a struct *nfsfh;
737 * -errno : An error occured.
738 * data is the error string.
739 */
66ad6d84 740EXTERN int nfs_creat_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
84004dbf
RS
741/*
742 * Sync creat()
743 * Function returns
744 * 0 : Success
745 * -errno : An error occured.
746 */
66ad6d84 747EXTERN int nfs_creat(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
84004dbf 748
037a1061
RL
749/*
750 * Async create()
751 *
752 * Same as nfs_creat_async but allows passing flags:
753 * O_APPEND
754 * O_SYNC
755 * O_EXCL
370c59e3 756 * O_TRUNC
037a1061
RL
757 *
758 * Function returns
759 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
760 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
761 *
762 * When the callback is invoked, status indicates the result:
763 * 0 : Success.
764 * data is a struct *nfsfh;
765 * -errno : An error occured.
766 * data is the error string.
767 */
768EXTERN int nfs_create_async(struct nfs_context *nfs, const char *path, int flags, int mode, nfs_cb cb, void *private_data);
769/*
770 * Sync create()
771 * Function returns
772 * 0 : Success
773 * -errno : An error occured.
774 */
775EXTERN int nfs_create(struct nfs_context *nfs, const char *path, int flags, int mode, struct nfsfh **nfsfh);
776
84004dbf 777
1ec6b50a
RS
778/*
779 * MKNOD()
780 */
781/*
782 * Async mknod()
783 *
784 * Function returns
785 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
786 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
787 *
788 * When the callback is invoked, status indicates the result:
789 * 0 : Success.
790 * -errno : An error occured.
791 * data is the error string.
792 */
793EXTERN int nfs_mknod_async(struct nfs_context *nfs, const char *path, int mode, int dev, nfs_cb cb, void *private_data);
794/*
795 * Sync mknod()
796 * Function returns
797 * 0 : Success
798 * -errno : An error occured.
799 */
800EXTERN int nfs_mknod(struct nfs_context *nfs, const char *path, int mode, int dev);
84004dbf
RS
801
802
803
804/*
805 * UNLINK()
806 */
807/*
808 * Async unlink()
809 *
810 * Function returns
811 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
812 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
813 *
814 * When the callback is invoked, status indicates the result:
815 * 0 : Success.
816 * data is NULL
817 * -errno : An error occured.
818 * data is the error string.
819 */
66ad6d84 820EXTERN int nfs_unlink_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
84004dbf
RS
821/*
822 * Sync unlink()
823 * Function returns
824 * 0 : Success
825 * -errno : An error occured.
826 */
66ad6d84 827EXTERN int nfs_unlink(struct nfs_context *nfs, const char *path);
84004dbf
RS
828
829
830
831
832/*
833 * OPENDIR()
834 */
835struct nfsdir;
836/*
837 * Async opendir()
838 *
839 * Function returns
840 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
841 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
842 *
843 * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
844 *
845 * When the callback is invoked, status indicates the result:
846 * 0 : Success.
847 * data is struct nfsdir *
848 * -errno : An error occured.
849 * data is the error string.
850 */
66ad6d84 851EXTERN int nfs_opendir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
84004dbf
RS
852/*
853 * Sync opendir()
854 * Function returns
855 * 0 : Success
856 * -errno : An error occured.
857 */
66ad6d84 858EXTERN int nfs_opendir(struct nfs_context *nfs, const char *path, struct nfsdir **nfsdir);
84004dbf
RS
859
860
861
862/*
863 * READDIR()
864 */
865struct nfsdirent {
866 struct nfsdirent *next;
867 char *name;
868 uint64_t inode;
0804e67d 869
7bda8bad
RS
870 /* Some extra fields we get for free through the READDIRPLUS3 call.
871 You need libnfs-raw-nfs.h for type/mode constants */
0804e67d
RS
872 uint32_t type; /* NF3REG, NF3DIR, NF3BLK, ... */
873 uint32_t mode;
874 uint64_t size;
875 struct timeval atime;
876 struct timeval mtime;
877 struct timeval ctime;
7bda8bad
RS
878 uint32_t uid;
879 uint32_t gid;
390ff38a 880 uint32_t nlink;
fc08ac45
RL
881 uint64_t dev;
882 uint64_t rdev;
883 uint64_t blksize;
884 uint64_t blocks;
885 uint64_t used;
886 uint32_t atime_nsec;
887 uint32_t mtime_nsec;
888 uint32_t ctime_nsec;
84004dbf
RS
889};
890/*
891 * nfs_readdir() never blocks, so no special sync/async versions are available
892 */
66ad6d84 893EXTERN struct nfsdirent *nfs_readdir(struct nfs_context *nfs, struct nfsdir *nfsdir);
84004dbf
RS
894
895
896
897/*
f893b680 898 * CLOSEDIR()
84004dbf
RS
899 */
900/*
901 * nfs_closedir() never blocks, so no special sync/async versions are available
902 */
66ad6d84 903EXTERN void nfs_closedir(struct nfs_context *nfs, struct nfsdir *nfsdir);
84004dbf
RS
904
905
f893b680
RS
906/*
907 * CHDIR()
908 */
909/*
910 * Async chdir(<path>)
911 *
912 * Function returns
913 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
914 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
915 *
916 * When the callback is invoked, status indicates the result:
917 * 0 : Success.
918 * data is NULL;
919 * -errno : An error occured.
920 * data is the error string.
921 */
922EXTERN int nfs_chdir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
923/*
924 * Sync chdir(<path>)
925 * Function returns
926 * 0 : The operation was successfull.
927 * -errno : The command failed.
928 */
929EXTERN int nfs_chdir(struct nfs_context *nfs, const char *path);
930
931/*
932 * GETCWD()
933 */
934/*
935 * nfs_getcwd() never blocks, so no special sync/async versions are available
936 */
937/*
938 * Sync getcwd()
939 * This function returns a pointer to the current working directory.
940 * This pointer is only stable until the next [f]chdir or when the
941 * context is destroyed.
942 *
943 * Function returns
944 * 0 : The operation was successfull and *cwd is filled in.
945 * -errno : The command failed.
946 */
947EXTERN void nfs_getcwd(struct nfs_context *nfs, const char **cwd);
948
84004dbf
RS
949
950/*
951 * STATVFS()
952 */
953/*
954 * Async statvfs(<dirname>)
955 * Function returns
956 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
957 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
958 *
959 * When the callback is invoked, status indicates the result:
960 * 0 : Success.
961 * data is struct statvfs *
962 * -errno : An error occured.
963 * data is the error string.
964 */
965struct statvfs;
66ad6d84 966EXTERN int nfs_statvfs_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
84004dbf
RS
967/*
968 * Sync statvfs(<dirname>)
969 * Function returns
970 * 0 : The operation was successfull.
971 * -errno : The command failed.
972 */
66ad6d84 973EXTERN int nfs_statvfs(struct nfs_context *nfs, const char *path, struct statvfs *svfs);
84004dbf
RS
974
975
976/*
977 * READLINK()
978 */
979/*
980 * Async readlink(<name>)
981 * Function returns
982 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
983 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
984 *
985 * When the callback is invoked, status indicates the result:
986 * 0 : Success.
987 * data is a char *
988 * data is only valid during the callback and is automatically freed when the callback returns.
989 * -errno : An error occured.
990 * data is the error string.
991 */
992struct statvfs;
66ad6d84 993EXTERN int nfs_readlink_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
84004dbf
RS
994/*
995 * Sync readlink(<name>)
996 * Function returns
997 * 0 : The operation was successfull.
998 * -errno : The command failed.
999 */
66ad6d84 1000EXTERN int nfs_readlink(struct nfs_context *nfs, const char *path, char *buf, int bufsize);
84004dbf
RS
1001
1002
1003
1004/*
1005 * CHMOD()
1006 */
1007/*
1008 * Async chmod(<name>)
1009 * Function returns
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.
1012 *
1013 * When the callback is invoked, status indicates the result:
1014 * 0 : Success.
1015 * data is NULL
1016 * -errno : An error occured.
1017 * data is the error string.
1018 */
66ad6d84 1019EXTERN int nfs_chmod_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
84004dbf
RS
1020/*
1021 * Sync chmod(<name>)
1022 * Function returns
1023 * 0 : The operation was successfull.
1024 * -errno : The command failed.
1025 */
66ad6d84 1026EXTERN int nfs_chmod(struct nfs_context *nfs, const char *path, int mode);
84004dbf
RS
1027
1028
1029
1030/*
1031 * FCHMOD()
1032 */
1033/*
1034 * Async fchmod(<handle>)
1035 * Function returns
1036 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1037 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1038 *
1039 * When the callback is invoked, status indicates the result:
1040 * 0 : Success.
1041 * data is NULL
1042 * -errno : An error occured.
1043 * data is the error string.
1044 */
66ad6d84 1045EXTERN int nfs_fchmod_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode, nfs_cb cb, void *private_data);
84004dbf
RS
1046/*
1047 * Sync fchmod(<handle>)
1048 * Function returns
1049 * 0 : The operation was successfull.
1050 * -errno : The command failed.
1051 */
66ad6d84 1052EXTERN int nfs_fchmod(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode);
84004dbf
RS
1053
1054
1055
1056/*
1057 * CHOWN()
1058 */
1059/*
1060 * Async chown(<name>)
1061 * Function returns
1062 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1063 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1064 *
1065 * When the callback is invoked, status indicates the result:
1066 * 0 : Success.
1067 * data is NULL
1068 * -errno : An error occured.
1069 * data is the error string.
1070 */
66ad6d84 1071EXTERN int nfs_chown_async(struct nfs_context *nfs, const char *path, int uid, int gid, nfs_cb cb, void *private_data);
84004dbf
RS
1072/*
1073 * Sync chown(<name>)
1074 * Function returns
1075 * 0 : The operation was successfull.
1076 * -errno : The command failed.
1077 */
66ad6d84 1078EXTERN int nfs_chown(struct nfs_context *nfs, const char *path, int uid, int gid);
5935a28a
RL
1079/*
1080 * Async chown(<name>)
1081 *
1082 * Like chown except if the destination is a symbolic link, it acts on the
1083 * symbolic link itself.
1084 *
1085 * Function returns
1086 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1087 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1088 *
1089 * When the callback is invoked, status indicates the result:
1090 * 0 : Success.
1091 * data is NULL
1092 * -errno : An error occured.
1093 * data is the error string.
1094 */
1095EXTERN int nfs_lchown_async(struct nfs_context *nfs, const char *path, int uid, int gid, nfs_cb cb, void *private_data);
1096/*
1097 * Sync chown(<name>)
1098 *
1099 * Like chown except if the destination is a symbolic link, it acts on the
1100 * symbolic link itself.
1101 *
1102 * Function returns
1103 * 0 : The operation was successfull.
1104 * -errno : The command failed.
1105 */
1106EXTERN int nfs_lchown(struct nfs_context *nfs, const char *path, int uid, int gid);
84004dbf
RS
1107
1108
1109
1110/*
1111 * FCHOWN()
1112 */
1113/*
1114 * Async fchown(<handle>)
1115 * Function returns
1116 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1117 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1118 *
1119 * When the callback is invoked, status indicates the result:
1120 * 0 : Success.
1121 * data is NULL
1122 * -errno : An error occured.
1123 * data is the error string.
1124 */
66ad6d84 1125EXTERN int nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid, nfs_cb cb, void *private_data);
84004dbf
RS
1126/*
1127 * Sync fchown(<handle>)
1128 * Function returns
1129 * 0 : The operation was successfull.
1130 * -errno : The command failed.
1131 */
66ad6d84 1132EXTERN int nfs_fchown(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid);
84004dbf
RS
1133
1134
1135
1136
1137/*
1138 * UTIMES()
1139 */
1140/*
1141 * Async utimes(<path>)
1142 * Function returns
1143 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1144 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1145 *
1146 * When the callback is invoked, status indicates the result:
1147 * 0 : Success.
1148 * data is NULL
1149 * -errno : An error occured.
1150 * data is the error string.
1151 */
66ad6d84 1152EXTERN int nfs_utimes_async(struct nfs_context *nfs, const char *path, struct timeval *times, nfs_cb cb, void *private_data);
84004dbf
RS
1153/*
1154 * Sync utimes(<path>)
1155 * Function returns
1156 * 0 : The operation was successfull.
1157 * -errno : The command failed.
1158 */
66ad6d84 1159EXTERN int nfs_utimes(struct nfs_context *nfs, const char *path, struct timeval *times);
6505b539
RL
1160/*
1161 * Async utimes(<path>)
1162 *
1163 * Like utimes except if the destination is a symbolic link, it acts on the
1164 * symbolic link itself.
1165 *
1166 * Function returns
1167 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1168 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1169 *
1170 * When the callback is invoked, status indicates the result:
1171 * 0 : Success.
1172 * data is NULL
1173 * -errno : An error occured.
1174 * data is the error string.
1175 */
1176EXTERN int nfs_lutimes_async(struct nfs_context *nfs, const char *path, struct timeval *times, nfs_cb cb, void *private_data);
1177/*
1178 * Sync utimes(<path>)
1179 *
1180 * Like utimes except if the destination is a symbolic link, it acts on the
1181 * symbolic link itself.
1182 *
1183 * Function returns
1184 * 0 : The operation was successfull.
1185 * -errno : The command failed.
1186 */
1187EXTERN int nfs_lutimes(struct nfs_context *nfs, const char *path, struct timeval *times);
84004dbf
RS
1188
1189
1190/*
1191 * UTIME()
1192 */
1193/*
1194 * Async utime(<path>)
1195 * Function returns
1196 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1197 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1198 *
1199 * When the callback is invoked, status indicates the result:
1200 * 0 : Success.
1201 * data is NULL
1202 * -errno : An error occured.
1203 * data is the error string.
1204 */
1205struct utimbuf;
66ad6d84 1206EXTERN int nfs_utime_async(struct nfs_context *nfs, const char *path, struct utimbuf *times, nfs_cb cb, void *private_data);
84004dbf
RS
1207/*
1208 * Sync utime(<path>)
1209 * Function returns
1210 * 0 : The operation was successfull.
1211 * -errno : The command failed.
1212 */
66ad6d84 1213EXTERN int nfs_utime(struct nfs_context *nfs, const char *path, struct utimbuf *times);
84004dbf
RS
1214
1215
1216
1217
1218/*
1219 * ACCESS()
1220 */
1221/*
1222 * Async access(<path>)
1223 * Function returns
1224 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1225 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1226 *
1227 * When the callback is invoked, status indicates the result:
1228 * 0 : Success.
1229 * data is NULL
1230 * -errno : An error occured.
1231 * data is the error string.
1232 */
66ad6d84 1233EXTERN int nfs_access_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
84004dbf
RS
1234/*
1235 * Sync access(<path>)
1236 * Function returns
1237 * 0 : The operation was successfull.
1238 * -errno : The command failed.
1239 */
66ad6d84 1240EXTERN int nfs_access(struct nfs_context *nfs, const char *path, int mode);
84004dbf
RS
1241
1242
1243
1244
1245/*
1246 * SYMLINK()
1247 */
1248/*
1249 * Async symlink(<path>)
1250 * Function returns
1251 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1252 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1253 *
1254 * When the callback is invoked, status indicates the result:
1255 * 0 : Success.
1256 * data is NULL
1257 * -errno : An error occured.
1258 * data is the error string.
1259 */
66ad6d84 1260EXTERN int nfs_symlink_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
84004dbf
RS
1261/*
1262 * Sync symlink(<path>)
1263 * Function returns
1264 * 0 : The operation was successfull.
1265 * -errno : The command failed.
1266 */
66ad6d84 1267EXTERN int nfs_symlink(struct nfs_context *nfs, const char *oldpath, const char *newpath);
84004dbf
RS
1268
1269
1270/*
1271 * RENAME()
1272 */
1273/*
1274 * Async rename(<oldpath>, <newpath>)
1275 * Function returns
1276 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1277 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1278 *
1279 * When the callback is invoked, status indicates the result:
1280 * 0 : Success.
1281 * data is NULL
1282 * -errno : An error occured.
1283 * data is the error string.
1284 */
66ad6d84 1285EXTERN int nfs_rename_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
84004dbf
RS
1286/*
1287 * Sync rename(<oldpath>, <newpath>)
1288 * Function returns
1289 * 0 : The operation was successfull.
1290 * -errno : The command failed.
1291 */
66ad6d84 1292EXTERN int nfs_rename(struct nfs_context *nfs, const char *oldpath, const char *newpath);
84004dbf
RS
1293
1294
1295
1296/*
1297 * LINK()
1298 */
1299/*
1300 * Async link(<oldpath>, <newpath>)
1301 * Function returns
1302 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1303 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1304 *
1305 * When the callback is invoked, status indicates the result:
1306 * 0 : Success.
1307 * data is NULL
1308 * -errno : An error occured.
1309 * data is the error string.
1310 */
66ad6d84 1311EXTERN int nfs_link_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
84004dbf
RS
1312/*
1313 * Sync link(<oldpath>, <newpath>)
1314 * Function returns
1315 * 0 : The operation was successfull.
1316 * -errno : The command failed.
1317 */
66ad6d84 1318EXTERN int nfs_link(struct nfs_context *nfs, const char *oldpath, const char *newpath);
84004dbf
RS
1319
1320
7f0242ca
RS
1321/*
1322 * GETEXPORTS()
1323 */
1324/*
1325 * Async getexports()
1326 * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
1327 * returned structures.
1328 *
1329 * This function will return the list of exports from an NFS server.
1330 *
1331 * Function returns
1332 * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
1333 * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
1334 *
1335 * When the callback is invoked, status indicates the result:
1336 * 0 : Success.
1337 * data is a pointer to an exports pointer:
1338 * exports export = *(exports *)data;
1339 * -errno : An error occured.
1340 * data is the error string.
1341 */
66ad6d84 1342EXTERN int mount_getexports_async(struct rpc_context *rpc, const char *server, rpc_cb cb, void *private_data);
df5af25f
RS
1343/*
1344 * Sync getexports(<server>)
1345 * Function returns
1346 * NULL : something failed
1347 * exports export : a linked list of exported directories
52014ebf 1348 *
df5af25f
RS
1349 * returned data must be freed by calling mount_free_export_list(exportnode);
1350 */
66ad6d84 1351EXTERN struct exportnode *mount_getexports(const char *server);
7f0242ca 1352
66ad6d84 1353EXTERN void mount_free_export_list(struct exportnode *exports);
7f0242ca 1354
84004dbf
RS
1355
1356//qqq replace later with lseek(cur, 0)
183451cf 1357uint64_t nfs_get_current_offset(struct nfsfh *nfsfh);
552c7665
RS
1358
1359
1360
9c4212bf
RS
1361
1362
552c7665
RS
1363struct nfs_server_list {
1364 struct nfs_server_list *next;
1365 char *addr;
1366};
1367
9c4212bf
RS
1368/*
1369 * Sync find_local_servers(<server>)
1370 * This function will probe all local networks for NFS server. This function will
1371 * block for one second while awaiting for all nfs servers to respond.
1372 *
1373 * Function returns
1374 * NULL : something failed
1375 *
1376 * struct nfs_server_list : a linked list of all discovered servers
52014ebf 1377 *
9c4212bf
RS
1378 * returned data must be freed by nfs_free_srvr_list(srv);
1379 */
552c7665
RS
1380struct nfs_server_list *nfs_find_local_servers(void);
1381void free_nfs_srvr_list(struct nfs_server_list *srv);
52014ebf 1382
d48be00c
AR
1383#ifdef __cplusplus
1384}
1385#endif
1386
52014ebf 1387#endif /* !_LIBNFS_H_ */