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