FIELD_PREP_CONST(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ FIELD_PREP_CONST(9) ✨

okay so bestie, welcome to the Kernel API Manual page for FIELD_PREP_CONST(9) β€” the one that prepares a constant bitfield element πŸ’…


🌸 NAME 🌸

FIELD_PREP_CONST β€” prepare a constant bitfield element ✨


πŸŽ€ SYNOPSIS πŸŽ€

FIELD_PREP_CONST (_mask , _val );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • _mask β€” the shifted mask that defines the field’s length and position πŸ‘‘
  • _val β€” the value you’re putting in the field 🫢

πŸ’– DESCRIPTION πŸ’–

FIELD_PREP_CONST masks and shifts up the value. The result should be combined with other fields of the bitfield using logical OR β€” yes, that part matters, slay πŸ”₯

Unlike FIELD_PREP, this is a constant expression and can therefore be used in initializers. Periodt. ✨

ngl the error checking is less comfortable for this version, and non-constant masks cannot be used. So keep that in mind, bestie 😭

🌈 SEE ALSO 🌈

Kernel file: ./include/linux/bitfield.h

Also check out FIELD_MAX(9), FIELD_FIT(9), FIELD_PREP(9), FIELD_GET(9), FIELD_GET_SIGNED(9), FIELD_MODIFY(9), field_prep(9), and field_get(9) 🧚


Byeee bestie β€” this iconic little page comes from the ./include/linux source/version and is dated October 2026 πŸ’œπŸŽ€

πŸ“¦ where this page comes from