STRUCT ND_NAMESPACE_INDEX(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’– struct nd_namespace_index(9) ๐Ÿ’–

okay bestie so this is a page straight out of the Kernel API Manual, and we're talking about a struct โ€” a label set superblock, no cap. yes it's giving very specific-and-niche but honestly? iconic. let's get into it ๐Ÿซถ


๐ŸŒธ NAME ๐ŸŒธ

struct nd_namespace_index โ€” the label set superblock, literally the main character of your label area โœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

struct nd_namespace_index {
    u8 sig[NSINDEX_SIG_LEN];
    u8 flags[3];
    u8 labelsize;
    __le32 seq;
    __le64 myoff;
    __le64 mysize;
    __le64 otheroff;
    __le64 labeloff;
    __le32 nslot;
    __le16 major;
    __le16 minor;
    __le64 checksum;
    u8 free[];
};

likeโ€ฆ look at her. she's structured. she's aligned. she's everything ๐Ÿ’…


๐ŸŽ€ Members ๐ŸŽ€

  • sig โ€” NAMESPACE_INDEX ๐Ÿท๏ธ that's the signature, periodt.
  • flags โ€” placeholder. yeah that's it. that's the whole vibe. a placeholder ๐Ÿ™ˆ
  • labelsize โ€” log2 size, and note the deets: v1 labels are 128 bytes, v2 labels are 256 bytes. lowkey important ๐Ÿ“
  • seq โ€” the sequence number for this index ๐Ÿ”ข
  • myoff โ€” offset of this index in the label area ๐Ÿ“
  • mysize โ€” size of this index struct, so she knows her own size ๐Ÿ’–
  • otheroff โ€” offset of the other index ๐Ÿ‘€ there's always another one
  • labeloff โ€” offset of the first label slot ๐ŸŽฏ
  • nslot โ€” total number of label slots ๐Ÿ—‚๏ธ
  • major โ€” label area major version ๐Ÿ”ฅ
  • minor โ€” label area minor version โœจ
  • checksum โ€” fletcher64 of all fields ๐Ÿงฎ every single field, she's thorough
  • free โ€” a bitmap, nlabel bits long ๐Ÿงš

๐Ÿ’œ Description ๐Ÿ’œ

so here's the tea โ˜• โ€” the size of free[] gets rounded up so that the total struct size is a multiple of NSINDEX_ALIGN bytes. that's just how it has to be, bestie ๐Ÿ“

and listen: any bits this allocates beyond the nlabel bits must be zero. not "should", not "ideally" โ€” must. zero. no cap, that's the rule ๐Ÿ’€


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

  • Kernel file ./drivers/nvdimm/label.h
  • struct cxl_region_label(9)
  • struct nvdimm_efi_label(9)
  • struct nvdimm_cxl_label(9)
  • struct nd_label_id(9)

go read those too, they're all linked in the lore ๐Ÿซถ


okay that's the whole page!! mwah ๐Ÿ’‹ this one lives in ./drivers/nvdimm, dated October 2026, and it's struct nd_namespace_index(9) all the way down. slay, stay aligned, and remember: the extra bits are zero ๐ŸŽ€โœจ

๐Ÿ“ฆ where this page comes from