Whamcloud - gitweb
LU-3157 llite: A not locked mutex can be unlocked.
[fs/lustre-release.git] / lustre / doc / llapi_hsm_state_set.3
1 .TH lustreapi 3 "2012 Dec 21" Lustre "Lustre Application Interface Library"
2 .SH NAME
3 llapi_hsm_state_set \- set HSM flags for a file on Lustre filesystem
4 .SH SYNOPSIS
5 .nf
6 .B #include <lustre/lustreapi.h>
7 .sp
8 .BI "int llapi_hsm_state_set(const char *" path ", __u64 " setmask ",
9 .BI "                        __u64 " clearmask ", __u32 " archive_id ");"
10 .sp
11 .fi
12 .SH DESCRIPTION
13 .LP
14 .B llapi_hsm_state_set(\|)
15 sets, clears HSM flags and modifies archive ID for file pointed by
16 .IR path .
17
18 .TP 20
19 .I setmask
20 Mask of flags to be added.
21 .TP 20
22 .I clearmask
23 Mask of flags to be removed.
24 .TP 20
25 .I archive_id
26 Archive ID (greater than 0) used for this file. Use 0 if you do not want to
27 change it.
28 .LP
29 See
30 .BR llapi_hsm_state_get (3)
31 for available flags.
32 .LP
33 .SH RETURN VALUES
34 .LP
35 .B llapi_hsm_state_set(\|)
36 returns:
37 .TP
38 0
39 on success
40 .TP
41 != 0
42 on failure,
43 .I errno
44 is set appropriately.
45 .SH ERRORS
46 .TP 15
47 .SM ENOMEM
48 failed to allocate memory.
49 .TP 15
50 .SM ENAMETOOLONG
51 .I path
52 was too long.
53 .TP 15
54 .SM ENOENT
55 .I path
56 does not point to a file or a directory.
57 .TP 15
58 .SM ENOTTY
59 .I path
60 does not point to a Lustre filesystem.
61 .TP 15
62 .SM EINVAL
63 Provided masks resulted in an incompatible set of flags.
64 .SH EXAMPLE
65
66 .nf
67 #include <stdlib.h>
68 #include <stdio.h>
69 #include <errno.h>
70
71 #include <lustre/lustreapi.h>
72
73 int main(int argc, char **argv)
74 {
75         int rc;
76
77         if (argc < 2) {
78                 fprintf(stderr, "usage: prog FILEPATH\\n");
79                 exit(1);
80         }
81
82         rc = llapi_hsm_state_set(argv[1], HS_DIRTY|HS_NORELEASE, 0, 0);
83         if (rc != 0) {
84                 fprintf(stderr, "Can't change hsm flags for %s: %s\\n",
85                         argv[1], strerror(errno = -rc));
86                 exit(rc);
87         }
88
89         exit(0);
90 }
91 .fi
92 .SH "SEE ALSO"
93 .BR lustre (7),
94 .BR lustreapi (7),
95 .BR llapi_hsm_state_get (3)