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