1 .TH lustreapi 3 "2014 Sep 22" Lustre "Lustre Application Interface Library"
3 llapi_hsm_state_get, llapi_hsm_state_get_fd \- get HSM state
4 information for a file on a Lustre filesystem
7 .B #include <lustre/lustreapi.h>
9 .BI "int llapi_hsm_state_get(const char *" path ", struct hsm_user_state *" hus ");"
11 .BI "int llapi_hsm_state_get_fd(int " fd ", struct hsm_user_state *" hus ");"
16 These functions return the HSM state flags and HSM archive ID for the
21 Information is returned in the
23 argument which should already be allocated.
26 struct hsm_user_state {
33 External HSM archive ID associated with this file.
36 Flag mask for different HSM states and policy hints.
41 is formed by bitwise or'ing the following possible states:
45 The file has been assigned to an archive and provided to the backend
46 for archiving. Partial copies may exist in the HSM archive and will
47 need to be deleted when the file is removed.
50 The file content is not in sync with the HSM archive. This flag is
51 set automatically when a file with HS_EXISTS set is changed, and can
52 be set explicitly by a user.
55 The file content is not present in Lustre, and must be restored from
56 the HSM archive before the file can be accessed. File must also be
57 HS_ARCHIVED state and not HS_DIRTY.
60 A complete copy of the file content exists in the HSM archive.
63 This flag indicates the file content should never be released. File
64 content will stay in Lustre even if a copy exists in HSM backend.
65 This can be set by a user.
68 The file will not be archived. This might be used for a large temporary
69 file, for example. This can be set by a user.
72 The file content in the archive is not available, and file can not be
73 restored. If this file is also HS_RELEASED, then attempts to access
74 the file will fail. This flag can be set by an administrator.
78 .B llapi_hsm_state_get(\|)
80 .B llapi_hsm_state_get_fd(\|)
91 failed to allocate memory.
99 does not point to a file or a directory.
103 does not point to a Lustre filesystem.
110 #include <lustre/lustreapi.h>
112 int main(int argc, char **argv)
114 struct hsm_user_state hus;
118 fprintf(stderr, "usage: prog FILEPATH\\n");
122 rc = llapi_hsm_state_get(argv[1], &hus);
124 fprintf(stderr, "can't get hsm state for %s: %s\\n",
125 argv[1], strerror(-rc));
129 if (hus.hus_states & HS_RELEASED)
131 if (hus.hus_states & HS_EXISTS)
133 if (hus.hus_states & HS_ARCHIVED)
136 /* Display settable flags */
137 if (hus.hus_states & HS_NORELEASE)
138 printf(" never_release");
139 if (hus.hus_states & HS_NOARCHIVE)
140 printf(" never_archive");
141 if (hus.hus_states & HS_DIRTY)
143 if (hus.hus_states & HS_LOST)
144 printf(" lost_from_hsm");
146 if (hus.hus_archive_id != 0)
147 printf(", archive_id:%d", hus.hus_archive_id);
157 .BR llapi_hsm_state_set (3),
158 .BR llapi_hsm_state_set_fd (3),