LLAPI_HSM_STATE_SET(3)

NAME
llapi_hsm_state_set, llapi_hsm_state_set_fd - set HSM flags for a file on 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);

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

setmask
    Mask of flags to be added.

clearmask
    Mask of flags to be removed.

archive_id
    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.

RETURN VALUES
llapi_hsm_state_set() and llapi_hsm_state_set_fd() return:

0   on success

!= 0
    on failure, errno is set appropriately.

ERRORS

-ENOMEM
    failed to allocate memory.

-ENAMETOOLONG
    path was too long.

-ENOENT
    path does not point to a file or a directory.

-ENOTTY
    path does not point to a Lustre filesystem.

-EINVAL
    Provided masks resulted in an incompatible set of flags.

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

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

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