1 .TH lustreapi 3 "2012 Dec 21" Lustre "Lustre Application Interface Library"
3 llapi_hsm_state_get \- 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 ");"
13 .B llapi_hsm_state_get(\|)
14 read HSM state information like HSM flags and HSM archive ID for file pointed by
16 Information is returned in
18 which should already be allocated.
21 struct hsm_user_state {
28 Flag mask for different HSM states and policy hints. See
33 External HSM ID used for this file.
50 A file copy exists in HSM backend.
53 File content is not in sync with HSM backend.
56 File content is no more present in Lustre and should be restored to be access.
59 An up-to-date file copy exists in HSM backend.
62 File should never be released. File data will stay in Lustre even if a copy exists in HSM backend.
65 File should never be archived. Useful if this is a temporary file by example.
68 File copy in backend is not usable anymore and file could not be restore.
71 .B llapi_hsm_state_get(\|)
84 failed to allocate memory.
92 does not point to a file or a directory.
96 does not point to a Lustre filesystem.
103 #include <lustre/lustreapi.h>
105 int main(int argc, char **argv)
107 struct hsm_user_state hus;
111 fprintf(stderr, "usage: prog FILEPATH\\n");
115 rc = llapi_hsm_state_get(argv[1], &hus);
117 fprintf(stderr, "can't get hsm state for %s: %s\\n",
118 argv[1], strerror(errno = -rc));
122 if (hus.hus_states & HS_RELEASED)
124 if (hus.hus_states & HS_EXISTS)
126 if (hus.hus_states & HS_DIRTY)
128 if (hus.hus_states & HS_ARCHIVED)
131 /* Display user-settable flags */
132 if (hus.hus_states & HS_NORELEASE)
133 printf(" never_release");
134 if (hus.hus_states & HS_NOARCHIVE)
135 printf(" never_archive");
136 if (hus.hus_states & HS_LOST)
137 printf(" lost_from_hsm");
139 if (hus.hus_archive_id != 0)
140 printf(", archive_id:%d", hus.hus_archive_id);
150 .BR llapi_hsm_state_set (3)