| 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 lowlevel interface to access NFS resources. |
| 19 | * Through this interface you have access to the full gamut of nfs and nfs related |
| 20 | * protocol as well as the XDR encoded/decoded structures. |
| 21 | */ |
| 22 | #include <stdint.h> |
| 23 | #include <rpc/rpc.h> |
| 24 | #include <rpc/auth.h> |
| 25 | |
| 26 | struct rpc_data { |
| 27 | int size; |
| 28 | unsigned char *data; |
| 29 | }; |
| 30 | |
| 31 | struct rpc_context; |
| 32 | struct rpc_context *rpc_init_context(void); |
| 33 | void rpc_destroy_context(struct rpc_context *rpc); |
| 34 | |
| 35 | void rpc_set_auth(struct rpc_context *rpc, AUTH *auth); |
| 36 | |
| 37 | int rpc_get_fd(struct rpc_context *rpc); |
| 38 | int rpc_which_events(struct rpc_context *rpc); |
| 39 | int rpc_service(struct rpc_context *rpc, int revents); |
| 40 | char *rpc_get_error(struct rpc_context *rpc); |
| 41 | int rpc_queue_length(struct rpc_context *rpc); |
| 42 | |
| 43 | |
| 44 | #define RPC_STATUS_SUCCESS 0 |
| 45 | #define RPC_STATUS_ERROR 1 |
| 46 | #define RPC_STATUS_CANCEL 2 |
| 47 | |
| 48 | /* |
| 49 | * Async connection to the tcp port at server:port. |
| 50 | * Function returns |
| 51 | * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked. |
| 52 | * <0 : An error occured when trying to set up the connection. The callback will not be invoked. |
| 53 | * |
| 54 | * When the callback is invoked, status indicates the result: |
| 55 | * RPC_STATUS_SUCCESS : The tcp connection was successfully established. |
| 56 | * data is NULL. |
| 57 | * RPC_STATUS_ERROR : The connection failed to establish. |
| 58 | * data is the erro string. |
| 59 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 60 | * : data is NULL. |
| 61 | */ |
| 62 | int rpc_connect_async(struct rpc_context *rpc, const char *server, int port, rpc_cb cb, void *private_data); |
| 63 | /* |
| 64 | * When disconnecting a connection in flight. All commands in flight will be called with the callback |
| 65 | * and status RPC_STATUS_ERROR. Data will be the error string for the disconnection. |
| 66 | */ |
| 67 | int rpc_disconnect(struct rpc_context *rpc, char *error); |
| 68 | |
| 69 | |
| 70 | /* |
| 71 | * PORTMAP FUNCTIONS |
| 72 | */ |
| 73 | |
| 74 | /* |
| 75 | * Call PORTMAPPER/NULL |
| 76 | * Function returns |
| 77 | * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked. |
| 78 | * <0 : An error occured when trying to set up the connection. The callback will not be invoked. |
| 79 | * |
| 80 | * When the callback is invoked, status indicates the result: |
| 81 | * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon. |
| 82 | * data is NULL. |
| 83 | * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper. |
| 84 | * data is the error string. |
| 85 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 86 | * data is NULL. |
| 87 | */ |
| 88 | int rpc_pmap_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); |
| 89 | |
| 90 | |
| 91 | /* |
| 92 | * Call PORTMAPPER/GETPORT. |
| 93 | * Function returns |
| 94 | * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked. |
| 95 | * <0 : An error occured when trying to set up the connection. The callback will not be invoked. |
| 96 | * |
| 97 | * When the callback is invoked, status indicates the result: |
| 98 | * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon. |
| 99 | * data is a (uint32_t *), containing the port returned. |
| 100 | * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper. |
| 101 | * data is the error string. |
| 102 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 103 | * data is NULL. |
| 104 | */ |
| 105 | int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, rpc_cb cb, void *private_data); |
| 106 | |
| 107 | |
| 108 | /* |
| 109 | * Call PORTMAPPER/CALLIT. |
| 110 | * Function returns |
| 111 | * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked. |
| 112 | * <0 : An error occured when trying to set up the connection. The callback will not be invoked. |
| 113 | * |
| 114 | * When the callback is invoked, status indicates the result: |
| 115 | * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon |
| 116 | * data is a 'pmap_call_result' pointer. |
| 117 | * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper. |
| 118 | * data is the error string. |
| 119 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 120 | * data is NULL. |
| 121 | */ |
| 122 | int rpc_pmap_callit_async(struct rpc_context *rpc, int program, int version, int procedure, const char *data, int datalen, rpc_cb cb, void *private_data); |
| 123 | |
| 124 | /* |
| 125 | * MOUNT FUNCTIONS |
| 126 | */ |
| 127 | char *mountstat3_to_str(int stat); |
| 128 | int mountstat3_to_errno(int error); |
| 129 | |
| 130 | /* |
| 131 | * Call MOUNT/NULL |
| 132 | * Function returns |
| 133 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 134 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 135 | * |
| 136 | * When the callback is invoked, status indicates the result: |
| 137 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. |
| 138 | * data is NULL. |
| 139 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. |
| 140 | * data is the error string. |
| 141 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 142 | * data is NULL. |
| 143 | */ |
| 144 | int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); |
| 145 | |
| 146 | /* |
| 147 | * Call MOUNT/MNT |
| 148 | * Function returns |
| 149 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 150 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 151 | * |
| 152 | * When the callback is invoked, status indicates the result: |
| 153 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. |
| 154 | * data is union mountres3. |
| 155 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. |
| 156 | * data is the error string. |
| 157 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 158 | * data is NULL. |
| 159 | */ |
| 160 | int rpc_mount_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data); |
| 161 | |
| 162 | /* |
| 163 | * Call MOUNT/DUMP |
| 164 | * Function returns |
| 165 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 166 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 167 | * |
| 168 | * When the callback is invoked, status indicates the result: |
| 169 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. |
| 170 | * data is a mountlist. |
| 171 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. |
| 172 | * data is the error string. |
| 173 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 174 | * data is NULL. |
| 175 | */ |
| 176 | int rpc_mount_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); |
| 177 | |
| 178 | /* |
| 179 | * Call MOUNT/UMNT |
| 180 | * Function returns |
| 181 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 182 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 183 | * |
| 184 | * When the callback is invoked, status indicates the result: |
| 185 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. |
| 186 | * data NULL. |
| 187 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. |
| 188 | * data is the error string. |
| 189 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 190 | * data is NULL. |
| 191 | */ |
| 192 | int rpc_mount_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data); |
| 193 | |
| 194 | /* |
| 195 | * Call MOUNT/UMNTALL |
| 196 | * Function returns |
| 197 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 198 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 199 | * |
| 200 | * When the callback is invoked, status indicates the result: |
| 201 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. |
| 202 | * data NULL. |
| 203 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. |
| 204 | * data is the error string. |
| 205 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 206 | * data is NULL. |
| 207 | */ |
| 208 | int rpc_mount_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); |
| 209 | |
| 210 | /* |
| 211 | * Call MOUNT/EXPORT |
| 212 | * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the |
| 213 | * returned structures. |
| 214 | * |
| 215 | * Function returns |
| 216 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 217 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 218 | * |
| 219 | * When the callback is invoked, status indicates the result: |
| 220 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. |
| 221 | * data is a pointer to an exports pointer: |
| 222 | * exports export = *(exports *)data; |
| 223 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. |
| 224 | * data is the error string. |
| 225 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 226 | * data is NULL. |
| 227 | */ |
| 228 | int rpc_mount_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | /* |
| 234 | * NFS FUNCTIONS |
| 235 | */ |
| 236 | struct nfs_fh3; |
| 237 | char *nfsstat3_to_str(int error); |
| 238 | int nfsstat3_to_errno(int error); |
| 239 | |
| 240 | /* |
| 241 | * Call NFS/NULL |
| 242 | * Function returns |
| 243 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 244 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 245 | * |
| 246 | * When the callback is invoked, status indicates the result: |
| 247 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 248 | * data is NULL. |
| 249 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 250 | * data is the error string. |
| 251 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 252 | * data is NULL. |
| 253 | */ |
| 254 | int rpc_nfs_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); |
| 255 | |
| 256 | /* |
| 257 | * Call NFS/GETATTR |
| 258 | * Function returns |
| 259 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 260 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 261 | * |
| 262 | * When the callback is invoked, status indicates the result: |
| 263 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 264 | * data is GETATTR3res |
| 265 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 266 | * data is the error string. |
| 267 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 268 | * data is NULL. |
| 269 | */ |
| 270 | int rpc_nfs_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data); |
| 271 | |
| 272 | /* |
| 273 | * Call NFS/LOOKUP |
| 274 | * Function returns |
| 275 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 276 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 277 | * |
| 278 | * When the callback is invoked, status indicates the result: |
| 279 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 280 | * data is LOOKUP3res |
| 281 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 282 | * data is the error string. |
| 283 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 284 | * data is NULL. |
| 285 | */ |
| 286 | int rpc_nfs_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data); |
| 287 | |
| 288 | /* |
| 289 | * Call NFS/ACCESS |
| 290 | * Function returns |
| 291 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 292 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 293 | * |
| 294 | * When the callback is invoked, status indicates the result: |
| 295 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 296 | * data is ACCESS3res |
| 297 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 298 | * data is the error string. |
| 299 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 300 | * data is NULL. |
| 301 | */ |
| 302 | int rpc_nfs_access_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, int access, void *private_data); |
| 303 | |
| 304 | /* |
| 305 | * Call NFS/READ |
| 306 | * Function returns |
| 307 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 308 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 309 | * |
| 310 | * When the callback is invoked, status indicates the result: |
| 311 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 312 | * data is ACCESS3res |
| 313 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 314 | * data is the error string. |
| 315 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 316 | * data is NULL. |
| 317 | */ |
| 318 | int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t offset, uint64_t count, void *private_data); |
| 319 | |
| 320 | /* |
| 321 | * Call NFS/WRITE |
| 322 | * Function returns |
| 323 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 324 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 325 | * |
| 326 | * When the callback is invoked, status indicates the result: |
| 327 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 328 | * data is WRITE3res * |
| 329 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 330 | * data is the error string. |
| 331 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 332 | * data is NULL. |
| 333 | */ |
| 334 | int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, uint64_t offset, uint64_t count, int stable_how, void *private_data); |
| 335 | |
| 336 | /* |
| 337 | * Call NFS/COMMIT |
| 338 | * Function returns |
| 339 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 340 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 341 | * |
| 342 | * When the callback is invoked, status indicates the result: |
| 343 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 344 | * data is COMMIT3res * |
| 345 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 346 | * data is the error string. |
| 347 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 348 | * data is NULL. |
| 349 | */ |
| 350 | int rpc_nfs_commit_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data); |
| 351 | |
| 352 | |
| 353 | /* |
| 354 | * Call NFS/SETATTR |
| 355 | * Function returns |
| 356 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 357 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 358 | * |
| 359 | * When the callback is invoked, status indicates the result: |
| 360 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 361 | * data is SETATTR3res * |
| 362 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 363 | * data is the error string. |
| 364 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 365 | * data is NULL. |
| 366 | */ |
| 367 | struct SETATTR3args; |
| 368 | int rpc_nfs_setattr_async(struct rpc_context *rpc, rpc_cb cb, struct SETATTR3args *args, void *private_data); |
| 369 | |
| 370 | |
| 371 | |
| 372 | /* |
| 373 | * Call NFS/MKDIR |
| 374 | * Function returns |
| 375 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 376 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 377 | * |
| 378 | * When the callback is invoked, status indicates the result: |
| 379 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 380 | * data is MKDIR3res * |
| 381 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 382 | * data is the error string. |
| 383 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 384 | * data is NULL. |
| 385 | */ |
| 386 | int rpc_nfs_mkdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *dir, void *private_data); |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | /* |
| 393 | * Call NFS/RMDIR |
| 394 | * Function returns |
| 395 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 396 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 397 | * |
| 398 | * When the callback is invoked, status indicates the result: |
| 399 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 400 | * data is RMDIR3res * |
| 401 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 402 | * data is the error string. |
| 403 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 404 | * data is NULL. |
| 405 | */ |
| 406 | int rpc_nfs_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *dir, void *private_data); |
| 407 | |
| 408 | |
| 409 | |
| 410 | |
| 411 | /* |
| 412 | * Call NFS/CREATE |
| 413 | * Function returns |
| 414 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 415 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 416 | * |
| 417 | * When the callback is invoked, status indicates the result: |
| 418 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 419 | * data is CREATE3res * |
| 420 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 421 | * data is the error string. |
| 422 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 423 | * data is NULL. |
| 424 | */ |
| 425 | int rpc_nfs_create_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, int mode, void *private_data); |
| 426 | |
| 427 | |
| 428 | /* |
| 429 | * Call NFS/MKNOD |
| 430 | * Function returns |
| 431 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 432 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 433 | * |
| 434 | * When the callback is invoked, status indicates the result: |
| 435 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 436 | * data is MKNOD3res * |
| 437 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 438 | * data is the error string. |
| 439 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 440 | * data is NULL. |
| 441 | */ |
| 442 | int rpc_nfs_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *file, int mode, int major, int minor, void *private_data); |
| 443 | |
| 444 | |
| 445 | /* |
| 446 | * Call NFS/REMOVE |
| 447 | * Function returns |
| 448 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 449 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 450 | * |
| 451 | * When the callback is invoked, status indicates the result: |
| 452 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 453 | * data is REMOVE3res * |
| 454 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 455 | * data is the error string. |
| 456 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 457 | * data is NULL. |
| 458 | */ |
| 459 | int rpc_nfs_remove_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data); |
| 460 | |
| 461 | |
| 462 | |
| 463 | /* |
| 464 | * Call NFS/READDIR |
| 465 | * Function returns |
| 466 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 467 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 468 | * |
| 469 | * When the callback is invoked, status indicates the result: |
| 470 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 471 | * data is READDIR3res * |
| 472 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 473 | * data is the error string. |
| 474 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 475 | * data is NULL. |
| 476 | */ |
| 477 | int rpc_nfs_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data); |
| 478 | |
| 479 | /* |
| 480 | * Call NFS/READDIRPLUS |
| 481 | * Function returns |
| 482 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 483 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 484 | * |
| 485 | * When the callback is invoked, status indicates the result: |
| 486 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 487 | * data is READDIRPLUS3res * |
| 488 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 489 | * data is the error string. |
| 490 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 491 | * data is NULL. |
| 492 | */ |
| 493 | int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data); |
| 494 | |
| 495 | /* |
| 496 | * Call NFS/FSSTAT |
| 497 | * Function returns |
| 498 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 499 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 500 | * |
| 501 | * When the callback is invoked, status indicates the result: |
| 502 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 503 | * data is FSSTAT3res |
| 504 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 505 | * data is the error string. |
| 506 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 507 | * data is NULL. |
| 508 | */ |
| 509 | int rpc_nfs_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data); |
| 510 | |
| 511 | |
| 512 | |
| 513 | /* |
| 514 | * Call NFS/FSINFO |
| 515 | * Function returns |
| 516 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 517 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 518 | * |
| 519 | * When the callback is invoked, status indicates the result: |
| 520 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 521 | * data is FSINFO3res |
| 522 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 523 | * data is the error string. |
| 524 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 525 | * data is NULL. |
| 526 | */ |
| 527 | int rpc_nfs_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data); |
| 528 | |
| 529 | |
| 530 | |
| 531 | /* |
| 532 | * Call NFS/READLINK |
| 533 | * Function returns |
| 534 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 535 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 536 | * |
| 537 | * When the callback is invoked, status indicates the result: |
| 538 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 539 | * data is READLINK3res * |
| 540 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 541 | * data is the error string. |
| 542 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 543 | * data is NULL. |
| 544 | */ |
| 545 | int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data); |
| 546 | |
| 547 | |
| 548 | |
| 549 | /* |
| 550 | * Call NFS/SYMLINK |
| 551 | * Function returns |
| 552 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 553 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 554 | * |
| 555 | * When the callback is invoked, status indicates the result: |
| 556 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 557 | * data is SYMLINK3res * |
| 558 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 559 | * data is the error string. |
| 560 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 561 | * data is NULL. |
| 562 | */ |
| 563 | int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *newname, char *oldpath, void *private_data); |
| 564 | |
| 565 | |
| 566 | /* |
| 567 | * Call NFS/RENAME |
| 568 | * Function returns |
| 569 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 570 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 571 | * |
| 572 | * When the callback is invoked, status indicates the result: |
| 573 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 574 | * data is RENAME3res * |
| 575 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 576 | * data is the error string. |
| 577 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 578 | * data is NULL. |
| 579 | */ |
| 580 | int rpc_nfs_rename_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *olddir, char *oldname, struct nfs_fh3 *newdir, char *newname, void *private_data); |
| 581 | |
| 582 | |
| 583 | |
| 584 | /* |
| 585 | * Call NFS/LINK |
| 586 | * Function returns |
| 587 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 588 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 589 | * |
| 590 | * When the callback is invoked, status indicates the result: |
| 591 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
| 592 | * data is LINK3res * |
| 593 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
| 594 | * data is the error string. |
| 595 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 596 | * data is NULL. |
| 597 | */ |
| 598 | int rpc_nfs_link_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *file, struct nfs_fh3 *newdir, char *newname, void *private_data); |
| 599 | |
| 600 | |
| 601 | |
| 602 | |
| 603 | /* |
| 604 | * RQUOTA FUNCTIONS |
| 605 | */ |
| 606 | char *rquotastat_to_str(int error); |
| 607 | int rquotastat_to_errno(int error); |
| 608 | |
| 609 | /* |
| 610 | * Call RQUOTA1/NULL |
| 611 | * Function returns |
| 612 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 613 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 614 | * |
| 615 | * When the callback is invoked, status indicates the result: |
| 616 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. |
| 617 | * data is NULL. |
| 618 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. |
| 619 | * data is the error string. |
| 620 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 621 | * data is NULL. |
| 622 | */ |
| 623 | int rpc_rquota1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); |
| 624 | |
| 625 | /* |
| 626 | * Call RQUOTA1/GETQUOTA |
| 627 | * Function returns |
| 628 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 629 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 630 | * |
| 631 | * When the callback is invoked, status indicates the result: |
| 632 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. |
| 633 | * data is a RQUOTA1res structure. |
| 634 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. |
| 635 | * data is the error string. |
| 636 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 637 | * data is NULL. |
| 638 | */ |
| 639 | int rpc_rquota1_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data); |
| 640 | |
| 641 | /* |
| 642 | * Call RQUOTA1/GETACTIVEQUOTA |
| 643 | * Function returns |
| 644 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 645 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 646 | * |
| 647 | * When the callback is invoked, status indicates the result: |
| 648 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. |
| 649 | * data is a RQUOTA1res structure. |
| 650 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. |
| 651 | * data is the error string. |
| 652 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 653 | * data is NULL. |
| 654 | */ |
| 655 | int rpc_rquota1_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data); |
| 656 | |
| 657 | |
| 658 | |
| 659 | |
| 660 | /* |
| 661 | * Call RQUOTA2/NULL |
| 662 | * Function returns |
| 663 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 664 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 665 | * |
| 666 | * When the callback is invoked, status indicates the result: |
| 667 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. |
| 668 | * data is NULL. |
| 669 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. |
| 670 | * data is the error string. |
| 671 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 672 | * data is NULL. |
| 673 | */ |
| 674 | int rpc_rquota2_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); |
| 675 | |
| 676 | /* |
| 677 | * Call RQUOTA2/GETQUOTA |
| 678 | * Function returns |
| 679 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 680 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 681 | * |
| 682 | * When the callback is invoked, status indicates the result: |
| 683 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. |
| 684 | * data is a RQUOTA1res structure. |
| 685 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. |
| 686 | * data is the error string. |
| 687 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 688 | * data is NULL. |
| 689 | */ |
| 690 | int rpc_rquota2_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int type, int uid, void *private_data); |
| 691 | |
| 692 | /* |
| 693 | * Call RQUOTA2/GETACTIVEQUOTA |
| 694 | * Function returns |
| 695 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 696 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 697 | * |
| 698 | * When the callback is invoked, status indicates the result: |
| 699 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. |
| 700 | * data is a RQUOTA1res structure. |
| 701 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. |
| 702 | * data is the error string. |
| 703 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 704 | * data is NULL. |
| 705 | */ |
| 706 | int rpc_rquota2_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int type, int uid, void *private_data); |
| 707 | |
| 708 | |
| 709 | |
| 710 | /* |
| 711 | * Call NFSACL/NULL |
| 712 | * Call the NULL procedure for the NFSACL |
| 713 | * |
| 714 | * Function returns |
| 715 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 716 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 717 | * |
| 718 | * When the callback is invoked, status indicates the result: |
| 719 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. |
| 720 | * data is NULL |
| 721 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. |
| 722 | * data is the error string. |
| 723 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 724 | * data is NULL. |
| 725 | */ |
| 726 | int rpc_nfsacl_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); |
| 727 | |
| 728 | /* |
| 729 | * Call NFSACL/GETACL |
| 730 | * |
| 731 | * Function returns |
| 732 | * 0 : The call was initiated. The callback will be invoked when the call completes. |
| 733 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. |
| 734 | * |
| 735 | * When the callback is invoked, status indicates the result: |
| 736 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. |
| 737 | * data is a GETACL3res pointer |
| 738 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. |
| 739 | * data is the error string. |
| 740 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. |
| 741 | * data is NULL. |
| 742 | */ |
| 743 | int rpc_nfsacl_getacl_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint32_t mask, void *private_data); |
| 744 | |