LLAPI_SEARCH_TGT(3)

πŸ“¦ version 2.17.58, in ubuntu stonking

πŸ’– LLAPI_SEARCH_TGT πŸ’–

okay bestie, pull up a chair, because we're diving into LLAPI_SEARCH_TGT(3) β€” that's section 3 of the manual, under Lustre Library Functions, and it's lowkey one of those little utility pages that quietly does a LOT. ✨

It's basically a vibe check for your filesystem targets: is this OST or MDT actually in this pool or what? πŸ‘‘ Three functions, one job, zero drama.


πŸŽ€ NAME πŸŽ€

llapi_search_tgt, llapi_search_mdt, llapi_search_ost β€” the trio that verifies an OST or MDT is in a specified pool. fr fr, that's the whole plot.


🌸 SYNOPSIS 🌸

first things first, you gotta bring the header in:

#include <lustre/lustreapi.h>

then it's giving:

int llapi_search_tgt(const char *fsname, const char *pool_name,
                     const char *tgt_name, bool is_mdt);

int llapi_search_mdt(const char *fsname, const char *pool_name,
                     const char *tgt_name);

int llapi_search_ost(const char *fsname, const char *pool_name,
                     const char *tgt_name);

three besties, same energy, slightly different jobs. 🫢


✨ DESCRIPTION ✨

so llapi_search_tgt() is the main character here. it verifies that the tgt_name you handed it is a valid MDT or OST β€” which one depends on whether is_mdt is true or false, respectively πŸ’… β€” inside the filesystem named fsname, and (if you specified one) inside the pool named pool_name of that filesystem.

the ground rules, because there are some, and we respect them:

  • At least fsname must be non-NULL. non-negotiable. it's the bare minimum, truly.
  • pool_name may be NULL if you're just checking that the target exists. no pool needed, just vibes.
  • tgt_name may be NULL if you're only checking that pool_name exists. icon behaviour, honestly.

and then there's the dynamic duo: llapi_search_mdt() and llapi_search_ost(). these two are simple convenience/compatibility wrappers around llapi_search_tgt() that just set is_mdt appropriately for the target type you want. like, they're not doing anything new, they're just saving you a bool. slay. πŸ¦‹


πŸ”₯ RETURN VALUES πŸ”₯

okay so here's what you actually get back, and this part matters so pay attention bestie:

  • returns 1 if tgt_name (or pool_name if tgt_name is NULL) is found in the specified pool (or filesystem if pool_name is NULL). found it, ate, periodt. πŸ‘‘
  • returns 0 if tgt_name (or pool_name) is not found in the specified pool (or filesystem). not here, not today. πŸ’€
  • returns a negative errno if an error occurred β€” and in that case, errno is also set appropriately. so yeah, check both.

😭 ERRORS 😭

when things go wrong, here's the receipts:

  • EINVAL β€” fsname is NULL or zero-length, or both pool_name and tgt_name are NULL. like, you gave it literally nothing to work with. πŸ™ˆ
  • ENOENT β€” pool_name is specified but is not part of fsname. it said what it said.

🌈 AVAILABILITY 🌈

llapi_search_tgt(), llapi_search_mdt() and llapi_search_ost() are part of the lustre(7) user application interface library since release 2.4.0. so they've been around. they're not new here, they're veterans. ⭐


πŸ’œ SEE ALSO πŸ’œ

go read these next, iykyk:


and that's the whole page, bestie!! 🧚 thank you for coming to my ted talk. this gem came to you courtesy of Lustre User API, dated 2024-08-28, and yes we are absolutely stanning a manpage. go check your targets, stay in your pool, and remember: fsname non-NULL or it's over. πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from