1 .TH lustreapi 3 "2012 Dec 21" Lustre "Lustre Application Interface Library"
3 llapi_hsm_state_get llapi_hsm_state_get_fd \- get HSM state information for a file on Lustre filesystem
6 .B #include <lustre/lustreapi.h>
8 .BI "int llapi_hsm_state_get(const char *" path ", struct hsm_user_state *" hus ");"
10 .BI "int llapi_hsm_state_get_fd(int " fd ", struct hsm_user_state *" hus ");"
15 .B llapi_hsm_state_get(\|)
16 .B llapi_hsm_state_get_fd(\|)
17 read HSM state information like HSM flags and HSM archive ID for file pointed by
21 Information is returned in
23 which should already be allocated.
26 struct hsm_user_state {
33 Flag mask for different HSM states and policy hints. See
38 External HSM ID used for this file.
55 A file copy exists in HSM backend.
58 File content is not in sync with HSM backend.
61 File content is no more present in Lustre and should be restored to be access.
64 An up-to-date file copy exists in HSM backend.
67 File should never be released. File data will stay in Lustre even if a copy exists in HSM backend.
70 File should never be archived. Useful if this is a temporary file by example.
73 File copy in backend is not usable anymore and file could not be restore.
76 .B llapi_hsm_state_get(\|)
77 .B llapi_hsm_state_get_fd(\|)
90 failed to allocate memory.
98 does not point to a file or a directory.
102 does not point to a Lustre filesystem.
109 #include <lustre/lustreapi.h>
111 int main(int argc, char **argv)
113 struct hsm_user_state hus;
117 fprintf(stderr, "usage: prog FILEPATH\\n");
121 rc = llapi_hsm_state_get(argv[1], &hus);
123 fprintf(stderr, "can't get hsm state for %s: %s\\n",
124 argv[1], strerror(errno = -rc));
128 if (hus.hus_states & HS_RELEASED)
130 if (hus.hus_states & HS_EXISTS)
132 if (hus.hus_states & HS_DIRTY)
134 if (hus.hus_states & HS_ARCHIVED)
137 /* Display user-settable flags */
138 if (hus.hus_states & HS_NORELEASE)
139 printf(" never_release");
140 if (hus.hus_states & HS_NOARCHIVE)
141 printf(" never_archive");
142 if (hus.hus_states & HS_LOST)
143 printf(" lost_from_hsm");
145 if (hus.hus_archive_id != 0)
146 printf(", archive_id:%d", hus.hus_archive_id);
156 .BR llapi_hsm_state_set (3)
157 .BR llapi_hsm_state_set_fd (3)