Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add RPC language definition of NFSv4 POSIX ACL extension

The language definition was extracted from the new
draft-ietf-nfsv4-posix-acls specification. This ensures good
constant and type name alignment between the spec and the Linux
kernel source code, and brings in some basic XDR utilities for
handling NFSv4 POSIX draft ACLs.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

+410 -3
+61
Documentation/sunrpc/xdr/nfs4_1.x
··· 53 53 */ 54 54 typedef uint32_t bitmap4<>; 55 55 56 + typedef opaque utf8string<>; 57 + typedef utf8string utf8str_cis; 58 + typedef utf8string utf8str_cs; 59 + typedef utf8string utf8str_mixed; 60 + 56 61 /* 57 62 * Timeval 58 63 */ ··· 189 184 OPEN_DELEGATE_READ_ATTRS_DELEG = 4, 190 185 OPEN_DELEGATE_WRITE_ATTRS_DELEG = 5 191 186 }; 187 + 188 + 189 + /* 190 + * The following content was extracted from draft-ietf-nfsv4-posix-acls 191 + */ 192 + 193 + enum aclmodel4 { 194 + ACL_MODEL_NFS4 = 1, 195 + ACL_MODEL_POSIX_DRAFT = 2, 196 + ACL_MODEL_NONE = 3 197 + }; 198 + pragma public aclmodel4; 199 + 200 + enum aclscope4 { 201 + ACL_SCOPE_FILE_OBJECT = 1, 202 + ACL_SCOPE_FILE_SYSTEM = 2, 203 + ACL_SCOPE_SERVER = 3 204 + }; 205 + pragma public aclscope4; 206 + 207 + enum posixacetag4 { 208 + POSIXACE4_TAG_USER_OBJ = 1, 209 + POSIXACE4_TAG_USER = 2, 210 + POSIXACE4_TAG_GROUP_OBJ = 3, 211 + POSIXACE4_TAG_GROUP = 4, 212 + POSIXACE4_TAG_MASK = 5, 213 + POSIXACE4_TAG_OTHER = 6 214 + }; 215 + pragma public posixacetag4; 216 + 217 + typedef uint32_t posixaceperm4; 218 + pragma public posixaceperm4; 219 + 220 + /* Bit definitions for posixaceperm4. */ 221 + const POSIXACE4_PERM_EXECUTE = 0x00000001; 222 + const POSIXACE4_PERM_WRITE = 0x00000002; 223 + const POSIXACE4_PERM_READ = 0x00000004; 224 + 225 + struct posixace4 { 226 + posixacetag4 tag; 227 + posixaceperm4 perm; 228 + utf8str_mixed who; 229 + }; 230 + 231 + typedef aclmodel4 fattr4_acl_trueform; 232 + typedef aclscope4 fattr4_acl_trueform_scope; 233 + typedef posixace4 fattr4_posix_default_acl<>; 234 + typedef posixace4 fattr4_posix_access_acl<>; 235 + 236 + %/* 237 + % * New for POSIX ACL extension 238 + % */ 239 + const FATTR4_ACL_TRUEFORM = 89; 240 + const FATTR4_ACL_TRUEFORM_SCOPE = 90; 241 + const FATTR4_POSIX_DEFAULT_ACL = 91; 242 + const FATTR4_POSIX_ACCESS_ACL = 92;
+238 -1
fs/nfsd/nfs4xdr_gen.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 // Generated by xdrgen. Manual edits will be lost. 3 3 // XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x 4 - // XDR specification modification time: Thu Jan 8 23:11:48 2026 4 + // XDR specification modification time: Thu Jan 8 23:12:07 2026 5 5 6 6 #include <linux/sunrpc/svc.h> 7 7 ··· 28 28 if (!xdrgen_decode_uint32_t(xdr, &ptr->element[i])) 29 29 return false; 30 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); 31 55 } 32 56 33 57 static bool __maybe_unused ··· 246 222 return true; 247 223 } 248 224 225 + bool 226 + xdrgen_decode_aclmodel4(struct xdr_stream *xdr, aclmodel4 *ptr) 227 + { 228 + u32 val; 229 + 230 + if (xdr_stream_decode_u32(xdr, &val) < 0) 231 + return false; 232 + /* Compiler may optimize to a range check for dense enums */ 233 + switch (val) { 234 + case ACL_MODEL_NFS4: 235 + case ACL_MODEL_POSIX_DRAFT: 236 + case ACL_MODEL_NONE: 237 + break; 238 + default: 239 + return false; 240 + } 241 + *ptr = val; 242 + return true; 243 + } 244 + 245 + bool 246 + xdrgen_decode_aclscope4(struct xdr_stream *xdr, aclscope4 *ptr) 247 + { 248 + u32 val; 249 + 250 + if (xdr_stream_decode_u32(xdr, &val) < 0) 251 + return false; 252 + /* Compiler may optimize to a range check for dense enums */ 253 + switch (val) { 254 + case ACL_SCOPE_FILE_OBJECT: 255 + case ACL_SCOPE_FILE_SYSTEM: 256 + case ACL_SCOPE_SERVER: 257 + break; 258 + default: 259 + return false; 260 + } 261 + *ptr = val; 262 + return true; 263 + } 264 + 265 + bool 266 + xdrgen_decode_posixacetag4(struct xdr_stream *xdr, posixacetag4 *ptr) 267 + { 268 + u32 val; 269 + 270 + if (xdr_stream_decode_u32(xdr, &val) < 0) 271 + return false; 272 + /* Compiler may optimize to a range check for dense enums */ 273 + switch (val) { 274 + case POSIXACE4_TAG_USER_OBJ: 275 + case POSIXACE4_TAG_USER: 276 + case POSIXACE4_TAG_GROUP_OBJ: 277 + case POSIXACE4_TAG_GROUP: 278 + case POSIXACE4_TAG_MASK: 279 + case POSIXACE4_TAG_OTHER: 280 + break; 281 + default: 282 + return false; 283 + } 284 + *ptr = val; 285 + return true; 286 + } 287 + 288 + bool 289 + xdrgen_decode_posixaceperm4(struct xdr_stream *xdr, posixaceperm4 *ptr) 290 + { 291 + return xdrgen_decode_uint32_t(xdr, ptr); 292 + } 293 + 294 + static bool __maybe_unused 295 + xdrgen_decode_posixace4(struct xdr_stream *xdr, struct posixace4 *ptr) 296 + { 297 + if (!xdrgen_decode_posixacetag4(xdr, &ptr->tag)) 298 + return false; 299 + if (!xdrgen_decode_posixaceperm4(xdr, &ptr->perm)) 300 + return false; 301 + if (!xdrgen_decode_utf8str_mixed(xdr, &ptr->who)) 302 + return false; 303 + return true; 304 + } 305 + 306 + static bool __maybe_unused 307 + xdrgen_decode_fattr4_acl_trueform(struct xdr_stream *xdr, fattr4_acl_trueform *ptr) 308 + { 309 + return xdrgen_decode_aclmodel4(xdr, ptr); 310 + } 311 + 312 + static bool __maybe_unused 313 + xdrgen_decode_fattr4_acl_trueform_scope(struct xdr_stream *xdr, fattr4_acl_trueform_scope *ptr) 314 + { 315 + return xdrgen_decode_aclscope4(xdr, ptr); 316 + } 317 + 318 + static bool __maybe_unused 319 + xdrgen_decode_fattr4_posix_default_acl(struct xdr_stream *xdr, fattr4_posix_default_acl *ptr) 320 + { 321 + if (xdr_stream_decode_u32(xdr, &ptr->count) < 0) 322 + return false; 323 + for (u32 i = 0; i < ptr->count; i++) 324 + if (!xdrgen_decode_posixace4(xdr, &ptr->element[i])) 325 + return false; 326 + return true; 327 + } 328 + 329 + static bool __maybe_unused 330 + xdrgen_decode_fattr4_posix_access_acl(struct xdr_stream *xdr, fattr4_posix_access_acl *ptr) 331 + { 332 + if (xdr_stream_decode_u32(xdr, &ptr->count) < 0) 333 + return false; 334 + for (u32 i = 0; i < ptr->count; i++) 335 + if (!xdrgen_decode_posixace4(xdr, &ptr->element[i])) 336 + return false; 337 + return true; 338 + } 339 + 340 + /* 341 + * New for POSIX ACL extension 342 + */ 343 + 249 344 static bool __maybe_unused 250 345 xdrgen_encode_int64_t(struct xdr_stream *xdr, const int64_t value) 251 346 { ··· 386 243 if (!xdrgen_encode_uint32_t(xdr, value.element[i])) 387 244 return false; 388 245 return true; 246 + } 247 + 248 + static bool __maybe_unused 249 + xdrgen_encode_utf8string(struct xdr_stream *xdr, const utf8string value) 250 + { 251 + return xdr_stream_encode_opaque(xdr, value.data, value.len) >= 0; 252 + } 253 + 254 + static bool __maybe_unused 255 + xdrgen_encode_utf8str_cis(struct xdr_stream *xdr, const utf8str_cis value) 256 + { 257 + return xdrgen_encode_utf8string(xdr, value); 258 + } 259 + 260 + static bool __maybe_unused 261 + xdrgen_encode_utf8str_cs(struct xdr_stream *xdr, const utf8str_cs value) 262 + { 263 + return xdrgen_encode_utf8string(xdr, value); 264 + } 265 + 266 + static bool __maybe_unused 267 + xdrgen_encode_utf8str_mixed(struct xdr_stream *xdr, const utf8str_mixed value) 268 + { 269 + return xdrgen_encode_utf8string(xdr, value); 389 270 } 390 271 391 272 static bool __maybe_unused ··· 496 329 xdrgen_encode_open_delegation_type4(struct xdr_stream *xdr, open_delegation_type4 value) 497 330 { 498 331 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 332 + } 333 + 334 + bool 335 + xdrgen_encode_aclmodel4(struct xdr_stream *xdr, aclmodel4 value) 336 + { 337 + return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 338 + } 339 + 340 + bool 341 + xdrgen_encode_aclscope4(struct xdr_stream *xdr, aclscope4 value) 342 + { 343 + return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 344 + } 345 + 346 + bool 347 + xdrgen_encode_posixacetag4(struct xdr_stream *xdr, posixacetag4 value) 348 + { 349 + return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 350 + } 351 + 352 + bool 353 + xdrgen_encode_posixaceperm4(struct xdr_stream *xdr, const posixaceperm4 value) 354 + { 355 + return xdrgen_encode_uint32_t(xdr, value); 356 + } 357 + 358 + static bool __maybe_unused 359 + xdrgen_encode_posixace4(struct xdr_stream *xdr, const struct posixace4 *value) 360 + { 361 + if (!xdrgen_encode_posixacetag4(xdr, value->tag)) 362 + return false; 363 + if (!xdrgen_encode_posixaceperm4(xdr, value->perm)) 364 + return false; 365 + if (!xdrgen_encode_utf8str_mixed(xdr, value->who)) 366 + return false; 367 + return true; 368 + } 369 + 370 + static bool __maybe_unused 371 + xdrgen_encode_fattr4_acl_trueform(struct xdr_stream *xdr, const fattr4_acl_trueform value) 372 + { 373 + return xdrgen_encode_aclmodel4(xdr, value); 374 + } 375 + 376 + static bool __maybe_unused 377 + xdrgen_encode_fattr4_acl_trueform_scope(struct xdr_stream *xdr, const fattr4_acl_trueform_scope value) 378 + { 379 + return xdrgen_encode_aclscope4(xdr, value); 380 + } 381 + 382 + static bool __maybe_unused 383 + xdrgen_encode_fattr4_posix_default_acl(struct xdr_stream *xdr, const fattr4_posix_default_acl value) 384 + { 385 + if (xdr_stream_encode_u32(xdr, value.count) != XDR_UNIT) 386 + return false; 387 + for (u32 i = 0; i < value.count; i++) 388 + if (!xdrgen_encode_posixace4(xdr, &value.element[i])) 389 + return false; 390 + return true; 391 + } 392 + 393 + static bool __maybe_unused 394 + xdrgen_encode_fattr4_posix_access_acl(struct xdr_stream *xdr, const fattr4_posix_access_acl value) 395 + { 396 + if (xdr_stream_encode_u32(xdr, value.count) != XDR_UNIT) 397 + return false; 398 + for (u32 i = 0; i < value.count; i++) 399 + if (!xdrgen_encode_posixace4(xdr, &value.element[i])) 400 + return false; 401 + return true; 499 402 }
+11 -1
fs/nfsd/nfs4xdr_gen.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /* Generated by xdrgen. Manual edits will be lost. */ 3 3 /* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */ 4 - /* XDR specification modification time: Thu Jan 8 23:11:48 2026 */ 4 + /* XDR specification modification time: Thu Jan 8 23:12:07 2026 */ 5 5 6 6 #ifndef _LINUX_XDRGEN_NFS4_1_DECL_H 7 7 #define _LINUX_XDRGEN_NFS4_1_DECL_H ··· 21 21 22 22 bool xdrgen_decode_fattr4_time_deleg_modify(struct xdr_stream *xdr, fattr4_time_deleg_modify *ptr); 23 23 bool xdrgen_encode_fattr4_time_deleg_modify(struct xdr_stream *xdr, const fattr4_time_deleg_modify *value); 24 + bool xdrgen_decode_aclmodel4(struct xdr_stream *xdr, aclmodel4 *ptr); 25 + bool xdrgen_encode_aclmodel4(struct xdr_stream *xdr, aclmodel4 value); 26 + bool xdrgen_decode_aclscope4(struct xdr_stream *xdr, aclscope4 *ptr); 27 + bool xdrgen_encode_aclscope4(struct xdr_stream *xdr, aclscope4 value); 28 + bool xdrgen_decode_posixacetag4(struct xdr_stream *xdr, posixacetag4 *ptr); 29 + bool xdrgen_encode_posixacetag4(struct xdr_stream *xdr, posixacetag4 value); 30 + 31 + bool xdrgen_decode_posixaceperm4(struct xdr_stream *xdr, posixaceperm4 *ptr); 32 + bool xdrgen_encode_posixaceperm4(struct xdr_stream *xdr, const posixaceperm4 value); 33 + 24 34 25 35 #endif /* _LINUX_XDRGEN_NFS4_1_DECL_H */
+4
include/linux/nfs4.h
··· 598 598 #define FATTR4_WORD2_TIME_DELEG_ACCESS BIT(FATTR4_TIME_DELEG_ACCESS - 64) 599 599 #define FATTR4_WORD2_TIME_DELEG_MODIFY BIT(FATTR4_TIME_DELEG_MODIFY - 64) 600 600 #define FATTR4_WORD2_OPEN_ARGUMENTS BIT(FATTR4_OPEN_ARGUMENTS - 64) 601 + #define FATTR4_WORD2_ACL_TRUEFORM BIT(FATTR4_ACL_TRUEFORM - 64) 602 + #define FATTR4_WORD2_ACL_TRUEFORM_SCOPE BIT(FATTR4_ACL_TRUEFORM_SCOPE - 64) 603 + #define FATTR4_WORD2_POSIX_DEFAULT_ACL BIT(FATTR4_POSIX_DEFAULT_ACL - 64) 604 + #define FATTR4_WORD2_POSIX_ACCESS_ACL BIT(FATTR4_POSIX_ACCESS_ACL - 64) 601 605 602 606 /* MDS threshold bitmap bits */ 603 607 #define THRESHOLD_RD (1UL << 0)
+96 -1
include/linux/sunrpc/xdrgen/nfs4_1.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /* Generated by xdrgen. Manual edits will be lost. */ 3 3 /* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */ 4 - /* XDR specification modification time: Thu Jan 8 23:11:48 2026 */ 4 + /* XDR specification modification time: Thu Jan 8 23:12:07 2026 */ 5 5 6 6 #ifndef _LINUX_XDRGEN_NFS4_1_DEF_H 7 7 #define _LINUX_XDRGEN_NFS4_1_DEF_H ··· 17 17 u32 count; 18 18 uint32_t *element; 19 19 } bitmap4; 20 + 21 + typedef opaque utf8string; 22 + 23 + typedef utf8string utf8str_cis; 24 + 25 + typedef utf8string utf8str_cs; 26 + 27 + typedef utf8string utf8str_mixed; 20 28 21 29 struct nfstime4 { 22 30 int64_t seconds; ··· 149 141 150 142 typedef enum open_delegation_type4 open_delegation_type4; 151 143 144 + enum aclmodel4 { 145 + ACL_MODEL_NFS4 = 1, 146 + ACL_MODEL_POSIX_DRAFT = 2, 147 + ACL_MODEL_NONE = 3, 148 + }; 149 + 150 + typedef enum aclmodel4 aclmodel4; 151 + 152 + enum aclscope4 { 153 + ACL_SCOPE_FILE_OBJECT = 1, 154 + ACL_SCOPE_FILE_SYSTEM = 2, 155 + ACL_SCOPE_SERVER = 3, 156 + }; 157 + 158 + typedef enum aclscope4 aclscope4; 159 + 160 + enum posixacetag4 { 161 + POSIXACE4_TAG_USER_OBJ = 1, 162 + POSIXACE4_TAG_USER = 2, 163 + POSIXACE4_TAG_GROUP_OBJ = 3, 164 + POSIXACE4_TAG_GROUP = 4, 165 + POSIXACE4_TAG_MASK = 5, 166 + POSIXACE4_TAG_OTHER = 6, 167 + }; 168 + 169 + typedef enum posixacetag4 posixacetag4; 170 + 171 + typedef uint32_t posixaceperm4; 172 + 173 + enum { POSIXACE4_PERM_EXECUTE = 0x00000001 }; 174 + 175 + enum { POSIXACE4_PERM_WRITE = 0x00000002 }; 176 + 177 + enum { POSIXACE4_PERM_READ = 0x00000004 }; 178 + 179 + struct posixace4 { 180 + posixacetag4 tag; 181 + posixaceperm4 perm; 182 + utf8str_mixed who; 183 + }; 184 + 185 + typedef aclmodel4 fattr4_acl_trueform; 186 + 187 + typedef aclscope4 fattr4_acl_trueform_scope; 188 + 189 + typedef struct { 190 + u32 count; 191 + struct posixace4 *element; 192 + } fattr4_posix_default_acl; 193 + 194 + typedef struct { 195 + u32 count; 196 + struct posixace4 *element; 197 + } fattr4_posix_access_acl; 198 + 199 + /* 200 + * New for POSIX ACL extension 201 + */ 202 + 203 + enum { FATTR4_ACL_TRUEFORM = 89 }; 204 + 205 + enum { FATTR4_ACL_TRUEFORM_SCOPE = 90 }; 206 + 207 + enum { FATTR4_POSIX_DEFAULT_ACL = 91 }; 208 + 209 + enum { FATTR4_POSIX_ACCESS_ACL = 92 }; 210 + 152 211 #define NFS4_int64_t_sz \ 153 212 (XDR_hyper) 154 213 #define NFS4_uint32_t_sz \ 155 214 (XDR_unsigned_int) 156 215 #define NFS4_bitmap4_sz (XDR_unsigned_int) 216 + #define NFS4_utf8string_sz (XDR_unsigned_int) 217 + #define NFS4_utf8str_cis_sz \ 218 + (NFS4_utf8string_sz) 219 + #define NFS4_utf8str_cs_sz \ 220 + (NFS4_utf8string_sz) 221 + #define NFS4_utf8str_mixed_sz \ 222 + (NFS4_utf8string_sz) 157 223 #define NFS4_nfstime4_sz \ 158 224 (NFS4_int64_t_sz + NFS4_uint32_t_sz) 159 225 #define NFS4_fattr4_offline_sz \ ··· 246 164 #define NFS4_fattr4_time_deleg_modify_sz \ 247 165 (NFS4_nfstime4_sz) 248 166 #define NFS4_open_delegation_type4_sz (XDR_int) 167 + #define NFS4_aclmodel4_sz (XDR_int) 168 + #define NFS4_aclscope4_sz (XDR_int) 169 + #define NFS4_posixacetag4_sz (XDR_int) 170 + #define NFS4_posixaceperm4_sz \ 171 + (NFS4_uint32_t_sz) 172 + #define NFS4_posixace4_sz \ 173 + (NFS4_posixacetag4_sz + NFS4_posixaceperm4_sz + NFS4_utf8str_mixed_sz) 174 + #define NFS4_fattr4_acl_trueform_sz \ 175 + (NFS4_aclmodel4_sz) 176 + #define NFS4_fattr4_acl_trueform_scope_sz \ 177 + (NFS4_aclscope4_sz) 178 + #define NFS4_fattr4_posix_default_acl_sz (XDR_unsigned_int) 179 + #define NFS4_fattr4_posix_access_acl_sz (XDR_unsigned_int) 249 180 250 181 #endif /* _LINUX_XDRGEN_NFS4_1_DEF_H */