string_get_size(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… string_get_size(9) β€” get the size in the specified units ✨

Okay so bestie, this is string_get_size(9) from the Kernel API Manual, and it's literally here to turn a size into a cute formatted string in the units you want. πŸŽ€


🌸 NAME 🌸

string_get_size β€” get the size in the specified units. Periodt. πŸ’–

✨ SYNOPSIS ✨

int string_get_size (u64 size , u64 blk_size , const enum
       string_size_units units , char *buf , int len );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • size β€” the size to be converted in blocks, bestie.
  • blk_size β€” size of the block (use 1 for size in bytes). Lowkey important.
  • units β€” units to use (powers of 1000 or 1024), whether to include space separator. So many choices, iconic.
  • buf β€” buffer to format to. That's where the string goes. πŸ’Œ
  • len β€” length of buffer.

πŸŽ€ DESCRIPTION πŸŽ€

This function returns a string formatted to 3 significant figures giving the size in the required units. Slay.

buf should have room for at least 9 bytes and will always be zero terminated. No cap, it's always null-terminated. 🫢

Return value: number of characters of output that would have been written (which may be greater than len, if output was truncated). So yeah, if it got cut off, the return value can still be bigger than len β€” that's the vibe. 😭

🌈 SEE ALSO 🌈

Kernel file ./lib/string_helpers.c and the whole squad:


Signed off from ./lib, dated October 2026 β€” string_get_size(9) out, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from