PMEM2_CONFIG_SET_REQUIRED_STORE_GRANULARITY(3)

✨ NAME ✨

pmem2_config_set_required_store_granularity() β€” bestie, this one sets a granularity inside the pmem2_config structure πŸ’…

So this is from the PMDK Programmer's Manual (yes, that PMDK), and it's a little function that lives in the libpmem2 world. Let's get into it πŸ¦‹


🌸 SYNOPSIS 🌸

Okay so first you gotta pull in the header, obviously:

#include <libpmem2.h>

Then there's this enum, and it's giving very much "pick one of three":

enum pmem2_granularity {
    PMEM2_GRANULARITY_BYTE,
    PMEM2_GRANULARITY_CACHE_LINE,
    PMEM2_GRANULARITY_PAGE,
};

And here's the function itself, no cap:

int pmem2_config_set_required_store_granularity(struct pmem2_config *cfg,
        enum pmem2_granularity g);

πŸ’– DESCRIPTION πŸ’–

So pmem2_config_set_required_store_granularity() sets a maximum permitted granularity g that the user is requesting, and it tucks that value right into the pmem2_config structure. Literally just vibes being configured, but make it granularity 🌈

And g has to be one of these three, periodt:

  • PMEM2_GRANULARITY_BYTE
  • PMEM2_GRANULARITY_CACHE_LINE
  • PMEM2_GRANULARITY_PAGE

Now if you're sitting there like "bestie what even is granularity" 😭 β€” the whole concept is explained over in the libpmem2(7) manpage. Go read that one, it's the main character of the granularity lore πŸ‘‘


🫢 RETURN VALUE 🫢

pmem2_config_set_required_store_granularity() returns 0 when it slays (success), or a negative error code when it does not (failure). That's it, that's the whole vibe check πŸ’€


πŸŽ€ ERRORS πŸŽ€

It can fail with this one, and only this one:

  • PMEM2_E_GRANULARITY_NOT_SUPPORTED β€” the granularity g is not a valid value πŸ™ˆ
Fr fr, if you pass something that isn't one of the three enum values, this is what you get. No guessing, no mercy.

🌟 SEE ALSO 🌟


And that's the whole page, babe πŸ’œ This little cutie came straight out of the PMDK Programmer's Manual, dated 2025-07-24. Now go configure something iconic πŸ‘‘βœ¨

πŸ“¦ where this page comes from