LLAPI_HSM_STATE_SET(3)
β¨ LLAPI_HSM_STATE_SET(3) β¨
okay bestie, sit down, hydrate, and let me tell you about a lil function from the Lustre Library Functions collection π it's called llapi_hsm_state_set, and it's literally the girlboss that sets your HSM flags for you. no cap.
πΈ NAME πΈ
llapi_hsm_state_set, llapi_hsm_state_set_fd β set HSM flags for a file on a Lustre filesystem π¦
π SYNOPSIS π
#include <lustre/lustreapi.h>
int llapi_hsm_state_set(const char *path, __u64 setmask,
__u64 clearmask, __u32 archive_id);
int llapi_hsm_state_set_fd(int fd, __u64 setmask,
__u64 clearmask, __u32 archive_id);
two flavors, same energy, pick your fave π
π DESCRIPTION π
so like, llapi_hsm_state_set() and llapi_hsm_state_set_fd() do the thing where they set, clear HSM flags and modify the archive ID for the file pointed at by path or fd. it's giving glow-up, but for metadata π
setmaskβ the mask of flags you wanna add. yes queen, stack them on πclearmaskβ the mask of flags you wanna remove. bye bestie, not your era anymore πarchive_idβ the archive ID (has to be greater than 0) used for this file. use0if you do not want to change it. iconic "leave it alone" behaviour fr fr π
head over to llapi_hsm_state_get(3) if you wanna see which flags are actually available, iykyk π
π«Ά RETURN VALUES π«Ά
llapi_hsm_state_set() and llapi_hsm_state_set_fd() return:
0β on success π slay!= 0β on failure, anderrnois set appropriately (as it should be, she's communicative) π
π ERRORS π
okay so when things go sideways, you might catch one of these:
-ENOMEMβ failed to allocate memory. lowkey tragic, no memory no party π-ENAMETOOLONGβ path was too long. that path was yapping too much π-ENOENTβ path does not point to a file or a directory. she's not there bestie, she left π-ENOTTYβ path does not point to a Lustre filesystem. wrong universe, girl πΈ-EINVALβ the provided masks resulted in an incompatible set of flags. the vibes did not pass the vibe check π
π₯ EXAMPLES π₯
here's a whole main character moment in C, showing you exactly how it's done:
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <lustre/lustreapi.h>
int main(int argc, char **argv)
{
int rc;
if (argc < 2) {
fprintf(stderr, "usage: prog FILEPATH\n");
exit(1);
}
rc = llapi_hsm_state_set(argv[1], HS_DIRTY|HS_NORELEASE, 0, 0);
if (rc != 0) {
fprintf(stderr, "Can't change hsm flags for %s: %s\n",
argv[1], strerror(errno = -rc));
exit(rc);
}
exit(0);
}
notice how the archive_id is 0 there? that's the "don't touch it" energy. periodt π
β AVAILABILITY β
llapi_hsm_state_set and llapi_hsm_state_set_fd are part of the lustre(7) user application interface library since release 2.4.0. yes she's been here a while and she's been serving the whole time πβ¨
π SEE ALSO π
llapi_hsm_state_get(3)llapi_hsm_state_get_fd(3)lustre(7)lustreapi(7)
bestie reminder: the flags live over in llapi_hsm_state_get(3), so go read that first before you start throwing masks around π
that's the whole page! written by the Lustre User API girlies on 2024-08-27 β stay slaying, stay aligned, and may your errno always be 0 π
ππ¦
π¦ where this page comes from
- ubuntu stonking: lustre-client-utils 2.17.58+dfsg-0ubuntu2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms