cube(2): CUBE_OP_PUT takes a class mask

The mask is the writer's and is stamped once, at the moment the record's
class is known for certain; every later reader is spared re-deriving it. It
means nothing to this side — which bits are which class is a vocabulary's
business, and a kernel that interpreted one would be inventing a vocabulary.

0 is "no class", which is what every record written before the field existed
reads as, so a caller that does not classify is not writing a special value.
A store whose image is the legacy packed layout has no field to put a mask in
and drops it: that layout cannot carry a class, and saying otherwise would be
a lie about the bytes on disk.

The field is appended, so sizeof(cube_args) grows from 80 to 88 — still
distinct from the other three argument blocks, which is what the size-first
dispatch depends on.
This commit is contained in:
surface-camera-build
2026-09-22 00:37:09 -04:00
parent 71552fc157
commit 9586e114e7
3 changed files with 25 additions and 4 deletions
+14
View File
@@ -34,6 +34,20 @@ struct cube_args {
* out: on -ERANGE, the bytes that would be needed;
* on success for CUBE_OP_GET, the bytes read.
*/
__u16 flags; /* in: CUBE_OP_PUT only — the class mask to stamp on the
* record. The mask is written where the record is written,
* which is the moment its class is known for certain; a
* reader never has to re-derive it. 0 is "no class", which
* is what every record written before the field existed
* reads as, so a caller that does not classify is not
* writing a special value.
*
* A store whose image is the legacy packed layout has no
* field to put a mask in, and drops it: that layout cannot
* carry a class and saying otherwise would be a lie about
* the bytes on disk.
*/
__u16 reserved; /* must be 0 */
};
#define CUBE_OP_PUT 1 /* store bytes at a coordinate */