OS Manuals

llapi_hsm_state_set(3)

llapi_hsm_state_set, llapi_hsm_state_set_fd - set HSM flags for a file on Lustre filesystem

LLAPI_HSM_STATE_SET(3) Lustre Library Functions LLAPI_HSM_STATE_SET(3)

llapi_hsm_state_set, llapi_hsm_state_set_fd - set HSM flags for a file on Lustre filesystem

#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);

llapi_hsm_state_set() llapi_hsm_state_set_fd() sets, clears HSM flags and modifies archive ID for file pointed by path or fd.

Mask of flags to be added.
Mask of flags to be removed.
Archive ID (greater than 0) used for this file. Use 0 if you do not want to change it.

See llapi_hsm_state_get(3) for available flags.

llapi_hsm_state_set() and llapi_hsm_state_set_fd() return:

0
on success
!= 0
on failure, errno is set appropriately.

failed to allocate memory.
path was too long.
path does not point to a file or a directory.
path does not point to a Lustre filesystem.
Provided masks resulted in an incompatible set of flags.

#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);
}

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

llapi_hsm_state_get(3), llapi_hsm_state_get_fd(3), lustre(7), lustreapi(7)

2024-08-27 Lustre User API

lustre 2.17.60-r0 · enterprise-packages · ingested 2026-10-22