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