LLAPI_UNLINK_FOREIGN(3)

πŸ“¦ version 2.17.58, in ubuntu stonking

okay bestie, gather round, because today we're talking about a lil function from the Lustre Library Functions lineup β€” llapi_unlink_foreign(3). it's giving "delete this thing that normal delete can't touch." iconic behavior honestly.


✨ NAME ✨

llapi_unlink_foreign β€” unlink a file/dir that has a foreign layout on a Lustre filesystem πŸ’…


🌸 SYNOPSIS 🌸

#include <lustre/lustreapi.h>

int llapi_unlink_foreign(char *name);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like. llapi_unlink_foreign() lets you unlink a file or dir named name when it's rockin' a foreign LOV/LMV β€” the exact kind of file/dir that the regular unlink/rmdir command or syscall would straight up refuse to touch. no cap.

and the plot twist? it also just works fine on a regular file/dir too. versatile queen. πŸ‘‘


πŸ’« RETURN VALUES πŸ’«

llapi_unlink_foreign() be returning:

  • =0 β€” slay, success ✨
  • <0 β€” oh no, failure. the absolute value of that number is an error code, so take the positivity out of it and go look it up.

πŸ’€ ERRORS πŸ’€

  • ENOENT β€” name does not exist. it's not there bestie, it never was 😭
  • ENOTTY β€” name may not point to a Lustre filesystem. wrong vibes, wrong filesystem fr fr.

πŸŽ€ EXAMPLES πŸŽ€

here's the whole vibe in code, copy it, love it, compile it:

#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>

#include <lustre/lustreapi.h>

int main(int argc, char **argv)
{
     char *foreign = NULL;
     int c, rc;

     while ((c = getopt(argc, argv, "hf:")) != -1) {
          switch (c) {
          case 'f':
               foreign = optarg;
               break;
          case 'h':
          default:
               fprintf(stderr,
                    "Usage: %s [-f <foreign file/dir pathname>]0,
                    argv[0]);
               exit(0);
               break;
          }
     }

     if (foreign == NULL) {
          fprintf(stderr, "a foreign file/dir pathname must be provided0);
          exit(0);
     }

     rc = llapi_unlink_foreign(foreign);
     if (rc < 0)
          fprintf(stderr, "llapi_unlink_foreign() error: %d0, rc);

     return rc;
}

🌈 AVAILABILITY 🌈

llapi_unlink_foreign() is part of the lustre(7) user application interface library, and it's been serving looks since release 2.9.0. so yeah, it's not new new, it's a seasoned icon.


πŸ‘‘ SEE ALSO πŸ‘‘


little reminder bestie: if you're getting a negative return, don't just vibe past it β€” that absolute value is a real error code and it wants your attention 🫢

and that's the whole page, fr fr. this lil slice of lore comes to you from the Lustre User API, dated 2024-08-28, and it'll be right here every time you need it. periodt. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from