1 // SPDX-License-Identifier: GPL-2.0 2 // Generated by xdrgen. Manual edits will be lost. 3 // XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x 4 // XDR specification modification time: Thu Jan 8 23:12:07 2026 5 6 #include <linux/sunrpc/svc.h> 7 8 #include "nfs4xdr_gen.h" 9 10 static bool __maybe_unused 11 xdrgen_decode_int64_t(struct xdr_stream *xdr, int64_t *ptr) 12 { 13 return xdrgen_decode_hyper(xdr, ptr); 14 } 15 16 static bool __maybe_unused 17 xdrgen_decode_uint32_t(struct xdr_stream *xdr, uint32_t *ptr) 18 { 19 return xdrgen_decode_unsigned_int(xdr, ptr); 20 } 21 22 static bool __maybe_unused 23 xdrgen_decode_bitmap4(struct xdr_stream *xdr, bitmap4 *ptr) 24 { 25 if (xdr_stream_decode_u32(xdr, &ptr->count) < 0) 26 return false; 27 for (u32 i = 0; i < ptr->count; i++) 28 if (!xdrgen_decode_uint32_t(xdr, &ptr->element[i])) 29 return false; 30 return true; 31 } 32 33 static bool __maybe_unused 34 xdrgen_decode_utf8string(struct xdr_stream *xdr, utf8string *ptr) 35 { 36 return xdrgen_decode_opaque(xdr, ptr, 0); 37 } 38 39 static bool __maybe_unused 40 xdrgen_decode_utf8str_cis(struct xdr_stream *xdr, utf8str_cis *ptr) 41 { 42 return xdrgen_decode_utf8string(xdr, ptr); 43 } 44 45 static bool __maybe_unused 46 xdrgen_decode_utf8str_cs(struct xdr_stream *xdr, utf8str_cs *ptr) 47 { 48 return xdrgen_decode_utf8string(xdr, ptr); 49 } 50 51 static bool __maybe_unused 52 xdrgen_decode_utf8str_mixed(struct xdr_stream *xdr, utf8str_mixed *ptr) 53 { 54 return xdrgen_decode_utf8string(xdr, ptr); 55 } 56 57 static bool __maybe_unused 58 xdrgen_decode_nfstime4(struct xdr_stream *xdr, struct nfstime4 *ptr) 59 { 60 if (!xdrgen_decode_int64_t(xdr, &ptr->seconds)) 61 return false; 62 if (!xdrgen_decode_uint32_t(xdr, &ptr->nseconds)) 63 return false; 64 return true; 65 } 66 67 static bool __maybe_unused 68 xdrgen_decode_fattr4_offline(struct xdr_stream *xdr, fattr4_offline *ptr) 69 { 70 return xdrgen_decode_bool(xdr, ptr); 71 } 72 73 static bool __maybe_unused 74 xdrgen_decode_open_arguments4(struct xdr_stream *xdr, struct open_arguments4 *ptr) 75 { 76 if (!xdrgen_decode_bitmap4(xdr, &ptr->oa_share_access)) 77 return false; 78 if (!xdrgen_decode_bitmap4(xdr, &ptr->oa_share_deny)) 79 return false; 80 if (!xdrgen_decode_bitmap4(xdr, &ptr->oa_share_access_want)) 81 return false; 82 if (!xdrgen_decode_bitmap4(xdr, &ptr->oa_open_claim)) 83 return false; 84 if (!xdrgen_decode_bitmap4(xdr, &ptr->oa_create_mode)) 85 return false; 86 return true; 87 } 88 89 static bool __maybe_unused 90 xdrgen_decode_open_args_share_access4(struct xdr_stream *xdr, open_args_share_access4 *ptr) 91 { 92 u32 val; 93 94 if (xdr_stream_decode_u32(xdr, &val) < 0) 95 return false; 96 /* Compiler may optimize to a range check for dense enums */ 97 switch (val) { 98 case OPEN_ARGS_SHARE_ACCESS_READ: 99 case OPEN_ARGS_SHARE_ACCESS_WRITE: 100 case OPEN_ARGS_SHARE_ACCESS_BOTH: 101 break; 102 default: 103 return false; 104 } 105 *ptr = val; 106 return true; 107 } 108 109 static bool __maybe_unused 110 xdrgen_decode_open_args_share_deny4(struct xdr_stream *xdr, open_args_share_deny4 *ptr) 111 { 112 u32 val; 113 114 if (xdr_stream_decode_u32(xdr, &val) < 0) 115 return false; 116 /* Compiler may optimize to a range check for dense enums */ 117 switch (val) { 118 case OPEN_ARGS_SHARE_DENY_NONE: 119 case OPEN_ARGS_SHARE_DENY_READ: 120 case OPEN_ARGS_SHARE_DENY_WRITE: 121 case OPEN_ARGS_SHARE_DENY_BOTH: 122 break; 123 default: 124 return false; 125 } 126 *ptr = val; 127 return true; 128 } 129 130 static bool __maybe_unused 131 xdrgen_decode_open_args_share_access_want4(struct xdr_stream *xdr, open_args_share_access_want4 *ptr) 132 { 133 u32 val; 134 135 if (xdr_stream_decode_u32(xdr, &val) < 0) 136 return false; 137 /* Compiler may optimize to a range check for dense enums */ 138 switch (val) { 139 case OPEN_ARGS_SHARE_ACCESS_WANT_ANY_DELEG: 140 case OPEN_ARGS_SHARE_ACCESS_WANT_NO_DELEG: 141 case OPEN_ARGS_SHARE_ACCESS_WANT_CANCEL: 142 case OPEN_ARGS_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL: 143 case OPEN_ARGS_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED: 144 case OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS: 145 case OPEN_ARGS_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION: 146 break; 147 default: 148 return false; 149 } 150 *ptr = val; 151 return true; 152 } 153 154 static bool __maybe_unused 155 xdrgen_decode_open_args_open_claim4(struct xdr_stream *xdr, open_args_open_claim4 *ptr) 156 { 157 u32 val; 158 159 if (xdr_stream_decode_u32(xdr, &val) < 0) 160 return false; 161 /* Compiler may optimize to a range check for dense enums */ 162 switch (val) { 163 case OPEN_ARGS_OPEN_CLAIM_NULL: 164 case OPEN_ARGS_OPEN_CLAIM_PREVIOUS: 165 case OPEN_ARGS_OPEN_CLAIM_DELEGATE_CUR: 166 case OPEN_ARGS_OPEN_CLAIM_DELEGATE_PREV: 167 case OPEN_ARGS_OPEN_CLAIM_FH: 168 case OPEN_ARGS_OPEN_CLAIM_DELEG_CUR_FH: 169 case OPEN_ARGS_OPEN_CLAIM_DELEG_PREV_FH: 170 break; 171 default: 172 return false; 173 } 174 *ptr = val; 175 return true; 176 } 177 178 static bool __maybe_unused 179 xdrgen_decode_open_args_createmode4(struct xdr_stream *xdr, open_args_createmode4 *ptr) 180 { 181 u32 val; 182 183 if (xdr_stream_decode_u32(xdr, &val) < 0) 184 return false; 185 /* Compiler may optimize to a range check for dense enums */ 186 switch (val) { 187 case OPEN_ARGS_CREATEMODE_UNCHECKED4: 188 case OPEN_ARGS_CREATE_MODE_GUARDED: 189 case OPEN_ARGS_CREATEMODE_EXCLUSIVE4: 190 case OPEN_ARGS_CREATE_MODE_EXCLUSIVE4_1: 191 break; 192 default: 193 return false; 194 } 195 *ptr = val; 196 return true; 197 } 198 199 bool 200 xdrgen_decode_fattr4_open_arguments(struct xdr_stream *xdr, fattr4_open_arguments *ptr) 201 { 202 return xdrgen_decode_open_arguments4(xdr, ptr); 203 } 204 205 /* 206 * Determine what OPEN supports. 207 */ 208 209 bool 210 xdrgen_decode_fattr4_time_deleg_access(struct xdr_stream *xdr, fattr4_time_deleg_access *ptr) 211 { 212 return xdrgen_decode_nfstime4(xdr, ptr); 213 } 214 215 bool 216 xdrgen_decode_fattr4_time_deleg_modify(struct xdr_stream *xdr, fattr4_time_deleg_modify *ptr) 217 { 218 return xdrgen_decode_nfstime4(xdr, ptr); 219 } 220 221 /* 222 * New RECOMMENDED Attribute for 223 * delegation caching of times 224 */ 225 226 static bool __maybe_unused 227 xdrgen_decode_open_delegation_type4(struct xdr_stream *xdr, open_delegation_type4 *ptr) 228 { 229 u32 val; 230 231 if (xdr_stream_decode_u32(xdr, &val) < 0) 232 return false; 233 /* Compiler may optimize to a range check for dense enums */ 234 switch (val) { 235 case OPEN_DELEGATE_NONE: 236 case OPEN_DELEGATE_READ: 237 case OPEN_DELEGATE_WRITE: 238 case OPEN_DELEGATE_NONE_EXT: 239 case OPEN_DELEGATE_READ_ATTRS_DELEG: 240 case OPEN_DELEGATE_WRITE_ATTRS_DELEG: 241 break; 242 default: 243 return false; 244 } 245 *ptr = val; 246 return true; 247 } 248 249 bool 250 xdrgen_decode_aclmodel4(struct xdr_stream *xdr, aclmodel4 *ptr) 251 { 252 u32 val; 253 254 if (xdr_stream_decode_u32(xdr, &val) < 0) 255 return false; 256 /* Compiler may optimize to a range check for dense enums */ 257 switch (val) { 258 case ACL_MODEL_NFS4: 259 case ACL_MODEL_POSIX_DRAFT: 260 case ACL_MODEL_NONE: 261 break; 262 default: 263 return false; 264 } 265 *ptr = val; 266 return true; 267 } 268 269 bool 270 xdrgen_decode_aclscope4(struct xdr_stream *xdr, aclscope4 *ptr) 271 { 272 u32 val; 273 274 if (xdr_stream_decode_u32(xdr, &val) < 0) 275 return false; 276 /* Compiler may optimize to a range check for dense enums */ 277 switch (val) { 278 case ACL_SCOPE_FILE_OBJECT: 279 case ACL_SCOPE_FILE_SYSTEM: 280 case ACL_SCOPE_SERVER: 281 break; 282 default: 283 return false; 284 } 285 *ptr = val; 286 return true; 287 } 288 289 bool 290 xdrgen_decode_posixacetag4(struct xdr_stream *xdr, posixacetag4 *ptr) 291 { 292 u32 val; 293 294 if (xdr_stream_decode_u32(xdr, &val) < 0) 295 return false; 296 /* Compiler may optimize to a range check for dense enums */ 297 switch (val) { 298 case POSIXACE4_TAG_USER_OBJ: 299 case POSIXACE4_TAG_USER: 300 case POSIXACE4_TAG_GROUP_OBJ: 301 case POSIXACE4_TAG_GROUP: 302 case POSIXACE4_TAG_MASK: 303 case POSIXACE4_TAG_OTHER: 304 break; 305 default: 306 return false; 307 } 308 *ptr = val; 309 return true; 310 } 311 312 bool 313 xdrgen_decode_posixaceperm4(struct xdr_stream *xdr, posixaceperm4 *ptr) 314 { 315 return xdrgen_decode_uint32_t(xdr, ptr); 316 } 317 318 static bool __maybe_unused 319 xdrgen_decode_posixace4(struct xdr_stream *xdr, struct posixace4 *ptr) 320 { 321 if (!xdrgen_decode_posixacetag4(xdr, &ptr->tag)) 322 return false; 323 if (!xdrgen_decode_posixaceperm4(xdr, &ptr->perm)) 324 return false; 325 if (!xdrgen_decode_utf8str_mixed(xdr, &ptr->who)) 326 return false; 327 return true; 328 } 329 330 static bool __maybe_unused 331 xdrgen_decode_fattr4_acl_trueform(struct xdr_stream *xdr, fattr4_acl_trueform *ptr) 332 { 333 return xdrgen_decode_aclmodel4(xdr, ptr); 334 } 335 336 static bool __maybe_unused 337 xdrgen_decode_fattr4_acl_trueform_scope(struct xdr_stream *xdr, fattr4_acl_trueform_scope *ptr) 338 { 339 return xdrgen_decode_aclscope4(xdr, ptr); 340 } 341 342 static bool __maybe_unused 343 xdrgen_decode_fattr4_posix_default_acl(struct xdr_stream *xdr, fattr4_posix_default_acl *ptr) 344 { 345 if (xdr_stream_decode_u32(xdr, &ptr->count) < 0) 346 return false; 347 for (u32 i = 0; i < ptr->count; i++) 348 if (!xdrgen_decode_posixace4(xdr, &ptr->element[i])) 349 return false; 350 return true; 351 } 352 353 static bool __maybe_unused 354 xdrgen_decode_fattr4_posix_access_acl(struct xdr_stream *xdr, fattr4_posix_access_acl *ptr) 355 { 356 if (xdr_stream_decode_u32(xdr, &ptr->count) < 0) 357 return false; 358 for (u32 i = 0; i < ptr->count; i++) 359 if (!xdrgen_decode_posixace4(xdr, &ptr->element[i])) 360 return false; 361 return true; 362 } 363 364 /* 365 * New for POSIX ACL extension 366 */ 367 368 static bool __maybe_unused 369 xdrgen_encode_int64_t(struct xdr_stream *xdr, const int64_t value) 370 { 371 return xdrgen_encode_hyper(xdr, value); 372 } 373 374 static bool __maybe_unused 375 xdrgen_encode_uint32_t(struct xdr_stream *xdr, const uint32_t value) 376 { 377 return xdrgen_encode_unsigned_int(xdr, value); 378 } 379 380 static bool __maybe_unused 381 xdrgen_encode_bitmap4(struct xdr_stream *xdr, const bitmap4 value) 382 { 383 if (xdr_stream_encode_u32(xdr, value.count) != XDR_UNIT) 384 return false; 385 for (u32 i = 0; i < value.count; i++) 386 if (!xdrgen_encode_uint32_t(xdr, value.element[i])) 387 return false; 388 return true; 389 } 390 391 static bool __maybe_unused 392 xdrgen_encode_utf8string(struct xdr_stream *xdr, const utf8string value) 393 { 394 return xdr_stream_encode_opaque(xdr, value.data, value.len) >= 0; 395 } 396 397 static bool __maybe_unused 398 xdrgen_encode_utf8str_cis(struct xdr_stream *xdr, const utf8str_cis value) 399 { 400 return xdrgen_encode_utf8string(xdr, value); 401 } 402 403 static bool __maybe_unused 404 xdrgen_encode_utf8str_cs(struct xdr_stream *xdr, const utf8str_cs value) 405 { 406 return xdrgen_encode_utf8string(xdr, value); 407 } 408 409 static bool __maybe_unused 410 xdrgen_encode_utf8str_mixed(struct xdr_stream *xdr, const utf8str_mixed value) 411 { 412 return xdrgen_encode_utf8string(xdr, value); 413 } 414 415 static bool __maybe_unused 416 xdrgen_encode_nfstime4(struct xdr_stream *xdr, const struct nfstime4 *value) 417 { 418 if (!xdrgen_encode_int64_t(xdr, value->seconds)) 419 return false; 420 if (!xdrgen_encode_uint32_t(xdr, value->nseconds)) 421 return false; 422 return true; 423 } 424 425 static bool __maybe_unused 426 xdrgen_encode_fattr4_offline(struct xdr_stream *xdr, const fattr4_offline value) 427 { 428 return xdrgen_encode_bool(xdr, value); 429 } 430 431 static bool __maybe_unused 432 xdrgen_encode_open_arguments4(struct xdr_stream *xdr, const struct open_arguments4 *value) 433 { 434 if (!xdrgen_encode_bitmap4(xdr, value->oa_share_access)) 435 return false; 436 if (!xdrgen_encode_bitmap4(xdr, value->oa_share_deny)) 437 return false; 438 if (!xdrgen_encode_bitmap4(xdr, value->oa_share_access_want)) 439 return false; 440 if (!xdrgen_encode_bitmap4(xdr, value->oa_open_claim)) 441 return false; 442 if (!xdrgen_encode_bitmap4(xdr, value->oa_create_mode)) 443 return false; 444 return true; 445 } 446 447 static bool __maybe_unused 448 xdrgen_encode_open_args_share_access4(struct xdr_stream *xdr, open_args_share_access4 value) 449 { 450 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 451 } 452 453 static bool __maybe_unused 454 xdrgen_encode_open_args_share_deny4(struct xdr_stream *xdr, open_args_share_deny4 value) 455 { 456 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 457 } 458 459 static bool __maybe_unused 460 xdrgen_encode_open_args_share_access_want4(struct xdr_stream *xdr, open_args_share_access_want4 value) 461 { 462 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 463 } 464 465 static bool __maybe_unused 466 xdrgen_encode_open_args_open_claim4(struct xdr_stream *xdr, open_args_open_claim4 value) 467 { 468 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 469 } 470 471 static bool __maybe_unused 472 xdrgen_encode_open_args_createmode4(struct xdr_stream *xdr, open_args_createmode4 value) 473 { 474 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 475 } 476 477 bool 478 xdrgen_encode_fattr4_open_arguments(struct xdr_stream *xdr, const fattr4_open_arguments *value) 479 { 480 return xdrgen_encode_open_arguments4(xdr, value); 481 } 482 483 bool 484 xdrgen_encode_fattr4_time_deleg_access(struct xdr_stream *xdr, const fattr4_time_deleg_access *value) 485 { 486 return xdrgen_encode_nfstime4(xdr, value); 487 } 488 489 bool 490 xdrgen_encode_fattr4_time_deleg_modify(struct xdr_stream *xdr, const fattr4_time_deleg_modify *value) 491 { 492 return xdrgen_encode_nfstime4(xdr, value); 493 } 494 495 static bool __maybe_unused 496 xdrgen_encode_open_delegation_type4(struct xdr_stream *xdr, open_delegation_type4 value) 497 { 498 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 499 } 500 501 bool 502 xdrgen_encode_aclmodel4(struct xdr_stream *xdr, aclmodel4 value) 503 { 504 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 505 } 506 507 bool 508 xdrgen_encode_aclscope4(struct xdr_stream *xdr, aclscope4 value) 509 { 510 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 511 } 512 513 bool 514 xdrgen_encode_posixacetag4(struct xdr_stream *xdr, posixacetag4 value) 515 { 516 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 517 } 518 519 bool 520 xdrgen_encode_posixaceperm4(struct xdr_stream *xdr, const posixaceperm4 value) 521 { 522 return xdrgen_encode_uint32_t(xdr, value); 523 } 524 525 static bool __maybe_unused 526 xdrgen_encode_posixace4(struct xdr_stream *xdr, const struct posixace4 *value) 527 { 528 if (!xdrgen_encode_posixacetag4(xdr, value->tag)) 529 return false; 530 if (!xdrgen_encode_posixaceperm4(xdr, value->perm)) 531 return false; 532 if (!xdrgen_encode_utf8str_mixed(xdr, value->who)) 533 return false; 534 return true; 535 } 536 537 static bool __maybe_unused 538 xdrgen_encode_fattr4_acl_trueform(struct xdr_stream *xdr, const fattr4_acl_trueform value) 539 { 540 return xdrgen_encode_aclmodel4(xdr, value); 541 } 542 543 static bool __maybe_unused 544 xdrgen_encode_fattr4_acl_trueform_scope(struct xdr_stream *xdr, const fattr4_acl_trueform_scope value) 545 { 546 return xdrgen_encode_aclscope4(xdr, value); 547 } 548 549 static bool __maybe_unused 550 xdrgen_encode_fattr4_posix_default_acl(struct xdr_stream *xdr, const fattr4_posix_default_acl value) 551 { 552 if (xdr_stream_encode_u32(xdr, value.count) != XDR_UNIT) 553 return false; 554 for (u32 i = 0; i < value.count; i++) 555 if (!xdrgen_encode_posixace4(xdr, &value.element[i])) 556 return false; 557 return true; 558 } 559 560 static bool __maybe_unused 561 xdrgen_encode_fattr4_posix_access_acl(struct xdr_stream *xdr, const fattr4_posix_access_acl value) 562 { 563 if (xdr_stream_encode_u32(xdr, value.count) != XDR_UNIT) 564 return false; 565 for (u32 i = 0; i < value.count; i++) 566 if (!xdrgen_encode_posixace4(xdr, &value.element[i])) 567 return false; 568 return true; 569 } 570