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